Software Engineering Concepts
83 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which of the following is NOT a defining characteristic of engineering design according to the CEAB definition?

  • Simple and straightforward (correct)
  • Open-ended
  • Multidisciplinary
  • Iterative

According to the engineering triangle, it is possible to achieve 'Good, Fast, and Economical' results simultaneously.

False (B)

In the context Software Engineering, briefly describe what a 'Fault' is within a program?

A hidden problem in the program

In the progression of Fault, Error, and Failure, an observable problem is referred to as a ______.

<p>failure</p> Signup and view all the answers

A company wants to develop a new software application. They need it to be high quality and they have a limited budget. According to the 'Engineering Triangle', what is the most likely consequence?

<p>The project will take a significant amount of time. (B)</p> Signup and view all the answers

Software engineering focuses solely on the coding aspect of software production.

<p>False (B)</p> Signup and view all the answers

State one of the reasons provided for why software systems can be complex.

<p>Many components</p> Signup and view all the answers

Match the following terms with their correct definitions in the context of software faults:

<p>Fault = A defect or flaw in the code that can lead to an error. Error = An incorrect state of the program during execution. Failure = The inability of a system or component to perform its required functions within specified performance requirements.</p> Signup and view all the answers

Which characteristic distinguishes static polymorphism from dynamic polymorphism?

<p>The timing of method call resolution. (D)</p> Signup and view all the answers

Cyclomatic complexity is a measure of the number of unique paths through the code.

<p>True (A)</p> Signup and view all the answers

In Agile methodology, what is a sprint?

<p>short, manageable phases</p> Signup and view all the answers

In Scrum, the individual who represents the customer’s interests is known as the ______.

<p>Product Owner</p> Signup and view all the answers

Which of the following is a primary benefit of DevOps?

<p>Faster and more reliable SDLC. (A)</p> Signup and view all the answers

UML class diagrams serve as blueprints for software by illustrating its structure and relationships.

<p>True (A)</p> Signup and view all the answers

What are the three sections of a class represented as in a UML class diagram?

<p>Name, Attributes, Methods</p> Signup and view all the answers

The Waterfall model of software development is best suited for projects with ______ requirements.

<p>clear</p> Signup and view all the answers

Which model emphasizes verification and validation at each development stage?

<p>V-Model (A)</p> Signup and view all the answers

In Agile, comprehensive documentation is considered the primary measure of progress.

<p>False (B)</p> Signup and view all the answers

What is 'Planning Poker' used for in the Scrum process?

<p>estimate task difficulty</p> Signup and view all the answers

A _____ is a solid line between two classes in a UML Class Diagram.

<p>association</p> Signup and view all the answers

Which of the following is a disadvantage of the Spiral Model?

<p>Requires skilled customer interaction. (A)</p> Signup and view all the answers

Match the following code smells with their descriptions:

<p>Missing braces on control statements = Reduces readability and increases the risk of errors. Confusing ternary operators = Can obscure logic and make code harder to understand.</p> Signup and view all the answers

What does velocity measure in Scrum?

<p>The amount of work completed in a sprint. (A)</p> Signup and view all the answers

Which of the following best describes the purpose of a model in software engineering?

<p>To simplify complex systems by focusing on important details. (C)</p> Signup and view all the answers

Domain-specific languages (DSLs) are designed to be versatile and applicable to a wide range of problems, similar to general-purpose programming languages.

<p>False (B)</p> Signup and view all the answers

What does UML stand for, and what is its primary purpose in software development?

<p>Unified Modeling Language, to communicate designs.</p> Signup and view all the answers

Developing the 'right product' focuses on meeting user needs, while 'developing the product _______' ensures maintainability, safety, and efficiency.

<p>right</p> Signup and view all the answers

What are the likely outcomes of focusing solely on business value without considering technical aspects in product development?

<p>Poor performance, difficulty in maintenance, and lack of technical sustainability. (B)</p> Signup and view all the answers

Technical debt always results in immediate and visible negative value, similar to bugs in the software.

<p>False (B)</p> Signup and view all the answers

What is the 'Boy Scout' rule in the context of managing technical debt, and why is it important?

<p>Always leave the code better than you found it, to prevent code deterioration.</p> Signup and view all the answers

Match the following delivery approaches with their descriptions:

<p>Continuous Delivery = Frequent, small updates for incremental value. Release Approach = Major updates delivered at set intervals. YOLO (You Only Live Once) = Uncontrolled, rushed updates with high risk.</p> Signup and view all the answers

