This post originated from an RSS feed registered with Agile Buzz
by James Robertson.
Original Post: .NET - pure OO or hybrid?
Feed Title: David Buck - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/buck-rss.xml
Feed Description: Smalltalk can do that
I recently heard someone say that all data in .NET is represented by objects. There are value types and references types, but both are objects. I disagreed with the statement, but it took me a bit of research and thinking to justify my point.
In C#.NET, you can do something like this:
System.Console.WriteLine (5.GetType().Name);
Since GetType is a method in Object, it seems to imply that literal integers (or any value type) can respond to messages. The trick here, however, is that .NET performs automatic boxing. It converts the value type 5 into the Int32 reference type 5 before calling GetType() on it. In my books, automatic conversion (requiring allocation and a copy) from a non-object into an object whenever a message is sent doesn't qualify the language as being a pure object oriented language. What do you think?