Design Principles Mid
How can you ensure that a software system maintains adherence to design principles as it evolves over time?
Select the correct answer
Ensuring adherence to design principles can be achieved through regular code reviews and automated testing.
Adherence to design principles is maintained by writing extensive documentation.
Design principles are maintained by avoiding the use of design patterns.
Adherence to design principles is achieved by frequent refactoring.
Explain the Law of Demeter.
Select the correct answer
The Law of Demeter focuses on minimizing memory usage.
The Law of Demeter means optimizing code for speed.
The Law of Demeter suggests writing documentation for every class.
The Law of Demeter advises that objects should only interact with their immediate friends.
What are some common code smells that may indicate violations of software design principles?
Select the correct answer
Common code smells include duplicated code, large classes, and long methods.
Common code smells include using modern libraries and frameworks.
Common code smells are about missing documentation.
Common code smells include too many comments.
What do you understand by the Open-Closed Principle (OCP)?
Select the correct answer
The Open-Closed Principle means code should be easily readable.
The Open-Closed Principle states that software entities should be open for extension but closed for modification.
The Open-Closed Principle is about testing code extensively.
The Open-Closed Principle suggests using only open-source libraries.
What is the "Principle of Least Astonishment" in user interface design?
Select the correct answer
The 'Principle of Least Astonishment' means avoiding the use of complex algorithms.
The 'Principle of Least Astonishment' suggests that a system should behave in a way that users expect.
The 'Principle of Least Astonishment' focuses on code optimization.
The 'Principle of Least Astonishment' means minimizing the number of features in software.
Explain the concept of "High Cohesion and Low Coupling" in software design.
Select the correct answer
High Cohesion means each module has a single responsibility, while Low Coupling means minimal dependencies between modules.
High Cohesion is about reducing code duplication, Low Coupling is about reusing modules.
High Cohesion means faster execution, Low Coupling means better memory management.
High Cohesion focuses on user interfaces, Low Coupling focuses on databases.
Explain Separation of Concerns.
Select the correct answer
Separation of Concerns involves dividing a program into distinct sections, each addressing a separate concern.
Separation of Concerns is about documenting every function in detail.
Separation of Concerns means ensuring data consistency.
Separation of Concerns focuses on optimizing code for speed.
Explain composition over inheritance.
Select the correct answer
Composition over inheritance suggests writing extensive tests first.
Composition over inheritance means preferring simple algorithms.
Composition over inheritance favors using object composition rather than inheritance.
Composition over inheritance encourages using design patterns.
What is "Cohesion" in software design, and why is it important?
Select the correct answer
Cohesion describes the speed at which code executes.
Cohesion refers to how closely related the responsibilities of a single module are.
Cohesion is about using consistent naming conventions in code.
Cohesion means ensuring code compatibility with different systems.