Thursday, August 16, 2007

Ruby vs. Java: Request for an adult version!

Question: Whats the average age of a ruby programmer?

It would be much more interesting, if both of them would be over 18 and one of them would be a girl… so they could actualy record the “Conception of JRuby” … but you would have to pay for that kind of content!

Tuesday, August 14, 2007

Know Your Language: Try-Catch-Fun in C#

I am currently going through several interview-processes. During the last technical interview I realized, that my knowledge of my favorite programming languages is not as profound as I would like it to be. I always dismissed this shortcoming with the excuse, that such "low-level stuff" was not my primary concern. But now I remembered a quote from my German teacher:

Those without sophisticated vocabulary will stay unredeemed!

- Markus Lüdin

Thinking about the truth of this, I set out to learn to express myself: My first stop was the try-catch-playground in C#-world.

In the sandbox a toddler had built the following:

try{
  return true;
}
finally{
  return false;
}
image

I stopped and began to stare ... schizophrenia started to fill my head ... but fortunately my buddy, the C#-Compiler, stepped in and rebuked the toddler: This was not allowed!

But the toddler was not so easily intimidated: He dug and sculpted with his little hands, and as I stayed and watched, schizophrenia slowly crept back into my head:

try
{
  throw new ArgumentException("First Ex!");
}
finally
{
  throw new ApplicationException("Second Ex!");
}
image A inexplicable urge came over me, and I started to build fervently my own constructs in the sand around those of the toddler:
[Test]
public void First_Exception_Is_Lost()
{
  SchizophreniaTrap trap = new SchizophreniaTrap();
  try{
      trap.TryFinallyException();
  }
  catch(ArgumentException ex){
      Debug.WriteLine("Caught First Ex");
      Assert.Fail("Ha! Things dont just disappear!");
  }
  catch(ApplicationException ex){
      Debug.WriteLine("Caught Second");
  }
}
image Oh no! The test passed! I started to scream! The first exception was lost! It had to be there somewhere in the sand! I started digging...

Saturday, August 11, 2007

Insights from reading the bible

The Mythical Man Month is the Bible of Software Engineering, everybody reads it but nobody does anything about it!

- Frederick P. Brooks

image

 

A project becomes a year late one day at a time.


Plan to throw one away.

Software is like waffles: Throw away the first.

image
image
Extrapolation of times for the hundred-yard dash shows that a man can run a mile in under three minutes.


Add little to little and there will be a big pile.
image
image
There is nothing in this world constant but inconstancy.

The only constancy is change itself.

Wednesday, August 8, 2007

Workshop: Object Relational Mapping

image I am going to give a workshop about Object Relational Mapping at the Workshop-Days of the Swiss Open Systems User Group.

The workshop will take place at the ETH Zurich, on the morning of September 12.

This is going to be a basic workshop that aims do give an overview and an introduction to the topic of object relational mapping.

I am going to talk a lot about patterns and techniques. I am going to illustrate this theoretical background with concrete examples realized in Java Hibernate and Ruby Active Record, since those are two very popular, yet different ORM-implementations.

The following workshop in the afternoon is going to be all about Hibernate. The lecturer will be Christian Bauer himself (one of the two Hibernate-Gods and author of Java Persistence with Hibernate). I am a bit nervous about that... I mean to set the stage for a god is quite a responsibility ;-)

image As a lecturer I will be allowed to attend other workshops for free. Of course this chance for knowledge-sucking comes close to my notion of paradise!

I plan to attend Rund um den Software-Architekten, Hibernate (awe and worship) and Introduction to JBoss Seam (some more awe and worship).

But there is still a lot of work to do until then...

Monday, August 6, 2007

Join Tables and Domain Models: The LINQ-Way

I blogged about Join Tables and Domain Models before, where I showed different ways to deal with 'association-entities' in Ruby and C# 2.0.

Now in C# 3.0, LINQ offers another interesting way to express a domain model.

Assume the following object model:

ClassDiagram1

Article has associated Users through the 'association-entities' Readings. Now LINQ allows us to express this association in another elegant way:

private readonly List<Reading> readings = new List<Reading>();
public IEnumerable<User> Readers {
   get {
       return from reading in readings
                  select reading.User;
       }
}

When I think about LINQ its mostly in the context of querying data, which is usually a common task in the data access layer. There LINQ allows us to specify what part of a domain model should be loaded.
But the above example shows us, that LINQ can be used in other scenarios, even in expressing our domain model itself.

Sunday, August 5, 2007

Resharper: to the next level!

image Hello, my name is Jonas and I am an addict! I am hooked for several years now. I have not written a single line of code without being on Resharper!
If I am put in front of a clean Visual Studio, I am getting nervous: My hands begin to shake, sweat appears on my forehead and I feel the distinct urge to download at least a trial version of Resharper...
I admit it: I am an addict!
image
When Visual Studio 2005 came out, I had a very hard time: JetBrains took a long time until they released a version of Resharper for Visual Studio 2005.
Remembering those times I was getting anxious again lately, because Visual Studio 2008 is on our doorsteps...
But I was pleased that this time JetBrains seems to take pity on all those junkies like me out there: There is already a pre-release of Resharper for Visual Studio 2008 available through the Early Access Program.
Resharper and Visual Studio 2008 seem to work fine, until you start to use the new features of C# 3.0. The following code-snippets compile and run ... but Resharper seems not to be happy.
image
image
I hope Resharper will learn C# 3.0 soon.
As a side note:  Mark Miller boasts on his blog that Refactor! Pro (the concurrence product for Resharper from DevExpress) already supports C# 3.0 and even offers special refactorings for the new language features. You can watch this in action in this video (hmm... I was somehow reminded of the beauty and the beast).
Related Posts Plugin for WordPress, Blogger...