MVC Design Pattern in Web Applications

Any modern-day website consist of a User Interface(UI), and a business logic that modifies data before sending to UI and modifies it again after receiving request from UI.

There are many issues that come while designing websites with complex functionalities. But one important one is “How to modularized the UI functionality so that individual parts can be easily modified”.

Why should we modularize?
* UI changes more frequently than Business logic and hence it makes sense if we separate both of them. We can make modification to UI without affecting and avoiding retesting of Business logic implementation.

* Same Data can be displayed differently on different Views (or Pages), like same data can deliver different graphs. So it will be good to separate View from the Data.

* User Interface can vary across platform while Business logic can still stay the same. Same website can have different UIs for mobiles and computers.

* Generally developing good UI and writing good complex business logic need separate skills, so its better to keep them apart for experts to handle them separately.

What is the solution?
One of the solution is to use Model-View-Controller (MVC) pattern. This pattern separates presentation, modelling and event handling in three separate classes.

Model : The model manages the behavior and data of the application domain, responds to the request for information about its state (from VIEW) and responds to instructions to change state (from controller).
View : The view manages display of the information.
Controller : Interprets input from the user (Mouse/Keyboard) to change the view or model.
MVC

Basically Model is the class containing business logic, controller contains event handlers and view have the UI.

Certain things to keep in mind :
* Developers must try to avoid making UI totally agnostic. View is designed to display information provided by a specific Model or set of models. So views and controllers can be dependent on model.
* But reverse must be tried. Keep model independent of view and controller. This model can then serve many views.
* Developers tend to bind UI and model together, putting business logic related to model into the UI code, which leads to unmaintainable applications.

One last thing:
Controller is in charge of processing user inputs and coordinating server-side calls until the view is rendered (in asp.net), however you can also apply this pattern to a stateful client UI technology such as Windows Forms or WPF.

spain-won

FIFA 2010 Final Spain v/s Netherlands

spain-won

World Cup final winners

All Spain lovers it’s time for enjoy. Finally Spain did justice to ill-tempered players from Dutch-land. Orange was squeezed by the Spanish bulls. From Dutch side 8 players got yellow card and finally one got red (they play fast but they play bad). Spanish players were replying to Dutch in similar Fashion. Frustration among Spain players were easily visible when Iniesta attacked Dutch player even when the ball was not there. He was lucky to be still playing. Sneijder himself avoided a couple of cards, when referee simply cautioned him. Van Bommel was found bringing down Puyol and Xavi and later he went to Webb when he was leaving the pitch at half time. As if he was asking the number of fouls he can commit before getting a life time sanction.Foul in Football De Jong planted his foot straight into Xabi’s chest and still he managed to avoid a red card. The match was intense and so were players. Everyone was trying to put his best in the game, off-course no one wants to lose after coming this close to world cup. If we leave the dirt from the game(because of card and fouls), the match was a good and competitive. Villa got many chances to shoot but was not looking in mood to hit the nets. Rubben got one chance with only Casillas at the goal. He waited, waited and waited finally to see ball going out of line after hitting keeper’s leg. Sneijder was trying all he can but then it was the day for Iniesta. Iniesta was playing a superb game since the start. The goal was his consolation prize and a goal that made history. Spain won the world cup for the first time in history of FIFA.
This world cup final was no different to last cup’s final where we saw Italy taking over France. They used physical and verbal abuse both and finally Zidane was sent out for head-butting Italian. This game also shows that Europe is more divided than India over linguistics and culture. The racism is more dominating in European culture than any other literate culture across world.

FIFA 2010 Updates.

Am i dreaming? Is it really true? I cannot trust what I saw, finally its official, “FRANCE” is out of this world cup. Though Frank Ribery and Malouda tried to keep french dreams alive, but their partners were in no mood to stay in South Africa for more. It was expected of the french performance.
Mexico, Uruguay, Argentina, South Korea, Brazil, Netherlands are already comfortably in for the next elimination rounds. The series starts from there. It is going to be any one’s day. You play good and you move forward, you loose and you are given return ticket to your homeland.
Stay tuned to FIFA for more fun.