A system has a class ReportGenerator that is responsible for generating reports in PDF, Excel, and CSV formats. Which SOLID principle is most clearly violated by this design?

<p>Single Responsibility Principle (A)</p> Signup and view all the answers

According to the risk formula provided, what factor can software engineers directly influence to manage risk?

<p>Value delivered over time. (D)</p> Signup and view all the answers

In iterative development, each _______ refines the product and incorporates feedback from previous cycles.

<p>iteration</p> Signup and view all the answers

Technical debt always refers to intentionally poor design choices made to meet a deadline.

<p>False (B)</p> Signup and view all the answers

An MVP (Minimum Viable Product) includes all possible features to fully satisfy the needs of early adopters.

<p>False (B)</p> Signup and view all the answers

What is the primary difference between overriding and overloading in object-oriented programming?

<p>Overriding replaces a method inherited from a superclass with a specialized implementation in a subclass, while overloading defines multiple methods with the same name but different parameter lists within the same class.</p> Signup and view all the answers

Which UML relationship is characterized by a weak 'has-a' relationship, where the contained object can exist independently of the container?

<p>Aggregation (D)</p> Signup and view all the answers

In object-oriented programming, a shallow copy ensures that all changes made to the copied object do not affect the original object.

<p>False (B)</p> Signup and view all the answers

Name two key enablers for successful iterative and incremental design.

<p>Maintainability and Test Coverage</p> Signup and view all the answers

In UML, a ______ diagram shows the types of objects in the system and the various kinds of static relationships that exist among them.

<p>class</p> Signup and view all the answers

What is the key benefit of encapsulation in terms of data protection?

<p>access control</p> Signup and view all the answers

Match the SOLID principles with their descriptions:

<p>Single Responsibility Principle = A class should have only one reason to change. Open/Closed Principle = Software entities should be open for extension but closed for modification. Liskov Substitution Principle = Subtypes must be substitutable for their base types without altering the correctness of the program. Dependency Inversion Principle = High-level modules should not depend on low-level modules. Both should depend on abstractions.</p> Signup and view all the answers

Which perspective in McCall's Quality Model focuses on aspects like maintainability and testability?

<p>Product Revision. (C)</p> Signup and view all the answers

Refactoring is a disciplined way of improving existing code's internal structure without affecting its _______.

<p>external behavior</p> Signup and view all the answers

The principle that states a class should have only one reason to change is known as the __________.

<p>single responsibility principle</p> Signup and view all the answers

How does polymorphism help in software design, particularly in relation to switch statements?

<p>By defining specific behaviors in subclasses, replacing the need for complex switch statements. (C)</p> Signup and view all the answers

Match each SOLID principle to its corresponding description:

<p>Single Responsibility Principle = A class should have only one reason to change. Open/Closed Principle = Software entities should be open for extension, but closed for modification. Liskov Substitution Principle = Subtypes must be substitutable for their base types without altering the correctness of the program. Interface Segregation Principle = Clients should not be forced to depend on methods they do not use.</p> Signup and view all the answers

Which of the following best describes the purpose of abstraction in object-oriented programming?

<p>Hiding complex implementation details and showing essential features. (A)</p> Signup and view all the answers

Composition is represented in UML with a hollow diamond at the container class end.

<p>False (B)</p> Signup and view all the answers

What does cardinality in UML relationships indicate?

<p>how many objects are associated</p> Signup and view all the answers

The 'is-a' relationship between classes indicates that _________ is being used.

<p>inheritance</p> Signup and view all the answers

What is the primary benefit of using a Card class with Value and Color attributes instead of integers to represent cards in a game?

<p>It eliminates primitive obsession and introduces domain-relevant concepts. (D)</p> Signup and view all the answers

Overusing getters and setters always enhances encapsulation and prevents leaky abstractions.

<p>False (B)</p> Signup and view all the answers

In terms of copying techniques, which ensures the safety of shared data by creating independent duplicates of objects?

<p>deep copy</p> Signup and view all the answers

According to the SOLID principles, the letter 'O' stands for the _________.

<p>open/closed principle</p> Signup and view all the answers

Which UML relationship is represented by a dashed line with a hollow triangle?

<p>Realization (C)</p> Signup and view all the answers

What type of relationship is best described by the statement: 'A file needs a directory to exist'?

<p>Composition (B)</p> Signup and view all the answers

Which of the following best describes the primary difference between an interface and a class?

<p>An interface defines what can be done, while a class defines how it is done. (B)</p> Signup and view all the answers

The YAGNI principle suggests adding functionality preemptively for potential future requirements.

