Have you ever heard someone say he knew he was becoming immersed in a new language when he started to dream in the new language? I remember a friend of mine saying this to me when he was learning to speak Hebrew. I had one of these dreams during my time at Microsoft. I was learning C#, but the dream wasn’t really about the language. It was a dream about chaos, security, and the potential of object oriented programming (OOP).
OOP is a programming model that involves grouping together related code into manageable and reusable pieces. Each of these pieces is called an ‘object’ and all objects have to comply with certain rules. It is not – as you may have interpreted from a Douglas Coupland novel – a system for putting together Lego blocks.
For example, a banking program may include some code that stores account information and other code that runs reports on account activity. This system might include an object called 'BankAccount' that encapsulates all of the code necessary to maintain account information. The BankAccount object would have properties such as 'Balance' and it would have routines (or functions) that perform operations such as ‘Withdrawal’ or ‘Deposit.’ Each of these routines would contain the code necessary to alter the client’s information in the Bank’s database. When another portion of the banking software, such as the daily report, needs information about an account, it simply asks the BankAccount object for its properties. The daily report program doesn't need to know anything about what's going on under the hood of the BankAccount object. For example, it doesn't need to know that the account information is actually being stored in a database at the bank's data centre. All the daily report program needs to do is talk to the BankAccount object.
The benefits of this model are plentiful. As you can imagine, that there may be numerous pieces of banking software that require account information. All of these pieces can access the same BankAccount object code when they need the Balance property. Since the code is nicely packaged and reused, it’s much easier to debug the program.
OOP is certainly not a new concept. It has been around for over 30 years; however, there is still plenty of unrealized potential. A great portion of code written today is not object oriented. It is – obviously - possible to write banking software without using OOP. However, since the introduction of OOP, programmers find that it is must easier to unlock the potential of their code. One example of this is web site programming. Until recently, very little web site code was object oriented. However, since technologies such as Microsoft's .Net initiative have brought OOP to the web, things have changed considerably. This is where my dream enters the discussion. What would the world be like if everything around us was using the potential of OOP?
My dream started with me checking into a hotel on a business trip. I arrived late at night and I was exhausted - all I wanted to do was get a glass of water and go to sleep. My hotel suite has a kitchen (I may dream like a geek, but I also dream like a big spender) so I go to the fridge and while I’m getting some water, I use an LCD fridge display to set my wake up call for the next morning. As I leave the kitchen area, I turn off the lights in the suite. What I don't know is that my ex-girlfriend is staying in the adjacent room.
We hadn't dated for ten years, but while we were dating, we gave one another security rights to our OOP enabled worlds. When we broke up, we forgot to go through the motions of a relationship security lockdown (let’s call that RSL :). This has no effect on our lives until ten years later when we happen to be staying in these adjacent hotel rooms.
Right around the time that my head hits the pillow, my ex goes to her fridge and hits the 'All Lights On' button. She has a big meeting the next day and needs to get some late work done. Unfortunately, because she has rights to my lights, so ‘all lights' now includes the lights in my room. While I am trying to fall asleep, the lights suddenly turn on. Confused, I get up and press the ‘All Lights Off’ button. This has the effect of turning off the lights in my ex's room. This goes back and forth for a while until we both curse Microsoft for messing up the lighting and call the front desk.
The truly interesting part of all of this is the cascading effect. Seemingly unrelated events are enmeshed because of technology. How well will we be able to keep up with the complexity? When I woke up, this was the question on my mind, and I couldn’t help but wonder how ‘chaotic’ things could get. Meteorologist Edward Lorenz - the first experimenter in the field of chaos theory - argued that many seemingly random events are linked through relationships so complex that we simply do not have the skill to identify the connections. In my dream, security is the example. The last few years have clearly shown that software security is already extremely difficult. Imagine a future where security permissions exist in everything around you - when object oriented programming is inside every object. Will the future of programming move us towards greater harmony of will it lead to more chaos?
Thursday, March 30, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment