tag:blogger.com,1999:blog-50546322008-07-22T11:25:52.387+02:00limaCAT's Weekly NewslimaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comBlogger167125tag:blogger.com,1999:blog-5054632.post-2811131192753957762008-07-16T21:07:00.002+02:002008-07-16T21:11:36.953+02:00I love this mouse.<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_NRjOZR8PFQk/SH5HGgbViUI/AAAAAAAAADM/esyxk3GmO6A/s1600-h/flat_optical_b.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_NRjOZR8PFQk/SH5HGgbViUI/AAAAAAAAADM/esyxk3GmO6A/s400/flat_optical_b.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5223690794905733442" /></a>
A 7 euros little beast, that I bought for substituting a Microsoft mouse for my notebook that was misbehaving (like all the other M$ products, lol). I simply fell in love. It clicks correctly, loudly, and feels good for navigation. The only problem is the scroll wheel that is still too little and does not have the same degree of control of a bigger mouse, but I still like it.limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-44731382893106179432008-07-10T14:59:00.001+02:002008-07-10T14:59:53.634+02:00Testing FlockAfter quite some time, I am again testing Flock. <p>
It seems quite nice, also because now it promises to keep the html code I write instead of punishing me with its own standard.limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-58480077830788784092008-06-20T23:08:00.002+02:002008-06-20T23:11:32.189+02:00Electric Light Orchestra - Twilight(Also: <a href="http://www.youtube.com/watch?v=rzy1RNJBUo4">bunnygirl</a>).
<p>
<i>
<code>Just on the border of your waking mind<br/>
There lies another time<br/>
Where darkness and light are one,<br/>
And as you tread the halls of sanity,<br/>
You feel so glad to be unable to go beyond.<br/>
I have a message from another time... <br/></code>
</i>
</p>
<p>
The visions dancing in my mind<br/>
The early dawn, the shades of time<br/>
Twilight crawling through my windowpane<br/>
Am I awake or do I dream?<br/>
The strangest pictures I have seen<br/>
Night is day and twilights gone away<br/>
</p>
<p>
With your head held high and your scarlet lies<br/>
You came down to me from the open skies<br/>
Its either real or its a dream<br/>
Theres nothing that is in between...<br/>
</p>
<p>
Chorus:<br/>
Twilight, I only meant to stay awhile<br/>
Twilight, I gave you time to steal my mind<br/>
Away from me.<br/>
</p>
<p>
Across the night I saw your face<br/>
You disappeared without a trace<br/>
You brought me here, but can you take me back?<br/>
Inside the image of your light<br/>
That now is day and once was night<br/>
You lead me here and then you go away.<br/>
</p>
<p>
Its either real or its a dream<br/>
Theres nothing that is in between...<br/>
</p>
<p>
(Twilight) I gave you time to steal my mind<br/>
Away from me.<br/>
</p>
<p>
You brought me here, but can you take me back again?<br/>
</p>
<p>
With your head held high and your scarlet lies<br/>
You came down to me from the open skies<br/>
</p>
<p>
Its either real or its a dream<br/>
Theres nothing that is in between...<br/>
</p>
<p>
Twilight, I only meant to stay awhile<br/>
Twilight, I gave you time to steal my mind<br/>
Twilight, I only meant to stay awhile (x2)
</p>limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-59069143828581941042008-05-30T11:07:00.001+02:002008-05-30T11:09:15.079+02:00Your webcomic does not have to be...An animu fighting epic with blue-haired girls and katanas. <a href="http://ryanpeq.livejournal.com/101065.html">The proof is here</a>.limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-53443238571854554142008-05-15T22:35:00.002+02:002008-05-15T22:42:32.692+02:00This is Hilarious.I have taken an insane addiction to ohloh, the new penis e-meter based on how much you code for opensource projects. The hilarious part is their totally skewed metrics:
<p>
<div align="center">
<a href="http://www.ohloh.net/projects/sexycodechecker?ref=sample">
<img width="193" height="33" src="http://www.ohloh.net/projects/sexycodechecker/widgets/project_partner_badge.gif" alt="Ohloh project report for SCC"/>
</a>
</div>
</p>
No, I do not believe SCC being worth circa 120 grands (at least, while you read this post). OTOH OHLOH could be useful if integrated a bit more with LinkedIn, just to be able to showcase your calculated software talents also on that network, (project usage and commits metrics mean an awful lot inside software projects) or if you could map your OSS neighborhood to your business colleagues.limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-79665749481876698582008-05-12T15:58:00.003+02:002008-05-12T16:07:55.981+02:00Got problems with Cygwin?Helping a colleague to install Cygwin on his own machine we came across two problems:
<ol>
<li><strong>Running Cygwin after setup a window opens and closes again rapidly.
</strong>. <em>Cause: Cygwin did not install the bash shell.</em> Possible solution: re-install the base packages, or better reinstall cygwin altogether.
</li><li><strong>Running Cygwin you find only the bash shell with bash-3.2$ as prompt</strong>. <em>Cause: Cygwin does not install everything (running scripts to recreate the /etc/profile file) because the Cygwin dir was already there and not with the permission it expected to find.</em> Possible solution: delete the C:/Cygwin directory, run setup again putting the install packages NOT under C:/Cygwin/THE_DIR_YOU_CHOSE_BEFORE directory.
</li>
</ol>
Hope this helps.limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-49890826960918801752008-05-07T16:39:00.010+02:002008-05-07T23:03:10.241+02:00Howto: Checkout sexycodechecker in SharpDevelop 2.0<p>
<strong>Addendum:</strong>
<em>
I created and posted a new .sln file for plain Visual Studio. If you use it, this tutorial here will work as well for Visual Studio 2008, probably on the 2005 version with .NET 2.0 as well since I removed all the 3.5 dependencies from it (scc is so does not need LINQ yet ;) …) but YMMV with it.
</em>
</p>
<p>
I had to install SharpDevelop 2.0 and .NET SDK 2.0 on my computer (it is still a Windows 2000 machine, while my brand new laptop is a vista machine with Visual Studio Express 2008), and since I was checking out the project from Berlios I decided to write down these installation notes.
</p>
<ol>
<li>
Install NUnit, TortoiseSVN and SharpDevelop 2.0 on your machine. Open SharpDevelop.
</li>
<li>
Check out the project from SVN
<ul>
<li>Choose the <code>Tools > Subversion > Checkout</code> menu option.</li>
<li><div>As Repository Url give:</div><code>http://svn.berlios.de/svnroot/repos/sexycodechecker/trunk</code></li>
<li><div>As Checkout directory give:</div>
<code>C:\Documents and Settings\Yourusername\Documenti\SharpDevelop Projects\cft-sexycodechecker</code></li>
</ul>
</li>
<li>
Open the solution: the correct solution file for SharpDevelop 2.0 is <code>cft-sexycodechecker.shdev2.sln</code> (Other solution files will be created as soon as I can)
</li>
<li>
Edit the Parameters.xml file
<ul>
<li>
In the projects view, check the "show all files" option, then find the <code>Tests/Resources/Parameters.xml.prototype</code> file.
Copy it as Parameters.xml and customize it putting the root-level source dir in
<code>C:/Documents and Settings/Yourusername/Documenti/SharpDevelop Projects/cft-sexycodechecker/cft-sexycodechecker/</code>
</li><li>
<strong>Beware:</strong> Sharp Develop 2 will not allow to copy a file and paste it again in the same directory. It will not create a new copy adding "Copy of" in front of it. You have to copy, paste and rename it from outside the ide.
</li><li>
<div><strong>Q:</strong> Why are you using a .prototype file and you are not posting the xml file directly to svn?
</div><div>
<strong>A:</strong> Because it has parameters tied to the local machine and I do not want to wake up one morning finding that my
Prototype.xml has been changed because someone committed it accidentally.
</div></li></ul>
</li>
<li>
Now build the solution (alt+F8)
</li>
<li>
Run NUnit to check that all is fine and dandy with your project
<ul><li>
Open NUnit, select the <code>File > Open Project</code> menu option and load the cft-sexycodechecker.dll under the <code>bin/Debug directory</code>
</li><li>
<strong>Beware:</strong> It could happen that your NUnit test fail spectacularly with:
<pre><code>Nunit Cluefultoys.Xml.LoadingTest (TestFixtureSetUp):
System.NullReferenceException : Object reference not set to an instance of an object.</code></pre>
The cause of this error might be because you have not configured Parameters.xml, or somehow it was un-embedded from the assembly resources.
You have to open the Parameters.xml properties, and set it as "BuildEmbedded" action.
</li><li>
Another cause of this error might be because you have recreated the project .csproj file from scratch and you havent set
the root namespace correctly: it must be <code>Cluefultoys</code> and not <code>cft_sexycodechecker</code>.
</li></ul>
</li>
</ol>limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-38464397219618064892008-05-06T12:15:00.004+02:002008-05-06T12:26:42.533+02:00Will troll for Scala.I don't know you, but i personally find that a language <a href="http://www.codecommit.com/blog/scala/quick-explanation-of-scalas-syntax">that allows the use of an ascii butt</a> is a welcome addition to Information Technology.
<pre><code>
class Butt {
var ass:Boolean = Array(true, false, false, true, false).reduceLeft[Boolean](_|_)
}
object Dick {
def main(args : Array[String]) : Unit = {
var x = new Butt
println("Your ass is grass (" + (x.ass) + ") and I'm the lawn-mower")
}
}
</code></pre>limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-7898426063825907582008-05-05T16:17:00.005+02:002008-05-05T17:09:05.935+02:00#5 make your stuff identifiable<p>
<ul><li>Identifiers, including iteration variables, will be spelled with names of at least three characters.</li></ul>
A coding rule I read in my previous job, probably one of the few rules that had sense inside the whole "The Evil Company" software coding standard, asked us to use two-characters iteration variables like "ii" or "jj" instead of the classic CS-style "i" and "j". It had sense because, I think, it helped our unix-and-j2ee department to check if there were problems in the java source code files using command line tools (looking for the "i" variable will also give you the "val<em>i</em>date()" method, the <em>i</em>nt keyword, the <em>i</em>f keyword…).
</p>
<p>
This made me reflect: <em>Why are we still using one-letter iteration variables?</em>. If the <code>i</code> variable is an <em>index</em>, why can't we call it <code>index</code>? Eclipse or Visual Studio will gladly help us to call it index in a speedy way (ctrl+space iirc). We are not anymore on teletypes, and you could also do a little sacrifice and back up that porn on a dvd and then delete it from <code>C:\</code> to make space for wider source files.
</p>
<p>
What is true for an admin ruining his eyes on a linux console, is also true for you ruining your eyes on the eclipse debugger: it is better at least that you understand what you are reading. Three characters is the minimum number of letter for having a meaningful name, at least in the vast majority of cases and talking about modern english, not logographic languages, and of course this rule has an implied part that asks the programmer to use names that are good enough for the job. Unfortunately finding properly named code is not a job for an automated tool, but it is a suitable job for a mace-wielding technical architect.
</p>limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-19827791133534371032008-05-05T15:59:00.005+02:002008-05-05T16:15:05.400+02:00#4 do not put too many eggs in a basketThis is the only rule that remained true to its own original version… like it was originally conceived while I was cleaning up my room before moving back to my hometown.
<ul><li>
Every method will be of 20 lines max.
</li></ul>
<p>
While a 400 lines long program can stay into a single method, a program longer than that must be modularized. When you vote for modularity, expecially in an object oriented environment, you are going to work for a division based on the data over which you must act: you keep the code that acts on a certain kind of data local to that data. Therefore it becomes useless to keep information on the way you act over, for example, end-of-the-year dates in the same method where you act over usernames or files on a remote filesystem. The remote filesystem files are not interested by how you well can handle the dates or username. And at 2.00 in the morning you wouldn't be interested by those relations as well if you are only trying to understand why you cannot suddenly access the remote filesystem.
</p><p>
So, in order to avoid this dispersion of concepts you need to factor your code into small, compact methods. 20 lines is actually a number large enough to allow some fragmentation and repetition, but it still allows a version of a CS algorithm like Merge-Sort (at least, a version I spiked out some time ago) without it being split further.
</p><p>
I think essentially the whole concept behind 700x128 boils down to "do not make methods that are long too much"... and remembering how was my Java life before changing job I think it is probably a strongly motivated rule. :)
</p>limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-81662885703539011272008-05-03T23:17:00.002+02:002008-05-03T23:20:37.511+02:00Ceci n'est pas un fanboy post.Quoting from <a href="http://gamefunk.net/?p=57">Gamefunk</a>...
<em>
<p>
That being said, there is something seriously wrong with the Nintendo Wii. No, its not that it doesn’t have the graphical capabilities of the 360/PS3. Nor is it the lackluster online service Nintendo provides either. It isn’t the paltry amount of hard drive space, sometimes unresponsive accelerometers of the nunchuck, or even the chuckle-inspiring name of the console. Its the software library.
</p>
<p>
<div><strong>BY COMPARISON</strong></div>
Since its release in 2005, there have been some 374 games released for the XBox 360. Of the 374, 86 titles have received a ‘good’ rating(an average ranking of 80% or higher, as per GameRankings). 92 have received ‘poor’ ratings(an average of lower than 60%). That means about 26% of the games for the 360 are ‘good’, and about 24% are considered trash. The PS3 has seen 122 games released, with 40(33%) good games and 20(17%) poor games(ironic considering the most common argument against the PS3 is a lack of good games).
</p>
</em>limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-78231074688616031902008-04-30T22:45:00.004+02:002008-05-01T00:02:57.039+02:00Scratch the thin patina.Scratch the thin patina that covers people on the surface, the crust of words and high hopes that they surround themselves with, and they will always show you their real colours. The only stupid is only me that always fall for the same old trick.limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-61103750886232962482008-04-27T22:55:00.003+02:002008-04-27T23:07:42.445+02:00My take on second life.From the pictures I see around, if you produce content for second life you are just wasting your talent. The engine still has the quality of a pre-quake2 3d graphics engine, and no matter how much time you spend to make your models and clothes better, the "in client screenshots" will still look awful. Heh, Linden Dollars, what have you done to people? I hope that at least SL content creators makers still keep high res tiffs of those textures stored somewhere, just in case Lidnen releases a less crappy engine.
<p/>
This post was brougtht to you by: a search for the packages of Electronic Arts "Whatever Construction Set" videogames series, and a big dose of ADHD, oooh, shiny!limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-8875507988030947642008-04-26T14:22:00.002+02:002008-04-26T14:54:28.329+02:00Seen it live...<i>[your application is] <a href="http://teddziuba.com/2008/04/im-going-to-scale-my-foot-up-y.html">having scalability problems because you coded a ton of N^2 loops into it and you're too self-important to get peer reviews on your commits.</a></i>
<p/>
Ted Dziuba's word on scalability. That resonates with me as I have seen an application having exactly that problem, and the only solution being allowed was to "rewrite all the sql queries".limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-11114324254519609102008-04-25T19:09:00.000+02:002008-04-25T19:10:38.979+02:00April 25th<pre>
Una mattina mi son svegliato,
o bella, ciao! bella, ciao! bella, ciao, ciao, ciao!
Una mattina mi son svegliato,
e ho trovato l'invasor.
O partigiano, portami via,
o bella, ciao! bella, ciao! bella, ciao, ciao, ciao!
O partigiano, portami via,
ché mi sento di morir.
E se io muoio da partigiano,
o bella, ciao! bella, ciao! bella, ciao, ciao, ciao!
E se io muoio da partigiano,
tu mi devi seppellir.
E seppellire lassù in montagna,
o bella, ciao! bella, ciao! bella, ciao, ciao, ciao!
E seppellire lassù in montagna,
sotto l'ombra di un bel fior.
Tutte le genti che passeranno,
o bella, ciao! bella, ciao! bella, ciao, ciao, ciao!
Tutte le genti che passeranno,
Mi diranno «Che bel fior!»
«È questo il fiore del partigiano»,
o bella, ciao! bella, ciao! bella, ciao, ciao, ciao!
«È questo il fiore del partigiano,
morto per la libertà!»
</pre>limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-50712226915958533062008-04-24T18:18:00.003+02:002008-04-24T18:23:16.895+02:00Spam spam lovely spam!I was checking my google mail spam folder for my routine junk cleanup and false positive check, when my eye came across this invitation.
<p align="center">
<img src="http://i9.photobucket.com/albums/a72/limacat/Funstuff/celeb1.jpg" alt="" />
</p>
Oh, a picture of a nice lady dressing in her birthday suit, only for me? Then I proceeded to open the e-mail.
<p align="center">
<img src="http://i9.photobucket.com/albums/a72/limacat/Funstuff/celeb2.jpg" alt="" />
</p>
No, I don't really dig Paris... she is a nice girl but she is not, you know, the kind of girl that I would like to see... thankyou but I'd rather pass on this occasion.
In the meanwhile I hopened the nice google images and proceeded to find some nice pic of <a href="http://temple3.wordpress.com/2007/05/04/dallas-mavericks-gone-fishing/">Susan Strorm</a> aka Jessica Alba, and now I am happy again...limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-75792396733272210942008-04-20T22:58:00.002+02:002008-04-20T23:03:43.357+02:00Anyway…I still wonder how I will defeat "the hydra": see <a href="http://svn.berlios.de/svnroot/repos/sexycodechecker/trunk/cft-sexycodechecker/Src/Checker.cs">here</a> (class Rule and its subclasses) and <a href="http://limacat.blogspot.com/2008/04/3-do-not-stutter.html">the last part of this post</a> to see my problem...limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-88562236643788647472008-04-20T18:26:00.005+02:002008-05-05T15:27:55.498+02:00A quickieJust a quickie to tell you that I posted the first part of the code for "sexycodechecker", my implementation of the 700x128 manifesto (which will probably soon become 400x128).
<p>
<ul>
<li>
<a href="https://developer.berlios.de/projects/sexycodechecker/">Page on Berlios</a>,
</li><li>
<a href="http://svn.berlios.de/svnroot/repos/sexycodechecker/trunk/">Link to SVN</a>,
</li><li>
<a href="http://svn.berlios.de/svnroot/repos/sexycodechecker/trunk/cft-sexycodechecker/Copying.txt">No Warranties</a>,
</li><li>
<a href="http://www.ibras.dk/montypython/episode27.htm">Funny Monty Python Episode</a>,
</li><li><a href="http://developer.berlios.de/devlog/limacat/">the projectblog, which will probably remain empty</a>.
</li>
</ul>
</p>
<p>
What you say? How to access it via SVN? Here you go:
<code><pre>
svn checkout http://svn.berlios.de/svnroot/repos/sexycodechecker/trunk
</pre></code>
It comes with a full suite of unit tests, that require an installation of NUnit.
</p>limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-6777516926089447782008-04-18T17:12:00.004+02:002008-04-18T17:17:42.506+02:00Frogisms and Object Oriented ProgrammingIt is not an object if you can prefix with "<code>static</code>" the only public metod belonging to the class and the compiler does not complain with an error.limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-65666588231074395852008-04-17T17:36:00.007+02:002008-04-17T19:30:15.379+02:00#3 do not stutterLike rule 1 and 2, rule three has been changed. In the current incarnation it says:
<ul>
<li>There will only be one statement for each line of code.
<ul>
<li>One statement, also, will stay only on one line of code.
</li>
</ul>
</li>
</ul>
<p>
Note that they are two different things: the first says that this code is wrong
<pre><code>string ycr = "your coding rules" ; string sucks = "suck";</code></pre>
The second says that this code, instead, is wrong
<pre><code>string ycr = "your coding rules" +
"suck big time!!!";</code></pre>
</p>
<p>
One statement per line, versus one line per statement. What is the need of resource bundles, external files and the like if you clobber up your source code with SQL queries instead? In 2008 there is no reason why you shouldn't be writing using different line for different statements. Either compilers are cleverly designed, or the computer are fast enough not to notice the differences. Bottlenecks in 2008 are given by bad algorithms, big transmission footprints and project requirements and guidelines gone wild. Trust your compiler, trust the metal, and program for clarity, as your job is programming, not masturbating the compiler or the platform.</p>
</p>
<p>
How does a single line per statement help you? Because you read by scanning line by line, not actually reading the entire line, but only looking for keywords in your code. In the meanwhile you try to do a mental map of your code, like a debugger, trying to see why the code behaves how it does. Putting two statements in a line defies that, even assignments, and something will become invisible at a first screening. Splitting the statement on two lines is just kidding yourself: you are dispersing your knowledge. So the best way to succeed is to stick only to the measure of 1-line-per-statement.
</p>
<p>
Development of the code for managing rule three was quite straightforward. I have wrote down a set of 7 tests. The tests in the end managed to be 11, with one bug and three further clarifications. I am going to make the code available soon too if you were curious.
</p>
<p>
One thing I wonder is this: I am using a variation on a coding pattern I have already used before: a hierarchy of method objects (or better, a hierarchy of strategy objects). This pattern helps me in defining a workflow and factor out duplication in favour of smaller, easier to mantain code (a bug can be only in a single node of the code, not somewhere else). Question is: isn't it crap in the end? Isn't it doing with inheritance what previously was done with a nested cluster of <code>if</code>s? <code>:)</code>. Well, at least the day I refactor I will have the tests covering my ass <code>:)</code>. Other trivia: my main file is already 616 lines long with 12 classes, and there are already 46 test cases.
</p>limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-48477291775209847212008-04-15T09:31:00.002+02:002008-04-15T09:37:38.997+02:00Home Internet via SatelliteBefore ADSL and that bad bad torrent protocol came in life, satellite internet was my dream. <a href="http://www.jelovic.com/misc/astralink.htm">Dejan Jelovic</a>, from a distant past, tells us his own experience.limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-71695579854736424742008-04-13T22:39:00.003+02:002008-04-13T22:55:54.186+02:00#2 not too fatI am still working on the <a href="http://limacat.blogspot.com/2008/04/rules-for-being-sexy-1-not-too-tall.html">700 by 128 manifesto</a> and on my code checker, and on my "nice code" theory.
<p>
The current incarnation of Rule 2 states that:
<ul>
<li>
No line of code can be wider more than 128 characters.
<ul>
<li>
Comments will not be part of the characters count.
</li>
<li>
With every indent, count will be starting by default at 4 characters more than previous line.
</li>
</ul>
</li>
</ul>
Basically the rationale boils down to the fact that if you need more than 128 characters to express yourself on a single statement (and there will be rule three that will expand on this and define one statement for each line, and one line for each statement) you are probably doing something wrong.
</p>
<p>
For example:
<ul><li>
you may be using a method with a parameter list that is too long
</li><li>
you might be putting messages that you should instead localize
</li><li>
probably you are sprinkling your code with sql instead of using an external source
</li><li>
you have put too many indents
</li></ul>
</p>
<p>
A too long parameter list is a signal that you are doing procedurally what you should do instead with an Object-Oriented Design,
and probably you are duplicating some logic between your caller method and your callee.
</p>
<p>
Pushing SQL and Messages inside the code is wrong too: mostly because it impedes you to concentrate on programming logic (other thing you have to see in order to understand how your code work), secondly because it hinders refactoring, and third because it restraints you from being able to update the application "on the fly" if the need arises. Something inside your code is simply doing something that it should not do: the "data storage". Your code should do its business logic, the storage of data or system interoperability should be outsourced to other resources.
</p>
<p>
Creating too many indentation level is bad too. I am not thinking about inner classes or, in Java, anonymous methods: I use them as the need for a new class arises, and my class is not intended for public consumption. I am thinking about - holy macaroni! -
too many levels of <code>if</code>s, or too many nested loops. I will not cite all the literature against too many <code>if</code>ss, <code>switch</code>es or nested loops: if you are already working on a large business project you will find them somewhere waiting to jump on you… What do you think about them? Are they pretty? Do you have a problem with them or not? If you haven't had any problem with them, probably you are only writing code and making someone else to correct anomalies on it… be honest once with yourself and start correcting the anomalies, and
watch how many days you are wasting on them to come out with a solution.
</p>
<p>
Number 128 characters and 4 spaces for every indent are again here a "rule of thumb". Probably 128 characters is a bit too right value to fit the occasional "oh shit, how can I write this omg" method, but nothing that cannot be overcome with some thinking...
</p>
<p>
While writing the code to check this rule I came across two challenges: the first, it was a comment line in my live code (I am checking my code with my own checker :D) that was 130 characters long. The second: I had some difficulty in cleaning up and refactoring my code. Eventually I won but it was a long fight :).
</p>
<p>
The 130 characters long comment line pushed me to do a comment line exception to this rule, like there is for rule number 1... it was some important work to do, because I had to pull up the comment facility from rule number 1 to the abstract parent class. By changing some code to follow what the variables told me by their own names, and not by how they were addessed by the code, and correcting some logical quirk like if I never read the code before, I borked the rule number 1. I examined the situation and understood that there was some flaw in my original reasoning that I failed to spot while I wrote the code. Oh well... I had to put quite some time to find how to make all my Junit, pardon, NUnit tests happy again. Now code works again, thanks NUnit!!!
</p>
<p>
The difficulty in refactoring, again, was given by that same logic flaw: only by cleaning up the comments mess I managed to have a situation clean enough to give me a hint for a better parsing design, but yet I felt somehow dishearted by a lack of a clear path in front of me.
</p>
<p>
In truth I wonder if aggressively working with extract method pays off: most of the time you will notice nice patterns which then push you into following a cleaner design, but sometimes extract method will give the exact opposite result. Well, the experiment is not over yet ;)
</p>
<p>
By the way: the living code for my code checker is already 400 lines long in one file, and there are already 8 different classes, each specialized for its own job. I wonder if 700 lines per compilation unit (class + import) is a sane number, or if I should go the radical way and push it to a really smaller value (perhaps two years of finance really ruined my coding habits).
</p>limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-59592615926113393592008-04-12T17:47:00.004+02:002008-04-12T17:52:38.663+02:00Do you miss those days?<div align="center">
<img src="http://i9.photobucket.com/albums/a72/limacat/Friends/Even.gif" alt="Even by Skyfire" title="For llhatarius!" />
</div>limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-83978374093735139492008-04-12T15:03:00.004+02:002008-04-12T15:23:03.617+02:00A month of Windows Vista.<p>
I bought a new laptop with windows vista. After a month of using it I can say... I almost love it. Really. I cannot understand why people are annoyed at UAC, but well, I would have switched to a non-power user account and then back to administrator just to install new software anyway (as I eventually did): UAC at least prompts me to put admin password to switch as admin, so I don't have to logout. It's not my fault, that is the same thing written in every single fucking safe computer usage manual on the internet: do not run as root or administrator, log in to install new software. That said, I love UAC, and I love it sometimes catches third party software trying to write to the registry. (I have to fill a complaint against <a href="http://www.jboss.org/tools/">Jboss tools</a> one day or later).
</p>
<p>
On the downside: it seems that Microsoft managed to slightly break explorer (the file manager, not IE) again: sometimes it goes into a trance then it resumes. Probably it is telling Redmond about the <a href="http://www.youtube.com/watch?v=Mdf9ddZcMHs">Wonder Momoi</a> mp3s or whatever is under the C:/Pr0n folder, but as long as it is bearable I can still work with that. No sign of <a href="http://www.theregister.co.uk/2007/05/15/vistas_long_goodbye_continues/">long goodbye</a> yet, even if sometimes after dehibernating it gives my USB mouse a long goodmorning (rotfl).
</p>
<p>
I have tried to install linux, I would have killed to be able to work on it but it seems that my Samsung R60+ is not fully covered by drivers… also in my new job I have a network full of linux machines to work with via command line :) (and Cygwin + awk also saved my ass once ;)).
</p>limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.comtag:blogger.com,1999:blog-5054632.post-56802084689635537182008-04-11T23:59:00.000+02:002008-04-11T23:53:21.512+02:00This blog is not Gasparri Compliant.<a href="http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Ait%3Aofficial&hs=psl&q=gasparri+schedare+blogger&btnG=Search">'nuff said</a>limaCAThttp://www.blogger.com/profile/09790785500820726074noreply@blogger.com