The S.O.L.I.D. Principles of Class Design explained with Posters

The S.O.L.I.D. principles seem to be the least common denominator of creating great classes; even before Design Patterns. In the early 2000s, Robert “ Uncle Bob ” Martin introduced a series of five principles for developing software with OOP that were designed to lead to higher - quality systems that were easier to maintain. These SOLID Principles became a sort of map for developers in both designing new applications and refactoring existing code bases.
Single Responsibility Principle
single_responsibility_principle
The “S” in SOLID is for Single Responsibility Principle, which states that every object should have a single responsibility and that all of its services should be aligned with that responsibility. “Responsibility” is defined as “a reason to change”, and Wikipedia does a pretty good job of explaining it:
As an example, consider a module that compiles and prints a report. Such a module can be changed for two reasons. First, the content of the report can change. Second, the format of the report can change. These two things change for very different causes; one substantive, and one cosmetic. The single responsibility principle says that these two aspects of the problem are really two separate responsibilities, and should therefore be in separate classes or modules. It would be a bad design to couple two things that change for different reasons at different times.
Open-Closed Principle
open-closed_principle
The “O” in SOLID is for Open-Closed Principle, which states that software entities – such as classes, modules, functions and so on – should be open for extension but closed for modification. The idea is that it’s often better to make changes to things like classes by adding to or building on top of them (using mechanisms like subclassing or polymorphism) rather than modifying their code.
Liskov Substitution Principle
liskov_substitution_principle
The “L” in SOLID is for Liskov Substitution Principle, which states that subclases should be substitutable for the classes from which they were derived. For example, if MySubclass is a subclass of MyClass, you should be able to replace MyClass with MySubclass without bunging up the program.
Interface Segregation Principle
interface_segregation_principle
The “I” in SOLID is for Interface Segregation Principle, which states that clients should not be forced to depend on methods they don’t use. If a class exposes so many members that those members can be broken down into groups that serve different clients that don’t use members from the other groups, you should think about exposing those member groups as separate interfaces.
Dependency Inversion Principle
dependency_inversion_principle
The “D” in SOLID is for Dependency Inversion Principle, which states that high-level modules shouldn’t depend on low-level modules, but both should depend on shared abstractions. In addition, abstractions should not depend on details – instead, details should depend on abstractions.

Courtesy - http://blogs.msdn.com/b/cdndevs/archive/2009/07/15/the-solid-principles-explained-with-motivational-posters.aspx

http://www.codeproject.com/Articles/60845/The-S-O-L-I-D-Object-Oriented-Programming-OOP-Prin

SOLID Motivational Posters, by Derick Bailey, is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

3 comments:

Fire Dragon said...

Bạn đang kinh doanh, bạn cần tìm nơi cung cấp dịch vụ giao hàng thu tiền cod? Tuy là có vô số nhà cung cấp dịch vụ này, nhưng bạn cần nơi đó phải thanh toán tiền thu hộ cho bạn nhanh để bạn còn xoay vốn. Nếu vậy thì bạn hãy đặt niềm tin vào chúng tôi. Đến với chúng tôi không chỉ là dịch vụ cod. Chúng tôi còn có nhiều dịch vụ khác như chuyển hàng đi đà nẵng, giao hàng nhanh, vận chuyển hàng đi hà nội, ký gửi hàng hóa, gửi hàng về miền tây, dịch vụ giao hàng cho shop online, nhận chuyển hàng về cần thơ, ship hàng giá rẻ toàn quốc, giao hàng nhanh nội thành hà nội - tphcm, chuyển phát nhanh trong nước, gửi hàng đi campuchia. Hãy an tâm khi đặt niềm tin nơi chúng tôi với kinh nghiệm lâu năm trong việc nhận ship hàng từ mỹ về việt nam của chúng tôi sẽ làm bạn hài lòng. Dịch vụ chuyen hang di da nang là một trong số những dịch vụ chúng tôi cung cấp được nhiều người sử dụng.

mai linh Nguyen said...
This comment has been removed by the author.
ABDUL QORIB said...

Putra tunggal furniture adalah industri Toko Mebel furniture minimalis menjual mebel berkualitas harga murah Mebel Jepara Minimalis yang tentunya dengan kualitas terbaik dan khas dari pengrajin mebel dengan ukiran mebel minimalis Jati katalog produk mebel kami banyak dan lebih dari ratusan hingga ribuan produk yang bisa anda cek disini meja makan minimalis dengan harga yang relatif murah anda sudah bisa mendapatkan produk Kamar Set Jati Minimalis asli produk mebel minimalis jepara yang berkualitas dan di kerjakan oleh para tukang kayu asli jepara yang sudah berpengalaman di bidangny. Selain itu toko mebel kami juga menjual produk kursi tamu minimalis asli produk jati dari jepara, Di samping itu produk yang kami tawarkan memang benar-benar mempunyai kualitas tinggi, tersedia juga produk buffet minimalis yang merupakan salah satu produk utama yang harus ada dalam satu hunian rumah kami sediakan dengan berbagai macam model Meja Makan Minimalis produk minimalis yang tentunya sangat elegant Kursi untuk ruang Tamu Jati Minimalis sampai dengan model yang mewah yang tentunya. kemewahan dari produk yang kami tawarkan berbeda dengan yang lain contohnya set kursi sofa produk modern berbahan baku jati yang tentunya sangat awet untuk anda peroleh untuk ditempatkan di rumah anda, semua itu anda bisa melihatnya di katalog produk tempat tidur minimalis asli karya toko jati Mebel Jepara Minimalis. Kami juga ada produk modern berbahan baku jati yang tentunya sangat awet untuk anda peroleh untuk ditempatkan di rumah anda, semua itu anda bisa melihatnya di katalog produk mebel jati dan untuk semua produk yang kami koleksi nantinya produk tersebut akan kami tawarkan sesuai dengan harga mebel tempat tidur. Anda jangan khawatir karena produk yang kami jual itu mempunyai kualitas yang terjamin yang di buat oleh para pengrajin kursi sofa minimalis yang sudah berpengalaman di bidangnya. Tentunya kami tidak ingin mengecewakan para konsumen kami,maka dari itu kami memberikan produk toko mebel online dengan harga yang terjangkau. Semua furniture yang kami jual adalah produk dari kami dan jika anda ingin melihat koleksi furniture dari jepara anda bisa mengunjungi toko furniture online jepara yang berkualitas dan terpercaya. Jangan pernah tertipu berbelanja furniture secara online yang mengatas namakan mebel jepara,hanya di sini anda bisa mendapatkan furniture jati yang berkualitas asli jepara.