Blogtrek

Blogtrek

2003/12/02

OO Programming Language Developers need to learn English

One of the principles of English is that proper nouns and adjectives are capitalized. For example, "car" is not capitalized for it is a common noun. It describes a car in general. However, "Toyota #137245" is capitalized because this is a specific instance of a car. It is a proper noun. The word "person" is not capitalized because it is a general word for any person. The words "George Walker Bush" are capitalized because they describe a specific person.

Object Oriented programming language developers have come up with a similar concept, namely that of a class. A class is a type of structure that is defined and generic, representing any old thing in the class. An instance of a class is a specific example of the class. An example of a class would be "cat". It would have attributes such as weight, breed, and the pitch of its meow. A specific instance of this class might be Boots. His attributes would then be 15 lb, tuxedo kitty, and high-pitched. I suppose you recognize this as exactly the same concept as that of common noun and proper noun in English.

Well if so, then why do OO programmers do it the other way around? In English we would say:

My cat is named Boots.

But in an OO language such as C# or Java, we would say:

Cat boots = new Cat;

That's just the reverse of how English does it! All of the books I have seen capitalize classes and lowercase instances. Why? Why can't we be consistent and why can't we notice OO programming in our everyday language when it exists? When I program, I am going to write

cat Boots = new cat;

and that will be that.

No comments: