I'm in the middle of your book and I'm loving it!
I have some esthetics issues with the idea of heavily commenting the code, it looks ugly and distracting (I'm coming from the paradigm of clean code) what is your thoughts on the matter?
And more importantly there is no example or data on the internet about the idea of commenting as design tool, are you aware of that? Can you post examples or video session of using it as a tool?
Thanks a lot,
David Peer
I have some esthetics issues with the idea of heavily commenting the code, it looks ugly and distracting (I'm coming from the paradigm of clean code) what is your thoughts on the matter?
And more importantly there is no example or data on the internet about the idea of commenting as design tool, are you aware of that? Can you post examples or video session of using it as a tool?
But when you get to the lower level implementation, that's when detail becomes more necessary. So say you're trying to figure out what cities are near Philadelphia. The high level context works well. But if you were trying to ask "What is a Philadelphia area?" you'd need a lower level context like this:
Knowing how/when to switch between contexts or "zoom levels" when dealing with complexity is, in my opinion, key to solving complex problems. With programming this can mean focusing your mental effort on a single zoom level at a time. Comments can be a tool to help with this and represent the areas of the map that we can't fully zoom in on.
The only problem I've experienced with this, is that it can lead to a procedural styling of programming unless careful.
In most cases after doing this, it makes sense to get rid of the comments. Unless the comments add more information to the 'map view' or context then they are a distraction. (example)
Organizing code in a pattern/templated fashion.
Another great way of using comments is to organize code in a templated fashion. Some people might point to something like an interface here, but interfaces only deal with behavior, not implementation.
A great example of this is the "Setup, Input, Transform, Output" paradigm. I'm surprised that I didn't find anything on that with a quick google search, but maybe it's just a nugget of industry knowledge that was handed down to me by some great mentors.
Essentially this is a pattern used in organizing code within a function:
--
You received this message because you are subscribed to the Google Groups "software-design-book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to software-design-...@googlegroups.com.
To post to this group, send email to software-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/software-design-book/CAGXJAmxtNKrHkuxfwDNHa1N8fANVz%2B4rNQ74fiPjeCkUKuKBPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
| ||||||||||
Well, I cannot provide a 1st hand experience, but I remember a colleague saying that whenever he wanted to do some transformation coding (in the context of ETL tools, which might be very visual/graphical), he'd first include a note, and describe there the pseudo code for all the steps his transformation code needed to do. So, I think that's what you refer to as designing tool? I.e. you can a-priori include comments -or the graphical equivalent- to decide/guide what will you code next?
You received this message because you are subscribed to a topic in the Google Groups "software-design-book" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/software-design-book/kIq42jPTR7U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to software-design-...@googlegroups.com.
To post to this group, send email to software-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/software-design-book/DM5PR03MB2441A7675D543F5CD4695FD6C1B50%40DM5PR03MB2441.namprd03.prod.outlook.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/software-design-book/CAB3OcEf%2BoS2OgLQJYwCdMzWw5d2qnLV%2BcauQk5c0E%2BYzHdX33Q%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/software-design-book/CANZdC1gL3D9P4Ukq3uw%3Dn3eLez34YVrNU0hBMFPPizZUSfo%3D8Q%40mail.gmail.com.
hi everybody, thanks for the inputs!john regarding your questions:Can you say a bit more about what you see as the problem? i think that a lot of comment can be distracting and can become a kind of mental load,bad example , good example this is clojure style (from the lisp family, this is one of my prefered languages), we call it doc-string, and it is idiomatic!
For example, what does "ugly" mean, i think that ugly code for me is two things:1, if i can't read the code in one shot from top to bottom like parts of a story and
2. the coloring schema that make code and comments so different that in fact i see two blocks of distinct text interleaved together.i think that esthetics plays a part in it. see for example how nice it is in the second link above, it looks natural!
and why does that matter? it is important when i want to evolve and create my style of coding or the team style guide if im talking about a team.
Why would a comment be distracting, if it helps you to understand the code that follows? the comment by itself is not distracting (especially when you really need it and it can help you!)but in a relatively big class or function i don't like the idea of a lot of comment all over the area! and i think that there is a strong relationship between simplicity(low cognitive load) and succinctness.