<p>False (B)</p> Signup and view all the answers

What is the primary goal of using composition in software design?

<p>create modular, maintainable code</p> Signup and view all the answers

A poorly structured, messy codebase is often referred to as a 'Big Ball of ______'.

<p>mud</p> Signup and view all the answers

Match the UML relationships with their correct descriptions:

<p>Association = A general 'has a reference to' relationship. Aggregation = A 'has-a' relationship where objects can exist independently. Composition = A 'part-of' relationship where objects cannot exist independently.</p> Signup and view all the answers

Which of the following is a key characteristic of composition compared to aggregation?

<p>Composition implies a stronger ownership and lifecycle dependency. (C)</p> Signup and view all the answers

Which of the following statements is true regarding naming conventions for Aggregation?

<p>One entity can have multiple aggregated objects. (A)</p> Signup and view all the answers

What should you use if reusable wheels are needed across multiple cars?

<p>Aggregation (D)</p> Signup and view all the answers

What is the primary advantage of behavioral composition?

<p>Dynamic behavior changes at runtime (D)</p> Signup and view all the answers

Which of the following is a potential drawback of behavioral composition?

<p>Increased object count (C)</p> Signup and view all the answers

Which principle states that a class should be open for extension but closed for modification?

<p>Open/Closed Principle (OCP) (A)</p> Signup and view all the answers

The Liskov Substitution Principle (LSP) implies that subclasses should always be able to replace their base classes without altering the correctness of the program.

<p>True (A)</p> Signup and view all the answers

What is the primary goal of the Interface Segregation Principle (ISP)?

<p>reduce unnecessary dependencies</p> Signup and view all the answers

The Dependency Inversion Principle (DIP) advises depending on ______ rather than concrete implementations.

<p>abstractions</p> Signup and view all the answers

Which principle, when violated, leads to tight coupling and makes code harder to change?

<p>Single Responsibility Principle (SRP) (A)</p> Signup and view all the answers

High cohesion is generally considered a bad design principle because it leads to classes performing multiple unrelated tasks.

<p>False (B)</p> Signup and view all the answers

What does GRASP stand for, in the context of object-oriented design?

<p>General Responsibility Assignment Software Patterns</p> Signup and view all the answers

According to the Expert pattern, responsibility should be assigned to the class that has the most ______ information to fulfill it.

<p>relevant</p> Signup and view all the answers

According to Creator Pattern, under what circumstance should class B create instance of class A?

<p>All of the above (D)</p> Signup and view all the answers

High coupling between classes is desirable as it increases flexibility and reduces interdependence.

<p>False (B)</p> Signup and view all the answers

Match the GRASP principle to its description.

<p>Information Expert = Assign responsibility to the class with the most relevant information. Creator = Assign responsibility for creating objects to the class that contains or closely uses them. Low Coupling = Minimize dependencies between classes to increase flexibility. High Cohesion = Keep related responsibilities together in a class.</p> Signup and view all the answers

In the context of the Pure Fabrication pattern, why might you create a class that doesn't represent a real-world entity?

<p>to keep cohesion high and coupling low</p> Signup and view all the answers

What is the major distinction between classes and types in OOP?

<p>Classes define implementation, while types define behavior. (B)</p> Signup and view all the answers

Classes and Types are the same?

<p>False (B)</p> Signup and view all the answers

A class defines an object's ______ structure and implementation details; a type (interface) defines an object’s ______.

<p>internal, behavior</p> Signup and view all the answers

Flashcards

Engineering Design

Solving problems creatively balancing technical knowledge and practical constraints.

Engineering Triangle

Good, Fast, Economical - you can only pick two.

Software Engineering

Systematic approach to designing and maintaining software.

Causes of Software Complexity

More parts, many stakeholders, unexpected interactions.

Signup and view all the flashcards

Fault

A hidden problem in the program (e.g., bad default value).

Signup and view all the flashcards

Error

A bad state during the program's execution (e.g., null value).

Signup and view all the flashcards

Failure

An observable problem caused by the error (e.g., program crash).

Signup and view all the flashcards

Fault -> Error -> Failure

Fault leads to Error which leads to Failure.

Signup and view all the flashcards

Technical Debt

The cost of future work caused by using a suboptimal design or workaround.

Signup and view all the flashcards

UML Class Diagram

A diagram showing classes, attributes, and relationships in a system.

Signup and view all the flashcards

UML Diagram Types

Defining the concept, specification clarifies behavior, and implementation defines types.

Signup and view all the flashcards

Realization vs. Inheritance

