Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
- understand the problem.
- devise a solution that addresses the problem.
- architect an application that implements the solution.
- switch your computer on. -
monkcs5464yFor me it helps to first print the assignment instructions, to be able to highlight important parts. I’m not always writing all the logic on paper per see, but writing up abstract parts of how I’m trying to solve the problem. Like if it object-oriented, get som names of the classes I’m probably have to implement, instead of keeping it in my head.
Git is also useful to use even by yourself, to make it easy to stash away code and try out some new idea without the pain of having to save away older versions. -
Voxera113884yI always start with pen and paper to sketch out information flow and then the main objects that will carry said information.
After that it all depends on how complex it is going to be.
But staying out of the computer to begin with help with keeping focus on the important structure and not implementation details. -
gammalost04yI usually start with all of the h-files and then try to explain it all in two pre and post comments.
//pre: this is what the function needs
//post: this is what the function does
Not sure if it's a good way of doing it, but that's what my OOP-course taught me -
My process is sth.like:
- think about the problem in general. What is the final goal?
- find the entry point (web request, cli input, scheduled job, ...). When does your logic start?
- Split the problem in independent tasks/components.
- Find data flow between the components. (what data goes from. where to where? concurrent? sequential?)
- Implement.
Usually I plan this out by writing class and function Signatures with comments in the body what it does. Or, for more complex tasks, I make quick, dirty and syntactically wrong UML diagrams keep things ordered in my head. -
monkcs5464y@Katakompe I agree, the UML diagrams one does are ALWAYS syntactically wrong haha 😅. People who does them right are weird
-
split problem into smaller pieces, solve small piece one by one. The rest will come. Think of it as journey, you will not figure it out uiless you find the way how not to do it.
So after a few struggles on my current uni assignment I’ve come to the realisation I need to change the way I write code, or at least the way I think about the code before I start.
I have a tendency to rush into coding something before I’ve planned it out properly, and over the last couple of days stupid mistakes on my part caused hours of stressing.
Are there any good methods for sitting down and planning stuff like this out, or is it just a case of getting some paper and a pen and writing out the logic etc in whatever way makes sense to you (me)?
question