Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URLyBird Design Choices- HELP!!

 
Ian Hamilton
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm having problems visualising the classes I'll need for my project because of my limited development experience. I've decided to update the data in memory and then update the database file after each update. Or should I be updating the file directly???

So far I have these four classes (two of which are enforced by Sun);

-> interface DBAccess (enforced)

-> Data class implements DBAccess (enforced) - opens database file, reads metadata, reads schema.

-> Helper class - adds Record objects to list.

-> Record class - blueprint of a record in database with get/set methods etc...


Data class loads schema from database, adding each row as a string to ArrayList1

Helper class interates through ArrayList1 passing each element to Record class which parses string.

Helper class adds each Record object to ArrayList2.

So now ArrayList2 is a representation of the database in memory.

Can anyone give me some design advice/help. I'm unsure how to progress
 
Ian Hamilton
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FYI - I thought this might shed some light.

public class Data implements DBAccess{
//read metadata
readHeader();
//adds rows to ArrayList1
readSchema();
}

public class Helper{

while ArrayList1 hasNext(){
string = (string) next;
record = new record(string);
list.add(record);
}

public class Record{

field 1;
field 2;
field 3;
field 4;
field 5;

parseString();

initialiseRecord();
}
 
Ian Hamilton
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe I'm approaching this the wrong way, but some tips/advice on how to approach this project would be very useful...
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ian,

Welcome to JavaRanch and this forum.

I am not sure what you are asking for here. Are you asking for comments on what you have done so far, or are you asking for suggestions for moving on to the next step?

Regards, Andrew
 
Ian Hamilton
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andrew,

I'm asking for advice on how to approach this project.

My approach so far been;

read DB into memory -> parse data -> populate JTable

The next logical step seems to be to implement create,update,delete, find functionality.

However I'm coding without much of a design and I'm aware that I'll probably have to refactor this code as my understanding of whats required grows.

Is this approach ok or should I spend more time on design?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ian,

The SCJD assignment is not a small project, and is likely to take considerable amounts of time. If you plan to do a lot of refactoring then you are going to take even more time than average. This may not be a problem for you, but you should be aware that you may get to the point where you are sick of this project and still have plenty to do simply because the lack of planning caused you to do far more work than expected.

So I would definately recommend spending more time on planning and designing.

You are correct that your next coding steps will probably involve writing the create, update, delete and find methods. That is pretty much a given since the instructions require them . However what do you do next?

Spending some time now thinking about what is going to go into your GUI and your server and how the three sections are going to interact will save you lots of time later. And it may help you to clarify what you want to tackle after you have finished with the Data class.

For example, you have suggested that after reading the db you are going to populate a JTable. But how will that work in a networked environment? How can you work this so that you will require no re-writing of code when you go from a standalone solution to a networked solution?

Regards, Andrew
 
Ian Hamilton
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers Andrew. The problem I'm facing is that it's difficult to make decisions (and then justify them in choices.txt) without understanding my options. i.e. I could choose RMI as my network protocol, but why didn't I choose a simple socket connection?

So to make an educated decision - and to maximise my development as a Java Developer, which is why I chose this exam rather than any of the other Java certifications - I have to implement several solutions for the same problem e.g updating the database directly/updating the data in memory, or using RMI /sockets, before making a decision. The knock on effect of this is an extremely cloudy design

As a result I don't expect to complete the SCJD this month
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To make an informed decision you have to understand the implications of each decision.
That doesn't necessarilly mean you have to implement them all and choose the best one afterwards. In the real world that's almost never done.

If you don't know the technologies involved enough to make such decisions then you must first learn them, which often means building some prototypes and test applications for just those technologies.

Don't think you can do it all in a month. Most people take a year or more.

Also don't think you can do it all by reading a single website or book.
I've purchased quite a few additions to my library for this, and updated some other books to more recent editions.

I started July last year, and am now in the final stages of pollishing up the code and documentation before submitting it.
 
Ian Hamilton
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As a result I don't expect to complete the SCJD this month


a joke. There weren't any [JOKE] [/JOKE] tags available. I'm well prepared to spend as long as it takes and won't be limiting myself to one resource.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic