As discussed before, a multi part posts will be published during the next weeks concerning how to develop enterprise web application with Microsoft Asp.Net MVC framework.
This first part will contains the project itself, the class diagram and the setup of the solution. The project will be iterative and incremental. We will establish the domain in this post, but we will enhance it during other parts. The reason we will do this is because in real life, the model change. We will start slowly and add stuff during the next week to finally have something done.
First of all, let define the project that we will create. Since I workout at the gym since a long time, I thought that we could build a gym workout planner. When people go to the gym, they have a plan of exercises for every group of exercise. Usually, trainer split every body part on multiple session during the week. So, in 1 week, you can go 4 times to the gym and train with 4 different workout. This is what we call a workout with 4 different session of exercise. Each session contains different exercises. Every exercise contains a name, a number of set and repetitions. It can also contain tempo which are at what time the exercise movement is done. While a set is the number of time you are doing the exercise, the repetition is the number of movement done every set of time. For example, you can have the exercise called “Leg Press” which are done 5 times (5 sets) of 10 repetitions (10 reps).
The Model in UML Class Diagram
If we try to translate this application into a static UML diagram, like the UML Class diagram we have something like below.
As we can see, we will have user that will be identified by the system which could have zero or many workout. Every workout will have at least one session (in the case a user want to do the same workout every training session) or could have multiple session (in case the user split his training in multiple session for example 4 different training per week). Workout session contain multiple exercise which are all associated to a muscle. Every muscle are grouped in group. For example, the bicep muscle and tricep muscle could be in the arm’s group. For the moment, let stay simple and not elaborate further more. Later, we will be able to give advice to user depending of objectives or muscles desired to train.
Creating a new Asp.Net MVC 4 project with Visual Studio 2012
A new project is created with the MVC 4 project type. The next step is to select the MVC4 template to be applied with Razor View Engine.
I have selected the Unit Test project to be created cause as any serious enterprise project, we will unit test most of what we will develop. Not only it will secure us but it will ensure us to develop with interface and good habit.
From there, we are setup to start. We have multiple possibility. We could start by implementing Microsoft Membership straight from the beginning or we can start by doing the system for a single user. If we look at the model diagram, 5 classes on 6 are concerning everything but user account. I suggest that we start doing the application for a single user. By that I mean that will will remove the User class and develop everything for a single user for few times. The advantage will be that we won’t have to configure the Microsoft Membership with Entity Framework from the start and will remove some overhead. Also, if we do not have time to implement this part of the software, we will have something functional rapidly for at least one user.
Article #1: Asp.Net MVC Enterprise Quality Web Application
Article #2: Asp.Net MVC Enterprise Quality Web Application Model
Article #3: Asp.Net MVC Enterprise Quality Web Application Controller
Article #4: Asp.Net MVC Enterprise Quality Web Repository Layer
Article #5: Asp.Net MVC Enterprise Quality Web with Entity Framework
Article #6: Asp.Net MVC Enterprise Quality Layers
Article #7: Asp.Net MVC Enterprise Quality Web Security