Feeds:
Posts
Comments

Archive for the ‘Software development’ Category

Second edition of the Microsoft application architecture guide is released: http://blogs.msdn.com/jmeier/archive/2009/11/24/now-available-final-pdf-of-the-microsoft-application-architecture-guide-second-edition.aspx 

 

Overview of some Fortune 500 Web sites shopping carts: http://designreviver.com/articles/case-study-fortune-500-companies-their-shopping-carts/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+DesignReviver+%28Design+Reviver%29

Read Full Post »

ASP.NET Add-in for best practices analyzer : http://www.codeplex.com/Wiki/View.aspx?ProjectName=BPAEngine

Tool to show useful information about an assembly when right clicking on it  (Debug or release, Version, public token, etc.) : http://www.codeplex.com/AssemblyInformation

Patterns and Practices guidance explorer: http://www.codeplex.com/guidanceExplorer

Patterns and Practices SharePoint guidance:http://spg.codeplex.com/

Tool to visualize the project dependencies in a solution: http://www.codeplex.com/dependencyvisualizer

Read Full Post »

Customers Connected Engineering (CCE): It is a way to build software with customers engaged in all phases of the Software development life cycle. its aim is “Software Built with customers, for customers”  http://shapingsoftware.com/2009/05/19/customer-connected-engineering/

Read Full Post »

Source Control Overview book: http://www.ericsink.com/scm/source_control.html

Version control with subversion complete online book: http://svnbook.red-bean.com/

Using Tortoise SVN complete online book: http://tortoisesvn.net/support

Setting up and running Subversion and Tortoise SVN with Visual Studio and .NET: This quick tutorial will show how to start creating a repository and adding Visual studio Solutions and projects to it and then how to work with SVN:  http://www.west-wind.com/presentations/subversion/

Simple settings to add some Tortoise SVN tools as external tools and a toolbar to be used from within Visual studio: http://garrys-brain.blogspot.com/2007/07/tortoisesvn-and-visual-studio.html

An open source Visual studio plug-in for SVN : http://ankhsvn.open.collab.net/

Codeproject article about SVN and Tortoise SVN: http://www.codeproject.com/KB/books/Subversion_TortoiseSVN.aspx

Read Full Post »

This tutorial will very quickly walk through creating a VERY SIMPLE  Entity Model. This is a VERY simple tutorial to simply get a taste of EF.

You will need visual Studio 2008 SP1 or later and SQL Server for the database and we will use the Nrothwind sample database.

ScreenHunter_01 Mar. 19 00.09

Open Visual Studio 2008:

ScreenHunter_02 Mar. 19 00.09

Create a new Project: (Make sure you are selecting Framework version 3.5)

ScreenHunter_03 Mar. 19 00.10

Right Click the Project Name and Select “Add Item”, Select ADO.NET Entity Data Model from the “Data” Category and select a name for it

ScreenHunter_05 Mar. 19 00.11

