I just draw a couple of samples of the Ganeti code, and it seems as if private functions/classes are generally defined first. I'll rearrange the code according to this, and re-send the patches afterwards.
Thanks, Thomas On Wed, May 15, 2013 at 11:01 AM, Thomas Thrainer <[email protected]>wrote: > > On Wed, May 15, 2013 at 10:49 AM, Bernardo Dal Seno > <[email protected]>wrote: > >> On 15 May 2013 10:29, Thomas Thrainer <[email protected]> wrote: >> > If there is still room for discussion, I'd have _very_ strong objections >> > against putting helper functions before their actual use. IMHO this >> destroys >> > the natural flow of reading code. >> >> I think that before any discussion, we should look at the data. If the >> rest of the code is done in one way, that's something we have to take >> into account (even if we decide to change it). Again, maybe I'm >> mistaken (except for cmdlib.py), and if that's the case please let me >> know. >> >> Obviously consistency is more important than personal preferences. I > would not opt for changing the whole codebase just because of my opinion. > But if we are starting a discussion which should lead to a guideline, I'd > like to give my 0.02$ :). > > > >> I understand that everybody has their own preferences, and I too read >> the main function first (so I'm perfectly fine with your proposal), >> but IMHO it's not something so important to warrant changing the whole >> code; after all, I've never seen anyone reading code line by line as >> you read a book. But this is something that we should discuss (in >> person would be better) given that you have strong feelings. >> >> > Usually you want to start with a rough >> > overview, and then dive into the details (or just skip them, if the >> > functions are aptly named). Please refer to Clean Code [0] for much more >> > arguments and thoughts about how to structure code w.r.t readability >> (and >> > cleanliness in general). >> >> True, but you can start by reading the last function/class, and IMHO >> it's not a big deal: After reading the main function usually you have >> to skip back and forth anyway, as the dependency graph is (almost) >> never linear. Naming functions in a sane way is much more important >> IMHO, and actually there are cases where we could have done better. >> >> > >> > Cheers, >> > Thomas >> > >> > [0] >> > >> http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882 >> >> I'm not sure why you didn't reply to the list, but if it was by >> mistake, you can forward this to the list. >> > > Sorry, just a mistake, I added the list again. > > >> >> Bernardo >> > > > > -- > Thomas Thrainer | Software Engineer | [email protected] | > > Google Germany GmbH > Dienerstr. 12 > 80331 München > > Registergericht und -nummer: Hamburg, HRB 86891 > Sitz der Gesellschaft: Hamburg > Geschäftsführer: Graham Law, Katherine Stephens > -- Thomas Thrainer | Software Engineer | [email protected] | Google Germany GmbH Dienerstr. 12 80331 München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Katherine Stephens
