Thank you for the proposals!

Feedback was sent!

~10% of final grade

Mike Chabot

Wednesday 3/11

Frontend, Backend, DevOps

Meaningful Names

Small Functions

Modular Functions

Function Arguments

Code Formatting


Object Oriented


Instances / Instance Variables

Getters / Setters

Static Methods

Singleton Pattern

Singleton Pattern

same instances!

Restricts to only one instance of a class!

But why ?!

Singleton Pattern



db = Database.getInstance();'something');
db = Database.getInstance();
db = Database.getInstance();
Logger.print('User logged in.');
Logger.print('Product deleted.');
db = new Database();'something');
db = new Database();
logger = new Logger();
logger.print('Product deleted.');
logger = new Logger();
logger.print('User logged in.');
class Circle:
    instance = None
    def __init__(self):
        Constructs a circle.
        self.__radius = 7 # this is private
        self.__radius2 = 1
        print('called constructor')
    def setRadius(self,radius):
        if radius == 7 or radius == 8:
            self.__radius = radius
    def getRadius(self):
        return self.__radius
    def getRadii(self):
        Returns a list of both values.
        return [self.__radius, self.__radius2]
    def draw(self):
    def create():
        if Circle.instance == None:
            Circle.instance = Circle()
        return Circle.instance
public final class Circle {

    private static final Circle INSTANCE = 
      new Circle();

    private Circle() {}

    public static Circle getInstance() {
        return INSTANCE;

Lazy loading!

Hands-on Series!

Today: C++ Basics

3/13: C++ Functions and Classes

3/27: C++ Arrays and Vectors

4/3: C++ Templates

4/10: C++ and Python with Cython!

conda install xeus-cling -c conda-forge

CS410 Lecture 14

By Daniel Haehn

CS410 Lecture 14

Slides for CS410 Software Engineering at UMass Boston. See!

  • 352