Browse > Home

| Subcribe via RSS

Career Thinking

April 12th, 2010 | 3 Comments | Posted in Code, Personal, Work

Both of the Java Posse Roundups I’ve been to, I’ve made some fairly big decisions about my career. Now, I didn’t even really consider my career until fairly recently. I’d had some great jobs, a couple of not-so-great jobs, and I was finally working as a professional programmer. A couple of years ago though I started thinking about what I’d like to be doing as a programmer in the future, whether I’d want to be a manager at some point, all of that stuff. At the 2009 Roundup, I’d just been reading about managers and finally figuring out that all programmer managers aren’t just wastes of space with the help of some people who had been good managers or had good managers. I realized there that I shouldn’t just sit around and put up with the bad manager I had at the time, that it was time to move on and try to find a good manager who could actually help me grow. I got a couple of good job offers but for various reasons decided it would be worthwhile to stay put.

At the 2010 Roundup, I was once again faced with seeing people doing things with their career that I want to do. I want to be learning and growing as a programmer the way a lot of Roundup attendees are. I decided that once again I would reevaluate my job and try to figure out what the best thing would be. The difference is, this time I want to figure out what to do not to escape a bad situation but to go towards something good. I haven’t decided what to do yet but I have refocused my efforts toward learning and getting better rather than just sitting comfortably.

I’ve always learned on the job and I’ve found I’m very good at that. The problem with that kind of learning is it tends to leave gaps in your knowledge since you don’t learn as much that you don’t need right then. I’m rectifying that with a renewed course of study in the areas I feel I’m missing. I’m also focusing on the quality of the work I do and the code I write even more. I don’t work for a software company so I’m a little limited in the efforts I can put forth here but now that our boss has decided we’re to run our own projects I’m definitely pushing more quality into my work and I’m prouder than I’ve ever been with my code.

Like I say, I haven’t decided exactly what to do so this blog post doesn’t have some big conclusion. My new focus is a big deal to me though so I wanted to write it here and not forget. More to come!

Roundup Thoughts

April 9th, 2010 | 1 Comment | Posted in Code, Geekery, Personal

This is a roundup of my thoughts about the Roundup, the Java Posse Roundup 2010 that is. If you don’t know, the Roundup is the yearly conference put on by the guys who do the Java Posse podcast and tech writer/speaker Bruce Eckel. If you’re a Java person, you should be listening to their podcast, no question. The conference is an unconference/open space conference/camp/etc. where it’s not about getting lectured to or watching slides but discussing topics with a group. There’s no speaker, just a bunch of smart people talking. This was my second Roundup and I very much hope it won’t be my last.

One of the best parts of the Roundup is seeing people I met and made friends with in person again. We drove up on Sunday and Bruce had a get-together for early attendees at his house that ended up being mostly returning folks catching up. It was great to see people again, even though I felt like I hadn’t spent any time away from some people thanks to Twitter.

The next day was Day 0 of the Roundup, the language dojo day. I had left last year’s Roundup with a great feeling about JavaFX and had done a little coding in it since then so I went to the JavaFX day Dick Wall of the Posse proposed. We spent the day writing a JavaFX version of OmmWriter (called ZenWriterFX) and fighting with git/github. If we hadn’t had so much trouble with git, we would have made it a lot farther but even so we made good progress. I helped a little generally and ended up doing the little bit that played the background sound for the app. Dick has since moved the project to Bitbucket so we can use Mercurial and I’m going to be participating in further development for sure. I already have some cool ideas I want to try out and I really like JavaFX.

I’ll go into the individual sessions at some later point when I can go over my notes but overall, the sessions were great again this year. I learned a lot, as always, and actually had something to say in more than a few. I do find that I like the sessions where I don’t talk as much more though. :) The Roundup attendees are all super smart people and it’s great to get everybody’s perspective and uses of things.

One of the best parts of the Roundup is the Lightning Talks. These are 5 minute talks people give on any subject that interests them, technical or not. This year there were talks about car engines, shaving, donating bone marrow, open mapping technology, and much more. The talks are recorded and will be on YouTube at some point. I even gave a talk this year! I did a short demo of the note taking system I use in my notebooks. Despite some technical difficulties (turns out Ubuntu does not like to be plugged into a projector while it’s coming back from sleep mode), I think my talk went well. I was super nervous so I rushed and forgot a couple things but people seemed to like it. I’ll have the video here when it’s up.

The Roundup is a very unique experience. If you’re expecting a regular conference or want to just blend in with a crowd it’s not for you. We don’t do technical stuff all the time (though of course if you want to, it’s up to you) and this year I did much less programming than last year. I spent my afternoons snow-shoeing and shooting a shotgun, watching the movie Vertigo, shopping, watching an impromptu demo of Scala, and lots else. It’s kind of a Geek Summer Camp, but in the blowing snow of Crested Butte, Colorado.

