Browsing the blog archives for October, 2011.

Engineering Over/Under

work safe

I’m not sure I’m sure where to go with with this week’s blog battle, Engineering Over/Under. But, a deal is a deal, and I’m still posting more than Moseng! By the way, this post has no answers, just some ravings.

I participated in the Science Olympiad when I was in high school. I did well in two competitions, orienteering and clock building. The other task I had but didn’t do so well in was bridge/tower building. I’m sure my bridge would have been the most efficient, but for safety reasons there was a limit to how much weight they would put on my bridge. The bridge was over engineered. In order to win, you need the most efficient bridge that will fail. If it stands, there were inefficiencies in the system.

There isn’t much to that story that has to do with software. Over engineering is about costing too much for the job at hand.

The truth is what we call over engineering in software is about picking the wrong things to build. It isn’t over engineering to put a ferris wheel on a bridge, it’s just wrong. But to build N-tier web services when all you need it to catch responses from an employee survey? We call that over engineering for some reason. No one complains if you make it too fast. But these additions to our software take more time and money and often make your software worse.

So what do we do about this? Focus on what you really need to build. Try not to get caught up with arbitrary requirements about how this needs to be web-scale or have zero latency. Now, the trick is balance. These are valid concerns that may be important, so you can’t paint yourself in to a corner where you can’t easily address them in the future.

Wait, what? Not make it right the first time? When architecting a real building, it is possible to design a building with rooms and features so specific to a certain layout that you can only use those spaces in specific ways. The obvious examples are bathrooms and kitchens (I’ve been thinking about a remodel for a few years), but auditoriums are also problems. The real treasure in building architecture is making flexible spaces that can be used for many purposes and occasions. Have you ever really looked at a great museum’s architecture? The galleries can usually be reconfigured in very short order to accommodate new collections or events.

In software, we like to try to keep our business logic free of our persistence or display technologies, just like rows of theater seats and a stage make it hard to repurpose a room. Some times the Smart Forms pattern is actually the answer. And sometimes it may be okay to do a little work in the UI thread.

No Comments

Get Better – “Because I’m a Better Person Than You.”

work safe

Once again the gauntlet has been thrown. I have taken up arms and the Sep blog battle has been joined. Because I’m a better person than you.

That is a common refrain around my office, “because I’m a better person that you.” Okay, I’ll fess up. It is actually just me and it’s not that often. It is also all a lie. I’m not better. I am actually a recovering fraud hiding behind my insecurity.

There is an a branch of theology that essentially states nothing you do matters, salvation comes to an elect few through no action of their own. This was practiced by the lay members of the early American churches as, “If you got away with it then God loves you. If your crop die or you lose your job you are evil.” This is less innocuously practiced today with phrases like, “I can’t draw. I’m not talented.” Or, worse, “I don’t care, I live a charmed life and can do what ever I want.” It is, in my mind, a cop-out. It means free-will is suborned to some other will. It means my choices are pointless and I may as well just sit on the couch and count flowers on the wall.

When this hit me professionally I had just had a contentious run with a project lead and felt exiled when I moved to my next project. I looked around at the situation and made a discovery, several of the people I graduated with had accelerated their career and I had stalled mine. Some of this was an accident of our exposure, but some what about realizing what’s important. I realized that I was focusing in the wrong things. I changed my focus and got back on track. I now know I was the perfect fit for that exile and I learned awesome perspectives there. I would do it again for the first time.

I can’t promise you that you will be the best, but I can promise you that you can be your best and do things you never thought possible. When studying the luminaries of our industry, most of them have worked hard to be able to do the things that have changed our world, but I’m not sure they are that different from us. Anyone can write a database engine. Anyone can write a programming language. Now, making it good requires effort. And achieving awesome means you stop telling yourself you can’t and never will. At a more personal level I know what keeps me from being a better artist. I don’t draw enough.

So the next time someone notices the fruit roll up in your lunch and expresses envy, let them know the only reason you have it and not them is that you did the work of putting it there in the first place. You know, “because I’m a better person than you.”

So, why do I strive to get better? The choices I make matter and I use those choices to make a better relationship, a better home, a better career, have better fun, and build a better me. I get better so that one day I can say, without a trace of irony, “Because I’m a better person than I was yesterday.”