One class inherits behavior, the other implements an interface.

Signup and view all the flashcards

Polymorphism

Ability of an object to take on many forms.

Signup and view all the flashcards

Interface (Type)

Defines what an object can do (methods), without implementation details.

Signup and view all the flashcards

YAGNI Principle

Don't add functionality until it's absolutely necessary.

Signup and view all the flashcards

Decomposition and Recomposition

Breaking down a problem into smaller parts and effectively recombining the solutions.

Signup and view all the flashcards

"Big Ball of Mud"

A poorly structured codebase with no clear separation of concerns.

Signup and view all the flashcards

Association (UML)

A general relationship indicating that one class has a reference to another.

Signup and view all the flashcards

Aggregation (UML)

A "has-a" relationship where objects can exist independently.

Signup and view all the flashcards

Composition (UML)

A "part-of" relationship where the child object's lifecycle is dependent on the parent.

Signup and view all the flashcards

Unidirectional Relationships

Preferring unidirectional relationships to make relationships easier to manage.

Signup and view all the flashcards

Behavioral Composition

Combining behaviors dynamically.

Signup and view all the flashcards

Pros and cons of Behavioral Composition

Flexibility and dynamic behaviour, but with a higher object count.

Signup and view all the flashcards

Reduction in Modeling

A model showing only essential details, ignoring less important aspects.

Signup and view all the flashcards

Pragmatism in Modeling

Creating a model with a specific purpose or goal in mind.

Signup and view all the flashcards

Domain-Specific Languages (DSLs)

Languages designed for specific tasks, offering tailored tools and structures.

Signup and view all the flashcards

Twofold Product Challenge

Ensuring a product meets user needs and is also reliable, maintainable, and efficient.

Signup and view all the flashcards

Iterative Development

Building software in cycles, refining and improving it after each cycle.

Signup and view all the flashcards

Mitigating Risks with Prototypes

Early prototypes or basic versions to validate the functionality and purpose of the product.

Signup and view all the flashcards

Minimum Viable Product (MVP)

A basic version of a product with just enough features to validate an idea and gather user feedback.

Signup and view all the flashcards

Key Enablers of Iterative Design

Refactor code constantly, add tests often, control code versions.

Signup and view all the flashcards

McCall's Quality Model

Software quality divided into product operation, revision, and transition.

Signup and view all the flashcards

Refactoring

Improving existing code without changing its external behavior.

Signup and view all the flashcards

Duplicated Code

Copy-pasting code instead of reusing it.

Signup and view all the flashcards

Shotgun Surgery

A single change requires edits in many places.

Signup and view all the flashcards

Static Polymorphism

Method call determined at compile time.

Signup and view all the flashcards

Dynamic Polymorphism

Method call determined at runtime.

Signup and view all the flashcards

Static Code Analysis

Analyzing code without executing it.

Signup and view all the flashcards

Cyclomatic Complexity

A metric counting unique paths in code.

Signup and view all the flashcards

Waterfall Model

A linear, sequential development approach.

Signup and view all the flashcards

V-Model

Emphasizes verification and validation at each stage.

Signup and view all the flashcards

W-Model

Integrates testing alongside development activities.

Signup and view all the flashcards

Spiral Model

Combines iterative development with risk assessment.

Signup and view all the flashcards

Agile Methodology

Breaks projects into sprints, emphasizes collaboration.

Signup and view all the flashcards

Scrum Master

The Scrum leader ensuring Agile principles are followed.

Signup and view all the flashcards

Product Owner (PO)

The person who represents the customer's interests in Scrum.

Signup and view all the flashcards

Backlog

Prioritized list of tasks in Scrum.

Signup and view all the flashcards

Velocity

Measures completed work in a sprint.

Signup and view all the flashcards

DevOps

Software development integrated with IT operations.

Signup and view all the flashcards

Sustainable DevOps (SusDevOps)

Software delivery that considers sustainability.

Signup and view all the flashcards

Inheritance

One class shares the behavior of another.

Signup and view all the flashcards

Realization

A class implements an interface.

Signup and view all the flashcards

Cardinality

How many objects are associated in a relationship.

Signup and view all the flashcards

Aggregation

Weak 'has-a' relationship; the contained object can exist independently.

Signup and view all the flashcards

Composition

Strong 'part-of' relationship; the contained object cannot exist independently.

Signup and view all the flashcards

Encapsulation

Bundling data and methods into a single unit (class).

Signup and view all the flashcards

Abstraction

Hiding complex implementation details, showing only essential features.

Signup and view all the flashcards

Shallow Copy