Like I said, I love going to the Roundup and hope to do it every year. I have a bunch of new friends because of it, I learned a lot, made some decisions about my career, and recharged my batteries to better attack the year to come.

The hacker, the architect and the superhero

March 22nd, 2010 | No Comments | Posted in Code

The hacker, the architect and the superhero: three completely different ways to be an excellent programmer « The Reinvigorated Programmer.

Text File parsing with Flatworm and Substring Hacks

February 23rd, 2010 | 1 Comment | Posted in Code

I’m going to start posting more code here, finally. I don’t consider myself a rockstar programmer or anybody to be telling others how to program but when I do something I found interesting, hopefully it’ll also be interesting to others. I’m always looking for better ways of doing things so if you have suggestions, I’m all ears.

Recently I was implementing a new project at work where I had to read and write a bunch of fixed-width files for communicating with a new vendor. My first thought was that I would have to use Java’s String.substring() method to pull out the individual fields. This is ugly because you end up with stuff like

final String FIELD1_START_POS = 10;
final String FIELD1_END_POS = 20;

When you have a few hundred fields, this is exceptionally ugly. Luckily for code and my sanity, I asked how best to do this on StackOverflow and was pointed to the great little library Flatworm. Flatworm allows you to create an XML descriptor for the file you need to parse, then it reads it into a plain Java bean for you. It also takes care of parsing the data if needed, casting into the correct type, stripping unwanted characters, etc. Very, very useful indeed.

Aside: Of course you could also use regular expressions to pull out the data but I don’t see where that would give any advantage. You still have to encode what the field looks like, where it starts, something of that nature. It just feels even more brittle to me. There’s also the more complete route of using lexers, parsers, etc. I don’t know enough about that process to see how that would be benefit me in this particular case. Maybe it would, I don’t know for sure. But from what I do know, it seems like overkill and not a big benefit.

Fast forward to now, I have another project where I need to read and write text files. “Ah ha!” I say. “I’ll use Flatworm again.” “Nope,” says the universe. Unfortunately the file I need to read runs into a limitation of Flatworm. The file has lines where the data starts on column 10, but then it’s a name that could be any length. Instead of padding out the line to the end of the file, the line ends after the name. Flatworm has no way of handling this. I considered hacking Flatworm to handle this condition (and I still might do this as I think it’s useful) but I wanted to try something else first. What I ended up with was better than my first example I think but not quite as cool as Flatworm.

Here’s a mockup of the file I’m working with for reference (. is a blank space)

.....12345......................................02/01/2010.....$123.45.....
.....One hundred twenty-three and forty-five cents
..........Matt Grommes
..........98765..........1 Test St..............123.45

Here’s the first version of the parser code I had

check.setCheckDate( new Date(checkLines[0].substring(91, checkLines[0].indexOf("$"))) );
check.setCheckTotal( checkLines[0].substring( checkLines[0].indexOf("$")+1, checkLines[0].length()) );
check.setAmountWords( checkLines[1].substring(10, checkLines[1].length()) );
check.setPayee( checkLines[3].substring( 10, checkLines[3].length()) );

This isn’t optimal because there is a ton of duplicated code, plus there are problems with the same lines that tripped up Flatworm. I ended up making a new function called getLineValue()

    private static String getLineValue(String line, int beginIndex, int endIndex) {
 
        String value = "";
 
        // endIndex 0 is just a shortcut to EndOfLine
        if(endIndex == 0)
            endIndex = line.length();
 
        if(line.length() != 0 && line.length() >= endIndex)
            value = line.substring(beginIndex, endIndex).trim();
 
        return value;
    }

This is of course just a wrapper around String.substring() but it lets me do some extra checks and have extra logic like using 0 for endIndex to indicate “go to end of line”.

Here’s the modified version, using the new function.

check.setCheckDate( new Date(getLineValue(checkLines[0], 91, checkLines[0].indexOf("$"))) );
check.setCheckTotal( getLineValue(checkLines[0], checkLines[0].indexOf("$")+1, 0) );
check.setAmountWords( getLineValue(checkLines[1], 10, 0) );
check.setPayee( getLineValue(checkLines[3], 10, 0) );

This is a lot better to my eye, not as much extra code cluttering things up. It’s a lot clearer what I’m doing since you don’t have to pay attention to a bunch of substring() and length() calls. This is only about 1/5 of the total lines of parsing code so hopefully you can see how much better this looks over the course of the whole method. See the Aside above for thoughts on some other ways of doing this.

This wasn’t a big project and there may be better ways of going about it but I was pretty happy how this ended up. I like seeing less code so when there are ways of cutting extra things out, it’s a win.

Thanks to the couple of redditors that made comments about this post. I’m always looking to get better at this so constructive criticism is welcome.

Unrealized projects

January 20th, 2010 | No Comments | Posted in Work

