Saturday, December 14, 2013

MVVM vs MVC vs MVP

MVVM vs MVC vs MVP


MVVM vs MVC vs MVP


Similarities


Model – The business objects and many business rules defined as classes


View – The interface the user interacts with


Controller , ViewModel, and Presenter – These all provide methods for separating the view from the model


Difference


Controller (ASP.NET MVC)


One-to-many relationship between the Controller and the views. One controller will be responsible for initiating the display of many different views.

There are numerous variations of how the views should or should not communicate with the models in MVC. With ASP.NET MVC, all requests are intercepted and redirected by a controller.


ViewModel (WPF, knockout js)


One-to-one relationship between the view model and the views

Views interact with the view model by binding (for example, WPF data binding) to the view model’s properties/functions


Presenter (WinForms)


One-to-one relationship between the Presenter and the views

There is no mechanism to bind the views to a view model so instead, each view implements an interface providing the means for the presenter to interact with the view. In addition, each view has a reference to the presenter. This allows views to forward messages to the presenter.


MVVM_MVC_MVP



MVVM vs MVC vs MVP

MVVM Interview Questions and Answers

MVVM


MVVM Interview Questions and Answers


What is MVVM?


The Model View ViewModel (MVVM) is an architectural pattern used in software engineering that originated from Microsoft as a specialization of the presentation model design pattern introduced by Martin Fowler.Largely based on the model–view–controller pattern (MVC),  MVVM is targeted at UI development platforms which support event-driven programming, such as HTML5,Windows Presentation Foundation (WPF), Silverlight and the ZK framework.


What are the elements of MVVM?


Model: as in the classic MVC pattern, the model refers to either (a) a domain model which represents the real state content (an object-oriented approach), or (b) the data access layer that represents that content (a data-centric approach).


View: as in the classic MVC pattern, the view refers to all elements displayed by the GUI such as buttons, labels, and other controls


View model: the view model is a “model of the view” meaning it is an abstraction of the view that also serves in mediating between the view and the model which is the target of the view data bindings.


Why we need MMVM?


MVVM facilitates a clear separation of the development of the UI from the development of the business logic or back end logic known as the model (also known as the data model to distinguish it from the view model). The view model of MVVM is a value converter. MVVM was designed to make use of data binding functions in WPF to better facilitate the separation of view layer development from the rest of the pattern by removing virtually all GUI code (“code-behind”) from the view layer.


What are advantages of MVVM over MVC?


1. Increases the “Blendability” of your views (ability to use Expression Blend to design views) – This enables a separation of responsibilities on teams that are lucky enough to have a designer and a programmer… each can work independent of the other.


2. “Lookless” view logic – Views are agnostic from the code that runs behind them, enabling the same view logic to be reused across multiple views or have a view easily retooled or replaced. Seperates concerns between “behavior” and “style”.


3. No duplicated code to update views – In code-behind you will see a lot of calls to update view controls. With MVVM you can be assured the view is updated appropriately just by setting the underlying property and all view side-effects thereof.


4. Testability – Since your logic is completely agnostic of your view, unit testing is made easy. You can test the behavior of a ViewModel without involving its view. This also enabled test-driven development of view behavior, which is almost impossible using code-behind.


5. Designer-Developer Workflow – MVVM facilitates a separation of UI and presentation logic concerns from the business layer that makes it easy to streamline the development process by allowing design cycles to happen in parallel with development.


What is INotifyPropertyChanged?


The INotifyPropertyChanged interface is used to notify clients, typically binding clients, that a property value has changed.


For example, consider a Stock object with a property called StockCount. To provide generic property-change notification, the Stock type implements the INotifyPropertyChanged interface and raises a PropertyChanged event when StockCount is changed.


For change notification to occur in a binding between a bound client and a data source, your bound type should either:


  • Implement the INotifyPropertyChanged interface (preferred).

  • Provide a change event for each property of the bound type.

What is ICommand?


ICommand defines a command


The ICommand type exposes the following members.
CanExecute

Defines the method that determines whether the command can execute in its current state.
Execute

Defines the method to be called when the command is invoked.
CanExecutehanged

Occurs when changes occur that affect whether or not the command should execute.



MVVM Interview Questions and Answers

Friday, December 13, 2013

India Against Reservation

India Against Reservation - Zappmania


 


India Against Reservation



Personally, I feel that since God has made us equal, we should not encourage reservation of any kind in our systems – jobs / admissions.

Whenever we reserve place for someone on these foolish basis, we are snatching away the rights from deserving candidates.


