Java classes help

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2008
Posts: 5
Reputation: esmeco is an unknown quantity at this point 
Solved Threads: 0
esmeco esmeco is offline Offline
Newbie Poster

Java classes help

 
0
  #1
Mar 30th, 2008
Hello!

I have a project in which I must simulate a blog application,with users' post mangament.
These are the requirements:

A blog has a title and a collection of posts.The posts have the following information:

-author
-data
-title
-text

Each post has a code thet is generated automatically and which acts like the serial number within the speciality the post belongs to.
The speciality are:

-Information:This's a post with just text and an answer is forbiden.
-Version: It's a post of an information's version that gets updated.
-Debate: this's a post containing information and accepts one or more answers.
-Answer: It's an answer to a specific debate.

The program must support the following operations:

-Ask for User login identification(no password involved) to later use as the author of given posts.
-showing information about posts.
-create new posts.
-create new blog.
-store blog in hard drive.
-load blog.


Here are my classes:


  1.  
  2. abstract public class Post
  3. {
  4. private Date date;
  5. private String author;
  6. private String title;
  7. private String text;
  8. private int code;
  9.  
  10.  
  11. }
  12.  
  13. public class Infor extends Post
  14. {
  15.  
  16. Version ver;
  17. }
  18.  
  19. public class Version extends Post
  20. {
  21.  
  22.  
  23. }
  24.  
  25. public class Debate extends Post
  26. {
  27. Version ver;
  28. Answer ans;
  29. }
  30.  
  31. public class Answer extends Post
  32. {
  33.  
  34. }
  35.  
  36. public class Blog
  37. {
  38. String btitle;
  39. Post pst;
  40. }


Does this look ok?Does it need any more specification?
Any help is very appreciated!
Last edited by esmeco; Mar 30th, 2008 at 12:53 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Java classes help

 
0
  #2
Mar 30th, 2008
no.
Author should be a class of its own, containing name, password, userid, etc. etc.
Debate should not contain an Answer, but a Collection of Answers.
A Blog with just a single Post is useless. A Blog with a Collection of Debates could get interesting.

That should give you a start
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 5
Reputation: esmeco is an unknown quantity at this point 
Solved Threads: 0
esmeco esmeco is offline Offline
Newbie Poster

Re: Java classes help

 
0
  #3
Mar 30th, 2008
Well,shoudl a class for authro really necessary?It's because there won't be any password storing and any else details,just the user id which will be in concrete the name of the author that will be associated to the post.

How would it look like a "collection of" in terms of my classes?Should it be represented within the classes?
Last edited by esmeco; Mar 30th, 2008 at 10:45 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Java classes help

 
0
  #4
Mar 30th, 2008
learn Java... Your last question especially shows you're not ready for a project of any size whatsoever.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 5
Reputation: esmeco is an unknown quantity at this point 
Solved Threads: 0
esmeco esmeco is offline Offline
Newbie Poster

Re: Java classes help

 
0
  #5
Mar 30th, 2008
I perhaps misformulated my question!
I know java has collections like lists,arrays,vectors,etc.
If I'm not mistaken,for example,I could make a vector of post objects that would be associated with the author name and a vector of debate objects associated to a vector of answer objects.
Regarding the Infor class I could make just an array of Infor objects.
Would this look ok?
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Java classes help

 
0
  #6
Mar 30th, 2008
it's hardly ever appropriate to use arrays, unless you can know for certainty at their creation that you will never need to change their size or when you need to pass them through for example a web service.

Vector is deprecated, use a List implementation instead (ArrayList for example).
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC