Ales Moukhine

Greenhorn
+ Follow
since Jul 03, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ales Moukhine

Hi Mike,

Originally posted by Mike Tilling:

does your assignment have this spec

"They take bookings only within 48 hours of the start of room occupancy" ?


Yes, it has.


Is the date field described as follows
"Date available : The single night to which this record relates, format is yyyy/mm/dd" ?


Exactly.


I see that you did not take date in consideration, if the owner is empty than you book the record, what if the date is not within the next 48 hours?


I also book the record if the date is not within the next 48 hours.
User on UI can choose wich records He/She what to see.


-when you book the record, you only provide the custoner ID, what about the new value for the date field, do you keep the same date for ever?


Yes, in DB I has each record for each day, so I only change the customer field when book.

Regards.
Ales'
17 years ago
Hi Mike.

Originally posted by Mike Tilling:

1- What do you provide as parameters when booking the selected record?

I will implement the booking method as follows (Thanks to Edwin Advice):

-On a create operation, I will provide all values including the customer

-The room can be booked if the owner is not empty regardless of what the date (available date) is. If the date is 10/10/2005 (one year ago) and the owner is not empty then the room can not be booked, what the user should do is to unbook the room to reset the owner into blanks or reaffect it to an other customer, the unbook reset the owner regardless of the date value.

in other words :

The booking request will be accepted if (date is today and owner is empty)
Or (date is tomorrow and owner is empty) or (date is after tomorrow and owner is empty).


As a parametr to my business code I provide 'customer code' only.
I did validation only on UI, booking request will be accepted if customer code will not be empty.
But if i try to book a record which is already booked, i throw an exception from Model layer.


3-If date is after today +48 hours and the owner is empty, will the room be ready for booking?



Yes, in my implementation you can book this record.

Regards.
Ales'
[ October 11, 2006: Message edited by: Ales Moukhine ]
17 years ago
Hi
Thanks for congratulations!!
First, few choices:
- Three-layer architecture (Model (Data) layer, Service (Business) layer, View (User interface)
- Business layer placed at server side
- Separate packages for Client and Server UI
- Provide Common package with common components and utilities
- Provide common UI components: AbstractConfigWindow, ClientMenu,
ConfigParamsValidator, StatusBar, Utils
- Provide 3 configuration windows: for server, client alone, client remote
- For server configuration window is main window, after pressing "start" button is disabled.
- One main window for clients, wich has separate dialog for search and booking
- Main window has menu, status bar with info about how many records has been readed, buttons for operations (get all, search, booking, exit) and checkbox "show only with 48h rule" wich is enabled by default.


Few words about documenting,
- JavaDoc
- Comments in code for all methods, and almost all class attributes, some time coments in code
- User help inside application, called from menu Help->help. Writed as simple html file
- design choices (only 8kb of text) has this structure:
1. General choices.
1.1. Design Patterns used.
2.Model layer.
2.1. Lock Manager.
2.2. DB functionality.
3.Service layer.
4. View layer.
4.1. Common Components.
4.2. Client View.
4.3. Server View.
5. Exception Handling.

I thing this information will be helpfull for You

Regards
Ales'
17 years ago
Hi,
This is one of the better news I receive last time

The maximum number of points is 400, to pass you need a score of 320. Section Summary: Section Max Actual
General Con: 100 90
Documentation: 70 70
OOD: 30 30
GUI: 40 40
Locking: 80 80
Data Store: 40 40
Network Server: 40 40
Total: 400 390

Thanks All of YOU on this forum, for answering questions
And good luck - who wait for results !!

Best regards
Ales Moukhine
SCJP, SCJD
17 years ago
Thank you for answer.
Gratulation - this is very good score !!!

Originally posted by Peter Jakobsen:
But always document your design choices, this is a major design choice, and the pros and cons should be discussed in your documentation.



English is not my primary language, what do you mean by 'pros and cons'?

Regards,
Ales'
hi ranchers
good to see someone, who did it on the server side and passed

I also have business on the server side.
How did you managed that requirements in "What you must do" section:
"Network server functionality for the database system"

I understand that, i must provide two remote interfaces, one for DB layer and other for business.

Peter, how much points did you receive for your design?

Regards
Ales'
Hi.
I agree with Roy:

Originally posted by Roy Mallard:
OK I've had a quick look at it...kind of hard to understand since you don't describe your locking strategy.
That synchronized (lockObject) line looks a bit suspicious. Are you sure there will only ever be one lockObject object for each record? What happens to the lockObjects when a record is deleted/created?


and Peter :

Originally posted by Peter Jakobsen :
You are using a HashMap to store locks. HashMap is not thread safe, so you need to exclusive access, when inserting locks in your lock handler. From what I can see, it looks like to threads can lock different records, and thereby modify the HashMap simultanously.




May be it would be better do synchronize in lockHandler.lock() on hashmap?

Next, I don't understand why do you have synchronized block in Data.lock() for?

Regards.
Ales'

Originally posted by Tony Bouer:
I can't see how this code is going to solve the issue I raised. If you are on the waiting state and receive the "go ahead" (the recNo is not locked anymore) so you should verify again if the record still valid or not. It could be deleted or updated with an owner making it non availble for update or delete.

Regards,
Tony




Hi Tony
In example code there is "checkRecForBook(rec);" in try block.
this method throw an exception if:
- we can't booked this room because it just booked by someone else.

So now we must only handle this exception and show user the message.

This is my proposition, but i haven't yet SCJD certificate

Regards.
Ales'
[ August 16, 2006: Message edited by: Ales Moukhine ]

Originally posted by Daniel Bryant:

1. Client A Locks Record 1.
2. Client B attempts to lock Record 1 - waiting
3. Client C attempts to lock Record 1 - waiting
4. Client A deletes Record 1
5. Client A unlocks Record 1 - notifyAll()
Now if you don't check if the record is deleted in your locking code how do client B and C deal with this? do they lock a non-existant record (and does this make sense-could this impact another thread creating a new record), or does only one client recieve notification and the other thread waits indefinitely?



Hi Daniel,
Thank you for analyzing my piece of code
In my code, after lock() method folow method read(), wich throw RecordNotFoundException if record was deleted.
So after point 5, for example:
6. Client B Locks Record 1
7. method read() throw RecordNotFoundException for Client B
8. Client B unlock Record 1 and notifyAll()

I don't think that locking code must knows what it locks exactly, we create lock for some number, but we don't know that this is room record, and it can be in delete/undelete state.

Can you write links to posts you found?

Regards
Ales'

PS. Sorry for not answering so long, I have a little vacation
[ August 16, 2006: Message edited by: Ales Moukhine ]

Originally posted by Tony Bouer:
I think it's strange to follow the reqs without taking care of this situation. Anybody has any comments on both cases ?

Any help would be fine !



Hi ranchers,
what do you think about this piece of code

I think it's pass yours examples.

Regards
Ales'

Originally posted by Mark Linese:
Are you checking for the record validity (non-deleted / non-owner) after a wait inside lock method ?



Hi Mark,
I don't think, that checking for the record validity inside lock method is a good idea. In my implementation i separate locking/unlocking code from implementation of the DB (my lockManager don't know anything about what it locks).
I check delete-validity of the record in read method, wich i call after lock.
my busines.book() :


