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

GkkqkUjIPT5BrlE7bHV1ij8RfwOpZjyg4DRmhwAAAABJRU5ErkJggg==

Composite

6eMAAAAASUVORK5CYII=

Decorator

kIIIUQeI8lfCCGEyGP+HwiTdfZtzQHPAAAAAElFTkSuQmCC

Bridge

W0o1uNnZ2Tz22GN8++23c30o88ZsdUtTwaOPPsrAwIC81ndh48aNc30I9ywvL48lS5bI63sf1qxZg6L89Vd0SUkJwWBQnuf79F99xgyJe9kSR5IkSZKkfyR15xslSZIkaR75H3oTDOyhe889AAAAAElFTkSuQmCC

Observer

XSt29fBg4cqJVjatCgQYMGDRq+Frrdc+jo6GDq1KkEBQVpPAoNGjRo0KBBw9dGtzorbrcbs9kspeyFZormsGjQoEGDBg0aviq61WswGAx4PB7pqGiqnBo0aNCgQYOGrwujqJQRIm6iGuibIPoJ4qeoctBEri6Mrq4u+Q4CK5c0aNCgQYOG7zP+PwTkmDToKTuBAAAAAElFTkSuQmCC

Factory (Façade is similar, but the top right should be FacadePatternDemo (+main))

dewv8DA3MME5bNJy8AAAAASUVORK5CYII=

Abstract Factory

A4XLzcqw0deSAAAAAElFTkSuQmCC

Proxy

jRxAwMkN0RMD4AaVql2qz4waMAAAAASUVORK5CYII=

Interpreter

u2BeEWmAAAAAElFTkSuQmCC

Entradas relacionadas: