Wednesday, February 27, 2008
No More Advices
I thought having an open mind is the most important thing a professional needs in this business. But the essence is avoiding questions and answers and caring about nothing at all. Even when you are asked for an opinion, you just avoid it. Don't hurt anyone with what your conversation, even if you have a point. You don't have to prove yourself to anyone other that you. And thats the secret behind every major developer's career. Why impose when you could suggest and then let the other person decide ?
Friday, February 22, 2008
MVC for HTML ?
Today I Stumbled Upon a great piece of lecture given by Jason Seifer from the Rails Envy group about Unobtrusive Javascript. The piece of video was a great insight on how to write apps which are purely MVC. Now the question is how does this have MVC ?
The terminologies according to Wikipedia
The comparison with Model/View/Controller is kind of wayward here. I would have it called Media/View/Controller for the better. The Media being the Cascading Style Sheets which hold the Presentation, the View being the HTML which acts as the Content and the Controller being the Javascripts which acts as the Behavior.
People have widely adopted the CSS style of coding ie. having the presentation separated and put into files that could be included in the HTML file. This accounts for better structure and traceability. If I were to change the font, I know the centralized and only place to change it. I won't want to change all the 'style' attributes of the tags in my HTML files. Of course the developer would have to understand how bad IE sucks when he tries to implement all those CSS hacks (necessary hacks) to make the page look the same in IE. But after the ACID test results (which Firefox WILL pass !!), I suppose developers will have a better time in the future.
Now I have not seen the same effort go into creating the Javascript files. Developers still write native Javascript using the attributes (events) and they end up in replicating code and making the HTML page obtrusive and ugly. Having all the code base in simple 'js' files allows the programmer re usability of code which results in what Jason states as 'Unobtrusive Javascript'. I personally have been using the excellent Prototype Javascript library for all my projects (including Workstreamr) and the results have been great.
A typical situation when the Javascript becomes obtrusive is when you add javascripts to events like click. Say we are content with the code being 'obtrusive'. With Firefox (the best browser in the world) it works fine. No memory leaks, nothing. But with IE this has the famous memory leak problem. If we were to have a site which has say one page and all the content being loaded in an Ajaxy way, then we will have problems with this. This code wont Garbage Collect unless you navigate away from the page (or refresh). Why use this primitive technique when prototype provides elegant event handling functionalities ?
What I would rather do is attach an id with the element ( say a span/div) and then use the event attaching functionality provided by Prototype. This may be implemented in a main js file accordingly (as per your requirements) and the call may happen from inside the page called (say an AJAX call ?). Using the OOP structure of Javascript is also a great add on. As a developer I felt so happy when I tried to use those concepts in my Javacript files. So the main Javascript file may have a Class which defines your application and routines inside the Object created will have the methods used in the application ( like a status update on the side of the app ?).
References :
Rails Envy
MVC
Ruby On Rails
This is the movie. I hope Jason won't mind this knowledge sharing !!
The terminologies according to Wikipedia
- Modal - The domain-specific representation of the information on which the application operates
- View - Renders the model into a form suitable for interaction, typically a user interface element.
- Controller - Processes and responds to events, typically user actions, and may invoke changes on the model.
- Content
- Presentation
- Behavior
The comparison with Model/View/Controller is kind of wayward here. I would have it called Media/View/Controller for the better. The Media being the Cascading Style Sheets which hold the Presentation, the View being the HTML which acts as the Content and the Controller being the Javascripts which acts as the Behavior.
People have widely adopted the CSS style of coding ie. having the presentation separated and put into files that could be included in the HTML file. This accounts for better structure and traceability. If I were to change the font, I know the centralized and only place to change it. I won't want to change all the 'style' attributes of the tags in my HTML files. Of course the developer would have to understand how bad IE sucks when he tries to implement all those CSS hacks (necessary hacks) to make the page look the same in IE. But after the ACID test results (which Firefox WILL pass !!), I suppose developers will have a better time in the future.
Now I have not seen the same effort go into creating the Javascript files. Developers still write native Javascript using the attributes (events) and they end up in replicating code and making the HTML page obtrusive and ugly. Having all the code base in simple 'js' files allows the programmer re usability of code which results in what Jason states as 'Unobtrusive Javascript'. I personally have been using the excellent Prototype Javascript library for all my projects (including Workstreamr) and the results have been great.
A typical situation when the Javascript becomes obtrusive is when you add javascripts to events like click. Say we are content with the code being 'obtrusive'. With Firefox (the best browser in the world) it works fine. No memory leaks, nothing. But with IE this has the famous memory leak problem. If we were to have a site which has say one page and all the content being loaded in an Ajaxy way, then we will have problems with this. This code wont Garbage Collect unless you navigate away from the page (or refresh). Why use this primitive technique when prototype provides elegant event handling functionalities ?
What I would rather do is attach an id with the element ( say a span/div) and then use the event attaching functionality provided by Prototype. This may be implemented in a main js file accordingly (as per your requirements) and the call may happen from inside the page called (say an AJAX call ?). Using the OOP structure of Javascript is also a great add on. As a developer I felt so happy when I tried to use those concepts in my Javacript files. So the main Javascript file may have a Class which defines your application and routines inside the Object created will have the methods used in the application ( like a status update on the side of the app ?).
References :
Rails Envy
MVC
Ruby On Rails
This is the movie. I hope Jason won't mind this knowledge sharing !!
Labels:
html,
javascript,
mvc,
programming,
workstreamr
Monday, February 18, 2008
Birthday Bumps
Enjoyable for obvious reasons. I learned today that I know a lot of people who actually know me. The flat mates had a nice time smacking my bottom yesterday night at 12. I even got a call from my great friend Sajith from Chennai. Mom and Dad called early in the morning followed by Sis. Shilpi sent me an greeting in SMS. When I reached the office I got the same 'Happy Birthday' from all my colleagues. The bouquet came shortly after. Its Chetan's birthday today as well and we exchanged wishes. My Orkut was filled with wishes and I personally felt obliged to reply to each one of them personally. I always thought I was kind of a loner but hey even I am being watched or observed rather !
Its depressing when I think about my age. 25. Now thats not old my any means. But its one of those ages when we brood over those sweet twenties ( 20 -24). Feeling young is not right any more. More weight/mass. Grumpier feeling. Stressed out after 5 minutes of play. Thats what happens. And I tend to give in to the fact that I am losing it ..
I am still in my twenties though. Not for long as time flies by.
Thursday, February 14, 2008
A Busy Week
The past week (or rather 2 weeks ) was tedious. Work was at its best not letting any time for the poor worker. Stowe Boyd was here in Delhi, were he talked about his visions and ideas for his new baby 'Workstreamr'. To say the least I was taken aback by his eloquence. He was stern with what he wanted but was open to new ideas as well. His short (or rather long) speeches he gave were absolutely great. Of all the people I have heard speaking, he attracts and keeps his listeners interested.
He talked about the concepts that he wanted, his visions on how the product would look like and the concerns he had. He was one of those people who would sell a dime for a dollar. Persuasive is the word if the above analogy was crap. We had a great time with Ben and Sam when we zig zag -ed through those Noida Highways, without even caring the signal lights. Ben and Sam better get used to those as they are going to be here for some time now!
My role has slightly shifted from a ROR programmer to an HTML programmer (if that could be categorized as programming). Standardizing the actual interface. I have always liked JavaScript but I feel I would have more time off that those other guys now. The problem that I faced, and all those HTML guys would agree to this, is not to make HTML with great style sheets but to make them work with the ever crappy Internet Explorer. I can't figure out why IE has become the most used browser. Its as Dracula says 'You suck more than I do !!'.
He talked about the concepts that he wanted, his visions on how the product would look like and the concerns he had. He was one of those people who would sell a dime for a dollar. Persuasive is the word if the above analogy was crap. We had a great time with Ben and Sam when we zig zag -ed through those Noida Highways, without even caring the signal lights. Ben and Sam better get used to those as they are going to be here for some time now!
My role has slightly shifted from a ROR programmer to an HTML programmer (if that could be categorized as programming). Standardizing the actual interface. I have always liked JavaScript but I feel I would have more time off that those other guys now. The problem that I faced, and all those HTML guys would agree to this, is not to make HTML with great style sheets but to make them work with the ever crappy Internet Explorer. I can't figure out why IE has become the most used browser. Its as Dracula says 'You suck more than I do !!'.
Subscribe to:
Posts (Atom)