CDL Section 3 - Designing SW Flashcards

1
Q

What helps to make modular code good?

A
  1. Well-maintained code is just as important as the product or service that this code delivers
  2. A clear communication path between different components.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are Microservices?

What’s an example of the how they communicate?

A

Applications are often split into a suite of multiple smaller, independently running components or services, all complementing each other to reach a common goal.

The code/app can be broken into blocks of reusable chunks that perform a single/related task ver well.

These applications communicate with lightweight mechanisms such as a REST API.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a Function (as it relates to Microservices)? How do you make them work?

A

Functions are blocks of reusable code chunks that perform a single, or related task. They are “invoked” when triggered i.e “invoking a function” = calling on a function to execute.

They are the first line in organizing and achieving a certain level of modularity.

    • Modules bring flexibility because one model can be changed entirely without affecting others.
    • Allows one module to be developed with little knowledge of the implementation in another module.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are code Modules?

A

A set of Functions that are grouped together into a single file, allowing them to all be called/invoked at once.

Modules can invoke specific Functions from other Modules if needed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

True/False: When importing Module(s) to your application code, should the import itself make any changes or execute any actions automatically?

A

FALSE - it should not.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is Object Oriented Programming/OOP?

A

OOP is a method of programming, or programming language, that introduces Objects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

REVIEW:

Significant Terms in OOP

A

→ Objects - basically records, or instances, of code, that allow you to carry data with them and execute defined actions on them
○ represents a blueprint of what an object looks like, and how it behaves is defined within a class.
○ An object = a collection of functions and data
○ Function = block or reusable code chunk.

→ Class - a formal description of an object that you want to create; contains parameters for holding data and Methods that will enable interaction with the object and execution of defined actions
○ Classes can also inherit data from other classes

→ Class is a blueprint or template to create Objects
○ you can create class hierarchies in which the child class inherits the parent default behavior and can also enhance its role with its own implementations

→ Method is a function that describes the behavior of an object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

TRUE/FALSE: Modules made code easier to understand?

A

TRUE

They lower the overwhelming feeling when you delve into the code for improvements or feature additions.

They should encapsulate parts of functionality of a system and constrain how these parts interact among each other.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Are Modules mainly static or dynamic in nature?

A

Static.

A change in one part of the application code should not break or affect other parts if designed correctly.

Modules must have well-defined interfaces that do not change.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a Module Interface?

A

The interface to a module is an abstraction of the module’s functions. The interface defines the features of the module and how to use them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are Acyclic v Cyclic Dependencies, as it relates to Modules and Classes?

A

Acyclic - ensures that when you split your monolithic application into multiple modules, these modules—and the classes accompanying them—have dependencies in ONE direction only.

Cyclic - means dependencies in both directions i.e any change in Module A would lead to a change in Module B, but then the changes in Module B could cause unexpected behavior in Module A.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

REVIEW:

Modules, classes, and functions are tools that should reduce complexity of your application and increase reusability.

A

What is a:

Module?

Class?
Allow us to logically group our data and functions in a way that’s easy to reuse and also build upon if needed; a blueprint for creating Instances and/or Objects.

Function?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the difference between Loose and Tight coupling of components in an app i.e Modules, classes, functions, etc?

A

Loose coupling is about reducing dependencies of a module, class, or function that uses different modules, classes, or functions directly; easier to maintain and reuse.

Tight Coupling is the opposite where all the objects are dependent on one another; more rigid.

  • Reducing the dependencies between components of a system results in reducing the risk that changes of one component will require you to change any other component *
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is Cohesion? (in relation to classes/functions/modules)

What makes for strong cohesion? Do you want this?

A

It interprets classes, modules, and functions and defines if all of them aim for the same goal.

Modules that contain strongly related classes and functions can be considered to have strong or high cohesion.

YES - the goal is to make Cohesion as strong as possible. This means that logically separated code blocks have a very clearly defined purpose.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the ideal combination of Coupling and Cohesion?

A

LOOSE Coupling with STRONG Cohesion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

REVIEW: Object Class & Instances & Variables

A

→ A class is simply a modeling tool provided by a programming language for use in representing real world objects in a program or application. EX) an “Employee” class

→ The class is structured to accommodate an object’s properties (member variables) and its operations (member functions/methods).

