Getting started – Project Structure

I have a standard project structure that I work to on 90% of all MVC.net web applications that I develop and would like to give some insight to what each part of the application

Folder Structure

The image below is the file system folder structure of this project.

  • Build
    Contains the build scripts for the CI server
     
  • Lib
    Contains all of the third party assemblies that will be used in this application.
     
  • Licenses
    Contains all of the third party assembly licences.
     
  • Src
    Contains the source code and project files.
     
  • Tools
    Contains the tools required for building and testing the application such as Nant and Nunit.

 

Visual Studio Solution

The image on the right is of my Visual Studio solution explorer which contains the following projects:

  • Build
    I create a Solution Folder and attach the build script files for easy access to edit within visual studio.
     
  • Core
    Initially when I create a new project, I keep all of my application and domain code in a core project separating the layers by namespaces as I personally do not see the need to overly complicate a project structure until such time as the codebase grows large enough to justify separating out to codebase into individual projects.
     
  • Core.Specifications
    Core.Specifications is referenced by Core.Specifications.Integration and Core.Specifications.State.  Core.Specifications is where I keep all of my test setup/helper classes.
     
  • Core.Specifications.Integration
    When it comes to testing an application, I prefer to separate out my integration and state based tests into separate projects.  It enables me to easily differentiate between the slower integration tests and fast state based tests when setting up my continuous integration server.

    The integration tests are those which actually execute against databases or other live services.
     
  • Core.Specifications.State
    The state based tests are those which are only testing the current “state” of the class under test.  For example when I add a Page to a Section, I want to assert that the page has actually been added to the sections page collection.
     
  • UI
    The UI project is the presentation layer of the application.  Harnessing the MVC framework and the Spark view engine give so much more freedom than the ASP.net Web Forms model.  It also has major benefits over the default MVC.net view engine, such as the formatting of the views – no classic asp spaghetti code in sight!
     

Next post will be on configuring the projects prerequisites - setting up castle/nhibernate/test helper libraries/MVC/Spark etc etc...

The Ninja

p.s the next post will be up when I return from Hong Kong (January)



In this article we will look at the key elements of a CMS, what they do, and decide on what functionality is going to be delivered in the first iteration of the application.
 

Key Elements

At the core of any CMS there are four types of element – Sections, Pages, Content and Media.  The purpose of a CMS is to allow the user to manage and deliver their content in an easy, structured format.
 

Section

Sections are used to categorise pages into logical areas and to provide primary and secondary navigational structures. For example “Events” and “News” could both be classed as sections as they are logical locations for a visitor of the site to access news and event pages.
 

Page

Pages are containers for content; they are the main element of delivery used to layout and display content to the visitor. For example on an “About Us” page, the page element would be used to display some form of text and image based content with information relating to the website and who runs it.
 

Content<T>

Content elements are, in my opinion, containers for information.  These elements are actually what hold the text and image/file references that the user enters into the CMS.
 
A page may have multiple content elements contained within it, allowing a more finely grained customisation of how the delivery mechanism of the CMS works. For example, a page could contain 3 different content elements (text, photo gallery, text) in an order the user can decide.
 

Media

Media elements are things like PDF files, images, audio files, Word documents etc.  They should be stored in a logical way so that they can be accessed and used anywhere within the site via the CMS administration.  For example the company’s logo; the user should only need upload once and be able to use it on any page of the website without having to re-upload.
 

Iteration 1 Functionality

In the first iteration of this application I want to deliver a very basic working CMS that will allow the creation of top level sections with child pages and textual content (including the ability to insert images).
 
This way I should be able to get the core concepts and development decisions that I go through when building an application like this, and also enable me to deliver this how to series in smaller manageable chunks of information, code samples and screen casts.
 
Ninja
 
 

I have been planning on doing an open source CMS application for .net MVC platform for quite some time now, and with all of the recent activity on twitter and blogs its time that I actually get this project up and running.


What is a CMS?

“A content management system (CMS) is a computer application used to create, edit, manage, and publish content in a consistently organized fashion.[1] CMSs are frequently used for storing, controlling, versioning, and publishing industry-specific documentation such as news articles, operators' manuals, technical manuals, sales guides, and marketing brochures. The content managed may include computer files, image media, audio files, video files, electronic documents, and Web content.” - http://en.wikipedia.org/wiki/Content_management_system


Background

I have been using and writing CMS engines for many years now, working with everything from small in-house ASP.net CMS applications to massive “enterprise” CMS solutions such as IXOS Obtree C4.
 
There has not been a single CMS application that I have used where I could truthfully state that it was easily usable and rock solid – they each have flaws and drawbacks whether it’s in the code or in the GUI - I believe this can all change with MVC.net*
 
* I know MVC is not specifically for Microsoft Platform, I am writing from the point of view that developing this, or any, web application on the .net platform can be done in such a nicer and more scalable way than Web Forms.  This is not a debate on MVC.net vs Rails!!
 

Technologies

The key technologies that this application will be harnessing are:
  • MVC.net / MVC Contrib
  • Spark View Engine
  • NHibernate
  • Castle Windsor
  • Binsor
  • Boo
  • Rhino Tools
 

End Goal

My intention with this and future blog articles is to give an almost step by step in my thought process behind building a CMS application, code for each part of the application and (time pending) do some screen casts while writing code resulting in a final release of an open source CMS system for the development community to use.
 
Ninja
 

 


About this blog

Dave the Ninja is an Alt.net practitioner from Glasgow in Scotland (UK). He rants about all things from coding to Kung Fu with some swearing thrown in for good measure.

Dave the Ninja has been programming professionally with Microsoft technologies for the past 9 years starting and is now working primarily with C# 3.5, MVC.net and Resharper.

Dave the Ninja has been practicing Chinese internal arts for the past 15 and a half years, mainly Taiji Quan, Neijia Quan , Chi Na and Qigong.

I have joined Anti-IF Campaign

My Communities/Projects

Flickr PhotoStream


Sponsors