Monday, 6 May 2013

object oriented vs object based programming language



Object Base Language Not Support Inheritance & Polimorphisum.

Object-Based Programming usually refers to objects without inheritance and without polymorphism, These languages support abstract data types and not classes,which provide inheritance and polymorphism.

however,support both inheritance and polymorphism and they are object-oriented.

Candidate Key Vs Primary Key Vs Alternate key Vs Composite Key Vs Unique Key VsForeign Key


Candidate Key

A Candidate Key is a set of one or more fields/columns that can identify a record uniquely in a table. There can be multiple Candidate Keys in one table. Each Candidate Key can work as Primary Key.
Example: In Student Table RollNo and EnrollNo are Candidate Keys since  these fields can be work as Primary Key.

Primary Key

Primary key is a set of one or more fields/columns of a table that uniquely identify a record in database table. It can not accept null, duplicate values. Only one Candidate Key can be Primary Key.

Alternate key
A Alternate key is a key that can be work as a primary key. Basically it is a candidate key that currently is not primary key.Example: In  RollNo and EnrollNo, RollNo becomes Alternate Keys when we define EnrollNo as Primary Key.

Composite/Compound Key

Composite Key is a combination of more than one fields/columns of a table. It can be a Candidate key, Primary key.

Unique Key

Uniquekey is a set of one or more fields/columns of a table that uniquely identify a record in database table. It is like Primary key but it can accept only one null value and it can not have duplicate values.

Foreign Key

Foreign Key is a field in table that is Primary key in another table. It can accept multiple null, duplicate values. Example : We can have a Emp_Id column in the Employee table which is pointing to Emp_Id column in a department table where it a foreign key.

Sunday, 28 April 2013

Interview questions of MVC (Part-1)


Q:What are the 3 main components of an ASP.NET MVC application?
A1. M - Model
 2. V - View
 3. C - Controller

Q:In which assembly is the MVC framework defined?
A:System.Web.Mvc

Q:Is it possible to combine ASP.NET webforms and ASP.MVC and develop a single
    web application?
A:Yes, it is possible to combine ASP.NET webforms and ASP.MVC and develop a single
     web application.

Q:What does Model, View and Controller represent in an MVC application?
A:Model: Model represents the application data domain. In short the applications business logic is
    contained with in the model.

  View: Views represent the user interface, with which the end users interact. In short the all the user
    interface logic is contained with in the UI.

 Controller: Controller is the component that responds to user actions. Based on the user actions,
  the respective controller, work with the model, and selects a view to render that displays the user
  interface. The user input logic is contained with in the controller.

Q:What is the greatest advantage of using asp.net mvc over asp.net webforms?
A:It is difficult to unit test UI with webforms, where views in mvc can be very easily unit tested.

Q:Which approach provides better support for test driven development - ASP.NET MVC or
    ASP.NET Webforms?
A:ASP.NET MVC

Q:What are the advantages of ASP.NET MVC?
A:1. Extensive support for TDD. With asp.net MVC, views can also be very easily unit tested.
   2. Complex applications can be easily managed
   3. Seperation of concerns. Different aspects of the application can be divided into Model, View
       and Controller.
  4. ASP.NET MVC views are light weight, as they donot use viewstate.

Q:Is it possible to unit test an MVC application without running the controllers in an ASP.NET
     process?
A:Yes, all the features in an asp.net MVC application are interface based and hence mocking is
     much easier.So, we don't have to run the controllers in an ASP.NET process for unit testing.

Q:Is it possible to share a view across multiple controllers?
A:Yes, put the view into the shared folder. This will automatically make the view available across
    multiple controllers.

Q:What is the role of a controller in an MVC application?
A:The controller responds to user interactions, with the application, by selecting the action method
    to execute and alse selecting the view to render.

Q:Where are the routing rules defined in an asp.net MVC application?
A:In Application_Start event in Global.asax

Monday, 22 April 2013

ViewModel in MVC


ViewModel is a complex object that may contain multiple entities or objects from different data models or data source.

ViewModel contain fields that are represented in the view (for LabelFor,EditorFor,DisplayFor helpers)
ViewModel can have specific validation rules using data annotations or IDataErrorInfo.
ViewModel can have multiple entities or objects from different data models or data source.

In ViewModel put only those fields/data that you want to display on the view/page.
Since view reperesents the properties of the ViewModel, hence it is easy for rendering and maintenance.
Use a mapper when ViewModel become more complex.

HTTP Handler Vs HTTP Module


HTTP Handler :
HTTP handlers are the .NET components that implement the System.Web.IHttpHandler interface. Any class that implements the IHttpHandler interface can act as a target for the incoming HTTP requests. HTTP handlers are somewhat similar to ISAPI extensions. One difference between HTTP handlers and ISAPI extensions is that HTTP handlers can be called directly by using their file name in the URL.

HttpHandler is a extension based processor.


HTTP Module :
Http modules are called before and after the http handler executes. Http modules enable developers to participate in, or modify each individual request. Http modules implement the IHttpModule interface, which is located in the System.Web namespace.

HttpModule is event based processor.

Tuesday, 9 April 2013

Bind vs Eval (Data Binder)


The data values can be retrieved with the Eval method – they cannot be modified or deleted.

The Bind method on the other hand allows for the data-bound controls to be modified in addition to retrieval, and hence is preferred over Eval method.
Real Time Analytics