码迷,mamicode.com
首页 > 其他好文 > 详细

The steps of designing class diagram

时间:2016-08-12 01:23:25      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:

1. Find all objects and the corrensponding function of each object.

  1. Canvas
  2. Geometry
  3. Style
  4. Painter

2. Extract the classes from the above objects.

2.1 List multiple objects of a same class,and find out their common characteristics and behaviors.

2.1.1 Canvas

  1. Multiple objects of Canvas:
  • screen (include pdf) – using graphics card.
  • wall
  • paper
    we just need to care ‘screen’.
  1. common characteristics and behaviors
  • width
  • height
  • backgroundColor

2.1.2 Geometry

  1. Multiple objects of Geometry
  • triangle
  • rectangle
  • circle
  • point
  1. Common characteristics and behaviors
  • perimeter
  • area

2.1.3 Style

  1. Multiple objects of Style
  • lineStyle – Pen
  • regionStyle – Brush
  1. Common characteristics and behaviors
  • color
  • width

Painter

  1. Multiple objects of Style
  • projector
  • printer
  • painter
  1. Common characteristics and behaviors
  • DrawPolygon
  • DrawLine
  • DrawPoint
  • FillPolygon

You can view the results of this phase now.
技术分享

3. not yet

4. Situation test

situation 1: Draw a line

  1. new Canvas(width,height,bgcolor);
  2. new LineStyle(lineType,width);
  3. List points = new List(new Point(),new Point());
  4. Geometry geo = new Polygon(points);
  5. Painter.Draw(canvas,style,geo);




The steps of designing class diagram

标签:

原文地址:http://www.cnblogs.com/yudidi/p/5763313.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!