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,565
|
Comments: 51,185
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 1 min | 192 words

Just spiked a test implementation on an Event Broker (similar to the CAB), basically support for loosely coupled events / commands. Took about... 40 minutes :-)

My understanding of the functionality in the CAB is based around:

  • [EventPublication], [EventSubscription]
  • [CommandHandler]

As far as I can see the separation between the two is main artifical, and based on whatever this is your code or a third party. Since both rely on events as the underlying mechanism, I don't see a reason to separate them out.

Biggest issue: string equality is a bummer.

I might do a live coding screen cast, showing how it can be done. Tried it now, but it is 2:28 AM right now, and I sound like a drunk sailor. I got tired of apologizing of slipping to Hebrew, and cut the recording.

That 40 minutes mark is starting to freak me, to tell you the truth...

On RYO vs. NIH

time to read 7 min | 1362 words

Bil Simser has stepped into the complexity debate with this post.

This is actually on the end of Bil's post, but it deserve a special mention:

As Jeremy put it, the P&P guys are a good thing as they're out there getting the Agile word out to many more people that we can.

In that, I haven't done justice to the P&P team. Introducing Agile methodologies and best practices is something that I am very passionate about, and I failed to give them their due credit about their efforts in this direction.

Oren's defense is around the fact that he (and Jeremy) follow the guideline of evolving a framework from your application needs, not building one (like what the P&P guys have done). Okay, that's fair but at some point you have to stop building things over and over again. So when does your own work become a framework that you reuse?

After you have built one application like this, you can extract the relevant parts into a "framework", although I am not sure that I like the term. The main difference being, again, that this is something that is driven by a developer seeking to make life eaiser, not by BDUF.

The end result is often a purpose fit framework that is very easy to work with, and doesn't require years of study.

Sure, you can put together the basic needs of an IoC in half a day (half a day Bil time, 40 minutes Oren time)

Not really, the basics are deceptively simple, but then you are going to hit a lot of issues with dependencies cycles, life time issues, etc.

I would argue that if you took something like StructureMap and evolved it to handle scenarios that you're not dealing with today, that you would be starting to build your own implementation of EntLib.

Not really, I would tend to use best-of-breed stuff that I would have available, it would cut the stuff that I would need to build by 60% at least. But I would not build the EntLib by any means, I may have components that have similar functionality, but in general, it would be a set of services, not a framework. Jeff Brown had a good post about the difference between the two.

EntLib and CAB do include everything and the kitchen sink and you do need to get past the learning curve, but in the end it's a good collection of tools that you can have in your toolbox.

The first part and last parts of the sentence conflict each other, fairly badly. If they are so complex, I would get much better ROI than rolling my own, or (more likely) reusing stuff already built that isn't so complex.

Unfortunately it's not something I could introduce at a conference or User Group session and describe the entire stack in an hour, so I tend to avoid showing off applications and concepts using it as it just turns into a discussion of what [SmartPart] means instead of the main goal like describing MVP which I can do with my own code.

Don't you think that this is an issue when you can't get the basic concepts of a framework in an hour without drowning in the details? Apples to oranges, but I can show a MonoRail application that has nothing but the basics, and talk about that and the concepts underlying that. If the technology is obstructing the end goal (creating maintianable applications), how is it useful?

Perhaps but then if I choose the 3rd party elements I want and wire them together to suit my needs, what kind of Frankenstein have I built in the progress?

Well, considerring that Frankenstein was a very smart doctor, probably a good one. I think you meant something else, and I am getting tired of answerring that statement, frankly. Using several components together is neither cobbling nor frankenseining nor hobbling a solution, it is using the best attributes of each to achieve a cohesive whole. The end result of a highly componentized architecture is... good design.

I don't think Oren or Jeremy are saying the P&P guys did a bad job on in, they just choose to evolve their own solutions using a minimalist approach.

This is were all the trouble start. I am explicitly not saying that the P&P guys did a bad job, I am saying that I don't believe that the direction they are pushing is the right one.

Like I mentioned with NHibernate, I needed to deploy log4net as it needs it, even if I didn't turn on that feature. At least with EntLib, if I'm not using security for example I don't need to deploy the security module.

Bitchy: Feel free to try to deploy P&P's DAAB without Microsoft.Practices.EnterpriseLibrary.Common, when you are successful, then you can complain that NH has a dependecies.

Seriously, NHibernate.dll has dependencies on several assemblies. And it follows separation of assemblies, so if, for instance, you don't need the 2nd level cache, you don't need the MemCached assemblies deployed.

Eventually I could have a really ugly monster on my hands with copies of Castle, StructureMap, CAB, EntLib, NHibernate, log4net, and who knows what else all living (hopefully) together in happy existence. I don't want that.

You get that with everything that you use, if it bothers you, use ILMerge to make this a single DLL, and then forget about it. Disk space is cheap, and it is really not an issue. About the previous point as well, you can merge log4net into NHibernate if you so like, and get rid of the extra dependency.

Could I get the same functionality from the other alteratives? For sure, however I would probably be writing more code to wire things together than I would with CAB.

I seriously doubt it. A good collection of tools would enable you to write clean, intent expressive code. I don't think that you would end up with more code, if anything, the lack of designer generated code would reduce the amount of code that you would have to deal with.

time to read 3 min | 412 words

