i have tried
putting the attribute in a list but it only says get index
i have tried to make set methods too but my mind is blank
and by the way comment also on the program if its Object Oriented or no.
thanks a lot more power to this forum
and lastly i have not run this program yet since i am stuck in retrieving a specific object so i do not know if the rs.executeQuery() in loadItemsToList() will work
just fine or if its even possible
joseph dela cruz wrote:and by the way comment also on the program if its Object Oriented or no.
The fact that every method and field in your class is staic would definitely point to it being NOT object oriented. The clue is in the name - object oriented programs will most likely make use of objects - you never create any.
Never never never write more than 2-3 lines before compiling and testing. This CANNOT be stressed enough.
Do not write a second setter until the first one works.
I probably wouldn't write any setters until my getter works.
ok, i may write them in pairs, but if I did, my first go at the setter would so nothing more than set exactly what is passed in. once that worked, i'd start adding the logic (if needed) to validate the data a piece at a time.
joseph dela cruz wrote:if ill make a different separate class that has separate file then it would be too bulky please help me
No. It will NOT be "too bulky" if you do a proper object-oriented design and use two classes. It's hard to say anything nice about the idea that you have to put everything in one class, so I'm just not going to say anything about that idea at all.
Bear Bibeault wrote:
joseph dela cruz wrote:and if ill make a different separate class that has separate file then it would be too bulky
This is an attitude that you need to unlearn, and quickly!
so separate file is better than nested classes? or non static Object class plus nested class within is ok or i should really make separate files? and also when to use nested classes? anyway thanks ill try to unlearn the bulky thing as soon as possible
Greg Brannon wrote:
and if ill make a different separate class that has separate file then it would be too bulky
When does software or source code become "too bulky?" From where did you get that idea?
it is when you have to do extra clicks anyway thanks for the comments i am really below beginner level
Junilu Lacar wrote:This is what is called a "Big Ball of Mud" - everything is lumped together into one class. I don't think you should even try to hit a database right now. Get the basics right first. What you have is not very OO.
yeah but my two subjects now requires database and one is case study i guess this is the price of not studying my previous subjects seriously im stuck in a big ball of mud
i have already hit the end of the tutorials i want to further my knowledge Kabayan junilu do you have small oop sample that i might have to look at its ok with me if you will empty methods just like on your old example before
1. First, start with the core classes - identify the entities that you want to model as objects
2. Identify what each class is responsible for in the overall system - one class: one responsibility
3. Identify other classes that each class will work with to accomplish a task
4. Databases and data storage are infrastructure concerns - worry about those later
5. User input and display are presentation concerns - worry about those later as well
As Fred advised earlier, test each bit of functionality as you write it. Only build out more functionality as get everything you have so far working.
So, to start you off, what exactly is the problem you are trying to solve? What is this program all about? Tell the story from the point of view of the user who will get a benefit from your program. Remember, the user doesn't care about databases or objects or classes. He cares about getting something done. What is that "getting something done?"
joseph dela cruz wrote:yeah but my two subjects now requires database and one is case study i guess this is the price of not studying my previous subjects seriously...
The partygoers lament. Sorry chum, can't help much except to say: been there, done that; got the T-Shirt.
If your latest project/case study involves a database then you need to look up the tutorials for JDBC PDQ...and there's a lot to read.
And, as Fred says, writing a hundred lines of code and expecting it to work first time is stupid (and again, I say that as someone who's done it).
I'm not so sure about his 3 lines of code, but a method? Certainly. That deals with a database? Duplo-certainement-absolutamente.
Write a database connection method. Test it. Does it work? If yes -file it; if not - find out WHY NOT before you write another line of code.
And do the same thing for everything you write; otherwise you are doomed to a life of trawling through stack traces in search of the 'embedded bug'.
considered big ball of mud already if yes then char return type is preferred? because i have done that numerous times in my previous programs