简单程序中用vs画uml
原来看过项目到底画不画uml的争论,我觉得真正聪明的人可以不画uml,他们可以通过代码在大脑中展现出图像。
一般人还是画吧,不论项目大小,uml都能让自己让别人的思路清晰。
我是一般人,写一个简单的程序,画一个简单的uml图。
层关系图
类图
活动图
这是一个简单的模拟mvc的程序
代码:
public class mvc_m
{
public List<int> i { get; set; }
public mvc_m()
{
i = new List<int>();
i.Add(1);
i.Add(2);
i.Add(3);
}
}
public class mvc_c
{
public static int get_max(List<int> i)
{
int temp = i[0];
foreach (var item in i)
{
if (item > temp)
{
temp = item;
}
}
return temp;
}
public static int get_min(List<int> i)
{
int temp = i[0];
foreach (var item in i)
{
if (item < temp)
{
temp = item;
}
}
return temp;
}
}
public class mvc_v
{
public static void show()
{
mvc_m m1 = new mvc_m();
Console.WriteLine(mvc_c.get_max(m1.i));
Console.WriteLine(mvc_c.get_min(m1.i));
// m1.i=new ;
}
}
public class work48
{
public static void Main()
{
mvc_v.show();
Console.Read();
}
}
学而时习之不亦乐乎,我有时没事会画画这种图.