Programming is full of acronyms

marsicdev | 2015-04-09

ā† All notes

Programming is full of acronyms

Nobody likes to hear that their code is stupid. It is offending. Donā€™t say it. But honestly: Most of the code being written around the globe is an unmaintainable, unreusable mess.

Donā€™t Repeat Yourself and stay DRY

KISS is teling you to Keep It Simple, Stupid!

What makes code STUPID?

  • Singleton
  • Tight coupling
  • Untestability
  • Premature Optimization
  • Indescriptive Naming
  • Duplication

SOLID deciphers to:

  • Single responsibility principle
  • Open/closed principle
  • Liskov substitution principle
  • Interface segregation principle
  • Dependency inversion principle

GRASP stands for General Responsibility Assignment Software Principles, which are the following:

  • Information Expert
  • Creator
  • Controller
  • Low Coupling
  • High Cohesion
  • Polymorphism
  • Pure Fabrication
  • Indirection
  • Protected Variations

Some lessons and conclusions

Unit testing is important. If you donā€™t test your code, you are bound to ship broken code. But still most people donā€™t properly cover their code with tests. Whenever you donā€™t write unit tests because you ā€œdonā€™t have timeā€ the real cause probably is that your code is bad. If your code is good you can test it in no time. Only with bad code unit testing becomes a burden.

Name your classes, methods, variables properly, so that people actually know what you mean. Iā€™m not arguing about variables like $i, those are short, but still self-explanatory. The problem is functions like the ones named above. Functions like strpbrk or variables like $yysstk may be obvious the author, but also only to the author.

Programmers are lazy animals, so it would be only natural to type as little code as possible. Still duplication prevails. The most common reason for duplication is following the second STUPID principle: Tight Coupling. If your code is tightly coupled, you just canā€™t reuse it. And here comes your duplication.

Source: Donā€™t be STUPID: GRASP SOLID



Related notes

What are notes for and what to expect from them

Every move is a step forward

design  programming  development  productivity  learning  writing 
Read

Rubber duck debugging

Use a rubber duck to help you review code

programming  development 
Read

Becoming great developer

Programming Wisdom

programming  development 
Read

Dunning-Kruger Effect

Unskilled persons tend to mistakenly assess their own abilities as being much more competent than they actually are.

programming 
Read

Threads, Sync, Async

Thoughts collection about these important terms

programming 
Read

Mobile ā¤ async

Async is more natural in a lot of cases on a mobile device. Why waste valuable battery life polling for updates if you can react on events pushed to you.

programming 
Read

Code commenting and modeling

Don't try to model everything! You need to step back and let the code speak for itself.

programming 
Read

Programming as a process

Writing software engages not only developers but also designers, business strategists, copy writers, and marketers at every stage.

programming 
Read