No Comments

I’ve got some change sets in my pocket

work safe

For a while, I’ve been putting some git repos on a thumb drive. It is a practice I have evangelized around the office and it caught some traction, so I figured now is the time to really explore it.

Why? As a developer, I use source control. As a responsible developer, I should use source control even on my crappy little projects and utilities. Since I code both at home and at work, I’d like access to my code in both places. Also, it is damn handy to have a backup.

Why not just use github? At my current level of use, paying for git hosting doesn’t gain me anything. Using github’s free services require that I expose all my code. I like open source, but there is a time and place for NOT opening your source. For example, if you are writing an rpg app that uses material copy written by Wizards of the Coast, it is best to keep that for personal use. It may also be far too early to release because the idea is half baked at best.

Okay, what’s the workflow? How does this work? I pull from the thumb drive, check out what ever branch I want to work on, do stuff, commit locally, and then push to the thumb drive.

Here’s how:

  1. create a git repo in your project’s working directory
    git init . && git add . && git commit -m "initial commit"
  2. create a bare repository on your drive
    f:\ && git init --bare myproj.git
  3. let your local repository know about the thumb drive
    c: && git remote add thumb f:\myproj.git
  4. push to the thumb drive.
    git push thumb master
  5. (optional) install portable git on your thumb drive.
3 Comments

“The Applebee’s of Software Development” – I Actually Know How To Cook

work safe

I can tell when the gauntlet has been thrown down. This is part of the SEP Blog Battle.

Shortly after I started dating Sally, I took her out to dinner for her birthday. I said she could go wherever she wanted. She wanted to go to Applebee’s. Really? Are you sure? I meant where ever, even St. Elmo’s. Okay, Applebee’s it is.

We have eaten at Applebee’s often since, and while it is comfy and familiar, I have a theory that their cooks aren’t actually cooks. Okay, that’s kinda snotty. Their cooks aren’t chefs. They are line cooks that mix frozen and prepared meals until warm and tasty. I kinda see them as a slightly more professional version of me dumping a frozen bag of ‘dinner for two’. It’s the little things like, “we are out of the mozzarella sticks,” or, “we will only have the pecan chicken salad until we run out of what’s in the freezer,” or the fact the food never looks like it does in the picture (the menu has pictures?). This style of cooking lacks creativity. There is no room for interpretation. In a either a small family place, or a high end restauraunt, the chef can alter the menue based on what’s in season. By the way, have you ever noticed that the seasonal veggies are always broccoli and squash in places like Applebee’s?

Now, let’s take a look at fortune 500 IT departments. Some of the fourtune 500 have advanced tech groups doing amazing custom things to change the world. Those aren’t the IT staff I’m talking about. I’m talking about the guy who was asked to write a quick desktop app to let catering know who’s flying today and this week and what they need to have stocked in the galley. that’s the guy who knows how to wire a web service to a data grid and call it a day.

That’s not why I’m here. People come to SEP to make a solution tailored to their needs. You come to SEP because your in-house IT would make your application show up on the programmer version of There, I Fixed It. I may use off the shelf components, but you want me adding a dash here and there because, quite frankly, I know this “kitchen” better than you and THAT is why you came to see us and not your own IT staff for this development project.

I love to cook and bake. Often, it is how I get exactly what I want. I also eat at a lot of chains, fast and casual dining both. But I adore the chance to eat food prepared with care by someone with an opinion. In software, that is why I’m here. For food near Indy, may I recommend the following; Zest, St Elmo’s, la Mie Emilie, Bazbeaux’s, Yats, The Loft at Trader’s Point, Pizzology, and Bub’s.

3 Comments

Short Programs for Short Programmers

work safe

It seems some of my esteemed colleagues decided to have a “Blogging” contest. They have, therefore, pressured me in to posting a couple of blog entries. I hates them so.

I’m a regular at the Indianapolis Code and Coffee. If you’re local, join us at 7:00 am on Thursday! Korff and I started doing some Project Euler problems in Haskell this week. Matt Swanson made a comment about Euler being way focused on math and wanting Project Euler for “practical” things. His idea of practical was, as an example, displaying a list of items on a web page. Hrm… Reminds me of Ruby Koans or Rails for Zombies. I’ll get to that post in a few days.

