On Fri, Nov 22, 2013 at 07:49:25PM +0100, Markus Teich wrote:
> Andrew Gwozdziewycz wrote:
> > My guess is the biggest objection (certainly mine) is that everything happens
> > in `main` instead of breaking the work down into smaller functions that do one
> > thing.
>
> Actually I started with that approach[0], but I found it too confusing for such
> a small and linear program and therefore I inlined all functions which were only
> called once.
[...]
> Should I extract some methods out of main()
> again or do you think it is enough, if I comment the linear process in main()
> more detailed?
If you extract function from main into seperate entities,
then you suggest a modular design, maybe with some parameters.
But the truth is that it's only called once, it's tested in 1 single
flow, and making them really modular with parameter checks & stuff
feels like overengineering.
Readability of the code is another reason to create functions,
but this is very subjective. Adding more documentation changes
somesone's perceived readability too.
--
Kurt Van Dijck
GRAMMER EiA ELECTRONICS
http://www.eia.be
kurt.van.dijck_AT_eia.be
+32-38708534
Received on Sat Nov 23 2013 - 13:22:53 CET