Wednesday, August 5, 2009

Can you think of a longer method name?

I was introduced to real programming in the summer of 2000. Ah! WebObjects. I had done about 6 months of VB before that. Now, you know how VB is right? WebObjects (WO) was a refreshing change. True MVC. So well architected.

The problem was WO was my first real programming experience. And I was totally spoilt. Whenever I came across other technologies later, they seemed so badly done and so difficult to use that I never really let go of WO.

I still remember my first web app from the "Getting started with WebObjects" book. There was this simple app. One lesson I clearly learnt from that app was to use descriptive method names. There was a method name called (and bear with me on this):

addObjectToBothSidesOfRelationshipWithKey

Gosh, that was long!

It was a very handy method. For those of you familiar with object relationship modeling, you often have two sided relationships. For example, the class Developer may be related to the class Project. The class Project may also be related to the class Developer. Now, usually, while relating a project and a developer object, in code, you would need to manually set both sides of the relationship. WO (or rather Enterprise Objects Framework, WO's first cousin!) had this method that just did that saving the programming community roughly a million lines of code per year!

Just for kicks, if you come across a longer method name (in any language or framework, not your own program!) please let me know.

6 comments:

kartikthum said...

Didn't come across any method longer than this one so far :)

But the very reason I remember this method still is because of it's long descriptive name! So, I don't mind that at all.

Srini said...

I have come across a method whose name is longer than the one mentioned in the post, i guess every one who has worked on WO might have used it atleast once and that is
removeObjectFromBothSidesOfRelationshipWithKey()

;)

Kamal Shah said...

Excellent Srinivas! You are right!

kartikthum said...

Awesome, that's a good one Srinivas :)!! How in the world did we forget that :p !!

Shravan Mahankali said...

ProjectWonder's ERXFramework has method names longer than these... like:

ERXArrayUtilities -> filteredArrayWithFetchSpecificationNamedEntityNamedBindings
ERXExtensions -> addObjectToBothSidesOfPotentialRelationshipFromObjectWithKeyPath

Kamal Shah said...

Great Shravan! Who else but the god of WebObjects himself could have got that right?!