• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Starting with SCJD

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody,

I received the assigment for the SCJD Java 5 today.

But now i'm having problems with starting. I hope you guys can help answering a few questions.

1. How do I start best with the assignment: Do I start from the GUI and develop from there all that is needed, or do I start with the interface I received from SUN?

2. I'm having big problems with SUN's interface. Let me explain with an example from the interface:

How stupid is this interface, do I have to put an fa�ade or so before this interface so my code works with Collections and Objects instead of array's and id's of records?

3. How do you start with the random access file? Is there a good site or post on the forum, where this topic is cleared out (thinking about concurrency and stuff). And perhaps the most important, is there an editor or so that I can use to read te file?

Thanks in advance.

Greetz,
Kim
 
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kim Lauwers:
I received the assigment for the SCJD Java 5 today.



Hi! Welcome, good choice and good luck!


1. How do I start best with the assignment: Do I start from the GUI and develop from there all that is needed, or do I start with the interface I received from SUN?


Different people probably have different approach.
I'll speak for myself. I divided (mentally) the project into 3 sections:

- Data (layer if you will);
- Business/Services/Facade/RMI;
- GUI;

That is also the order I followed. I spent about 1 month on the Data class itself. I find that from bottom-up, you don't have any dependencies. However, when you code your GUI, I find it much easier to rely on a 100% reliable Data layer. The same goes for the Business/Service layer, which took me about 5 days to complete. I spent about 3-4 weeks on the GUI.

But, again, I think it's worth spending a lot of time on the Data class, setup all Exception correctly, write unit test, try thread scenarios...


2. I'm having big problems with SUN's interface. Let me explain with an example from the interface:

How stupid is this interface, do I have to put an fa�ade or so before this interface so my code works with Collections and Objects instead of array's and id's of records?



As a data layer, it is pretty dumb. You can certainly (I used the Business delegate pattern) put a facade for it and use it from your GUI. However, it won't change your assignment and the fact that you must implement all the features in your Data class.


3. How do you start with the random access file? Is there a good site or post on the forum, where this topic is cleared out (thinking about concurrency and stuff). And perhaps the most important, is there an editor or so that I can use to read te file?



If you look for "RandomAccessFile" on the forum, you'll find infinite source of information on it
You could read posts like this one: NX: Notes on a design that passed 389/400 to give you an good and quick overview.

bye,
Alex
[ April 05, 2008: Message edited by: Alex Belisle Turcot ]
 
Kim Lauwers
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alex thanks for the input.

But I'm having really difficulties with how to read the database file, that is provided with the assignment.


RoomRecordReader.java

Room.java



And if I use a testclass to print the output of the file:


But I get a none clear output, so it seems that i'm reading my file incorrect.

Can someone assist me with this?

Thanks,
Kim
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your main you create a new Repository and then immediately call readRecord which reads the first RECORD_LENGTH bytes of the db file. Read your instructions again carefully, what are you really reading in?
 
Kim Lauwers
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Mike,

My code isn't nice modelled, I'm just trying to find out how to read my databasefile.

In my interface I need to implement I have the method:
public String[] readRecord(long locationInFile)

So I assume that this String[] contains all the fields of one record.

But I just can't seem the read the databasefile correct.

Greetz,
Kim
 
Mike Bailey
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your problem doesn't have anything to do with the format of your code.

You're reading the file just fine... but what actual bytes are you reading from the file when you call readRecord on a newly created repository? Look at your instructions again, especially the database schema section.

I would say your assumption about the interface method readRecord and what it should return are correct, however this doesn't have anything to do with what you're reading in your code.
 
reply
    Bookmark Topic Watch Topic
  • New Topic