Every year, [Tim Burton] spent an enormous amount of time on failed projects.

A few: Catwoman, Conversations With Vincent, Dinosaurs Attack!, The Fall of the House of Usher, Geek Love, Go Baby Go, Hawkline Monster, Lost in Oz, Mai the Psychic Girl, Mary Reilly, Superman Lives, X: The Man With X-Ray Eyes.

One key element of a successful artist: ship. Get it out the door. Make things happen.

Seth’s Blog: Unrealized projects.

I love that Tim Burton is even willing to put this kind of info in his career retrospective instead of focusing on just his successes.

Mobius Sliced Linked Bagel

December 7th, 2009 | No Comments | Posted in Geekery

Mobius Bagel

Mathematically Correct Breakfast — Mobius Sliced Linked Bagel.

This isn’t exactly programming related but it’s very geeky. Next time we have bagels at work the keyword will be: Awesome.

A New Theory of Awesomeness and Miracles

December 4th, 2009 | No Comments | Posted in Geekery

A New Theory of Awesomeness and Miracles, by James Bridle, concerning Charles Babbage, Heath Robinson, MENACE and MAGE.

Frequently Forgotten Fundamental Facts about Software Engineering

December 3rd, 2009 | 2 Comments | Posted in Code

Here are the most frequently forgotten fundamental facts about software engineering. Some are of vital importance—we forget them at considerable risk.

via Frequently Forgotten Fundamental Facts about Software Engineering.

Very interesting list of easily forgotten ideas. I hesitate to outright call them “facts” since there’s so little real research in programming (and even the author says they might be figments of his imagination. One of the most annoying things about the computer field is how much we reinvent things and forget old lessons so lists like this and discussions on the topics are always valuable if they keep things from being forgotten.

Random Football Picks in Groovy

September 25th, 2009 | 1 Comment | Posted in Code

My friend runs an informal football picks contest every week and I thought of a way to participate in a very geeky way, a program that would make my picks for me. I decided it would be funny to write a program that would randomly make my picks for me since everybody else spends an inordinate amount of time thinking over their picks. Plus, I don’t pay attention to football so my picks would have been essentially random in any case.

The contest is simple; pick who you think is going to win in all the games. The person with the most correct picks wins. You also guess how many points the next Monday Night Football game is going to have in total so if there’s a tie, whoever is closest to that number wins.

Here’s the code for my program:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def matchups = [1 : ['Atlanta','Carolina'],          2 : ['Detroit','Minnesota'],
 3 : ['Green Bay','Cincinnati'],      4 : ['Jacksonville','Arizona'],
 5 : ['Kansas City','Oakland'],       6 : ['New York(NYJ)','New England'],
 7 : ['Philadelphia','New Orleans'],  8 : ['Tennessee','Houston'],
 9 : ['Washington','St. Louis'],     10 : ['Buffalo','Tampa Bay'],
 11 : ['San Francisco','Seattle'],   12 : ['Chicago','Pittsburgh'],
 13 : ['Denver','Cleveland'],        14 : ['San Diego','Baltimore'],
 15 : ['Dallas','New York(NYG)'],    16 : ['Miami','Indianapolis']]
 
def rand = new Random(System.currentTimeMillis() + Runtime.runtime.freeMemory())
matchups.each() { key, value -> println("${value[rand.nextInt(2)]}") }
 
def score1 = rand.nextInt(5) * 7;
def score2 = rand.nextInt(5) * 3;
println("${score1} + ${score2} = ${score1 + score2}")

I’m a Groovy newbie, one of the reasons I wanted to use the language for this little thing, so I don’t know if this is the best way of doing this but this turned out to be pretty quick and easy. The hash/array data structure I used for the matchups variable makes it very easy to pick the various winners with the one-liner on 11. I went with a recommendation I found for super-extra randomness on 10 just make sure.

In the end, my random picks weren’t all that accurate. I think I had 5 right out of 16. There’s randomness for you, so unreliable. :) I also learned that when a random number generator makes your picks, you can’t take the blame for making bad picks but you also can’t take credit for the ones you got right.

Feel free to steal this code if you want to make your own picks. You have to put in all the matchups for the week but I tried to format the code so I could make the list in UltraEdit using its column-editing mode and just drop the teams in. If you have a more Groovy-ish way I could have done the matchups I’d love to hear it in the comments.

I do like my profession, I don’t like my job

September 14th, 2009 | No Comments | Posted in Business, Code, Work

To only a fraction of the human race does God give the privilege of earning one’s bread doing what one would have gladly pursued free, for passion. I am very thankful.

The Mythical Man Month, p. 291

via CLOSED-LOOP: The passionate developer: I do like my profession, I don’t like my job.

This is great stuff. I’ve always felt the way Fred Brooks talks about in that quote and this post captures a lot of how I feel about my job as well. Well worth reading.