Ayende @ Rahien

Oren Eini aka Ayende Rahien CEO of Hibernating Rhinos LTD, which develops RavenDB, a NoSQL Open Source Document Database.

Get in touch with me:

oren@ravendb.net

+972 52-548-6969

Posts: 7,339 | Comments: 50,704

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

No future posts left, oh my!

RECENT SERIES

  1. Challenge (69):
    01 Jul 2022 - Find the stack smash bug… – answer
  2. High performance .NET (6):
    27 Jun 2022 - Building a Redis Clone – skipping strings
  3. re (31):
    02 Jun 2022 - BonsaiDb performance update
  4. Production postmortem (37):
    29 Apr 2022 - Deduplicating replication speed
  5. Recording (3):
    11 Apr 2022 - Clean Architecture with RavenDB
View all series

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats