Wednesday 26 December 2012

4. UML


In this post, I am going to explain more about UML and its significants.

As we know most of the techies are don’t use UML much and they don’t know exact usability of the UML. Generally techies are straightaway start writing coding & they spend most of the time related in terms of technologies. So they don’t know where the UML is fit for them until they use to realize.

In short form, UML diagrams gives you in the simplified modelling language which is equal to what you going explain in many numbers of lines on the document or so on.

For example, let’s say you are going to explain to someone (to your stakeholders) about your project and your project is called online banking system. For this, you need to write huge document which contains so much of lines and take so much of time to explain to someone. But simple UML diagram save you everything.

Let’s see how it is? The following UML use case diagram will tell you overall what the system does.

Online Banking System

What is UML?
UML stands for Unified Modelling language. This is not a programming language and it’s a modelling language.

Where UML comes from and what is the history of the UML?
Please visit www.omg.org to know more details about UML including version details and change history.

What are the different types of UML?
In UML 2.x, there are 14 types of UML diagrams and below picture shows all types which from http://en.wikipedia.org/wiki/Unified_Modeling_Language

UML

Next, our question is do we need to use all the types of diagrams for our project?
No. Its depends upon of the project and project domain type. For Information technology (IT) projects we don’t use Timing Diagram but for the manufacturing project, Timing Diagram is essentials.

What are the most commonly used UML diagrams in IT?
  1. Use Case
  2. Sequence
  3. Class
  4. Object
  5. Activity
  6. State Machine
  7. Component
  8. Package
  9. Deployment
What are the UML tools are available on the market?
There are many tools are available on the market.  Please visit http://en.wikipedia.org/wiki/List_of_Unified_Modeling_Language_tools to know more about the all tools.

Which UML tool can we use for our projects?
It’s all depends upon your taste. Recent Microsoft Visual Studio, Enterprise Architect (from Sparx Systems) and Visual Paradigm (from http://www.visual-paradigm.com) are comes with modelling project which is collaboration with source version controls systems such as TFS, SVN…etc. and more integrated with other project development tools. This is very useful for our development. Let’s say for example, some people like to buy things from Woolworths and some people from Coles but the product (say Dairy Milk) is the same.

Any books or online materials are useful for learning UML?
There are many books and information are available on the internet. If you use VS for modelling then I would suggest visiting MSDN site for more information http://msdn.microsoft.com/en-us/library/57b85fsc.aspx and I also suggest the book called UML Distilled: A Brief Guide to the Standard Object Modeling Language (3rd Edition) by Martin Fowler.

Is there any other diagrams which useful for our team?
Yes. There are other few more diagrams namely
  1. Layer
  2. Network
  3. Customize diagram which can be useful for all other purposes.
Up to here, we know little bit about UML and UML tools…etc. I would suggest lets learn first about UML notations so that we know where we can use exactly. I am not going to explain about all the notations however, I do explain the necessary notations which we need it for our modelling. I am explain with the following details for most commonly used UML diagrams
  1. Diagram name
  2. Notations
  3. When to use
  4. Who will be using
  5. Example
Let’s start with Use Case diagram.
Use Case Diagram:
  1. Diagram name: Use Case. Use Case diagram describes what system does and its does shows the overall functionalities of the systems.
  • 2.       Notations:
UseCaseNotations
UseCase

3.       When to use:  Initial phase of the project such as requirements gathering & describes the functionalities of the system.

4.       Who will be using: Technical and non-technical people.

5.       Example:

 6.       Notes:
There are two types of actors in Use Case and they are Primary and Secondary actors.
  1. Primary Actor: Who are the active participants and they are initiate the Use Case
  2. Secondary Actor:   Who are the passively participants.
  3. <Include>>:  One Use Case used by other Use Case similar like one function called by another function.
  4. <Extend>>:  Extending to another Use Case but some situations not necessarily to be extended.

Please visit the below URL’s
http://knowhow.visual-paradigm.com/uml/10-use-case-diagram-tips/ for more details about other notations and how to use them.

Sequence Diagram:
  1. Diagram name: Sequence. Sequence diagram shows the interaction between objects over specific period of the time. For each and every Use Case diagram we can draw the sequence diagram for that.
2.       Notations:
SequenceDiagram
SequenceDiagram1 
3.       When to use:  we can use the sequence diagrams when we want to look at the behaviour of the many objects with in a single Use Case.


4.       Who will be using: Technical and non-technical people.

5.       Example:

SequenceDiagramExample1

6.       Notes

Please note that messages are the important when we use the Sequence diagram and Please visit the below URL’s
for more details about messages and how to use them.

Class Diagram:
1.       Diagram name: Class. Class diagram provides an overview of the classes, objects and relationship between them. We can say class diagrams are prototype model of the target systems. Each and every Class diagram contains 3 compartments namely Class name, Attributes, Methods. 
  • + -- used to define public properties/methods
  • # -- used to define protected properties/methods
  • -   -- used to define private properties/methods
  • ~ -- used to define the package
Example:

3CompartmentsinClassDiagrams

The following 3 relationships are the very important when we draw the class diagrams.

Association: – Relation between two classes.

Composition: – A type of association represents a part of whole relationship. One part dies and other part will dies in the relationship. So simply, one cannot exist without another.

Aggregation: - A type of association represents a part of whole relationship. However one part lives without other part in the relationship.

Example:

3Classrelationships

Here, Company cannot exist without groups. This relation is called Composition and the symbol is filled diamond. We can say this relation is a strong relationship.

Employee leaves the company and Groups still exists. This relation is called Aggregation and symbol is diamond. We can say this relation is a part of relationship and it’s not strong relationship.

Multiplicity: Represents the multiple associations or one class links to many other classes.

0..1
No instances, or one instance (optional, may)
1
Exactly one instance
0..* or *
Zero or more instances
1..*
One or more instances (at least one)

Example:

MultiplicityInClassDiagrams

Here, Customer has zero or more orders.

Generalization & Specialization: Defines the parent and child relationships.

Example:

GeneralizationSpecialization

Abstract Class: Abstract class are represented by with in {abstract}  as shown in the below picture.

AbstractClass

2         Notations:

ClassDiagram
ClassDiagram1

3         When to use:  we can use the class diagrams when we want to represents the relationship between classes and objects.

4         Who will be using: Technical people.

5         Example:

ClassDiagramExample1

6         Notes:

Please visit the below URL’s
for more details about other notations and how to use them.

Object Diagram:

1. Diagram name: Object. Object diagram shows the how classes are looks when object are created for that class. It’s similar like class diagram and the same notations can be used in the object diagram and used to illustrate an instance of a class at a particular point in time.

2.  Notations:
ObjectDiagram

3.       When to use:  we can use the object diagrams when we want to create the instances of the classes and it does show how the class looks.

4.       Who will be using: Technical people.

5.       Example:

ObjectDiagramExample1

6.       Notes:

Please note that its similar like class diagram and top of that it does shows the instance of the classes. Please visit the below URL’s
for more details about object diagrams and how to use them.

Activity Diagram:

1. Diagram name: Activity. Activity diagram used to captures the complicated flows in a system. Main notations are Start, Activity and End.
Start - activity is denoted by a dark circle.
End - activity is denoted by a dark circle inside a white circle.
Activities - denoted by simple oval rectangles.

2.       Notations:
ActivityDiagram

ActivityDiagram1
ActivityDiagram2
3.       When to use:  we can use the Activity diagrams to shows the various flows with in a systems and mainly this diagram used whenever we have complicated flows in our project.


4.       Who will be using: Technical and non-technical people.

5.       Example:
ActivityDiagramExample1

6.       Notes:
Please visit the below URL’s
http://www.visual-paradigm.com/support/documents/vpumluserguide/94/200/6713_drawingactiv.html for more details about Activity diagrams and how to use them.

State Machine or State Chart Diagram:
  1. Diagram name: State Machine. State diagram shows the object undergoing process and shows the dynamic behaviour of the object.
For example, ATM machine is best examples for this diagram. The states are when we withdraw money from ATM machine.

What is the difference between Activity and State Diagram?
State diagram shows status of the object undergoing process. It gives a clear picture of the changes in the object's state in each and every process.
For example, withdraw money from ATM machine
Card object states: Checking, Approving, Rejecting

Activity diagram is a shows the flow of activity of a process.
For example, withdraw money from ATM machine
Withdraw activities: Insert Card, Enter PIN, Check PIN, Enter amount, Check balance, withdraw money, remove card.

 2.       Notations:
StateMachineDiagram
StateMachineDiagram1

3.       When to use:  we can use the State diagrams to shows the various status of the object undergoing the process and gives you clear picture of the list of possibilities of the status.

4.       Who will be using: Technical people

5.       Example:
StateMachineDiagramExample

6.       Notes:
Please visit the below URL’s
for more details about State diagrams and how to use them.

Component Diagram:
  • 1. Diagram name: Component. Component diagram shows the different software components to be used and how they connected each other in your project.
2.       Notations:
Component

3.       When to use:  we can use the Component diagrams to shows the various software components and how they are interconnected in our project.

4.       Who will be using: Technical people

5.       Example:
ComponentDiagramExample

6.       Notes:

Please visit the below URL’s
for more details about Component diagrams and how to use the them.

Package Diagram:
  1. Diagram name: Package. Package diagram is used to specify the logical groups of classes and its related components. Technically, Package diagram maps each and every library of our project which developer in ASP.NET MVC or Java etc.
 Stereo types are mainly use in Package diagrams.

What is the stereo type and what are the commonly used stereo types in UML?
Stereotypes are a way to define various entity components in UML.
The commonly used stereo types in UML are
<<Interface>>: To represents an interface.
<<Web services>>: To represents a web service
<<Executable>>: To represents a software component which can be executable.
<<Library>>:  To represents the library
<<Database>>: To represents the database of the application.
<<ODBC>>: To represents the database connectivity.

2.       Notations:
PackageDiagrams
3.       When to use:  we can use the Component diagrams to shows the various software components and how they are interconnected in our project.

4.       Who will be using: Technical people  & deployment engineer.

5.       Example:
PackageDiagramExample

6.       Notes:
Please visit the below URL’s
for more details about Package diagrams and how to use them.

Deployment Diagram:
1.       Diagram name: Deployment. Deployment diagram shows overall view of the how software and hardware nodes in our application. Deployment diagrams will helpful when we have so many assemblies which need to be deploying which servers…etc. This diagram mainly used by deployment managers and engineers.

 2.       Notations:
DeploymentDiagrams1
DeploymentDiagrams2
3.       When to use:  we can use the Deployment diagrams for deploying which package on which server…etc. and shows that changes of single assembly affect the how many systems and where need to deploy to make sure everything is correct and its does helpful for the outage notification…etc.

4.       Who will be using: Technical people, deployment managers and engineers.

5.       Example:
DeploymentDiagramExample1

6.       Notes:
Please visit the below URL’s
for more details about Deployment diagrams and how to use them.
I hope you enjoy reading this post.
Conclusions:
  1. Please try to use relevant UML diagrams which needs for your project development and it does save you lot of time and leads the project to be successful.
  2. We can use other diagrams such as Layer and Network diagrams for our future developers and application supporters. Recent Microsoft Development Studio come with modelling project and it is collaboration tool with many futures. Please try to use them and get more benefits for your project.
  3. Now, we are expert in UML.

UML flows in Greenfield projects


UML flows and who will be using which diagrams in Greenfield projects:

An architect topic number 4. UML describes more about UML, various UML diagrams and usages. This post explains the UML flows such as where to start, who will be using which UML diagrams …etc.

The below UML diagram describes all of the above. However, the below UML flows varies depends upon the project stakeholders availability, project type, size of the project, project implementation methodologies for your company …etc.

UML Flows

I hope you enjoy reading this post.

Monday 17 December 2012

17. Lesson learned from your experience

Lesson Learned (LL) is the key for any project whether project was success or failure. Generally, we did not allocate the time for LL and we forgot many things to document and doing the same kind of mistakes again and again. This will eat most of the development team time by doing the same things again and again and literally project will be either unsuccessful or not doing in the efficient way.

In Project Management, Project Manager is responsible for documenting the Lesson Learned. I am not going to explain in terms of Project Management Lesson Learned. I am focusing on Lesson Learned in technical point of view.

Two important things can be performed from Lesson Learned.
  1. Avoid the same old mistakes by focussing on Lessons Learned & try to improve the development efficiency.
  2. Assess how can we do better than the last project from LL and use same methodologies/techniques which we used in the last project given the better output than anything else.
Next, what is Lesson Learned?
Lesson Learned is process of documenting gained by experience. It does not matter either project was success or failure. But still we need document the LL.

Who will initiate LL process and what to document?
Project team will initiate the LL process. Once project has been completed, project team should get together to discuss what has been done, how it’s performed, is there any better way, positive and negative actions…etc.
Please document once project team is agreed the valued points gained from experience and outcome of the project.

What are the examples of considerations for the LL process?
  1. If your project team did spent lot of time for the particulate task, then in the LL process we can analyse to improve that process.
  2. Think back & analyse what happened in the project and where we can fill the gaps to improve everything in the next project. For example,  let’s say if your project team did used latest technologies in the last project then they may be spending lot of time to debug and troubleshoot the problems as they using the that latest technologies in first time. So in this case we may come the conclusion from LL that it’s good to be get trained our development team  if we using the latest technologies in first time or don’t have any of our team members experience on that technologies.
  3. Use the methodologies/techniques which worked in better way in the next project as well.
  4. Document what are the different root causes of the problems while in development.
  5. Document if you learned anything new from last project.
  6. Capture everything what you did in the last project and come to the conclusion that based on the time which you spent on the each and every tasks.
Is there any Lesson Learned template can we use for our LL process?
You can download sample template from Microsoft office site http://office.microsoft.com/en-au/templates/project-lessons-learned-TC001144319.aspx and change the temple according your requirements and your project team suggestions which everyone agreed. Please note that you can download other templates which may useful for your team from http://office.microsoft.com. Please browse this site and use them.

Or

You can also come your with own template with your project team to document the LL.

What are the benefits for building N tier architecture applications in .NET?


Sorry. This page is under construction. Please check back soon. Please click  the below links to visit other pages.
Please click the corresponding link which do you wish to know more details.
2. OOAD
4. UML

2.1.2 Static Classes and Access Modifiers


What is Static class?
Static classes are used to create data and functions that can be accessed without creating an instance of the class. We can access any members of Static classes without creating instance of the class.
Example:
//Start
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HowToBecomeAnArchitect.OOAD.StaticClass
{
static class Logger
{
public static int logLevel = 1;
public static void LogMessage()
{
//Write code here
Console.WriteLine("Logger:LogMessage() is executed");
}
}
class Demo
{
static void Main(string[] args)
{
Console.WriteLine("Main method is started");
Logger.LogMessage();
Console.WriteLine("Logger Level = " + Logger.logLevel);
Console.ReadKey();
}
}
}
//End
Note:
  1. Static classes contain only static members.
  2. Static classes cannot be instantiated.
  3. Static classes are sealed.
  4. Static variable is stored on the heap, regardless of whether it's declared within a reference type or a value type. There is only one slot in total no matter how many instances are created. This heap is separate from the normal garbage collected heap - it's known as a "high frequency heap", and there's one per application domain.
When to use Static classes?
  1. Static classes can be used when there is no data or behavior in the class that depends on any object.
  2. Static keyword will make your code a bit faster since no object creation is involved.
  3. Static classes used for logger and utility methods which often needed to access without creating any instances of the class to make faster and allocating with less memory.
  4. Static classes used for declaring the global constants for your project and these constants values read from config file and this is good practice for your development.
For example,
Config settings are
<appSettings>
<add key="MaxNoOfUsersAllowed" value="8" />
<add key="CachingServerName" value="au.cachingserver1.google.com" />
</appSettings>
Static class as follows
GoogleGlobal.cs
public static class GoogleGlobal
{
private static string cachingServerName = int.Parse(System.Configuration.ConfigurationManager.AppSettings["CachingServerName "].ToString());
private static int maxNoOfUsersAllowed = int.Parse(System.Configuration.ConfigurationManager.AppSettings["MaxNoOfUsersAllowed"]);
public static int CachingServerName { get { return cachingServerName; } }
public static int MaxNoOfUsersAllowed { get { return maxNoOfUsersAllowed; } }
}
Access Modifiers:
The following access modifiers are available in .NET
  1. 1.       Private – Access is limited to within class only.
  2. 2.       Protected – Access is limited to within class and to any class that inherits from the class.
  3. 3.       Public - There is no restriction for accessing the public members.
  4. 4.       Internal – Access is limited to the current project assembly.
  5. 5.       Protected Internal – Access is limited to the current project assembly and any types derived from the class.
Example:
//Start
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HowToBecomeAnArchitect.OOAD.AccessModifiers
{
public class BaseClass
{
// For testing only
private int privateVariable = 1;
protected int protectedVariable = 2;
public int publicVariable = 3;
internal int internalVariable = 4;
protected internal int protectedInternalVariable = 5;
}
public class DrivedClass :BaseClass
{
public DrivedClass()
{
// print the BaseClass variables
//Console.WriteLine("Private Variable Value = " + privateVariable); //error on this line due to private variable
Console.WriteLine("Protected Variable Value = " + protectedVariable);
Console.WriteLine("Public Variable Value = " + publicVariable);
Console.WriteLine("Internal Variable Value = " + internalVariable);
Console.WriteLine("Internal Protected Variable Value = " + protectedInternalVariable);
}
}
class Demo
{
static void Main(string[] args)
{
Console.WriteLine("Main method is started");
DrivedClass drivedObj = new DrivedClass();
Console.ReadKey();
}
}
}
//End
Please visit the following URL to know more about how to use objects and classes.
http://msdn.microsoft.com/en-us/library/ms173109.aspx