tag:blogger.com,1999:blog-6748806271290317100.post2562307469574429638..comments2022-11-23T23:32:46.336+13:00Comments on Brendel Consulting: Read-optimize your source codejbrendelhttp://www.blogger.com/profile/09547073366771090616noreply@blogger.comBlogger23125tag:blogger.com,1999:blog-6748806271290317100.post-3262023395771047012014-02-19T15:07:26.686+13:002014-02-19T15:07:26.686+13:00Please see http://google-styleguide.googlecode.com...Please see http://google-styleguide.googlecode.com/svn/trunk/javaguide.html#s4.6.3-horizontal-alignment<br />If you maintain a large code base with lots of developers, you are not going to be a fan of vertical alignment.Mike Patnodehttps://www.blogger.com/profile/02078225414788962341noreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-32812042156290157722011-06-02T22:03:51.930+12:002011-06-02T22:03:51.930+12:00I have seen many companies who write the code in v...I have seen many companies who write the code in very complicated way. They think that it is a customer retention policy as no one will able to read and re-engineer/construct the website. I strongly dislike this kind of shady activities. To me code should be always easy to read and understand by any person. your post can surely help to optimize the coding. <br /><br />Thanks for sharing,<br />SusanCustom Software Development Serviceshttp://www.etechts.comnoreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-82695027341038437912011-03-19T07:51:51.736+13:002011-03-19T07:51:51.736+13:00This is really great advice. I look at code allot...This is really great advice. I look at code allot and the ones that are the easiest for me to read and decifer are the ones that have lots of notes. Yes it does take a little time but it the code ever needs to be refactored in any way, by you or anyone else, notes will help you remember what you were thinking and why that line of code is there and not somewhere else. Thanks for the post.Custom Softwarehttp://www.surgeforward.comnoreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-18480390443033036962009-06-23T20:19:07.331+12:002009-06-23T20:19:07.331+12:00That text is full of "good use" tips ! I...That text is full of "good use" tips ! It should be teached at school !<br /><br />Simple, factual, clear enough ... Really it's great !<br /><br />I create a cumputer game. My code is a bit dark. Thanksfully, I still make some comments. On 200 000 lines, more than 20% is comments. I'll keep my way for this project, but I'll might use some more comments, just to practice your tips ^^.<br /><br />Kéké<br />PS : sorry for my language. I'm French, and so is my game.<br />PS : I read your blog from here : http://forum.jeux-web.com/index.php?topic=78 , just in case you want to speak with us ^^ (it's a french cumputer developping games' forum.)kékéhttp://www.magdales.comnoreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-10497339655628553152009-06-20T01:23:35.550+12:002009-06-20T01:23:35.550+12:00I like much of what you are writing, readable code...I like much of what you are writing, readable code is much more cost effective than the big-ball-of-mud like units that I some time come across. I wish that some software managers would finally understand that cleaning up, refactoring and making the code purdy actually pays off.<br /><br />Alignment of code may start out good. But I at up to my neck in what <br />used to be aligned comments/assignments/declarations but what is now a mess. Old comments may be a problem, but if you are lucky they will get updated once in a while. Who bothers with some broken alignment? None of the developers I am working with, that's for sure. And then you get the long variable name, that some indents, other don't, in any case it looks bad.<br /><br />I am completly for a consistent style in coding. But on a per-unit basis is enough for me, I am proficent enough in my languages to read and write most coding styles, not only my favourite. The problem with consitstent styles is when you actually have to use energy on following the style, the people start slacking off. And aligning code is one of those.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-72966250192343735392009-06-19T03:05:19.961+12:002009-06-19T03:05:19.961+12:00Juergen,
Good article. One of the best complimen...Juergen,<br /><br />Good article. One of the best compliments I heard one programmer give another is "Your code is very simple to understand." Your ideas overlap with Donald Knuth's Literate Programming concept. You may find http://www.literateprogramming.com/ interesting.Ira Kaplannoreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-22248492914684863572009-06-18T03:58:25.846+12:002009-06-18T03:58:25.846+12:00Comments should only be used to elucidate code tha...Comments should only be used to elucidate code that is not self-explanatory. Any comments take away visual space from code, possibly preventing the ability to view an entire block on a single screen.<br /><br />That being said, it's almost always useful to have a class-level javadoc comment that goes into detail on what the class does, and more, depending on whether the primary users are white-box or black-box users.<br /><br />If the class is being used primarily by white-box users, then unfortunately this does require more verbosity, as these users will use the Javadoc as their primary reference, not the code itself. Some of the impact of this can be minimized, however. Typically, people put the javadoc comment start, "/**" on a line by itself. If you need a short javadoc comment for a bunch of single line property definitions, it would be effective to start the comment with "/** Start of comment ...". That makes for one more line that can be seen on the screen at once.Anonymoushttps://www.blogger.com/profile/17575148038635091341noreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-47430251445378017762009-06-17T12:08:09.487+12:002009-06-17T12:08:09.487+12:00Good job! You really kicked the asses of those str...Good job! You really kicked the asses of those straw men.Benjamin Raghebhttp://www.benzado.com/noreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-79796770241609178692009-06-16T23:33:18.858+12:002009-06-16T23:33:18.858+12:00Aligned assignment code tends to decrease readabil...Aligned assignment code tends to decrease readability in my experience. When you have short placeholder identifiers like 'i' mixed with long descriptive identifiers, aligned assignment introduces too much visual gap between lvalue and rvalue.<br /><br />On the other hand, for complex conditional expressions (such as those spread over more than 2 lines), alignment corresponding to logical expression tree nesting is essential.Barry Kellyhttps://www.blogger.com/profile/10559947643606684495noreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-77332355173826043512009-06-16T23:10:41.242+12:002009-06-16T23:10:41.242+12:00I have another suggestion for this article - elimi...I have another suggestion for this article - eliminate tabs in your code if you're able. There is nothing more troublesome than opening up a piece of code in Emacs, or Notepad (when you don't have a real editor), VC++, Code::Blocks, or Eclipse, and have a mess because one editor uses tabs of 4 spaces, and another uses tabs of 7 or 8, or whatever. Tabs aren't consistent, so remove them entirely from your code - every editor allows you to do this. Tabs are the biggest problem I run into.<br /><br />Secondly, comments should explain entirely a function's function, it's a good check to see if the code is right. If the comments don't agree with the code, you're not done. Comments should explain a function well enough that the comments alone can be used to entirely re-implement the function to make it work. I know this isn't always practical, but if you do this, you can distinguish between intent and operation of a function. Even I don't always follow this rule, but I try to.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-91462638241282342702009-06-16T21:07:35.163+12:002009-06-16T21:07:35.163+12:00I couldn't agree more with the entire article....I couldn't agree more with the entire article. <br /><br />At my first corporate gig, it was amazing to me how bad the coding standards were (actually there was none in this 10+ year old company) and how resistant particular staffers were to doing something as simple vertical spacing let alone = or , alignment.Justinhttp://zebrakick.comnoreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-19800027990196369012009-06-16T18:08:57.632+12:002009-06-16T18:08:57.632+12:00I always explain that even independent devs work i...I always explain that even independent devs work in a team, always including their future selves.Arjen Lentzhttps://www.blogger.com/profile/10094246971103644167noreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-82854661228191766152009-06-16T17:52:02.973+12:002009-06-16T17:52:02.973+12:00I couldn't agree with this more. In the major...I couldn't agree with this more. In the majority of cases, the time that a subsequent developer loses trying to understand "super special optimised code" will never be made up at runtime by the optimisations that took so long to understand.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-2696271707718793632009-06-16T15:43:09.929+12:002009-06-16T15:43:09.929+12:00YOU DON'T OWN THE CODE. The company does.
Th...YOU DON'T OWN THE CODE. The company does.<br /><br />That's what I tell my staff. Sometimes people forget that.Davenoreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-22091475752538978382009-06-16T15:33:25.011+12:002009-06-16T15:33:25.011+12:00This is a pretty good article, and I agree with al...This is a pretty good article, and I agree with almost everything you have stated. However, I tend to disagree with your points on comments. I think that the code should document itself and the best way to do this is with testing. When you develop with a testing mindset, your will have smaller business concepts and functionality concepts broken into seperate testable methods. The test methods act both as documentation to describe what the code should do and *also* tests to make sure that it actually acts as it is intended. That being said, test methods should also be descriptive of what their functionality actually is.Chris Schmidthttps://www.blogger.com/profile/00176557422611541107noreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-81854992429862483042009-06-16T14:55:29.125+12:002009-06-16T14:55:29.125+12:00"The compiler doesn't care whether the fu..."The compiler doesn't care whether the function name is 3 characters or 30 characters long."<br /><br />Unless you have to interoperate with old C compilers/linkers, in which case you may have to worry about making the first six characters of your names unique. Pretty rare these days, but not totally gone.Andrewnoreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-13961185798846236562009-06-16T13:09:45.225+12:002009-06-16T13:09:45.225+12:00@Anonymous: Yes, that classic article is much bett...@Anonymous: Yes, that classic article is much better! :-)jbrendelhttps://www.blogger.com/profile/09547073366771090616noreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-76499467392785492672009-06-16T13:04:18.817+12:002009-06-16T13:04:18.817+12:00Guys guys guys, slow down. Here is a much better ...Guys guys guys, slow down. Here is a much better article:<br />http://freeworld.thc.org/root/phun/unmaintain.htmlAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-71236636119862414122009-06-16T11:39:57.359+12:002009-06-16T11:39:57.359+12:00@ob: Thank you for the comment. I agree that the &...@ob: Thank you for the comment. I agree that the 'why' part can change. However, please see what I wrote about the 'obsolete comments': Code reviews can be use to address this. I have never suggested to document the progression of code (I assume here you mean the evolution over time) by means of code comments. Instead, once the code has addressed an issue differently, the comments regarding that particular piece of code should be updated. As you said, the 'current' design tradeoffs are usually all we are interested in.jbrendelhttp://www.brendel.com/consultingnoreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-20811506263171056972009-06-16T11:17:50.455+12:002009-06-16T11:17:50.455+12:00I tend to agree with all your points, except the o...I tend to agree with all your points, except the one about commenting. I think the importance of source control management systems is currently underplayed by programmers. The "why" part is often a function of time (we started with design X, then realized that didn't work because of A, then shifted to Y, etc). <br /><br />If you try to document the progression of code in the code itself, you end up with long rambling comments that are hardly maintained. I posit a better way of working is hiding the historical reasons in the SCM and having just brief comments that explain the current design tradeoffs in the code. I think people don't do this because the current SCM history browsing tools suck. But some day we'll get there.<br /><br />For a longer example of what I mean, see <a href="http://oscarbonilla.com/2006/12/code-tells-you-how-revision-history-tells-you-why/" rel="nofollow">this blog post</a>.obhttp://oscarbonilla.comnoreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-79820053023764574212009-06-16T10:01:11.666+12:002009-06-16T10:01:11.666+12:00I actually had an interesting experience regarding...I actually had an interesting experience regarding this: I just open-sourced a piece of software (http://github.com/groby/iCalFix) that I considered quite reasonably written in terms of readability.<br /><br />Until I pulled the trigger on pushing it out in the open. Suddenly, I *had* to spend another 4 hours on it because it was in a shape that I'd consider completely unacceptable. Not that the code changed - just knowing it'd be exposed to an audience made all the difference.<br /><br />It was a fascinating experience, and makes me appreciate open-sourcing even more. Just the *prospect* of being judged by readers of the code (nobody actually has spent any time looking at it so far ;) significantly changed my quality standards.<br /><br />And I swear on a pack of bibles - if I didn't consider it a mostly dead project, I'd probably spend more time cleaning this up ;)Rachel Blumhttp://www.codingadventures.comnoreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-53647004662237662042009-06-16T09:57:28.707+12:002009-06-16T09:57:28.707+12:00Amen, brotherAmen, brotherAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6748806271290317100.post-55883497410683673632009-06-16T08:20:41.080+12:002009-06-16T08:20:41.080+12:00I like your article, well written and informative....I like your article, well written and informative.Anonymousnoreply@blogger.com