Академический Документы
Профессиональный Документы
Культура Документы
.NET Application Modeling
Language (nAML)
V1.0 (Beta 1) Specification, Examples and Tools
Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
Page intentionally left blank.
Page | 2
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
License
You are free to copy, distribute and display this book. However please include my name “Mohammad
Ashraful Alam” while referring any content of this book.
Page | 3 Issue Reporting
This specification is in Beta 1 stage currently. Please have your valuable inputs to be sent to the
following email to make it better.
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
Table of Contents
License ........................................................................................................................................................... 3
Issue Reporting ............................................................................................................................................. 3
nAML: Specification ...................................................................................................................................... 6
Page | 4
Introduction .............................................................................................................................................. 6
Terms and Definitions ............................................................................................................................... 6
Element: ................................................................................................................................................ 6
Operation: ............................................................................................................................................. 6
Association ............................................................................................................................................ 7
Attribute ................................................................................................................................................ 7
Element Lifeline .................................................................................................................................... 7
Common Semantic Guideline ................................................................................................................... 8
Web User Interface Sample: The Hello World! ............................................................................................. 9
C# Samples .................................................................................................................................................. 11
Block Statement ...................................................................................................................................... 11
If Condition .............................................................................................................................................. 12
Compound If Condition ........................................................................................................................... 13
Try/Catch Block ....................................................................................................................................... 14
While Loop .............................................................................................................................................. 15
For Loop .................................................................................................................................................. 16
Nested For Loop ...................................................................................................................................... 17
Method Call and Return .......................................................................................................................... 18
SQL Samples ................................................................................................................................................ 20
SQL Create Table ..................................................................................................................................... 20
SQL Alter Table: Add Column .................................................................................................................. 21
SQL Alter Table: Alter Column ................................................................................................................ 22
SQL Alter Table: Drop Column ................................................................................................................ 23
SQL Drop Table ........................................................................................................................................ 24
SQL Select ................................................................................................................................................ 25
SQL Where .............................................................................................................................................. 26
SQL Insert ................................................................................................................................................ 27
SQL Update ............................................................................................................................................. 28
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
SQL Delete ............................................................................................................................................... 29
SQL Inner Join.......................................................................................................................................... 30
SQL Left Outer Join .................................................................................................................................. 31
SQL Union ................................................................................................................................................ 32
Page | 5
SQL Insert‐Select ..................................................................................................................................... 33
SQL Where‐Select ................................................................................................................................... 34
Tools and Tutorial ....................................................................................................................................... 35
Appendix: Common Attributes ................................................................................................................... 38
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
nAML: Specification
Introduction
nAML (.NET Application Language, pronounced as “namel”) is a visual modeling semantics to model
.net applications with wide range of specific details. It contains extremely power visual notations and
Page | 6 semantics to illustrate complex application components, processes and operations easily. It overcomes
the limitation of traditional modeling languages by providing a single space to describe an application
system with its structural and behavioral, as well as physical and logical components. One of it’s the
most powerful objectives is nAML requires near to zero knowledge on notation semantics to
understand an application system from readers perspective.
Example: Using nAML, for instance, a software architect can model a whole or part of a web
application in a single visual diagram with respect to interaction, communication and structure
between end user, web interface, .net classes, database objects, physical tiers (web server, business
logic server, database server etc) and so on.
The primary objectives of nAML can be considered as follows:
• Provides a single space to visually describe one or more application systems with structural
and behavioral components.
• Provides a single space to visually describe one or more application systems with logical and
physical components.
• Provides a single space to visually describe one or more application systems from top to low
level.
• Provides a single space to visually describe a part or whole of one or more application
systems.
• Extremely simple and easy understand and learn from readers and designers perspective.
• Concentrates on .NET applications, with its related logical and physical entities (user interface,
application logic, business logic, database etc).
Terms and Definitions
Element:
Definition: An Element is a structural notation that is the physical or logical object that holds one or
more physical and/or logical objects.
Notation:
Example: In an ASP.NET web application, an ASP.NET page can be an Element, having controls
embedded within it as sub-Element and the event handler methods as defined Operation within it. For
a .net class, the member Elements are the properties, data fields etc. For a physical database, its
member Elements is the tables.
Operation:
Definition: An Operation is a behavioral notation that is the set of one or more actions to be performed
that are defined in an Element.
Notation:
Or
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
Example: For instance, an ASP.NET page code behind class, as an Element, can have controls event
handlers (click event handler of button etc) as Operation. For a .net class, the members Elements are
the methods etc. For a physical database, its “Operation” can be defined within the stored procedure,
functions.
Page | 7
Association
Definition: Association is a structural notation that illustrates how the Elements or Operations are
connected to other Elements or Operations.
Notation:
Attribute
Definition: Attribute is a structural notation that is the Meta data information that describes an
Element, Operation or Association.
Notation:
The notation of attribute can be simple text or a visual notation of an Element, Operation to be
expressed as characteristics of another Element or Operation.
Example: For a .NET class “Employee” can have an Attribute as,
Class Name: Employee
Element Lifeline
Definition: An Element lifeline is a behavioral notation which is the time span within which all activities
related to the corresponding Element is illustrated. The life line also shows the active and inactive
state of the Element. Each lifeline for a given Element applies to only one instance of that Element.
Notation:
Example: If an instance of a .net class is being created, then its activation will be illustrated from the
moment it created.
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
Common Semantic Guideline
• To distinguish structural and behavioral components of system, consider solid line diagrams as
the behavioral component and dashed line diagrams as the structural component.
• Element Lifeline reflects the time span for behavioral components only, rather structural
components
Page | 8
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
Web User Interface Sample: The Hello World!
The sample illustrated below shows the “Hello World” message in an ASP.NET Label server control,
when a user clicks on a ASP.NET Button server control.
UI: Button
Text: Chick Here
Clicks ID: btnHelloWorld
Type: Belongs to
System.Web.UI.WebContro
ls.Button
Belongs to
C# Method: btnHelloWorld_Click
Parameter: sender
Parameter name: sender
Parameter type: object
Parameter value: Calls
btnHelloWorld
Parameter: e
Parameter name: e
Parameter type:
System.EventArgs
lblMessage.Text = "Hello
World!";
UI: Label
Text: Hello World Belongs to
Type:
Sees System.Web.UI.WebContro
ls.Label
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
Now let’s see the corresponding nAML notations implemented in this example.
Page | 10
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
C# Samples
Block Statement
Code Sample
nAML Illustration
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
If Condition
Code Sample
nAML Illustration
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
Compound If Condition
Code Sample
nAML Illustration
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
Try/Catch Block
Code Sample
try
{
throw new Exception("ERROR!");
Page | 14 }
catch (Exception e)
{
Console.WriteLine(e.Message);
}
finally
{
Console.WriteLine("IN FINALLY BLOCK!");
}
nAML Illustration
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
While Loop
Code Sample
int i = 0;
while (true)
{
Page | 15 Console.WriteLine("Hello World");
i++;
if (i > 10) break;
}
nAML Illustration
i=0
while
true
Console.WriteLine(“Hello World”);
No
i=i+1
if
i == 10
Yes
break
End loop
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
For Loop
Code Sample
Page | 16
nAML Illustration
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
Nested For Loop
Code Sample
nAML Illustration
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
Method Call and Return
Code Sample
class SimpleMethodTesterClass
{
public static void TesterMethod()
Page | 18 {
float discount = SimpleMethodSampleClass.GetDiscount(21);
Console.WriteLine("You got discount: " + discount * 100 + " %");
}
}
class SimpleMethodSampleClass
{
public static float GetDiscount(float age)
{
if (age < 18)
return 0.1f;
else
return 0.01f;
}
}
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
nAML Illustration
Page | 19
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
SQL Samples
SQL Create Table
Code Sample
nAML Illustration
CREATE
Table: tblUser
UserName nvarchar(50) No No
UserPassword nvarchar(50) No No
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
SQL Alter Table: Add Column
Code Sample
ALTER
Table: tblUser
UserName nvarchar(50) No No
UserPassword nvarchar(50) No No
ADD COLUMN
UserEmail nvarchar(50) No No
Table: tblUser
UserName nvarchar(50) No No
UserPassword nvarchar(50) No No
UserEmail nvarchar(50) No No
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
SQL Alter Table: Alter Column
Code Sample
ALTER
Table: tblUser
UserName nvarchar(50) No No
UserPassword nvarchar(50) No No
ALTER COLUMN
UserPassword nvarchar(100) No No
Table: tblUser
UserName nvarchar(50) No No
UserPassword nvarchar(100) No No
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
SQL Alter Table: Drop Column
Code Sample
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
SQL Drop Table
Code Sample
nAML Illustration
Page | 24
DROP
Table: tblUser
UserName nvarchar(50) No No
UserPassword nvarchar(50) No No
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
SQL Select
Code Sample
nAML Illustration
SELECT
Table: tblUser
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
SQL Where
Code Sample
nAML Illustration
SELECT
Table: tblUser
WHERE
UserId = 1
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
SQL Insert
Code Sample
nAML Illustration
INSERT
Table: tblUser
UserId int 1
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
SQL Update
Code Sample
UPDATE tblUser
Page | 28 SET
UserName = 'test00',
UserPassword = 'passw@@rd'
WHERE UserId = 1
nAML Illustration
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
SQL Delete
Code Sample
DELETE tblUser
Page | 29 WHERE UserId = 1
nAML Illustration
DELETE
Table: tblUser
UserName nvarchar(50) No
UserPassword nvarchar(50) No
WHERE
UserId = 1
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
SQL Inner Join
Code Sample
nAML Illustration
SELECT
UserPassword Comment
DateLogged DateLogged
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
SQL Left Outer Join
Code Sample
nAML Illustration
SELECT
UserPassword Comment
DateLogged DateLogged
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
SQL Union
Code Sample
nAML Illustration
SELECT
Table: tblUser
UNION
Table: tblUserArchive
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
SQL InsertSelect
Code Sample
nAML Illustration
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
SQL WhereSelect
Code Sample
nAML Illustration
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
Tools and Tutorial
You can start implementing nAML just using a pen and a piece of paper. However if we had any
software level tool support to dram nAML diagram, it would really cool. Well, MS Visio is an excellent
modeling tool and has wonderful support for “Customized Stencil” to implement custom shapes. To
facilitate nAML modeling, custom stencil is available. Just download the latest “nAML Stencil”, install it
Page | 35 with your Visio and start drawing nAML diagrams. Here is a walkthrough regarding how to install and
implement nAML stencils.
3. Browse nAML Stencil (nAML.vss), where you downloaded and extracted nAML stencil.
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
Page | 36
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
Page | 37
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
Appendix: Common Attributes
Attributes are one of the powerful features of nAML. Here are few simple samples which you can
utilize while modeling your .NET application.
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
Return Value Text Value
If Statement .NET Method Operation Condition Text Value
Assignment .NET Method Operation Assignment Text Value
Statement
Loop Statement .NET Method Operation Count/Condition Text Value
Page | 39
.NET Property .NET Class Operation Property Name Text Value
Property Type Text Value
Property Value Text Value
Database None Element Content Category Sql Server 2000,
Sql Server 2005,
Office Access 2007
Database Name Text Value
Network Location Text Value
Disk Location Text Value
Database Table Database Element Field Name Text Value
Show As Text Value
Type Number;
Text;
True/False;
Binary;
GUID;
Date/Time
Stored Database Operation Procedure Name Text Value
Procedure
Stored Stored Element Parameter Type Number;
Procedure Procedure
Text;
Parameter
True/False;
Binary;
GUID;
Date/Time
Parameter Instance Name Text Value
Parameter Value Text Value
Select SQL Stored Operation Table Name Text Value
Procedure
Table Select SQL Element Field Name Text Value
Field Type Text Value
Show As Text Value
Update SQL Stored Operation Table Name Text Value
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP
.NET Application Modeling Language V1.0 (Beta 1) Specification and Examples
Procedure
Field Name Text Value
Field Type Text Value
Value Text Value
Copyright 2008 © Mohammad Ashraful Alam, Microsoft MVP