• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

does it will lead to automatic failure if i don't implement the cookie function?

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,alll
i decide not to send the cookie value to the client side,and hide the lock/create/delete functions from client.so i don't know what the cookie value can be use for?what do you think about? does it will lead to automatic failure?thanks for any response!
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jo. In my assignment there is one cookie value at the beginning of the file and I think (from what I've read) that this is used to verify that the file being read (i.e. the database) is actually the correct format file. Basically U take the cookie value make it into a hard coded constant within your java app and then make sure that when you read the initial header of the database file it matches your hard coded constant.


Paul.
 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think Joe talks about the cookie used in locking mechanism not the very first bytes on the data file.

It doesn't matter how the mechanism you use to get this cookie value, it got to be some value to uniquely identify a client which is doing the critical process on the server. Some mechanism is easier than others. Search the forum you will find one. I have a specific posting on this issue and get 80 over locking using the mechanism I proposed and proved it correct.
 
joe lin
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
I think Andy has got my point,but not all.because i don't want to know what mechanism can be used to get a cookie value.i mean i needn't cookie value at all.this sequence : lock record -> update/create/delete record -> unlock record is done in the server side and surely done by the same client.because the client only invoke one method like book(...).so ,the cookie value needn't be used at all.what do you think?
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Joe,

It sounds like you have hidden the complexity of the locking mechanism from the client. I have done the same thing in my assignment. However, this doesn't free you from the need to use the cookie.

When doing the lock -> update -> unlock on the server side, you should probably use the cookie. If you don't, you probably won't fail automatically, but the grader would have a good reason for taking off points you'd rather keep.
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Joe,

You are correct - in your implementation the lock cookie makes no sense at all (there is a separate argument that the lock cookie makes no sense in any circumstances, but we won't go into that ).

I would still recommend that you spend some time in ensuring that lock cookies are used correctly as specified in the interface comments. The reason for this is that in theory some other class could use your Data class, and would expect it to behave in a certain way, as specified in the instructions. If you ignore the cookie value then another programmer can no longer rely on your Data class.

Regards, Andrew
 
joe lin
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
first,thanks for your reply!
original posted by Jason:

It sounds like you have hidden the complexity of the locking mechanism from the client. I have done the same thing in my assignment. However, this doesn't free you from the need to use the cookie.



Jason,could you explain more detail about that why it doesn't free me from the need to use the cookie?in my implementation i really don't rely on the cookie value.many thanks!
 
Jason Ford
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Joe,

As Andrew mentioned, you should implement the cookie as specified in the interface comments. I agree that it isn't technically necessary. However, it is one of the easier requirements to implement, so why not do it?

Have you ever heard of the Halo effect? You know, where you've convinced somebody that everything you do is great and that you can do no wrong? Well, by doing little things like locking with cookies, you make it a little easier for the grader to think, "Oh, man, this Joe is a great guy."

Now, imagine that you don't implement the cookie. The grader will be inclined to think, "Oh, there's sloppy Joe again. He's always cutting corners."

So, even if you can't think of a good technical reason for implementing the functionality, you should implement it anyway. After all, that's what the interface expects.
 
joe lin
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jason,i think you are right.i will implement the cookie function in my project.i think the grader will smile for this.thanks!
 
Die Fledermaus does not fear such a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic