Decomposition Technique

Decomposition is one of the important skills for a programmer as we need to break any problems into smaller and manageable chunk. Bumped into this top-down approach on achieving that. Step as follows:
  1. Describe an overview of the problem in your head, with words.
  2. Try to write code that is the closest to those words
  3. For every unimplemented thing, repeat until done.
Pay attention to step 1 and 2. If you can conceptualize the problem and solution in your head and describe it in most layman term, surely the code produced will be easily understandable. As they said, good programmer are good writer or rather good communicator, they can convey their ideas across.

Similarly, another approach is to use reference pattern or application architecture. But this is at different scale, more of the overall architecture. Example is Command Query Responsibility Segregation (CQRS) which is an alternative model to CRUD model. Still reading and try to learn other approach than CRUD.

No comments:

Post a Comment