This post of mine is kind of continuation my effort in developing of generalized utilities (specifically on grid layouts ).
Well here this time I had moved bit ahead and tried to develop an editable dynamic data grid which would be quite closure to what we get in datasheet view of SharePoint list. SharePoint 2010 is the targeted platform for this one.
For now I’m going to upload images of my latest buddy 🙂 Do have a look at it.
webparts custom properties in modal-dailogue
Today I’m going to discuss some very exciting facts and concepts about OOP’s that I came across during my project works.
So as the title explains I’m trying to list down differences between a class and interface:
- Class: In simple words its a collection of data members and member functions/methods/subroutines on basis of which we can perform operations/ data manipulation just by creating an instance of it. Here needless to say that; all member functions/methods/subroutines are concrete i.e they have signature as well as implementation.
- Abstract Class: Its bit special type of class which provides you to have member functions/methods/subroutines as concrete as well as member functions/methods/subroutines which do not have implementation.
- Need of abstract class comes into picture in case of multiple inheritance as per above specification 🙂
- Interface: As name implies its basic outline of any concrete class. It has got just member functions/methods/subroutines with mere signature and no implementation. That’s why it ease the Multiple Inheritance.
The Pure Object Oriented language’s comes up with the limitation of not supporting multiple inheritence. And in any case if we want to implement this then, interface is the only work around for it (I mean class novel: Ibook, Imagzine).
|Multiple inheritance||A class may inherit several interfaces.||A class may inherit only one abstract class.|
|Default implementation||An interface cannot provide any code, just the signature.||An abstract class can provide complete, default code and/or just the details that have to be overridden.|
|Access Modfiers||An interface cannot have access modifiers for the subs, functions, properties etc everything is assumed as public||An abstract class can contain access modifiers for the subs, functions, properties|
|Core VS Peripheral||Interfaces are used to define the peripheral abilities of a class. In other words both Human and Vehicle can inherit from a IMovable interface.||An abstract class defines the core identity of a class and there it is used for objects of the same type.|
|Homogeneity||If various implementations only share method signatures then it is better to use Interfaces.||If various implementations are of the same kind and use common behaviour or status then abstract class is better to use.|
|Speed||Requires more time to find the actual method in the corresponding classes.||Fast|
|Adding functionality (Versioning)||If we add a new method to an Interface then we have to track down all the implementations of the interface and define implementation for the new method.||If we add a new method to an abstract class then we have the option of providing default implementation and therefore all the existing code might work properly.|
|Fields and Constants||No fields can be defined in interfaces||An abstract class can have fields and constrants defined|
since from many days I was trying to get some good material’s on new frameworks and patterns for software developement and the out come was “NHibernate” below are links could prove informative in these areas:
- http://sourceforge.net/projects/orm-net/files/ORM.NET/V220.127.116.11654/ORM.NET-V18.104.22.168654.msi/download(source code project)
I’m planning to write a article on this but god knows when it happen!!! 😦
Today I will dive bit more in depth of Share Point ocean to dig out vital information and knowledge of OOP’s and application architecture in case of share point. Before starting to explore the share point arena I would like to clear few myths and miss-conception about share point.
- Share Point development is not just about web application development and coding tremendously for building some web application, rather share point is a pre-developed web application(which sets you [developer] free doing tremendous coding for building application) with lot many out-of the box features (this term is many a time miss understood by many developers).
- Since majority of share point development community comes from traditional web application developer back-ground (even though they are .NET developers), so every one is having his own mind set and thinking regarding web application development which share point has nothing to do with.
- Many times developers (including me) tend to curse sharepoint because even though it provides some thing called as out-of the box requires good enough coding (may be xml, client side coding, server coding). The best example is BDC 🙂
So because of above reasons (including those which I haven’t specified) working with share point some times becomes a kind of punishment or an unwanted battle. Tell date I haven’t found any best practice for share point development, customization and configuration (now doubt the days are really changing now). This post is in context with the same in which I’m trying to explain how we can implement Design Patterns and Frameworks in case of share point.
Recently I was asked to develop a share point list view (or in a language of .NET developer a fancy gridview which gives share point look-n-feel) now onwards I will refer it as SPGridView control that comes-up with share point. The task was good enough challenging because it was not just about retaining the sharepoint look-n-feel but it should be 100% re-usable control with easy to configure intention and which can be tied to any data source.
So after little bit of googling and using my past experience with SPGridView I started developing a share point web part by which I can achieve the objective.
Below are the links that will guide for developing the web part using SPGridView object:
- http://blogs.msdn.com/powlo/archive/2007/02/25/displaying-custom-data-through-sharepoint-lists-using-spgridview-and-spmenufield.aspx (this one is my all time favourite)
Majority of the articles stated above bind data to the webpart by creating a object datasource of the sql-server database. This thing proved very helpful for me as my webpart required to be easy for configuration and still rigid. The other requirements were:
- Toolbar Menu Item for creating new item: when user clicks this link he/she must be redirected to the external wizard page.
- Context Menu Item “View”: when user clicks on this tab he/she must be redirected to the external wizard page with some required metadata.
- Context Menu Item “Edit”: when user clicks on this tab he/she must be redirected to the external wizard page with some required metadata.
- Context Menu Item “Delete”: when user clicks on this tab he/she must be able to delete the context item/record successfully. Also while performing this action a warning message should be pop-up and based on reply further action should be performed.
So based on the above specified details I decided to go ahead with web part that picks-up the required details from some configuration file (definitely xml) and based on the details renders the data and generates the menu items. After some good amountof brainstorming and paper work I came up with architecture design and to my surprise this design nothing but perfect implementation of MVC / MVP pattern which clearly separates database, data, metadata Model from the Presentation layer whose mere responsiblity is to render the data and this happens through the Controller who acts as perfect mediator in between Model and Presentation/View.
More details about MVC can be found here: http://msdn.microsoft.com/en-us/library/ms998540.aspx and http://www.c-sharpcorner.com/UploadFile/napanchal/MVCDesign12052005035152AM/MVCDesign.aspx
So the only thing’s I did while developing this webpart :
- View / Presenter
- Wrote a server side code which reads the configuration xml file residing in the virtual directory of the sharepoint site
- Locates the xml file and loades it into server cache so to speed up the action.
- Reads the file using xml document class of .NET
- Creates a Hashtable for object data source details (datasource name, assembly details etc), select method name, delete method name etc.
- Creates a Hashtable for insert, update, view, delete url, query string parameters etc.
- Creates a Hashtable for applying filter and sorting on grid columns
- Creates a IList for getting name column name and their metadata which is required for rendering details.
- Creates context menu controls and toolbar menu controls
- Builds the url and query string
- An xml file which has every minute detail about the underlying model (datasource) so that View / Presentation layer on reading it pulls up proper data and configures it so that listing of data and linking of pages for further data manipulation goes smoothly.
- Details specified under View heading are jolted into this xml.
- This is set of classes that has all methods required for listing data, insert, update, delete data on the database
- This set of classes is encapsulted into a assembly which on strong naming is deployed into the GAC of the server so that it becomes accessible by other process and applications.
Design Pattern Categorization
What do you mean by design pattern?
The concept of design pattern is adopted from the construction-engineering field where the common issues faced during construction are addressed using some structural designs.
Definition: Descriptions of communicating objects and classes that are customized to solve a general design problem in a particular context.
Design pattern identifies key aspects of a common design structure, extracts the metadata and names them.
Each design pattern focuses on a particular object-oriented design problem issue.
Design pattern identifies the participating classes and instances, their roles and collaborations, and distribution of responsibilities.
What are the essential elements of Design Pattern?
There are four essential elements of design patterns as follows:
1. Pattern Name is a handle we can use to describe a design problem, its solutions, and its consequences.
2. Problem it-self describes when and which pattern to be used.
3. Solution, it describes the elements that contribute to design, their relationships, responsibilities, and collaborations.
4. Consequences, the end results/output on implementation of design. Consequences decide the pros and cons of a design.
How design pattern solves design problem?
• Finding appropriate objects
• Determining object granularity
• Specifying object interfaces
• Specifying object implementations
Design Pattern Categorization:
What are Frameworks?
Framework is set of cooperating classes that makes up reusable design for a specific class of software.
Framework can help in building compilers for different programming languages and target machines.
Framework is dedicated for specific kind of application development. Hence, framework dictates the architecture of the application.
The framework captures the design decisions that are common to its application domain.
Frameworks emphasize design reuse over code reuse.
Definition: Framework will define the overall structure, its portioning into classes and objects, the key responsibilities. Framework predefines these design parameters so that the application designer/implementer can concentrate on the specifics of your application.
Difference between Design Pattern and Framework:
1. Design patterns are generic in nature and can be used in any kind of application irrespective of there domain.
Were as Frameworks are specific in nature and addresses issues that are faced in domains.
2. Design pattern are smaller architectural elements than frameworks. Hence, a typical framework contains several design patterns, but reverses of it is not possible.
3. Frameworks can be embodying in code, but only examples of patterns can be embodying in code.
How to select a design pattern?
Consider how design patterns solve design problems.
Scan Intent sections.
Study how patterns interrelate.
Study patterns of like purpose.
Examine a cause of redesign.
Consider what should be variable in your design.
How to use a design pattern?
1. Read the pattern once through for an overview.
2. Go back and study the structure, participants and collaborations sections.
3. Look at the sample code section to see a concrete example of the pattern in code.
4. Choose names for pattern participants that are meaningful in the application context.
5. Define the classes.
6. Define application-specific names for operations in the pattern.
7. Implement the operations to carry out the responsibilities and collaborations in the pattern.
Few days back when I was asked to work on a project which is a complete revamp, redesign of exsiting application. In this project the main challenge (yes, it’s challenge for me because I am really bad, worst at UI designing) was to design the existing UI(user interface) so that it becomes more user friendly and intutive.
So on bit googling and using my some of common sense (limited stock) I came up with few new UI’s which my client liked the most (lucky. Ohh.. god you are great!!!). but the main thing that I got to know was: there are design patterns for UI’s also (I am only aware about .NET, Java etc. based Design Patterns and Frameworks)
So below are the links to the same, hope you people find it helpful.