Software Development Principles and Design Patterns
Classified in Computers
Written at on English with a size of 697.56 KB.
Key Concepts in Software Development
Complexity: Involves abstraction and decomposition into smaller, manageable problems.
Changeability: Requires effective management and a well-defined Software Development Life Cycle (SDLC).
Testing Before Implementation: Identifies defects early, saving time and resources.
Microsoft SDL: Emphasizes security considerations throughout all phases of the development cycle, including security and privacy risk assessment.
Understanding UML Diagrams
Sequence Diagram: Provides a time-based view of object interactions through function calls, illustrating the interaction among objects.
State Chart: Depicts the sequence of states an object goes through in response to external events, focusing on the state changes of a single object.
Requirements Elicitation and Validation
Requirements Elicitation:
- Requirements Elicitation: Definition of the system in a way that users can understand.
- Requirements Analysis: Technical specification that developers can understand.
- Requirements Validation: Includes both validation and verification.
Requirements Validation:
- Correctness: Ensures that the system requirements are true statements of what the system must do.
- Completeness: Describes all significant requirements of concern to the user.
Object Design and Key Activities
Object Design: Involves adding details to requirements analysis and making implementation decisions.
Key Activities:
- Identification of existing solutions (use of inheritance).
- Interface specification (describing each class interface).
- Object Model (OM) restructuring (transforming the object design to improve understanding and extensibility).
- OM optimization (transforming the object design to address performance criteria such as response time and memory utilization).
Reusing Functionality: Inheritance vs. Delegation
Inheritance: Straightforward to use but exposes the subclass to the details of the parent class.
Delegation: Allows any object to be replaced at runtime (if it's the same type) but is harder to understand.
Programming to an Interface
Programming to an Interface, Not an Implementation: The application should always use interfaces from other parts of the application rather than concrete implementations.
Contracts and Restraints
Contracts Include Three Types of Restraints:
- Invariant: A predicate that is always true for all instances of a class. Invariants are constraints associated with classes or interfaces.
- Precondition: Predicates associated with a specific operation that must be true before the operation is invoked.
- Postcondition: Predicates associated with a specific operation that must be true after the operation is invoked.
Design Patterns
Design Patterns: A means to communicate, identify, and remember solutions to common problems. Each pattern names, explains, and evaluates a solution to a common problem.
Four Essential Elements: Pattern name, Problem, Solution, Consequences.
Categories of Design Patterns
- Structural Patterns: Adapter, Composite, Bridge, Decorator, Façade, Flyweight, and Proxy.
- Creational Patterns: Abstract Factory, Builder, Factory Method, Prototype, and Singleton.
- Behavioral Patterns: Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, and Visitor.
SOLID Principles
S (SRP, Single Responsibility Principle): A class should have responsibility over a single part of the functionality.
O (OCP, Open/Closed Principle): A class should be open for extension but closed for modification.
L (LSP, Liskov Substitution Principle): If S is a subtype of T, then objects of type T may be replaced with objects of type S without altering any desirable properties of the program.
I (ISP, Interface Segregation Principle): Many client-specific interfaces are better than one general-purpose interface.
D (DIP, Dependency Inversion Principle): Depend upon abstractions, not concretions.
Visual Representation of Design Patterns
Composite
Decorator
Bridge
Observer
Factory (Façade is similar, but the top right should be FacadePatternDemo (+main))
Abstract Factory
Proxy
Interpreter