5 basic principles of SOLID object-oriented programming and design

The principles when applied together intend to make it more likely that aprogrammer will create a system that is easy to maintain and extend over time

S. single responsibility principle states that every class should have a single responsibility, and that responsibility should be entirely encapsulated by the class. All its services should be narrowly aligned with that responsibility. A responsibility is a reason to change, and a class or module should have one, and only one, reason to change.

O. open/closed principle states “software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification“;[1] that is, such an entity can allow its behaviour to be modified without altering its source code.

L. Liskov substitution principle “objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program”. In Design by contract (DbC), software designers should define formal, precise and verifiable interface specifications for software components, which extend the ordinary definition of abstract data types with preconditions,postconditions and invariants.

I. The interface-segregation principle (ISP) states that no client should be forced to depend on methods it does not use.

D. Dependency inversion principle one should “Depend upon Abstractions. Do not depend upon concretions. Dependency injection is a software design pattern that allows removing hard-coded dependencies and making it possible to change them, whether at run-time or compile-time.

Advertisements

Deixa un comentari

Fill in your details below or click an icon to log in:

WordPress.com Logo

Esteu comentant fent servir el compte WordPress.com. Log Out / Canvia )

Twitter picture

Esteu comentant fent servir el compte Twitter. Log Out / Canvia )

Facebook photo

Esteu comentant fent servir el compte Facebook. Log Out / Canvia )

Google+ photo

Esteu comentant fent servir el compte Google+. Log Out / Canvia )

Connecting to %s


%d bloggers like this: