Saturday, November 3, 2007
Java 6 on OS X
13949712720901ForOSX
Friday, March 16, 2007
Groovy on OS X and MacPorts
The default MacPorts install of groovy didn't work out of the box. When I ran
groovy from the prompt I got a nasty java.lang.SecurityException.The problem ended up being that my Java CLASSPATH included
classes.jar.The solution ended up clearing out the CLASSPATH system variable altogether before invoking groovy. You can do this with a command line switch but the easiest way to do it was to edit the
startGroovy file (found in the /bin directory of the groovy installation). A fast way to find this is using SpotlightI simply added
CLASSPATH= as the first thing in the file:
...
##
## $Revision: 4298 $
## $Date: 2006-12-04 02:39:45 +0100 (Mo, 04 Dez 2006) $
##
CLASSPATH=
PROGNAME=`basename "$0"`
...
Groovy Process Piping: Follow-up
p=['sh','-c','ls -l | sort'].execute()
println p.text
This is mostly cross-platform (assuming CygWin) and is nicely succinct.
I like this method over using the Groovy Groosh module as suggested by Yuri Schimke if only because it doesn't require an import:
def f = gsh.find('.', '-name', '*.java', '-ls');
f.pipeTo(lines);
As always there are many ways to skin the same cat.
Thursday, January 25, 2007
Commenting fields/methods
Less comments but more content.
Along with methods, if a field has to be commented, I’ve found it is usually because it is misnamed.
// Counter that keeps track of login attempts private int counter;
Would be better expressed as: private int loginAttemptCounter;
It is funny how this simple DRY concept can keep you on the high road of development. Also important is spell-checking and grammar. While a comment shouldn’t be an English thesis paper it should be professionally written. If English is not your strong point have a buddy on the team review your code for errors. Even the best authors lean heavily on editors (the human proof-reading kind not the text-editing kind).
EZ Project Management
No matter what the chosen process is or how tasks are broken up, every major project I’ve been on has been time blocked:
- Management decides the new system should be finished by date X.
- The analysts and project manager divide the amount of tasks by the number of iterations available before date X.
- For each iteration-task-set you divide it evenly amongst your available developers.
- You ask your developers for an estimation on their tasks for each iteration.
- They respond by taking the number of assigned tasks, divided by the hours available in the iteration.
- Some magic happens (scope reduction, overtime, bring in experts to clean up, implement tasks with TODO: statements)
- The project finishes on date X.
I’ve developed this project management process on a single MS excel sheet. I’m making it available for a cost of $1000 per seat with an annual $10K maintenance charge. Of course I can offer consulting services to customize it to your corporation at a $300/hour bill rate. Do you like curly fonts?
Corporate Code Smells
Corporate Code smells:
- WSAD - There is a reason it isn’t called WHAPPY
- Only javadoc is the eclipse message telling you how to change your default javadoc templates
- No interfaces at all or an interface for every class
- junit.jar exists in the lib directory but no tests to be found
- I got this unit test that calls the production database
- optimized imports? code formatting? we don’t have time in the project plan for that
- Sure we use Spring, but we wrap it with our own classes so we can switch it out later
- We’ve cached the bean instance returned by Spring to speed things up
- We added hibernate because we knew we were going to hit the database
- Synchronization? Threads? the container takes care of that
- Guys, look at this framework I cranked out last night!
- With annotations I was able to expose all my classes as web services, you know, for reuse!