Software Design: Making Software Manageable

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/18

flashcard set

Earn XP

Description and Tags

Flashcards based on lecture notes about software design principles, focusing on separation of concerns, encapsulation, modularity, coupling, cohesion, information hiding, and interfaces.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

19 Terms

1
New cards

Separation of Concerns

A design principle that divides system into smaller units (with minimal overlap) to reduce complexity and improve independence

2
New cards

Encapsulation

Placing information (data and methods) into a unit and hiding it to prevent unwanted access, design units/modules with all relevant data and exposing it via an interface.

3
New cards

Modularity

Structuring software into independent modules or units.

4
New cards

Coupling

The degree of interaction between units (e.g., method calls between classes).

5
New cards

Cohesion

The degree to which a unit fulfills one purpose. Maximize choesion → purpose of each unit is more clear

6
New cards

Information Hiding

Revealing as little information to the outside as needed to prevent data manipulation and ensure integrity.

7
New cards

Interface

A contract that defines what a class must do, without specifying how. It only contains method signatures, and classes implement it to define behavior.

8
New cards

Abstraction

Hiding and generalizing details to reduce complexity; level of abstraction differs during the design..

9
New cards

DRY

Don't Repeat Yourself is a design principle to avoid code clones.

10
New cards

Why minimize coupling?

~Reveal as little information to the outside as needed
• Prevent data manipulation (i.e., check for modification in the capsule)
• Ensure integrity of the unit
• Allows access via a single, controlled interface

11
New cards

Why maximize cohesion?

Why are the sub-units in a unit not working together? Why are the sub-units working so much with those of other units? In essence: What is the purpose of each unit?

12
New cards

Advantages of separation of concerns

• Each unit is easier to understand and analyze

• Independent units are easier to maintain, change, and reuse (less impact on other units)

• Clearly defined sub-unit responsible for external exposure (avoids that something gets changed unexpectedly)

• Teams can work in parallel on individual units (also benefits planning and tracking)

• Easier to quality assure and test individual units (unit tests, reviews, …)

• Enables iterative development and integration

13
New cards

Disadvantages of separation of concerns

It can be challenging to define a good separation of concerns (a wrong design can have severe consequences due to redesign later)

Needs experience and typically some experimenting (concepts look different in different languages)

Separation of concerns often leads to overhead (restructuring, defining interfaces, additional code, …)

Functions cannot be defined in isolation

14
New cards

A good separation is defined by

A unit should solve one well-defined problem
Limit the sizes of interfaces/interactions between units
Each problem should be solved at one place only
A method should have a small/clear implementation

15
New cards

How to do coupling

Depends on the level of abstraction (and programming language)
• Methods (within a class) call each other
• Classes call the methods of other classes Information is hidden by visibility: private, public, protected, package The interface to a class are its public methods

16
New cards

Interfaces are useful for

“Making behavior accessible independently of concrete implementation”

17
New cards

Example of Low vs. High Coupling

  • Low coupling: classes interact only through simple interfaces → easier to change and maintain

  • High coupling: classes rely heavily on each other’s internal logic → fragile and hard to update

18
New cards

What’s an example of high vs. low cohesion?

  • High cohesion: a class that only handles user login

  • Low cohesion: a class that handles login, file saving, and sending emails

19
New cards

What are Java’s visibility levels and what do they mean?

  • private: accessible only within the class

  • public: accessible from anywhere

  • protected: accessible within the same package or subclasses

  • no keyword (package-private): accessible within the same package