FIFA-Mexico V/S France (Dream comes true)


A packed stadium is an ideal place for Mexican wave. More fascinating if the team playing comes out to be Mexico. The anxiety increases if they play against France. This happened today in Africa where Mexico fought a battle against mighty France. Trust me, they fought well and finally emerged as winners too. French team fell down when Mexican wave over took the ground. Two goals, back to back, on target, and France was trembling.
The game was looking balanced at the start of first half but sooner Mexican’s showed that they are here for a win. They started hitting shots at French goal post in tandem. French defence showed their weakness when Salcido reached close to French goal post with only keeper to defend France. Apart from Ribery and Malouda, no french player was looking in control of ball. Result, Mexico sent the ball directly inside the post. Sooner one penalty shot made it 2-0.
It was a much-needed defeat for the french who came to world cup with no charm, coordination among their players.
A little upset in this tournament and we will be saying good-bye to French team.

Fifa 2010 RSA v/s Uruguay


Whole Africa is celebrating, they can see all their stars in action. It’s a big event for all African nations, specially South Africa (RSA). Local support for home team is enormous. People cheer them up, every time they run towards opponent’s goal. But the poor performance by RSA team was not worth the efforts supporters are making. They were playing like a newbie. The ball looked in no mood to stick to their shoes. They were loosing possession to Uruguay players as soon as they were coming inside their half. Uruguay too was in no mood to take the opponent lightly. Even though Uruguay is no football champion but they managed to kill RSA by 3-0.
Overall, the match was a pain to eyes.

FIFA-Brazil v/s North Korea (Fairest Game I ever watched)

Football season is on. Everybody is walking, talking and living football. Yesterday night Brazil played against North Korea (or Korea DPR). I was cheering for Brazil, off-course yes they have Kaka, and probably one of the best attack. But it was a pleasure to watch Koreans playing football. How often do you see players falling on ground with a slight push from opponent. Almost every minute, and if that team happens to be Portugal (Read Ronaldo here), almost every time they loose ball to opponent.Its disgusting to watch them, fighting for fouls. I have seen one match when Beckham was tired of opponent because they were falling every time he was taking away ball from them. But yesterday Koreans were running after ball like hungry tiger chasing down a deer. They were not falling down with a slight push, instead they were holding their ground even when Brazil was hitting hard on their legs. What a spirit!! They were everywhere on the ground. At a time, Brazil goal was under attack from red Koreans, and Brazil was looking desperate to keep ball in the korean half. Though they ate two goals from Dunga’s army, they are still looking strong and i hope they will give a tough fight to I.Coast and Portugal. Who knows, we may be watching them playing Spain in the quarters. But there must be an award for the fairest team in the tournament and that award must go to Korean. All the best to Korean Team and wish to see similar performance from them.

Whose Life is This?

This is one of the most common question that every person have to face at least once in his life. Who owns the life they are living.

Long time back millions of sperms started their journey to reach the unfertilized egg inside fallopian tubes. Finally after swimming hard and faster than competitors, one was successful in reaching the destination. The fertilized egg stayed in the womb for nine long months and on one fateful day the human child was born. His parents took care of him and fed him while he was still trying to figure out the meaning of word, MOM. His parents sent him to school and taught him ways to live in this world. They taught him how to think rational and solve the problems that he was going to face during coming years. He learned everything calmly without questioning on any aspect of his training. Finally a day arrived when he wanted to live his life on his own. Paused and startled, he is thinking, “Whose life is this?”, “What has he done to get this life?”. Nothing!!, he has not done anything to get this life, so he doesn’t own his life. He has no right on his life. So, who does? The question gets answer from the point where it all started, Origin of his life. Yes, it’s the parents who owns his life. They are the master of his life. They are Originator, Controller, and if they wish to, Destroyer of this life. The person is just a slave to his originator. He is bound to follow his originators.

The life belongs to the person who creates it.