St. Louis Day of .NET 2011 – Brief Notes on Objective-C, LINQ, and NHibernate

This is part of a series of posts containing my notes from the sessions I attended at the 2011 St. Louis Day of .NET conference.

This series does not attempt to give complete accounts of the information presented in each session; it is just a way to capture the bullet points, notes, and opinions that I recorded while attending the conference. I have previously posted a list of all of the session materials and sample code that I have been able to find online, so if you are looking for a more precise account of a session, try looking there.

I took only brief notes in sessions focusing on Objective-C, LINQ, and NHibernate, so I’m combining all of them into this post.

First up is Looking at Objective-C Through the Glass of a Typical .NET Developer, presented by Muljadi Budiman.  This session, on a decidedly NON-Microsoft topic, was filled to overflowing… needed a bigger room for this one.  Perhaps my favorite sound-bite of the conference came from this session… “does anyone think this is NOT weird?”.

  • Objective-C is a superset of C, very different from C#
  • Each class made up of two files:  header files (*.h) provide an provide interface, and source files (*m) provide the implementation
  • XCode is the OSX-based Objective-C development environment
  • Classes must be referred to with a pointer syntax.  For example, NSString* instead of NSString, or Person* instead of Person
  • Accessibility operators (@private, @public, @protected) are valid only for variables, not classes, methods, or properties.  Because of this, *any* method or property can be overridden.
  • In Objective-C, you must allocate (alloc) and initialize (init) objects.  Use "new" to alloc, init, and call constructor.  In addition, objects should be "release" when you are done with them.  If not, the objects stay in memory.
  • "Protocols" behave something like interfaces in C#
  • There are no static classes.

Next is Deliver Cleaner Code with LINQ to Objects.  Not the best choice of sessions on my part.  The material presented was fine, but it didn’t teach me much I didn’t already know.

  • Don’t use "var" just because you can.  Use it when you truly don’t know the return type until run-time.
  • When using LINQ, you can use either extension methods or LINQ queries.  Queries are typically easier for developers with database experience, but some functionality is only available via extension methods.
  • Extension methods utilize lambda expressions.
  • The compiler turns the LINQ query syntax into extension methods.
  • LINQ Extension Method Example
    var list = contacts.Where(x => x.State == "TX").Select (c => c.BirthDate);

LINQ Query Syntax Example
var list = from c in contacts where c.State == ‘TX" select c;

The last couple notes are from Lee Brandt’s session on NHibernate, titled NHibernate, Fluent NHibernate, and the Repository Pattern.  The demos given in this session mostly focused on (relatively) complex completed code.  There was no from-the-start “Hello World” example given.  So while I was able to get a general sense of what it takes to work with NHibernate, I was left with a lot of unanswered questions.

  • It looks like extensive up-front work is needed to wire up the database (create mappings, etc)
  • Unanswered question:  Is there no way to auto-generate the initial class-to-database mappings?
  • These links may be useful for future research into NHibernate:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: