Design and Develop clean JAVA systems

Design and Develop clean JAVA systems

When we start writing POJO classes or first interface we adhere to basic principles of coding .The more expert we become more we become goal focused and start taking coding thumb rules for granted .

When i train folks on Java or software development ,I start day 1 with below principles which i want to share with everyone writting Java code .

  1. Develop less coupled code. If code is tightly coupled, a group of classes are dependent on one another. This should be avoided for better maintainability and readability.
  2. There should never be more than one reason for a class to change. This means that every class, or similar structure, in your code should have only one job to do.
  3. Classes should be open for extension but closed for modification
  4. You should design your classes so that client dependencies can be substituted with subclasses without the client knowing about the change.
  5. Clients should not be forced to depend upon interface members they do not use. When we have non-cohesive interfaces create multiple, smaller, cohesive interfaces.
  6. High-level modules should not depend upon low-level modules; they should depend on abstractions.
  7. Abstractions should not depend upon details; details should depend upon abstractions. The idea is that we isolate our class behind a boundary formed by the abstractions it depends on. If all the details behind those abstractions change, then our class is still safe. This helps keep coupling low and makes our design easier to change. DIP also allows us to test things in isolation.


I am starting a youtube channel and blog to publish best practices for coding .

Aman Priyadarshi

Senior DevOps Engineer

1 年

Great stuff Ashish Srivastava

回复

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

Ashish Srivastava的更多文章

社区洞察

其他会员也浏览了