Copies references, not the actual objects.

Signup and view all the flashcards

Deep Copy

Creates independent duplicates of objects.

Signup and view all the flashcards

Read-Only Copy

Prevents modifications using immutable collections.

Signup and view all the flashcards

Single Responsibility Principle (SRP)

A class should have only one reason to change.

Signup and view all the flashcards

Inheritance (UML)

Arrow pointing to parent class of a class that inherits properties.

Signup and view all the flashcards

Open/Closed Principle (OCP)

A class should be open for extension but closed for modification. Allows adding new functionality without altering existing code.

Signup and view all the flashcards

Liskov Substitution Principle (LSP)

If S is a subtype of T, objects of S can replace objects of T without errors. Subclasses should be substitutable for their base classes.

Signup and view all the flashcards

Interface Segregation Principle (ISP)

A class should not be forced to implement interfaces it doesn’t use. Avoid fat interfaces; split them into smaller, specific ones.

Signup and view all the flashcards

Dependency Inversion Principle (DIP)

Depend on abstractions, not concrete implementations. High-level modules should not depend on low-level modules; both should depend on abstractions.

Signup and view all the flashcards

Responsibility

A task or function that an object is designed to perform in software.

Signup and view all the flashcards

SRP (Single Responsibility Principle)

Each object should have only one responsibility. A class should have only one reason to change.

Signup and view all the flashcards

GRASP

General Responsibility Assignment Software Patterns. Helps decide where to assign responsibilities in OOP.

Signup and view all the flashcards

Information Specialist (Expert)

Assign responsibility to the object that has the most relevant information to fulfill it.

Signup and view all the flashcards

Creator Pattern

Object B should create object A if B contains A, closely uses A, or has the necessary information to initialize A.

Signup and view all the flashcards

Coupling

Measures how much one class depends on another. Low coupling is desirable.

Signup and view all the flashcards

Cohesion

Measures how well the elements inside a module/class belong together. High cohesion is desirable.

Signup and view all the flashcards

Pure Fabrication

No real-world entity fits the needed responsibility. Invent a class to handle it.

Signup and view all the flashcards

Primitive Types

Basic built-in types like int, double, float.

Signup and view all the flashcards

Non-Primitive Types

Custom objects in Java (e.g., Car, Cat, Dog).

Signup and view all the flashcards

Type (Interface)

Defines an object’s behavior; the requests it can respond to.

Signup and view all the flashcards

Study Notes

Engineering Design (CEAB Definition)

  • The process of engineering design involves creatively solving problems while carefully considering both technical knowledge and practical limitations.
  • Engineering problems are complex, open-ended, iterative, and multidisciplinary; they may have multiple solutions, require several attempts, and involve various areas of expertise.
  • Informed decisions rely on the use of science and mathematics to determine the most effective solutions.
  • Design constraints include factors like health, safety, cost, environmental impact, and regulatory compliance.

The Engineering Triangle

  • The engineering triangle illustrates a common trade-off where you can only prioritize two of the following attributes: good, fast, and economical.
  • "Good" and "Fast" results in higher expenses.
  • "Good" and "Economical" results in longer development time.
  • "Fast" and "Economical" results in compromised quality.

Definitions of Software Engineering

  • IEEE/ISO defines it as the systematic application of knowledge and methods for software design and maintenance.
  • Sommerville states that it encompasses all aspects of software production.
  • Bauer defines it as the application of engineering principles to create reliable, efficient, and cost-effective software.

Cause of Complexity

  • Software systems are inherently complex due to many components, potentially leading to more points of failure.
  • Multiple stakeholders with differing perspectives and needs increase the complexity of software systems.
  • Emergent behavior, characterized by unexpected interactions between components, further contributes to the complexity of software systems.
  • Engineering systematically manages this complexity.

Fault, Error, and Failure

  • A fault is a hidden problem within the program, like an incorrect default setting.
  • An error is a flawed state that occurs while the program is running, such as encountering a null value when one is not expected.
  • A failure is an observable issue resulting from the error, such as when the program crashes.
  • The progression is: Fault -> Error -> Failure.

What makes a Model useful?

  • Modeling involves three main principles: mapping, reduction, and pragmatism.
  • Mapping ensures the model accurately reflects real-world elements.
  • Reduction simplifies the model to only include essential details.
  • Pragmatism ensures the model is created with a specific purpose in mind.
  • Models help in addressing the complexity of large systems by simplifying and focusing on the most critical aspects.

