Reflections on Model Design

crowsfoot_notationI am a visual learner. I have a difficult time taking in concepts and removing the qualities of the teaching from the lesson itself. I believe this comes from a focus on sound quality that I’ve been developing for over 20 years as a musician. The extra signals that sometimes come across when someone is explaining something to me causes me to focus on the wrong signals and to mangle the points in the argument or the lesson. I’ll have to ask for them to repeat themselves or close my eyes to visualize what they just said, shutting out all the extra signals.

When I work with code I have to write out the concepts. I learned a very interesting way of making problems more easy to solve or new concepts easier to digest. I write them out in this list form. Then I use indentation to visually cluster important concepts together. This has worked for me the past. However, during this week’s 2 WODs my indentation learning method did not serve me well.

The first WOD this week asked me to create an Entity Relationship model for a library. Here’s what the original specification looked like:

Screen Shot 2015-04-14 at 12.43.01 PM

And here’s what it looked like after I cut it up into sections and created my own indentations to show the relationship between the words with my method of indentation:

Hamilton Library, 
	students and faculty 
		take out books on loan. 
	student or faculty member 
		can be loaned up to five books at a time. 
	Several copies of the same book 
		exist for those in high demand. 
	Borrowers
		make reservations when all copies of a book are out on loan.

	Information to be stored includes: 
		to whom a book is loaned; 
		the date a book is loaned; 
		the ISBN number, 
		title
		author of a book
		the student or faculty member reserving a book
		date reserved.

The Library staff needs to be able to do the following:

    Check whether a book being returned has been reserved;
    Check which borrower has a particular book out on loan;
    Check which books are out on loan to a particular borrow;
    Check whether a copy of a particular title is loaned out or not.
    Check which reservation should receive the newly turned in book.
    The history of loans for a book.
    The history of reservations for a book.

I did the same indentation format for the second WOD. Here’s what it looked like originally:

Screen Shot 2015-04-14 at 12.47.32 PM

And here’s what I came up with once I had cut it up into visual sections:

Car rental domain model

A car rental company called RentAJunker 
	keeps a number of offices 
	variety of cities 
		locations within each city. 

Each location maintains a 
	number of cars and trucks. 

The car types include: 
	Economy, 
	Standard, and 
	Van. 

Truck types include 
	Box Trucks 
	Cargo Vans.

RentAJunker maintains a 
	list of all their customers. 

When a customer first rents a vehicle, 
	the company records the customer name, 
	address, 
	phone number. 

A customer is usually identified by their phone number.

A customer 
	can reserve a vehicle 
		for specific days, 
	can rent a vehicle, 
	or return the vehicle that she/he has rented. 

To make a reservation, a customer 
	provides the location, 
	the type of the vehicle 
	and the day and time 
		for which she/he would like to pick up 
		and return the vehicle. 

When a customer returns a vehicle 
	the clerk enters the date, 
	the time, 
	the odometer reading and 
	whether the gas tank is full.

WOD Results

ER Diagram for the library:

ERD Library-1

ER Diagram for the Car Rental Company:

ERD_CarRental-1

  • I finished the first WOD in 14 minutes 5 seconds.
  • I finished the second WOD in 18 minutes and 4 seconds on the first try.

Lessons Learned this week

Getting relationships by examining the relationships between unconnected entities is a big change in how I think about modeling with ERDs. For example the customer does not need to have a relationship with a specific vehicle. And the reservation does not have to be with a specific car because the relationship can be gleaned from the office’s relationship with the car. I will be watching out for hidden models such as the Copy entity in the first WOD and the need to model the VehicleType for the second WOD.

Now that I know that my indentation modeling scheme is not flawless. I will have to try new methods to learn concepts more quickly. If you have any suggestions on how you learn computer science material. Please contact me.

Author: David Neely

Professional Software Developer. Technology and Web Coordinator at the University of Hawaii's Manoa Career Center.