Oren Eini

CEO of RavenDB

a NoSQL Open Source Document Database

Get in touch with me:

oren@ravendb.net +972 52-548-6969

Posts: 7,546
|
Comments: 51,163
Privacy Policy · Terms
filter by tags archive
time to read 8 min | 1532 words

I am a bit funny when it comes to learning technology, I read about it away from the computer, because otherwise there would be a lot of stuff that I would be doing that would interfer with the process of actually reading a book. Anyway, I am reading Agile Java Development right now, and I got to the point where the author shows how to build a simple page.

The sheer amount of steps required is scaring me. What is more worrying is that the author keeps saying how simple this is compare to other approaches (which I presume Java guys would be familiar with). I keep comparing it to MonoRail + Windsor, and I can't believe that this is so complex.

From an architecture point of view, it is very separated, but from an implementation point of view, it looks messy. Here is the piece of code that caused this post. It is meant to put the current object for the request in the context:

protected Object formBackingObject(HttpServletRequest request)

{

    if (request.getParameter(TID) != null

            && request.getParameter(TID).trim().length() > 0)

        return timesheetManager.getTimesheet(Integer.parseInt(request

                .getParameter(TID)), false);

 

    Timesheet timesheet = new Timesheet();

    Employee employee = (Employee) applicationSecurityManager

            .getEmployee(request);

    timesheet.setEmployeeId(employee.getEmployeeId());

    timesheet.setStatusCode("P");

    timesheet.setPeriodEndingDate(DateUtil.getCurrentPeriodEndingDate());

    return timesheet;

}

I am not a Java guy, and I never did anything beyond an applet in Java, so I may be missing something, but is this considered to be a good form of writing your code?

Issuses that I have with the code:

  • Dealing directly with the request, extracting inputs, going to the database, etc. Those are infrastructure style stuff (and fairly repetitive, I would imagine). I want my controller to deal with business use case.
  • The whole model seems to be based on overriding specific methods calls, while I appriciate the design, to me it seems like it unnecessarily complicating things by moving related functionality to separate methods, when it could be in the same place. (The timesheet object returned from this method is passed to another method down the line, for instance.)

Am I missing something?

(Hm, angering the Java people, angering the P&P people, all I have left now is to anger the Ruby guys and I am set. I shouldn't worry about that, I have a safe place to hide, Cell #6.)

time to read 2 min | 254 words

Ben has a few words to say about Compiled vs Dynamic Laguages and the Code Feedback Loop.

I mostly agree with what he says, I usually open a booish interpreter open so I can try stuff out.

However, there are a few things that I don't agree with:

The compiler is becoming less and less popular these days because it cannot protect your program from logic flaws, It’s becoming much like the spell-check feature of word processors.  They can tell you that you mispelled the word definate definite, but a sentence like this one will pass spell-check just fine:  We will meat at the movie theater.

(Image from clipboard).png

The above image is from Word 2007 ;-)

There are things that are harder to do with dynamic languages, intellisense is one of them, and it is a fairly major one when you deal with a framework that has 1,279 public types with 18,483 public methods in the mscorlib.dll alone. And it is not just method names that I am talking about here, it is the various overloads that makes intellisense a must for me.

That said, take into account that I regulary work in either booish (command line interpreter) or notepad to code.

FUTURE POSTS

  1. Partial writes, IO_Uring and safety - one day from now
  2. Configuration values & Escape hatches - 4 days from now
  3. What happens when a sparse file allocation fails? - 6 days from now
  4. NTFS has an emergency stash of disk space - 8 days from now
  5. Challenge: Giving file system developer ulcer - 11 days from now

And 4 more posts are pending...

There are posts all the way to Feb 17, 2025

RECENT SERIES

  1. Challenge (77):
    20 Jan 2025 - What does this code do?
  2. Answer (13):
    22 Jan 2025 - What does this code do?
  3. Production post-mortem (2):
    17 Jan 2025 - Inspecting ourselves to death
  4. Performance discovery (2):
    10 Jan 2025 - IOPS vs. IOPS
View all series

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats
}