Patrick Cauldwell has a post about a set of guiding principal, which I mostly agree on, except:

  • Buy, not build
    • Take full advantage of the platform, even if it only solves the 80% case
      • every line of code we don't have to write and maintain saves us time and money
    • Don't write a single line of code you don't have to
    • Take full advantage of .NET 3.0, SQL 2005, Windows 2003 Server, plan for- and test on Longhorn

    There is a couple of things here that is missing, that is business need and evaluating fitness to do the job. I am pretty sure that Patrick didn't mean to sound this way (by the rest of the post, he & I could argue for a few decades on the fine details, but I mostly agree), but this sound like an approach for a tech driven disaster to me.

    I have seen technological solutions crumble under their own wieght, because their fitness to the business problem was never really considered. "It is MyNewThing, of course it can handle this easily, why, it can handle ten times this load." - But you forgot that scalability != perfromance. The end result was a failed project and a poisioned relationship with a customer.

    Perhaps the only thing that I would add to Patrick's statement is: "When it makes sense to the business problem at hand..."

     

    time to read 2 min | 354 words

    Several times recently I had to created what is basically random assoications between two sets of tables. The problem is usually trying to get some data for the UI. Here is what I came up with:

    update Policies

    set Status = (select top 1 Id from

          PolicyStatuses where Policies.Id != PolicyStatuses .Id

          order by newid())

    The only interesting part is the where clause, since it forces SQL Server to evaluate the statement on a row by row basis. This has horrible performance, by the way.

    time to read 1 min | 178 words

    From the Hibernate Blog:

    Well, it is nice for us, but it's not nice for the guy who comes along next! He's one of those shiny-eyed (and slightly scary) Ruby fanatics. Or maybe he's a VB guy (senior citizens matter too). Or maybe its 5000 years from now: Java and Ruby have both vanished (of course, VB is going strong) and a team of archeaologists from Ganymede are trying to piece together something about our forgotten civilization from what's left of your customer database, using the recently released Perl 6.0. Wouldn't it be easier for them if your database just had strings and numbers in it?

    You really have to read the whole thing to get the spirit of the thing. ROTFL.

    Oh, and the message isn't that bad either, I had similar discussion with Ted Neward on the OR/M Smackdown.

    time to read 15 min | 2978 words

    I don't get a lot of chances to work on VB.Net, but when I do, it is almost always because someone has a problem with my code (or their code), and I need to look at it. The problem is that I like the syntax (sort of booish :-) ), but I keep trying to think about it like C#, so I keep getting wierd compiler errors. I am probably the only one who learns the VB syntax from opening reflector and switching to the VB.Net view.

    Anyway, I was asked how you can mock event registration with Rhino Mocks in VB.Net, and here is the answer:

    <TestFixture()> _

    Public Class RhinoMocks_InVB

           <Test()> _

           Public Sub UsingEvents()

                  Dim mocks As New MockRepository()

                  Dim lv As ILoginView = mocks.CreateMock(Of ILoginView)()

     

                  Using mocks.Record

                         AddHandler lv.Load, Nothing

                         LastCall.IgnoreArguments()

                  End Using

     

                  Using mocks.Playback

                         Dim temp As New LoginPresenter(lv)

                  End Using

     

           End Sub

    End Class

    Where the objects we are test are:

    Public Interface ILoginView

           Event Load As EventHandler

    End Interface

     

    Public Class LoginPresenter

           Public Sub New(ByVal view As ILoginView)

                  AddHandler view.Load, AddressOf OnLoad

           End Sub

     

           Public Sub OnLoad(ByVal sender As Object, ByVal e As EventArgs)

     

           End Sub

    End Class

    time to read 4 min | 692 words

    I just responded to a message on the Israeli .NET dev forum, where the poster asked how they can gain experiance when all the jobs require experience. The poster assumed that in order to contribute to an open source project, he would need experience as well.

    Personal fact: My professional (commercial/getting-paid-to-do-this) experience in programming: 1 year, 5 months, 1 week. Talking from a head hunter point of view, I am not even rated for a beginner's job.

    Well, consider this an open invitation for anyone that can pick up an if statement, to contribute to the following open source projects.

    • NHibernate
    • Castle Active Record
    • Castle MonoRail
    • Castle Windsor
    • Rhino Mocks
    • Rhino Commons
    • Rhino Igloo
    • NHibernate Query Analyzer
    • NHibernate Query Generator
    • Linq for NHibernate

    I don't care about grades or time in the industry, I would only care about the contributions that you can make. Get the source, and see if you can make things better. (Just to clarify, this option is opened for experienced developers as well)

    What do you get from it?

    • Warm fuzzy feeling :-)
    • More work
    • The chance to work with some really smart people on really fun projoects
    • Experience that you couldn't get anywhere else.

    How you can help?

    You can talk to the development teams here:

    • NHibernate-dev mailing list: nhibernate-development AT lists.sourceforge.net
    • Castle-dev mailing list: castle-project-devel AT googlegroups.com
    • Rhino Tools-dev mailing list: rhino-tools-dev AT googlegroups.com

    NHibernate source:

    svn co https://svn.sourceforge.net/svnroot/nhibernate/trunk/nhibernate

    Castle source:

    svn co https://svn.castleproject.org/svn/castle/trunk

    Rhino Tools source:

    svn co https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk

     

    FUTURE POSTS

    No future posts left, oh my!

    RECENT SERIES

    1. Production Postmortem (52):
      07 Apr 2025 - The race condition in the interlock
    2. RavenDB (13):
      02 Apr 2025 - .NET Aspire integration
    3. RavenDB 7.1 (6):
      18 Mar 2025 - One IO Ring to rule them all
    4. RavenDB 7.0 Released (4):
      07 Mar 2025 - Moving to NLog
    5. Challenge (77):
      03 Feb 2025 - Giving file system developer ulcer
    View all series

    RECENT COMMENTS

    Syndication

    Main feed Feed Stats
    Comments feed   Comments Feed Stats
    }