Comments anyone?
Rather than being a request for comments, this post is all about comments in code. When I write code, I tend to treat the code as I would writing for this blog (i.e. with a lot of other people trying to read it). So wherever possible I try to make the code as readable as I can, so that others can understand, maintain or even correct my code.
There's nothing new in that, and it's a core part of being an agile developer. The code is the most important artifact of the software development process, so make it beautiful to the reader. This has become even more important when developing for open source, where more often than not the code is the only artifact.
So that brings me to my point, which is javascript comments. I recently came across a question about the length of comments in javascript code that ran along the lines of "this is a massive comment, should we be sending this to the browser". It was a fair observation as the code comment was lengthy and really only for the development team only, but the most interesting point is that whereas server-side comments can be specified in taglibs (using the <%-- --%> comment bracket), there's no equivalent that I know of for javascript.
So every comment you put in your javascript is sent to the client. Every single character of it, even though the client (usually the browser) will probably do nothing but ignore those comments and that the actual sending of those comments can significantly bloat the transaction.
This leaves me a bit cold to be honest, because the fact that javascript comments can lead to client-side code bloat is a VERY BAD THING. It pushes a developer to leave as little documentation in their code as possible, which is ok if the javascript is relatively readable, but with variable and function name optimisations this is increasingly unlikely as we try to keep the length of the code down for much the same reasons.
So my concern led me to Dojo's Rhino-based ShrinkSafe, which seems to have one answer. This tool executes several smart steps to bring the size of your served-to-the-client code size down, and one of those steps is to remove documentation where indicated. I've now used this tool and have found it to be excellent on small-ish (couple of hundred k) codebases.
Anyone else out there using this build step that would like to comment on it's performance?
References (4)
-
Response: boobHi everybody! I want buy thispenNeed tmfcvsofaor thisboobsor thisshoes pens. Need tmfcv -
Response: shoesHalla everybody! I want buy this{sofa||boob||shoes store||pen} pen. Need whjta -
Response: boobHalla everybody! I want buy thissofa. Need yacut -
Response: seven card stud spielenPreview apuesta portal online bingo bestes poker spiel ganar dinero real internet texas holdem online spielen











Reader Comments (2)
http://www.fioricet4sale.com
http://www.butalbital4sale.com
http://www.onlinebutalbital.com
http://www.FIORICETTABS.COM
http://www.BUTALBITALDRUG.COM