+ 2
How to think as a programmer? I am asked to make class design structure for given classes names. how can I start this task?
In the end of the java course we were given multiple class names like; promotion, grade, student,major,schedule...ect and asked to make class design structure to describe our institut using java I make some brain storming and try to link together the classes we were given and start coding but always even i blocked and don't know how to use the code i made or i couldn't imagine the whole structure from the top Is there any tips for me? please share
3 Answers
+ 4
Hadjer
The short answer is: you need experience in programming.
The long answer is: you get experience by try-catch problems into solutions. To master a programming language you need > 5 years on hands-on programming. What do you expect to?!
The correct answer: OOP concepts are for human interaction into machine world so us, humans, to understand easier the source code and to code more efficiently. A machine doesn't care about classes and objects. A machine will get a set of instructions (see Assembler).
So, you need to act like a human and think about your classes:
a "promotion" has an integer year, some strings for Professor Names, Colleagues etc.
a "grade" has a string for name of the course, a float or an integer for the value etc.
a "student" has a string for the complete Name, an Address, Skills etc.
Why is this a hard task? To think like a human and not like a machine?
PS: You will never get the things done from the first try. You need to be persistent!
+ 2
Romeo Cojocaru thank you so much for your help
I think it's hard to find what will the code do in the end?
what i will write in the main function?
Is it okay to only store data to these classes using java then print them to the user in main function
Is it a good practice ?
How can i make it professional code?
These questions block me always... is there any course will help to write better codes?
Thanks again @Romeo Cojocaru
+ 2
Besides Romeo Cojocaru perfect answer, use what's true for everything in life: start small and grow in steps.
Main function is where logic happens. Details go in classes and other functions. So start a main function doing just a small part of the project, then add just one class, start using it in main class, and test a lot in each step.
Just like in life, trying too much at a time is too frustrating. Small steps help achieving small victories, which fuels you up for the next step. Eventually, you reach the end.
Small steps, small errors, and small corrections, add up to big lessons.