A Wizard will start, Please select “Generate from Database” (Note: Though theoretically, you can start with the Model and the Later on map it to the a database, The Visual studio tools for EF are best designed in this current release to generate the mode from the database.

ScreenHunter_06 Mar. 19 00.11

The Next form will ask you to create the connection to the database Or choose from an existing connection in the project if one exists:

ScreenHunter_07 Mar. 19 00.11

Create the connection. Note that the wizard automatically creates a key in the web.config or app.config with the connection string inside it (nice feature)

Next you will be asked To select the Tables/Views/Procedures that you want to include in the Entity Data Model and to se a namespace for the Model Classes:

ScreenHunter_09 Mar. 19 00.13

In Our case we will simply Select the “products” and “Categories” Tables from the List of tables available in the Northwind database. (This is just for simplicity).

Based on the choice, the Wizard will generate the Entity data model.

ScreenHunter_10 Mar. 19 00.17

To make the Model more easy to understand and more natural, you can set the name for the Entity (Product as opposed to products like the table name in the database) and the Name of the Entity Set (we can make it Products or ProductSet or whatever)

ScreenHunter_11 Mar. 19 00.28

You can also change the Class properties, For example, you can rename ProductName (as in the column name in the DB) to be “Name” to be more natural to write code like productObj.Name rather than productObj.ProductName for example.

 

Now the model is ready we can start retrieving data.

A very simple code to load all products will look like this:

using (NorthwindDBConn context = new NorthwindDBConn())
{
    foreach (Product prod in context.Products)
    {
        Console.WriteLine(prod.Name);
    }
}

Important Note: Though prod Object has a category property, due to Lazy loading by the EF it will e initialized as null and wont be fetched from the database.

In order to read it from the database and make sure it is initialized, you need to add the line “ prod.CategoryReference.Load(); “ so the code will look like :

 

using (NorthwindDBConn context = new NorthwindDBConn())
{
    foreach (Product prod in context.Products)
    {
        prod.CategoryReference.Load();
        Console.WriteLine(prod.Name);
    }
}

 

That is All you need to retrieve elements from EF. To use more sophisticated queries, EF allows you to use LINQ to build queries.

 

In order to save an Product object for example, all you nee to do is:

using (NorthwindDBConn context = new NorthwindDBConn())
    {
        Product x = new Product();
        x.Name = "New Product";

        context.AddToProducts(x);

        context.SaveChanges();
    }

 

That is all you need to get started with the EF.

For more information you can refer to:

Read Full Post »

Whenever programmers start any project that involve business objects (examples: Customer, Bank, Account, Check, Purchase Order, Invoice, etc.), we start designing each object and deciding what properties each object should have:

Example:

Class Customer

{

public String FirstName;

public String LastName;

}

This means we basically start from scratch, we build these business objects from Integers, Strings, floats, boolean, Dates, etc.

Why are we content with doing this when we know that for any banking application for example, we will always have a customer object that will always have a “Name”, “ID”, “Address”, etc. ? Moreover, within any domain (banking, retail, travel, etc…) There will be always a given set of basic business objects with some given set of properties and methods.

If we take retail applications for example, we will always have classes like Customer (with properties like: Name, ID, Phone, etc.) , Product(with properties like: ID, Description, Price, etc.) , Invoice (with properties like: Date, Total Price, etc.)

For Medical applications, we will always have classes like Patient, Physician, Diagnosis, etc.

For Education applications, we will have classes like: Student, Class, Course, Instructors, etc.

Why then don’t developers just use ready made libraries that can be domain specific. For example:

  • in the health care field we will have a library having classes like: Patient, Provider, Claim, Physician, Hospital, etc.
  • For Banking field we have: Customer, Account, Transaction, etc.
  • For Retail field we have: Customer, Order, Invoice, Product, etc.

This could prove to be a huge time saver and also may help reuse some of the logic, analysis and effort that was already put in that area.

So Next time I need to start a banking application for example, All I need to do is:

  1. Reference the banking.dll in my project (or import the project having the source code)
  2. Subclass the different classes I need to fine tune.
  3. Bingo !

Imagine how much time could be saved that way.

Surely enough not all projects are the same even within the same domain. Object oriented programming have a solution for that: “Inheritance”. Any developer can simply subclass whichever class they want and add / Customize the properties and fine tune it to their needs. At least all the basics will be ready to use, a developer will just add the extra work needed for their own unique project.

I was in a store the other day and found many ready made “paper” invoices, purchase orders, etc. for people to buy and use. Companies find that it makes sense to invest money producing such hard copies and people buy them because such items are more or less the same across the board. How come then that we don’t have the same approach in software where we have a much higher degree of ability of customization and fine tuning?

The same argument applies for Database tables. The difference is that customizing the tables simply means editing the tables structures to fit the exact needs.

Or to take it a step further, maybe these libraries will come along with database scripts and O/R classes or data layer classes or  Stored procedures to slash even more of the time needed to persist the classes in the library.

Programmers  use ready made components all the time. in User interface design, It doesn’t make sense for a programmer to build his own Text box or data grid. We simply use ready-made text boxes and data grids. 

This approach is used to some extent in the data layer as well, we use application blocks that handle database operations rather than than doing all the tedious work.

Why then when it comes to Business objects, everyone is content with starting everything from strings, integers, Dates, etc.?

 

We can start open source project to build such libraries that will benefit everyone. Would anyone join?

 

“If I could see further, It’s because I stood on the shoulders of the giants who preceded me” (Sir Isaac Newton)

Read Full Post »

Visual studio 2008 was released today !

Trial versions found here

http://msdn2.microsoft.com/en-us/vstudio/products/aa700831.aspx

And the free express versions are here

http://www.microsoft.com/express/

Read Full Post »

« Newer Posts