I'm still in progress with scjd, so I don't know exactly is it good for Sun

Regards
Ales'
Hi Daniel,

I hope I know how "well coded" look like

In instruction I have "A clear design, such as will be readily understood by junior programmers, will be preferred to a complex one, even if the complex one is a little more efficient. Code complexity, including nesting depth, argument passing, and the number of classes and interfaces, should be reasonable. "

But providing caching will be "more more more efficient" not "little more efficient".

But thank you for reply

Regards
Ales
Hi ranchers,

I'm almost close my DB module, now doing some tests.
Size of example DB file - 6k.
And dbEngine can serve 600-800 find/read/delete/create/update operations per sec.
with 10 concurrently users. (Pentium M 1.7Gh).

First question is it enough?

Next I notice that with 2M DB file, 10 concurrently users can do only 10-15 operation per sec.

I know where is the problem, but I decided to not implement cache functionality.

What do you think is it important for those who will mark assignment?

Regards
Ales'

Originally posted by Al Purvis:
Thanks all. Based on the results of this thread I passed today. It was only a couple of minor changes and I got a 371/400. Most missed points were in the GUI.
Hope to see you in the SCEA.



Congratulation !!!

Did you correct only application start dialog ?

Good luck with SCEA

Ales'

Originally posted by Mihai Radulescu:

I propose you an other method name for your "findWith48hRule....



I agry, I named it that only for discussion

Originally posted by Mihai Radulescu:
What you understand by business rule ?


Business process contain one or more business rules,
By business rule I understand how I must do some part of bisness process (business transaction), but not talking about how I get data or save it. For example (not exactly from assignment), "booking" process :
1. lock entities
2. change and update hotel entity
3. change and update room entity
4. create and insert new record into history
5. change and update client entity
6. send mail to manager
7. unlock entities

where all positions are business rules

Please ask, if it's confuse

Regards
Ales'
[ July 13, 2006: Message edited by: Ales Moukhine ]