DevPinoy.org
A Filipino Developers Community
   
Predictable code

In my early years of programming, performance was everything. These days, since I don't do system-level programming anymore, code maintainability is more important. Of course that doesn't mean to say that it's OK for my code to suck so many CPU cycles doing trivial things. It just means that it pays off better in the long run to have code that is easy to maintain/improve with good/average performance than to have blazing-fast software whose code is hard to understand (and is possibly buggy or will eventually have bugs).

Jeremy Miller weighs in on putting code where you would expect to find it. This particular quote here caught my attention:

I wouldn't want to live without ReSharper's CTRL-N shortcut to find any class in the solution (with wild cards too!). Then again, finding code with ReSharper will be a whole lot easier if you employ good naming practices and put code where you would expect to find it.

That sounds just like the situation I had with a project in my previous company. The C# class files were stored in directories that did not match their namespaces. Good thing ReSharper was there, then again it's still much better to have predictable code and ReSharper at the same time. Wink


Posted 06-12-2007 7:55 AM by cruizer
Filed under: , , ,

Comments

keithrull wrote re: Predictable code
on 06-11-2007 5:14 PM

haha, parang plugging ng JetBrains ang dating :P

cruizer wrote re: Predictable code
on 06-11-2007 5:23 PM

di plugging yan pre! if not for ReSharper i would have lost most of my hair already with that project. :P

jokiz wrote re: Predictable code
on 06-11-2007 8:25 PM

i agree that the folders on the said project and the namespaces were not following the standards.  unfortunately, i didn't have the chance to do the change, but we're planning to address it now...

undetected wrote re: Predictable code
on 06-12-2007 10:51 AM

For me, it goes beyond that.  Sometimes I actually go against the tool's suggested optimization for clarity. For instance, minsan meron akong multi-level if statements that IntelliJ (also from JetBrains) will say can be simplified.  I try out their simplified version, which works, pero mas madaling basahin yung longer version, kasi the conditions being tested are more explicit.  It's another case of "maintainability" over "efficiency".  Being in the corporate environment a few years made me adjust my scales between those two.

cruizer wrote re: Predictable code
on 06-12-2007 8:14 PM

you're always free to ignore the suggestions made by ReSharper. after all YOU know the code better than ReSharper does, right? it's just a tool, it's not the boss.

smash wrote re: Predictable code
on 06-12-2007 9:50 PM

Well I havent had the privilege of using Resharper yet.  Which means I have to do code optimizations manually.  I also suck big time when it comes to folder naming which usually needs to be changed every now and then as the code goes thru the refactoring cycle.  So what I'm doing now is just put all the source in one folder and just rely on on the Class browser to navigate thru the code.  It's a little bit old school but it works for me.  The upside is it works well with SVN :)

jokiz wrote re: Predictable code
on 06-12-2007 9:59 PM

>The upside is it works well with SVN

upside?  do you mean organized code sheets (grouped in folders) does not work well with SVN?

smash wrote re: Predictable code
on 06-12-2007 10:22 PM

Who says SVN doesn't work with folders.  Obviously it does. What I'm trying to say is that ever since I started using a single folder for my sources, I never got into trouble while using SVN again.  chill!

jokiz wrote re: Predictable code
on 06-12-2007 11:42 PM

sorry bout that, i was just curious why you said that the upside is it works well with SVN with your approach

Copyright DevPinoy 2005-2008