I’ve done some of the Euler problems and they are really math oriented. The point of these exercises really is to think about math and the relationship of numbers. What a programmer can take from these exercises is focusing on algorithmic implementation and optimization. It is not that we solve it, but that we tweak and re tweak our implementation to be faster or more expressive. It is a great way to learn about a programming language in the small.

Koans are small guided steps. Where Project Euler expects a single number as an answer with out regard to HOW you got the answer, koans are all about the journey. They are usually language specific. They are a series of automated test failures that allow a conversation of learning similar to The Little Schemer. Again, koans are about learning small concepts a little at a time.

Katas are also about the journey. The problems that katas use are actually incidental. It isn’t important that I’m dealing with an incomplete simulation of a bowling game, or pricing some children’s books. It is about the things you do around the problem. Katas are about the red/green/refactor cycle.

All of these have their place and appeal to different people for different reasons. But they deal with software in the small. Like writing short stories, they teach you how to communicate more effectively. These lessons can be taken to larger structures, but they can also teach a kind of tunnel vision. A short story is not a novel and their structures are different. With that caveat out of the way, enjoy yourself. If you’re pressed for time, they can be great bite-sized puzzlers and exercises. They can also teach you to take care with the smallest parts of your code.

5 Comments

Git Saved our Bacon

work safe

My current work project is a mobile app for a medical device company. The software is, depending on the eventual feature set, FDA regulated. This means we will eventually have to undergo a HUGE FDA audit on our codebase. Not a problem if we have out entire history with comments and tags tying commits to work items, right? Well, our source control server died.

Yesterday morning, our gitorious server decided to eat its virtual disk. IT is trying to get it pulled from a recent backup, but it’s a many terabyte off-site backup. But we have work to do. So we fired up a new git instance, pushed master from the dev who had the latest, and we started working again. Once gitorious is stood back up, we will push latest to that and our code reviews in crucible will work like a champ again. Yay!

Here is how we did it:

  1. create a bare git repository on a developer’s machine (mine).
    git init --bare /c/GimmeTehCodez/project.git
  2. Share the directory with windows sharing. I limited access to only my team members, but had to set them all to Read/Write access.
  3. add a new remote for the mirror. Note the four /s in the remote URL. Two are a relative file URL, three are an absolute URL. Four is another computer. In this case it is Wallace who shares my GimmeTehCodez directory for coworkers to upload stuff that can’t be put in email. Kind of a neat hack, huh? No drive mapping needed!
    git remote add mirror 'file:////Wallace/GimmeTehCodez/project.git'
  4. start by pushing the last good master back in to the repo
    git push mirror master

And we’re off and running again! We could get a network share from IT, but that would take too long and distract them from getting my server back.

If we were using TFS and had a server issue like this, how long would we be out? If we’d lost our code history, how much worse would the FDA audit be with all that lost history?

Next step is to start thinking about a ‘hot standby.’. Probably not needed, but it would be cool. Then I can think about using git-tfs to make our tfs projects stand-by as well…

4 Comments

Unsoliceted Code Review – Haskell Chat Server Edition

work safe

Our most recent Sep book club has been The Passionate Programmer. One of the things mentioned was taking some third party code and reviewing it.

This is not a new idea. Many people has said the best way to understand the code you write is to understand the good and bad of code written by other people. In addition, reading code in a language you are learning exposes you to functions you might not understand as well as idioms you don’t understand. We had an idea of meeting occasionally over lunch and tackling some code. Here’s kinda what I’m thinking that would look like. Please comment and let me know if there’s something else I’m missing.

With that in mind, I found an article on the Haskell Wiki where they implement a chat server in Haskell.

I’m only posting the code review for the final version. Technically, the final version and my changes to make it compile. There are more about that in the comments. I added my initials, BJB, to the comments I made and if I had to look up an API, I provided a link to where I learned about it.

This chat server has a couple of interesting features. It uses lightweight threading to handle multiple incoming and outgoing IO. It uses channels to communicate across these threads. The forking calls are also used to create separate “loops of control” for each IO channel being handled.

Below are the comments I’ve added to the program.

Continue Reading »

No Comments