DEV Community

Discussion on: The PRINCIPLES for SOFTWARE ENGINEERS

Collapse
 
grzegorzgrzegorz profile image
grzegorzgrzegorz

Hi,

These all are valid rules but I think some of them are too general. It makes them hard to use in practice.
I recently read 2 books which are much more detailed and I can see much improvement in the way I create code and tests since I read them:

  • 5 lines of code (Christian Clausen) -> I like very much how he limits numerous OO coding ways to just few one should use. So, there are many DON'Ts: no if-else, no switch, no getters or setters and most shocking but what I think I like best: NO INHERITANCE. There is only interface implementation, pushing code to classes and keeping methods extremely short like 5 lines. I am recommending the book as it also shows most of the presented ideas step-by-step using TypeScript application. Composition over inheritance, careful coupling, minimal generality: this is all concrete.
  • Functional thinking (Neal Ford) -> start using 3 basic functions: filter, map and reduce; compiler decides about efficiency so it is easy to write fast computing code (especially it is easy to create multithreaded functions); immutability over mutability and again COMPOSITION. There is interesting paradigm comparison as well: functional/immutable vs oop/imperative/mostOftenMutable where the first approach should be used more for core of the app and the latter more for controllers around it. Very nice book to hear about functional world.

If we speak about clean code, this is all about communication. I have seen this in few places already and I agree: code == communication. I think this my rule number 1 and then all the rest I wrote above.