Code commenting and modeling

marsicdev | 2015-01-09

All notes

Software engineering is hard to get right. One person’s pretty data model looks like metadata-addiction to another person.

I think we can learn some lessons from code-commenting: don’t try to model everything! You need to step back and let the code speak for itself.

For instance, as just one random illustrative example, you might need to return 2 values from a function in Java (a language with no direct support for multiple return values). Should you model it as a MyFunctionCallResult class with named ValueOne and ValueTwo fields (presumably with actual names appropriate to the problem at hand)? Or should you just return a 2-element array (possibly of mixed types) and have the caller unpack it?

I think the general answer to this is: when in doubt, don’t model it. Just get the code written, make forward progress. Don’t let yourself get bogged down with the details of modeling a helper class that you’re creating for documentation purposes.



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

Programming is full of acronyms

SOLID, KISS, DRY, STUPID

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

Programming as a process

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

programming 
Read