The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Class Design Help

In my scenario,the user needs to record fares for train and air,for various routes.Both type have similar features like rate,currency,class(business,normal etc).The differences are that, in case of Air Fare, tax(%) is charged,while in case of Train service charge( a fixed amount) is added to fare.Also, class types are different for Air and Train.
Tuesday, August 22, 2006
I would make them a single class until you see a real need to split them.
Have 2 tax variables for scale and offset.
Have an internal enum for type, use this to determine if rail or plane when necessary.

In general I find that having a single class 'fruit' with an internal state (enum) for 'apple' 'orange' etc much better than deriving an apple type from a fruit base class. Especially when you want to add a mixture of fruits to the same basket.
Martin Send private email
Tuesday, August 22, 2006
> I would make them a single class until you see a real need to split them.

Like for a programming assignment. :)

So, should we second-guess what the instructor is looking for (parent class Fare, child classes AirFare and TrainFare), or should we program the way we would in Real Life (tm)?
Tuesday, August 22, 2006
==> Like for a programming assignment. :)

It's not *even* September yet!!
Tuesday, August 22, 2006
There was a previous post titled "Class Design Help" from Vishy: "I have a class called RoomType,part of Hotel entity.RoomType has roomrate.Now,there are two cases..In one case it has a single rate(whatever be the group size),and in another case it has 2 rates(depending on the size of group wanting to book rooms).I am thinking of defing 3 enums for these type of rates,and when I create roomrate object,i will define what type it is using enum.
Vishy didn't respond to the class design help that was given in that thread; I suspect this is just another troll for outsourcing programming homework from Indian to the U.S.
Tuesday, August 22, 2006
I have beed reading about how making small objects is good.So,I have  these objects-TicketFare,which is composed of  FareAmount(Amount and Currency as properties),TravelClass(business,executive),TravelSector(Start and End Location).

Now,tax is standard,same for all air fares.So,I am thinking of storing it in a table,from where I will get the values,and do total fare calculation.

This is for a real project I am doing,alone,for an international tour company.I post questions here to get some feedback,and understand desiging better.
Wednesday, August 23, 2006
Don't kids just copy from the year above them anymore?
Martin Send private email
Wednesday, August 23, 2006
If the international tour company is paying full rate for you, they're getting overcharged - and your employer is committing fraud.  If they sell your time as an intern, that's fine; but if they put interns who don't know how to design classes in charge of designing classes, then they'll wind up making lousy software.  I'm astounded by the prospect of how someone who lacks fluency in either business English or object-oriented design getting a job designing sofware classes.

Remind me to not take a vacation that's booked on your hotel, train, or air reservation system.

I'll withdraw from further class design help.  If you really are getting paid for this, then I'm giving your employer free remedial training; and if you're really just a student, then you're using dishonesty to build a career.  Either way, not something I'm willing to support with a donation of my professional expertise.
Thursday, August 24, 2006
You are most welcome.Feel sorry,for your judgemental mentality.
Friday, September 01, 2006

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz