only a single responsibility (i.e. changes to only one part of the software's specification should be able to affect the specification of the class). A class should have only one reason to change. E.g A module complies and prints a report. It can be changed for two reasons: a) the content of the report could change or b) the format of the report could change. Pros It makes the class more robust.
(classes, modules, functions, etc.) should be open for extension, but closed for modification. A module will be said to be open if it is still available for extension. For example, it should be possible to add fields to the data structures it contains, or new elements to the set of functions it performs. A module will be said to be closed if [it] is available for use by other modules. This assumes that the module has been given a well-defined, stable description (the interface in the sense of information hiding).
program should be replaceable with instances of their subtypes without altering the correctness of that program. • Contravariance of method arguments in the subtype. • Covariance of return types in the subtype. • No new exceptions should be thrown by methods of the subtype, except where those exceptions are themselves subtypes of exceptions thrown by the methods of the supertype. A great example illustrating LSP (given by Uncle Bob in a podcast I heard recently) was how sometimes something that sounds right in natural language doesn't quite work in code.
better than one general-purpose interface. Pros It keeps a system decoupled and thus easier to refactor, change, and redeploy. E.g Xerox printer system
abstractions, [not] concretions. A. High-level modules should not depend on low-level modules. Both should depend on abstractions. B. Abstractions should not depend on details. Details should depend on abstractions. Pros Simpler to see a good thinking principle as a coding pattern Easy to mocking for testing
of the classes inside the package are reusable, or none of them are.” The classes must also be of the same family. Classes that are unrelated to the purpose of the package should not be included. Pros A package constructed as a family of reusable classes tends to be most useful and reusable. Reuse-release Equivalence Principle
one reason to change. If changes were to happen in an application dependent on a number of packages, ideally one only want changes to occur in one package, rather than in a number of them. This helps to identify classes that are likely to change, and package them together for the same reasons. If the classes are tightly coupled, they belong to the same package. Common-Closure Principle
together belong in the same package together. It is a way of helping to decide which classes belong in which package. When depending on a package, one wants to make sure that the classes are inseparable and interdependent, which is also handy when culling classes that do not belong in the package. Common-Reuse Principle
needs to happen in small incremental releases. The ADP states that there can be no cycles in the dependency structure, and that when an incremental release is made, the other developers can adopt and build upon it. Acyclic Dependencies Principle
could create an abstract base class that has the interface that MyDialogs needs. We could then put that abstract base into MyDialogs and inherit it into MyApplication. This inverts the dependency between MyDialogs and MyApplication thus breaking the cycle. 2. Create a new package that both MyDialogs and MyApplication depend upon. Move the class(es) that they both depend upon into that new package. Acyclic Dependencies Principle
or by, are changing. Thus, package design needs to support change as well. The SDP states that any packages one wants to be volatile should not be depended upon by a package that is difficult to change. Stable-Dependencies Principle
abstract, so that its stability does not prevent it from being extended. It also states that an unstable package should be concrete, since its instability allows the concrete code within it to be easily changed. Stable-Abstractions Principle
the existence of some library of feature laden software. This allows you to use such frameworks as tools, rather than having to cram your system into their limited constraints. Testable The business rules can be tested without the UI, Database, Web Server, or any other external element. Independent of UI The UI can change easily, without changing the rest of the system. A Web UI could be replaced with a console UI, for example, without changing the business rules. Independent of Database You can swap out Oracle or SQL Server, for Mongo, BigTable, CouchDB, or something else. Your business rules are not bound to the database. Independent of any external agency In fact your business rules simply don’t know anything at all about the outside world.
be an object with methods, or it can be a set of data structures and functions. It doesn’t matter so long as the entities could be used by many different applications in the enterprise.
business rules. It encapsulates and implements all of the use cases of the system. These use cases orchestrate the flow of data to and from the entities, and direct those entities to use their enterprise wide business rules to achieve the goals of the use case.
of adapters that convert data from the format most convenient for the use cases and entities, to the format most convenient for some external agency such as the Database or the Web. It is this layer, for example, that will wholly contain the MVC architecture of a GUI. The Presenters, Views, and Controllers all belong in here. The models are likely just data structures that are passed from the controllers to the use cases, and then back from the use cases to the presenters and views.
frameworks and tools such as the Database, the Web Framework, etc. Generally you don’t write much code in this layer other than glue code that communicates to the next circle inwards.