Tuesday, 24 May 2016

How to Code most efficiently

This analysis only pertains to the code part.

What does it mean to Code efficiently?
Least context, mind frame switches
Least file,  scrolling switches.

Maximize both to find best method.

I believe the best way is to program by feature.

If you think about it,  the way we,  designers,  developers and users alike,  conceive of a program through its flows.

Flows are big,  but they can be broken down into units called features.

Ideally,  we would love to see features programmed directly. But that leads to redundant code which is also messy.

So what we want to do is trace through code paths of a feature. That is also the optimum way to read code and become productive.

So no matter how messy code,  specs are,  one can always straighten things out like this.

Of course,  code can have side effects. This increases the complexity the coder needs to understand, often overloading their poor minds. In this case,  minor refactoring,  documenting may be required and best for understanding.

There is a pitfall of the evil side effects story.  Event driven programming can seem like it is all about side effects. Nothing can be further from truth.  Every event fulfills a code path required by feature, while allowing each kind of event to be handled by totally independent modules.

Feature is forever the most important.  It is the why of developing applications in the first place.

Footnote.
I wish some CS professor could chain this up into a flowing story through development like I did here.

No comments: