The S.O.L.I.D Principles

The S.O.L.I.D Principles

These five software rules help make software easier to grow and keep in good shape. They were made popular by a software engineer, Robert C. Martin.

S — Single Responsibility

A class should have a single responsibility


O — Open-Closed

Classes should be open for extension, but closed for modification

L — Liskov Substitution

If S is like T, you can swap T with S without messing up the program's qualities.

I Interface Segregation

Clients should not be forced to depend on methods that they do not use.

D Dependency Inversion

High-level modules should not depend on low-level modules. Both should depend on the abstraction. Abstractions should not depend on details. Details should depend on abstractions.

Summary

We've talked about these five rules and why they matter. They make your code flexible, expandable, and easy to test.

Thanks for reading! I hope you found this helpful and enjoyed it as much as I did writing it. If you have questions or ideas, please leave a comment.

Adrian Buda

?? Senior .NET Engineer ? Contractor ? Freelancer | Implementing clean, maintainable and scalable web apps

11 个月
回复

要查看或添加评论,请登录

Karlen Mkrtchyan的更多文章

社区洞察

其他会员也浏览了