Jump to content

Urgent help required: Class Diagram


j_cart007

Recommended Posts

Hi !

 

i'm trying to get my head around this scenario i've come up with a class diagram but i'm not sure it's correct if anyone can have a look at it pls.

 

N.B: my class diagram is attached aswell.

 

SCENARIO:

 

A local book shop that has approached you to build them a computerised stock control system and point of sale system.

The shop sells a large number of books which are classified into genres: Non-Fiction (Science,Mathematics, Humanities, Languages, Arts), Science Fiction (SciFi, Steampunk, Apocalyptic, Time Travel), Crime Fiction (Legal, Spy, Whodunnit, Suspence) and Literary Fiction.

 

Each book has a title (e.g. “The Hitchhikers Guide to the Galaxy”) an author (e.g. “Douglas Adams”), a date of publication, a cost (how much the shop paid for the book) and a price (how much they will sell the book for).

· The non-fiction books also need to record details of what degree courses they are suitable for and which year of study (e.g. “Software Engineering”, “Level 2”), and a list of Universities which use the book.

· Crime Fiction books need to record the type of crime involved (e.g. “Murder”, “Theft”, “Fraud”).

· The Science Fiction books need to record which years the books are set in (e.g. 3010—3025).

 

The shop purchases its stock from a number of different suppliers. It usually telephones the supplier to order books and will pay for the book when it is delivered. The system will need to record the orders and actual purchases (i.e. delivery) from a supplier giving the name of the supplier, the date of purchase and the amount paid. Once purchased, the book is added to the shop’s inventory.

 

2. The system will also need to record all sales of books to customers showing the customer, the date of the sale and the amount paid. The shop have asked that the system should be able to provide them with information about the number and total amount of purchases from each of their suppliers each month, the number of sales and total price for each genre of book each month.

ClsDgm_WlvBooks4U.jpg

Link to comment
Share on other sites

Good start.

 

Constructive criticism, and do take it that way please.

 

1. No inheritance. The first part of the problem on types of books screams inheritance. How can I find out that Ringworld is a science fiction book set in the late 29th century or that Gravitation is a graduate-level physics text?

 

2. What's this Controller thing? There is too much information in this controller and very little in the real objects in the system.

 

3. For example, customers buy books, and suppliers supply them.

 

4. Where are the reports?

Link to comment
Share on other sites

It looks a lot like a UML class diagram. It looks a lot like a UML class diagram created with Umbrello, but with the atrocious default colors overridden.

 

Not that I know *anything* about UML. (Admit that you know that computer sciency stuff in a technical organization and the next thing you know you are stuck with some truly nasty job like coordinating your company's CMMI 3 compliance plan and V&V plan. The next thing you know after that is that your pet math and physics problems need to be turned over to someone else because the company needs you to dedicate your time to those pressing corporate issues.)


Merged post follows:

Consecutive posts merged
i appreciate that sir.

 

Can u give some easy points to fix this diagram pls? coz i'm not that expert to do all this.

 

BR.

Back on topic:

 

This looks like a homework problem. Our job here is to help you do your own homework. I already gave you some good pointers, maybe a bit too much.

 

 

Compare the scenario you posted originally to your design. Can you point out where your design accomplishes each of the items in that narrative? If not, why not, and what can you do to fix it?

Link to comment
Share on other sites

It looks a lot like a UML class diagram.

 

Well, I suppose it's a bit confusing as domain models can be described with UML diagrams too:

 

Domain_model.png

 

My gut reaction is this is an overly complex way to represent these entities. Part of that is my reaction as a Rubyist of not having singleton classes/metaclasses to stick methods which query entities into. Why, for example do you have a "removeBook" method in your "Inventory" class, as opposed to having "remove" be a method on Book itself? I am not sure where to factor "addBook" in that case though... in Ruby I'd stick it into the "singleton class" which is similar to what you'd get back from getClass() on an object in Java. Then you can simply do Book.add() in Ruby, which is a "factory" method for creating Book objects.

 

I suppose also I am used to dealing with domains which exist upon Object/Relational Mappers (ORMs), and thus you have the full power of an RDBMS to perform your queries.

 

It's a nice compromise.

 

That said, I do have some initial concerns right off the bat:

 

Why do you have a bunch of enumerations instead of, say, a Category class (with a Subcategory subclass?) That's certainly how myself and others represent such things in a real Content Management System.

 

I may be rather opinionated about this subject because you are effectively designing a CMS for a library which is what I work on myself every day.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.