What are codes really meant for?Filed Under: Weekly Tuesday Dose of goodness
Many people out there treat coding as though as it’s the one and only way to get things done. However at the same time, this many people doesn’t really know what coding is all about.
In another article of mine, I did mention that codes are best suited for functionality. So, what exactly are codes meant to do? Read on…
Now, I have to explain a few words regarding functionality. In this context, functionality actually meant a single technical function or component that serve as a utility or algorithm to callers.
It’s not the same as functionality that is tested by testers via a set of use cases. That’s known as business requirement functionality, in short, Use Case.
For example:
strcpy(), std::string and so on
These are all utility functions that can be orchestrated to make bigger things right?
You think the orchestration is done by codes? Yes you’re right in this level. For example, if I need a more specific function such as a String Buffer, I’d definitely need to bind a few codes together to form a functionality that conforms to how a string buffer should behave.
But this isn’t really orchestration. This is just wrapping and being more specific that’s all.
To translate contents business requirements directly onto codes would be a sure disaster. As one work towards the higher levels of programming and development, the good ones will eventually realise that coding all the way isn’t the best solution afterall.
Codes should be left where they perform the best; being technical functionalities.
Business logic should always be orchestrated by another form, such as:
1) Reflection technique
2) Scripting
3) Or using technologies like Services Oriented Architecture
So, when should coding be done?
Coding should be done only when there’s a functionality that doesn’t run efficiently via orchestration. Here’s an example:
I want to create a bank account with $5000 as initial deposit. Account holder is ABC. This account is given 1.5% interest per year.
Orchestration Steps:
1) Create a bank account, name it as ABC. (Create Bank Account)
2) Set account balance of ABC to $5000 (Set Account Balance)
3) Set interest rates to 1.5% (Set Account Interest Rate)
Coding - How to combine 3 statements into 1 single function?
- Orchesration method: (Create Bank Account)
1) In the codes, read parameters for account holder, initial deposit and interest rates
2) In the codes, create an Account object and pass in the respective variables.
3) Next, I’ll set the interest rates accordingly.
In short, coding can be used effectively to a certain extent only. They cannot always be regarded as the one and only solution to all problems in IT.
However, how about scripting languages? Aren’t they the solution to the problem already? The answer is, yes and no. A good scripting language removes the need for one to be knowledgable in programming semantics.
Scripting should never subsitute coding; they should only serve as a macro form of development and should never be overly complex so that non-programmers can also harness the usefulness of scripts.
There’s a balance that a developer has to keep between codes that are overly simple or codes that are extremely complex. This is the same when it goes for script bindings and reflections for methods.
Codes are still but functions that you can call for a certain behavior or result to occur, but other than that, it should not do more than it should otherwise it simply makes it too difficult for one to master the language effectively.
Signing off,
Jeremy
- Permalink
- Admin
- 27 Feb 2009 2:46 PM
- Comments (0)