Languages for Models

  • Programming languages, such as Python and Java, are different from modeling languages like UML.
  • General-purpose languages are suitable for various problems, while domain-specific languages (DSLs) are designed for use in very specific fields.

UML Class Diagrams

  • UML is a tool used to model systems.
  • A class diagram shows classes and their relationships.
  • Classes (e.g., Car) possess attributes (e.g., make, model) etc.
  • Relationships, for example: a Car is driven by a Driver.

UML

  • Class diagrams show the structure of a system.
  • Sequence diagrams show how objects interact over time.
  • Activity diagrams represent workflows.
  • UML serves as a universal language for software engineers to exchange design ideas.

Delivering Value

  • Developing a product involves both developing the right product, to ensure it meets user requirements, and developing the product right, to make sure that it is maintainable, safe, and efficient.

Balancing Business and Technical Value

  • Focusing only on business value may result in poor performance, maintenance difficulties, and a lack of technical sustainability.
  • Focusing only on technical value may result in excellent code but a product that does not meet user needs.
  • Balancing both aspects is ideal but challenging, particularly with strict deadlines.

Characterising Value

  • Features add visible positive value.
  • Design choices add invisible but positive value.
  • Bugs are those things imparting a visible, negative value.
  • Technical debt is any invisible but negative value.

Delivering Value Over Time

  • There are three delivery approaches: continuous delivery, a release approach, and a "You Only Live Once" (YOLO) approach.
  • Continuous delivery is the most valuable and lowest risk approach

Relation to Risk Management

  • Risk equals costs minus value delivered over time, Risk = Costs – Value Delivered Over Time.
  • Software engineers have limited control over costs but can influence how quickly and effectively value is delivered.

Technical Debt

  • Technical debt is the future cost of rework caused by suboptimal design or shortcuts taken during development.
  • It occurs due to poor design decisions, rushed or untested code, and prioritizing speed over quality.
  • Repercussions include increased entropy (disorder) in the codebase and higher costs for new features or fixes.

How to Manage Technical Debt

  • Follow the Boy Scout rule: Always leave the code better than you found it.
  • Follow the Broken Window principle By ensuring code is clean and maintained.

Iterative Development

  • Building software in small cycles (iterations).
  • Each iteration refines the product and incorporates feedback from previous cycles.

Iterative and Incremental Development

  • Iterative development allows gradual understanding of the problem and refinement of the solution.
  • Incremental development adds small, functional pieces to the system.

Benefits

  • Mitigating risks through early prototypes.
  • Addressing technical debt early.

Minimum Viable Product (MVP)

  • An MVP is a basic version of the product with minimal features and must be viable/functional enough to validate its usefulness.

MVP Goal:

  • To get feedback from users, and improve the product through iterations.

Key Enablers of Iterative Design

  • Maintainability, test coverage, and version control.
  • Refactor code (without breaking functionality) ensuring it can be added to easily.
  • Write tests to avoid breaking existing code.
  • Use tools like Git to track changes effectively.

McCall's Quality Model Triangle

  • It breaks down software quality into three perspectives: product operation, product revision, and product transition.
  • Includes efficiency and reliability
  • Includes maintainability and testability
  • Includes portability and interoperability

Refactoring

  • Refactoring improves existing code in a disciplined way.
  • It changes the internal structure without affecting external behavior.
  • Refactoring improves maintainability.
  • Refactoring helps makes the code easier to read and modify.

Refactoring 101

  • It involves small steps to minimize errors.
  • The system remains functional after every change.
  • Examples: Simplify long methods, remove duplicate code, and reduce unnecessary complexity.

Patterns That Need Refactoring

  • Duplicated code, long methods, shotgun surgery (making a single change requires edits in many places), and feature envy (when one class relies heavily on another class’s data).

Polymorphism

  • Polymorphism allows a single interface to represent different types or behaviors, which can replace switch statements.

Static Polymorphism

  • The method that gets called is determined at compile time.
  • Achieved through: method overloading and operator overloading.

Dynamic Polymorphism

  • The method that gets called is determined at runtime.
  • Achieved through: method overriding.

Static Code Analysis

  • Examining the code without running it.
  • Measures lines of code (LOC).
  • Simplicity over excessive length.
  • Cyclomatic complexity tracks the number of unique paths through the code.

Cyclomatic Complexity

  • This metric counts the number of edges and nodes in a control flow graph.
  • It measures how complicated the logic is.

Managing Code Quality

  • Always use braces for clarity, even in simple conditions.
  • Avoid confusing ternary operators.

Waterfall Model

  • A linear, sequential approach.
  • Each phase depends on the completion of the previous one.

