Nikolay Petrov

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

Recent posts by Nikolay Petrov

That's a coin toss, or an educated gamble. Making a class a factory for itself is kind of a "least possible effort" design for the chance that you might need a factory. If you're more sure you'll need one, or already know that's your plan, go ahead and make a nice purpose-built one.

On the other hand I think that making one class factory itself breaks one of OO principles, i.e. the SRP (Single Responsibility Principle). I mean that in fact this class is starting to do 2 separate things: 1) Work as calculator and 2) Work as factory.

Could anybody please tell me what is the difference between component and module? I've searched through google but did not found anything specific. As I see it both are independent pieces of software made for some purpose but the module is actually bigger. I mean that the module could be composed of some components for instance.
I know this package very well. But I'm not sure is it ok to use it in my assignment and that is why I don't. On the other hand until you know how to make something I don't advise using it. I mean that even if the package is there I must know how its working.

You could also use synchronized on you record storage. I mean all operations like find/delete could be placed inside synchronized block.
I don't keep DB in-memory. I have record object and its alone is responsible for performing all operations. This gives me the opportunity of not to lock the entrire DB when I do some operations.

After a little brainstorming on this I came up with idea of read/write lock(gate). As I picture it this means that I have an object with following methods:
I target here the following things:
1. When you perform lockRead all lockReads are passing, but lockWrite is waiting until unlockReads are executed.
2. When you perform lockWrite all other threads should wait until unlockWrite is executed (this includes all lockReads and lockWrites).
I have synchronization on DB file level. This means that it is imposible to write/read simultainiously and therefore its imposible to corrupt the data on this level. The issue I was directing is a little outside the scope of the assignment. I mean that the other layers are accessing DB in a given order. For example:

The problem is when you are writing an application that will give the possibility of the client to execute operations from different threads. I mean that it could be possible to lock record from Thread1, than perform modification of the record from Thread2 and unlock the record from Thread3.
In this case the it is likely the two situations I've described to happen.
Hi All,

I'm working on URLyBird 1.2.1 task assignment. I'm curious about how you deal with these two types of synchronizations (if it is applicable to you assignment of cource):
1. Should we support dirty reads. This means that in some cases read record could be executed simultainiously with update/delete and therefore the client will receive wrong data. The cure for this could be to make read/update/delete methods synchronized and thus not allowing records to be read/modified simultainiously (I have separate record object which hadles these, and there is not worry when read/modify different records)
2. Another one is that it is possible to modify/unlock record simultainiously. Again the cure here is to make all of these synchronized.

My method isRecordValid never returns false. If the record is valid, it will return true. Otherwise, it will just throw a RecordNotFoundException.

In that case do not declare it to return boolean


Your user interface should be designed with the expectation of future functionality enhancements, and it should establish a framework that will support this with minimal disruption to the users when this occurs.


The thin client does not do this. Any enhancement to the capabilities of the client would require modifications be made to the server and possibly all existing clients.

The requirement does state this but for GUI. As I understand it this part SUN are talking about GUI functional enhancements. The guys from URLyBird will need to hire a programmer in order to do these. So he could also do the modifications in GUI's facade.

With the fat client approach the server has all the functionality required to provide access to the data and thus an enhanced client can run concurrently with the older version of the client. I actually have several client programs that can access the same server. The maintenance and testing client allows all database actions, inuding locking a records and leaving it locked.

With this I'm totally agree on the other hand