Are functions objects? If so, is Object Re-orientation THE ANSWER?
Function parameters could be analagous to instance variables. Objects need not always be used of as nouns, as the tradition is. We would need to think a little differently about objects, state and methods. A function might be a specialized form of object. It sounds like I'm stretching object orientation too far. But I think that we're wearing the wrong lens. Objects are not about nouns. Object is the wrong word. I will reorient and then rephrase in a later post.
Categories: functional programming · object oriented programming
This post will not go into how tests are written. There are many excellent guides to test driven development on the net. I might post some links for this later. On to business…
Code won’t compile unless our objects talk to eachother as the compiler expects.
Take the example of the ATM from my last post. The ATM object has two responsibilities: login, getBalance. The compiler can ensure that a user object only invokes getBalance and login. That is called type safety. If we try to invoke some responsibility of the ATM object such as showStatement, which it does not have in the example, the compiler will scream and wail like a spoiled child. You will be forced to remove the offending line of code. What can go wrong now?
(more…)
Categories: Programming · Test Driven Development (TDD) · object oriented programming
Scenario: You go to an ATM machine, swipe in using your atm card, and ask for your bank balance.
(more…)
Categories: Programming · object oriented programming
I thought I’d put down some ideas here now and in the future about this. I’ve been meaning to put this down somewhere for a long time, so why not here.This is for people looking to understand object orientation in a light different from the traditional approach. (more…)
Categories: Programming · object oriented programming