Advantages:

  • Simple and easy to follow.

Disadvantages

  • Difficult to make changes once a phase is completed, slow value delivery because value isn’t delivered until the very end.

V-Model

  • Similar to the Waterfall model but emphasizes verification and validation (V&V) at each stage.

Advantages;

  • A strong focus on testing.

Disadvantages:

  • Still rigid and slow.
  • Late value delivery.

W-Model

  • Testing occurs earlier, reducing late-stage issues.
  • Tracking progress is harder.

Spiral Model

  • A combination of iterative development with systematic risk assessment.

Advantages:

  • Better risk management.

Disadvantages

  • Continuous value delivery through increments, requires skilled customer interaction, and can be costly and complex.

Agile Methodology

  • Breaking projects into sprints.
  • Sprint examples include collaboration and continuous improvement.

Advantages:

  • Flexible.

Examples:

  • Scrum, Extreme Programming (XP).

Agile Frameworks: Scrum

  • Key Concepts include:
    • Scrum Master
    • Product Owner (PO)
    • Backlog
    • Velocity

Agile Challenges

  • Agile principles are often misused or misunderstood.
  • Internal and external misalignments between principles and practices.

Agile

  • It promotes working software as the primary measure of progress, instead of extensive documentation.
  • It reduces risk through frequent delivery and adapting to changes.
  • Not always suitable for projects requiring heavy certification.

Scrum Process

  • Planning poker and Daily stand ups

DevOps

  • Integrates software development (Dev) with IT operations (Ops) to automate workflows and foster collaboration.

Benefits:

  • Complements Agile practices.

Sustainable DevOps (SusDevOps)

  • Incorporates sustainability as a first-class principle in software delivery while retaining Agile principles.

Introduction to UML Class Diagrams

  • UML gives a standard way to visualize system design.
  • Class diagrams are blueprints for software, revealing its structure and relationships.

UML include:

 - Class Diagrams
 - Sequence Diagrams
 - Activity Diagrams
 - Use-Case Diagrams
 - State Machine Diagrams

General vs. Domain-Specific Languages

  • General-purpose languages (Java, Python) work for every problem.
  • Domain-specific languages (SQL) are tailored for specific problems.

UML Class Diagram - Entities

  • Classes (name, attributes, methods)
  • Objects are instances of a class.

Perspectives in Class Diagrams

  • UML can be conceptual, logical, and implementational.
  • Conceptual (high-level representation of entities).
  • Logical (shows relationships and interactions).
  • Implementation (details like database tables or code structure).

Relationships in UML

  • Association, inheritance (generalization), aggregation, composition, dependency.

Association

  • Solid line between two classes.
  • Example: A Person owns a Car.

Inheritance (Generalization):

Hollow triangle

  • Example: Dog inherits from Animal.

Aggregation

Hollow diamond

  • Example: A Team contains Players.

Composition

Filled diamond

  • Example: A House contains Rooms.

Dependency

Dashed line

  • Example: A Student depends on Library.

Inheritance

  • One class shares the behavior of another.
  • Vehicle, car, bike examples .

Realization

  • A class implements an interface.
  • Represented by a dashed line with a hollow triangle.

Cardinality in Relationships

  • Cardinality indicates how many objects are associated.
    • 1..1: Exactly one.
    • 0..*: Zero or many.
    • 1..*: One or more.

Aggregation vs. Composition

  • Aggregation is a weak "has-a" relationship.
  • Classrooms have students, but students can exist without the classroom.
  • Composition is a strong "part-of" relationship.
    • Houses have rooms, and rooms cannot exist without the house.

Encapsulation

  • Encapsulation is about bundling data (attributes) and behavior (methods) into a class, ensuring integrity by hiding internal details and defining visibility rules.

Problems Without Encapsulation

  • Tight coupling with internal representation can lead to data corruption and difficulty maintaining code.

Benefits of Encapsulation

  • Eliminates primitive obsession, access control ensures no uncontrolled modification of private data.

Encapsulation of Behaviour

  • A CardPile defines business logic to shuffle and draw cards.
  • Users don’t need to know how the cards are stored; they just use the services provided by the CardPile class.

Information Hiding and Trade-offs

  • Overusing getters can lead to leaky abstractions, exposing internal data and violating invariants.

Abstractions

  • Abstraction focuses on what an object does rather than how it does it.
  • A Shape class might have an abstract method draw().
  • The implementation of draw() will differ for subclasses like Circle and Rectangle.

Copying and Encapsulation

  • Copying techniques ensure the safety of shared data: shallow copy, deep copy, and read-only copy.

UML Relationships

  • Inheritance children get some properties from the parent
  • Association key word is "uses" or "associates"
  • Composition has the "has a" key word with a strong relationship
  • Aggregation has the "has a" key word with a weak relationship

Recap of Foundational OOP Mechanisms

  • Polymorphism (one interface, multiple implementations), encapsulation, and abstraction.
  • Inheritance enables reuse of code by extending classes.
  • These principles are the building blocks of the SOLID design principles.
  • The SOLID principles help developers create understandable, flexible, and maintainable software.

What does SOLID stand for?

  • Single Responsibility Principle (SRP), Open/Closed Principle (OCP), Liskov Substitution Principle (LSP), Interface Segregation Principle (ISP), and Dependency Inversion Principle (DIP).

Single Responsibility Principle (SRP)

  • A class should have only one reason to change.
  • Break Library class into BookCollection, UserRegistry, and FeeTracker classes.
  • Benefits include easier maintenance, more testability, and flexibility.

Open/Closed Principle (OCP)

  • A class should be open for extension but closed for modification.
  • Use polymorphism: Create a Vehicle interface with a method like move().

Liskov Substitution Principle (LSP)

  • Ensure predictability when using subclasses and avoid bugs due to unexpected behavior.

Interface Segregation Principle (ISP)

  • A class should not be forced to implement interfaces it doesn’t use.
  • Split the Searchable interface into smaller, more specific interfaces.
  • Reduces unnecessary dependencies and improves modularity and flexibility.

Dependency Inversion Principle (DIP)

  • Depend on abstractions, not on concrete implementations.
  • Use an abstraction like BookDataSource (interface).
  • Improves testability by mocking dependencies.

Responsibility

  • A task or function that an object performs.
  • "Who should do what" is the fundamental question in object-oriented design.

GRASP

  • GRASP is a set of principles, in object oriented programming, to help decide where to assign responsibilities.
  • Stand for General Responsibility Assignment Software Patterns

List of GRASP patterns:

  1. Information Specialist (Expert)
  2. Creator
  3. Controller
  4. Indirection
  5. Low Coupling
  6. High Cohesion
  7. Polymorphism
  8. Protected Variations
  9. Pure Fabrication

Information Specialist (Expert Pattern)

  • Give responsibility to the class that has the required data.

Example

  • Board should handle tile-related operations (e.g., finding a tile).

Creator Pattern

  • Object (B) should create another object (A) when:
    • B contains A.
    • B closely uses A.
    • B has the necessary initialization information.

Low Coupling

  • Avoid tight dependency between classes to increase flexibility.

High Cohesion

  • Keep classes focused on one task to improve reusability and readability.

Pure Fabrication

  • Create helper classes when needed to keep cohesion high and coupling low.

Types in OOP

  • Primitives: int, double, float.
  • Non-primitive, custom objects in Java: Car, Cat, Dog.
  • Classes define implementation.
  • Types define behavior.

Classes vs. Types

  • Classes define an object’s internal structure and implementation details.
  • Types (interfaces) define an object’s behavior.

Key takeaway

  • Interfaces defines what can be done, while classes define how it is done.
  • Use interfaces as return types whenever possible.

YAGNI Principle (You Aren't Gonna Need It)

  • Don't write code for future, uncertain requirements
  • Avoid writing unnecessary code based on anticipated future needs.

Why Composition Matters?

  • Decomposition and recomposition are effective problem-solving approaches.

The Big Ball of Mud (Bad Design)

  • "Big Ball of Mud" refers to a messy codebase with no clear separation of concerns.
  • Spaghetti code has no clear structure, making it hard to debug and maintain.
  • Use composition to create well-structured relationships.

Composition As A Special Form

Composition == Stronger Ownership than Aggregation

UML Notation for Relationships

  • Prefer unidirectional relationships whenever possible to reduce coupling.

Behavioral Composition

  • Structural composition deals with data relationships.
  • Behavioral composition combines behaviors dynamically.

Why

  • Delegates behavior (does not repeat), can be changed at runtime, and follows SRP.

Behavioral Composition Key Tradeoffs

  • Pros: low coupling, no if-else clutter, runtime flexibility.
  • Cons: requires many small objects.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

Comprehensive software engineering quiz covering design characteristics, the engineering triangle, faults, errors, failures, and polymorphism. It explores complexity in software systems and cyclomatic complexity measurements. This assessment tests understanding of core software engineering principles.

More Like This

Use Quizgecko on...
Browser
Browser