posts by tag

java (3)
Feeling good about less lines of code

At the Rails Edge conference, one of the speakers mentioned how, as a young programmer, there was no better feeling than to write a program with an enormous LOC count. It made him proud. And I tend to agree. I remember first learning C/C++ and how good it felt to have a rather large program compile successfully. “The more the better,” I thought. Well, that’s hardly the case. Software development entails writing less and less LOC, intentionally. The creator(s) of Rails have made some logical assumptions that have allowed them to extract a lot of the annoying and incessant work, which provides a more focused development process.

As an example, here’s the controller portion for an edit method using the well-known MVC Java framework, Jakarta Struts:

public ActionForward edit(ActionMapping mapping,
                          ActionForm form,
                          HttpServletRequest request,
                          HttpServletResponse response)
  throws Exception {
  PersonForm personForm = (PersonForm) form;
  if (personForm.getId() != null) {
    PersonManager mgr = (PersonManager) getBean("personManager");
    Person person = mgr.getPerson(personForm.getId());
    personForm = (PersonForm) convert(person);
    updateFormBean(mapping, request, personForm);
  }
  return mapping.findForward("edit");
}

And here’s the cleaner, simpler Rails version:

def edit
  @person = Person.find(params[:id])
end

Rails takes care of the tedious, repetitive, grunt work—much more than I realize am making note of, here. From this example, to cut the Struts method down to one line, a few assumptions had to be made:

  1. Most methods are usually public
  2. Put regularly used objects in scope
  3. No need for a “manager” (which caused two objects to represent person, plus conversion code)
  4. No mapping
  5. It’s a web application, so stuff will fail (remove the explicit throws Exception)

That makes sense to me. While working with Ruby and Rails, I’ve enforced my desire to do more with less. It’s often more of a challenge to write less code to achieve the same results, but it’s much more fun.

Visualizing data

I’m a sucker for charts and graphs. I found something from IBM yesterday that kept me entertained for a few minutes: Many Eyes. It lets you submit data sets, then use their visualizations to see your (or someone else’s) data.

And while I’m at it, another interesting (but almost disturbing) visualization is BreathingEarth. It shows the CO~2 emissions from every country in the world, along with birth and death rates. And the data is in real-time. If I were into data analysis, I think it would be fun to come up with creative ways to present data (assuming I could write Java applets and Flash movies).

It's only a matter of time, now

I recently received word that my long awaited security clearance is in its final stage and will be done in a week or two. Yeah, it’s the same clearance I submitted in November of 2005 (Thanksgiving break). I’ve been full-time in the Fairmont office of IRC while I wait on the clearance. I’m anxious to get this process overwith, but I wonder what it will be like at Lockheed Martin. I know I’ll be working in a UNIX based environment with Java as the core language; but, I don’t know any of the people I’ll be working with, what my office space will look like (cubicle?), if I’ll have outside internet access and so on. I’m sort of nervous. It’s almost as if I’m starting all over again. I guess I am starting all over again. I’ll have a new project, new co-workers, new language and no more web-development. Although, I have to say, the last month or two at work has been rough. I’ve been switched over to a project that I’m not particularly fond of. It’s to the point where I’m almost ready to leave for Lockheed because of this project. It’s just not for me. It’s entirely not IRC’s fault, though – they were kind enough to let me go full-time back in January while I wait on the FBI, which basically means I work on several different projects. I’ve been able to save a lot of money and pay off a couple of those annoying bills that never seem to go away.

I guess there are high points and low points about leaving, but I can sum it up briefly. The reason(s) I want to go is to get a break from the current project I’m on, plus it will be a really good experience. The reason(s) I don’t want to leave is because of the people I work with. They are the absolute best, and the atmosphere around the office could never be replaced. It’s a great place to work. System.out.println("So, I guess it's time to get out the Java book again. Redundant, lengthy code, here I come!");

2008 by Ryan Heath | Get In Touch

flickr

DesolateInfinityLooking upDazedBlurred