→ An Instance on the other hand is simply a variation of an object created from a class (where the class = the blueprint). You create an object variant (Instance) using a constructor which is a method within a class specifically defined for this purpose. EX) You can create Employee1 and Employee2 from the “Employee” class

→ Instance Variables = contain data that is unique to each instance. EX) height/weight/hair color/etc. of Employee1 and 2 which are instances in the Employee class

17
Q

What is the Unified Modeling Language (UML)?

A

The Unified Modeling Language is a general-purpose, developmental, modeling language in software engineering that is intended to provide a standard way to visualize the design of a system.

Helps developers to create a graphical notation of the programs that are being built.

18
Q

TRUE/FALSE: Is it important for developers to be able to test a system or software architecture?

A

TRUE

To enable developers to push out changes, you should first make sure that the changes will not break existing functionalities, so testability of a system is a top concern for often-changing code.

19
Q

REVIEW: Layered ARCH Pattern

  • very common, general purpose pattern
  • Software components within this pattern are formed into horizontal layers, where each layer performs a specific role in the application
  • the most common # of layers is (4); more complex apps can have/use more than the 4 layers if needed
A

Layers:
§ Presentation - handles the logic for user interface communication; processes input of the user and passes request down to other layers and then returns the results to the user.

§ Business - used to perform specific business rules based on the events that happen in the system or requests that originate from the user
□ Handling customer data, processing orders in a web store, and any kind of calculation or action that is considered as a part of business functionality happens at this layer.

§ Persistence - handles the requests for data in the database layer
□ When the business layer needs to retrieve data or save data to the database, it passes the request to the persistence layer that performs the required action.

§ DB - where data is stored; like a SQL DB.

20
Q

Do layers in the Layered ARCH Pattern rely or concern themselves with processes in the other layers?

A

NO - each layer handles it’s own domain/set of actions.

Each layer should be developed independently with changes that are done in isolation of other layers.

Well defined APIs allow the layers to communicate = loosely coupled.

21
Q

What does encapsulation in OOP mean?

A

Encapsulation in OOP conceals the internal state and the implementation of an object from other objects; restricts what can be accessed on an object.

Has the intention to hide the implementation and restrict direct access to the object data.

22
Q

What is Model View Controller (MVC)?

A

One of the most known and used architectural patterns in programming languages.

MVC is an application design model comprised of three interconnected parts. They include the model (data), the view (user interface), and the controller (processes that handle input).

The MVC model or “pattern” is commonly used for developing modern user interfaces.

23
Q

MVC Components:

○ View - contains the logic for displaying information to a user
§ If the model, for example, defines user data, the View renders that data on the display, which can be a web browser or a mobile or desktop application
§ entry point for a user accessing an application
§ This is where the “Front End” of the application would be developed

○ Model - encapsulates the information
§ defines the state of an object in the application and implements the functions for accessing the data of modeled objects
§ Controller will ask the Model to get data when there is a user requests that requires a change to the View
§ Only cares about interacting with the backend DB

A

○ Controller - takes input from the View component, makes changes on the model if necessary, then hits the view component to update the presentation accordingly
§Handles the request flow; never handles the data logic

→ Summary:
○ The Model handles all of the data
○ The View handles all of the presentation
○ The Controller just tells the Model and View what to do

→ The Model and View NEVER interact with each other; any comms are done via the Controller

24
Q

REVIEW: MVC

→ This architecture’s behavior is governed by the dependencies between the components

○ The View depends on the Model for obtaining data

○ Controller sits in between the Model and View, depending on both (whereas the Model is NOT dependent on the Controller)

A

→ One of the primary features of MVC architecture is the separation between the view and the model, which is considered a very important design principle in software

○ The presentation of data and the logic of data are completely separate.. Making creating complex applications much easier

○ The reason that you want to keep the controller separate is that if you do not, the View becomes responsible for two different things

25
Q

What is the Observer Design Patter?

A

Behavioral patterns that define a ‘one-to-many’ dependency between objects.

The dependency works together with a subscription mechanism for informing subscribed objects on changes happening on the object they are observing.

The idea of the observer pattern is that you add a subscription mechanism to the class from which you want to generate change notifications

26
Q

In Observer Pattern design, how are the Publisher and Observer coupled?

A

LOOSE

The coupling of the publisher and observer should be loose, because the publisher should not know any concrete class implementation of the observers