Code that Suits Us

Hello! I had quite a small dilemma this month. As fact I am working on a small CMS that I create by myself. Not being arrogant or self prided, it was just for exercise so that I could keep myself away from games (especially DoTA 2 that had taken so many of my Internet quota). I also wish that it will help people one day. As note, Framework Method here means methods that you can use from the framework that can ease your work. Plain Codes here means methods that the language give, using plain language, or method from existing library that the language use. Wrapped Codes are similar like framework method, but it is not always from the framework.

As you people know, I was working on websites using Sitecore, Orchard, and YAF lately. The first story is when I was working with Orchard CMS. The CMS itself has so many interfaces and classes that implements it. If you have ever read Head First OOAD, you encounter a phrase, “You may extend, but may not modify.” Well it is not really like that, but quite similar. For real, I get in touch with that phrase when I worked with Orchard. Somehow, there is a problem. The moment I wanted to add a field on a specific table, I had to add the reference in many files, and created another method related to the module that handles it. Meanwhile, I thought using simple SQL stored procedure could do the same job.

The second story, when I was on Sitecore, I wanted to add simple cookie to my web. It should be as simple as in MSDN, I am sure. At first, of course, I tried plain codes first. I got stressed somehow because my cookie is exist in the response header, but not injected to the browser. Later on, then I learned that Sitecore have their own method on adding cookie to the website. The method simplify our task in creating cookie, but it is such a pain in the ass because the limitation that it gives. While in the plain codes I mention earlier, I can modify much as I want. I am not saying that Sitecore is little evil because of that. I ever tried to send email using plain code and it works just the same like using Sitecore sending email method.

The third story, this is related to the second story. I created the cookie using jQuery cookie this time. Somehow, there is only one method, but, the parameters give the plugin user more flexibility in creating the cookie. Also from the file, I can extend the method easily (follows the OOAD rule, eh?).

The fourth and the last (finally!) story, when I was using Code Igniter (PHP). They have their own methods, they create it as flexible as possible, and also, when I use the plain methods, what I wish is what I got (with some trial-error of course).

Finally I come to this part, meditation. As I am going to create my small CMS, I come to conclusion, I better let the future developer able to use plain methods, more extensible methods, and provide flexible-as-possible framework methods. Letting the developer using plain codes is somehow letting their more expressive. But also, if I want to create a framework method for my CMS, I better make it as flexible as possible.

Again, I am not trying to judge every single CMS/platform/Framework that I use. I just use it as my daily experience. Everything is great and good, but of course everything has a flaw. Maybe for me I don’t like it, then I consider it as flaw, for others is good. Feel free to comment 😀

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s