Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another OOP struggler!

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
0
0
US
Like Dean, I'm having real problems trying to get my head around OOP....I think I understand the concepts, but I'm finding it very difficult to implement them in the real world! It doesn't help that there's no one in house that has really used OOP and can assist.

So, on to my issue....I have been assigned a project to convert an existing process that uses a combination of RPG and Delphi to a purely Java/web based replacement. Here's what I need to do:

When a person is pulled over and issued a ticket, the law enforcement agency uses the radio in the car (or the dispatcher uses a Delphi desktop application) and sends to a socket on the iSeries the Agency and Man Number of the officer making the request. Then I need to send back through the socket connection a date and time that has been calculated as the next available date for the person to come to court. If that date doesn't work for the person, then a cancellation request is sent for the original and another date is sent.

A few other details...there is a lead time for calculating the court date that is stored in a hearing type table. There is a table that records audit information about which officer used/cancelled what dates. There is a prefilled table that contains the dates and times of the availalbe hearings and a max number of assignments and the current assignments:

[tt]
HERNGDAT HERTIM HERTYP JUDCOD HERSEQ HERMAX
20071203 815 TA 11 27 30
20071203 945 TA 11 27 30
20071203 1030 TA 11 25 30
20071203 1115 TA 11 26 30
20071203 1315 TA 11 25 30
20071203 1400 TA 11 24 30
20071203 1445 TA 11 24 30
20071203 1530 TA 11 25 30
[/tt]

HERSEQ is an updated field; every time a date time is used it is incremented.

So, it's not a very big project, but I can't get my head around what's my class? What are my methods and properties?

Any suggestions welcome!

Thanks,




Leslie

In an open world there's no need for windows and gates
 
As I see it, your main issue is an Appointment, which transforms from Open to Reservation to Confirmed. These last three are states, not necessarily classes (although you might search the net for enumeration classes in java).
I think another class is a Person, whose data must be coupled to the appointment, and an Officer.

But really, if you are more comfortable with non-object-oriented code, you could always start, notice that some pieces of code only touch specific variables and extract a class from them.

If you name your methods senibly, they will tend to breakdown as well. If you have methods like SendAppointment OfficerName, PersonAddress, you will probably want to transform them to <something>.send(appointment), Officer.Name and Person.Address

Hope this helps.
 
thanks! I also found an article for OOP in Delphi (which is the language I've been using for the past 5 years, I wish I had found it a few years ago!) I found it at about.com and it has given me a MUCH better idea of how to implement the OOP model.

I think even though I'm going to be doing my new project in Java, I'll be able to take some of the information from this Delphi paper and apply it to Java and have a much more OOP model for my new project.

I'll post back with any specific questions....

thanks!
Les
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top