Three most basic rules every software developer should follow

  1. Model classes have properties and nothing more.
    Note: Properties are basically getter and setter methods. In languages without properties, getters and setters are the equivalent. Do not use getter or setter methods as methods for anything more complex than default instantiation of the type. Example: You can make sure a List is not null in a getter and lazy load it, but don’t do much more. Or a calculated property might have minor logic but it is all internal to the model.
  2. Any class with methods can reference primitives, collections and lists, interfaces, and model classes. Do not reference a class with methods directly from any other class. Reference another class through and interface.
  3. 10/100 Rule (Slightly bendable rule). No method should have more than 10 lines of code, including curly braces and comments. No Class should be more than 100 lines of code, including curly braces and comments.

Look, there is S.O.L.I.D., there is D.R.Y, there is S.R.P., and many other rules. There are design patterns, including the gang of four patterns, and many others. There are architectures, MVC, MVVM, etc. But if you, as a software developer, follow the above three rules, you will automatically end up following most of the other rules. Design patterns will naturally be used in your code, even if you don’t know them, though I recommend you still learn and know about them.

2 Comments

  1. www.Jzqudou.com

    Three most basic rules every software development should follow | Rhyous

  2. how to make cat furniture out of cardboard

    Three most basic rules every software development should follow | Rhyous

Leave a Reply

How to post code in comments?