Skip to content

Geometry

Complete version (all in one file) - All 57 sections combined in a single document for easy reading or printing.

Teaching note: Three ways to give a Circle a centre - constructor parameters versus attributes, and UML association versus composition. See also Circle and Point constructors.

Table of Contents

Structure

Each chapter is in its own folder with separate markdown files per section. Use the Table of Contents above to jump to any section.

Image List

Images Overview - All 18 images on one page with descriptions.

Description and image link Used in
Circle with public radius, centre coordinates, colour, perimeter and area operations 1.2 Creating a class
Autocompletion 1.3 Using a class
Circle with three constructors, perimeter and area methods, static Definition and static member 1.6 Class diagram
Encapsulated Circle with private fields, properties, constant LimitValueForBigShape, DescribeSize and static Definition 2.6 Class diagram
Point with X and Y, private backing fields, properties and chained constructors 3.2 Classes as attribute
Circle with Point centre reference, radius, colour, geometry operations and static Definition 3.3 Class diagram
Circle and Point with many-to-one association: each Circle has one Centre Point 3.4 Relationship between Circle and Point
Point, Circle and Rectangle with centre or corner links to Point and full operation sets 3.6 Class diagram
Shape base class with protected colour, default colour constant, virtual area and perimeter, DescribeSize and static Definition 4.2 Shape base class
Shape superclass with Circle and Rectangle subclasses, each composed of Point 4.5 Class diagram
Abstract Shape with abstract CalculateArea and CalculatePerimeter, colour and DescribeSize 5.4 Class diagram
Surface layout with rectangles 6.4 Surface class
Surface layout with rectangles and circles 6.4 Surface class
Abstract Shape, Circle, Rectangle, Point and Surface holding a list of shapes on a sized canvas 6.6 Class diagram
Shape family and Surface plus IComparable of Shape for ordering shapes 7.3 Class diagram
DbAccess with connection string, MySqlConnection and OpenConnection, GetConnection, CloseConnection 10.4 DbAccess class
AbstractDao base class storing DbAccess for shared database access in concrete DAOs 11.2 AbstractDao class
DbAccess used by AbstractDao; PointDao and CircleDao inherit and add SavePoint, SaveCircle and queries 11.4 Refactor CircleDao

Supporting files

Conventions

Database (chapters 10-11)

  1. Run Data/CreateInsertScriptShapes.sql in MySQL Workbench
  2. Add NuGet package: MySql.Data
  3. Adjust connection string if your MySQL setup differs

Back to: Overview