I think that those people in our society who cannot afford education, may be provided free education as part of various governent policies and programmes but not reservation of seats should be there where students compete through entraces or test processes. Government should provide free BASIC education but not reservation for seats.



India Against Reservation

Joke : A Funny Case Of Kiss And Slap - must read it

husband-wife_Zappmania


A Funny Case Of Kiss And Slap


A HR Manager, His Assistant, An Old Woman And Her Young Daughter Are Traveling In A Train And During The Course Of Time Get Themselves Introduced To Each Other And Become Temporary Friends…


The Train Goes Through A Tunnel And It Gets Completely Dark…


Suddenly There Is A Kissing Sound And Then A Slap !!!

The Train Comes Out Of The Tunnel…


The Women And The Assistant Are Sitting There Looking Perplexed…


The Manager Is Bending Over Holding His Face, Which Is Red From An Apparent Slap.

All Of Them Remain Diplomatic And Nobody Says Anything…


The Old Woman Is Thinking :

These Managers Are All Crazy After Girls. He Must Have Kissed My Daughter In The Tunnel. Very Proper That She Slapped Him…


The Young Girl Is Thinking :

The Manager Must Have Tried To Kiss Me But Kissed My Mother Instead And Got Slapped…


The Manager Is Thinking :

Damn It… My Assistant Must Have Kissed The Young Girl. She Might Have Thought It Was Me And Slapped Me…


Now Guess What The Assistant Is Thinking…


.


.


Now Hold Your Breath And Read What The Assistant Is Thinking…


If This Train Goes Through Another Tunnel I Will Make Another Kissing Sound And Slap My Manager Again…

The Bastard Keeps Harassing Me In The Office…!!



Joke : A Funny Case Of Kiss And Slap - must read it

Joke: Lady first time at Bar

husband-wife_Zappmania


A Lady visited A Bar for the First Time.


She Sat on the Table in Front of the Bar Tender..


 


 


A Guy at Her Left ordered: “Jack Daniels, Single”


 


A Guy at Her Right ordered: “Johnny Walker, Single”


The Bar Tender Looked at the Lady & said: And You..??


.


.


.


.


.


.


.


.


.


Lady replied: “Sonia Dixit , Married…


:);)



Joke: Lady first time at Bar

Thursday, December 12, 2013

Joke: Only when he is drunk

husband and wife jokes : Only when he is drunk


Only when he is drunk


A man who was driving a car with his wife was stopped by a police officer.

The following exchange took place.

The man says, “What’s the problem, officer?”
Officer: “You were going at least 75 in a 55 zone.”
Man: “No sir, I was going 65.”
Wife: “Oh, Harry. You were going 80.” (The man gave his wife a dirty look.)


Officer: “I’m also going to give you a ticket for your broken taillight. ”
Man: “Broken taillight? I didn’t know about a broken taillight!”
Wife: “Oh Harry, you’ve known about that taillight for weeks.” (The man gave his wife another dirty look.)


Officer: “I’m also going to give you a citation for not wearing your seat belt.”
Man: “Oh, I just took it off when you were walking up to the car.”
Wife: “Oh Harry, you never wear your seat belt.”


The man turned to his wife and yelled, “SHUT YOUR MOUTH!”


The officer turned to the woman and asked, “Ma’am, does your husband talk to you this way all the time?”

.

.

.

.

.

.

.

.

.

.

The wife said, “No, only when he’s drunk!”



Joke: Only when he is drunk

Joke : Husband Wife and a loving relationship

husband and wife jokes


Joke : Husband Wife and a loving relationship


There was a group of women gathered at a seminar on how to live in a loving relationship with your husband.


The women were asked, “How many of you love your husbands?”


All the women raised their hands.


Then they were asked, “When was the last time you told your husband you loved him?”


Some women answered today, some yesterday, some didn’t remember. The women were then told to take their cell phones and send the following text to their respective husband: ‘I love you, sweetheart.’


Then the women were told to exchange phones and read the responding text messages.


Here are some of the replies:


1. Eh, mother of my children, are you sick?


2. What now? Did you crash the car again?


3. I don’t understand what you mean?


4. What did you do now? I won’t forgive you this time!!!


5. ?!?


6. Don’t beat about the bush, just tell me how much you need?


7. Am I dreaming? ???????


8. If you don’t tell me who this message is actually for, you will die today…!!!


9. I asked you not to drink anymore!!


and the best one…


10. Who is this?



Joke : Husband Wife and a loving relationship