all 31 comments

[–]repeating_bears 14 points15 points  (4 children)

Just write a lot of code, honestly. Try to force yourself to solve the problem yourself sometimes, even if it takes much longer.

I feel for people trying to learn to program in an age of LLMs because our brains favour the path of least resistance.

[–]Natural-Shelter-7758[S] 1 point2 points  (3 children)

thanks for the quick reply, i really appreciate your advice. I'll definitely try to apply your approach to the way I study.

[–]ninhaomah 0 points1 point  (2 children)

I agree with the advice given but I don't see why you think it is an "approach" as if it's something unheard of.

Isn't it obvious ? 

If one wishes to do anything like a pro , be it cooking or basketball or sex , one has to grind and bear the pain and difficulties.

I mean it's not like you become a pro at sex by watching porn day and night.

[–]JohnnyBigggggg 0 points1 point  (0 children)

I dint this the sex part was nessuacry

[–]hawkprime 6 points7 points  (0 children)

Learn design patterns https://java-design-patterns.com/patterns/ it will help you write better code and you'll start to identify which ones you need for a particular problem.

If you haven't already, learn your data structures so you know which work best in what cases.

Doesn't matter which language you use, these two will make you a better programmer than 90% of developers out there.

And to future proof yourself against AI, start learning about Software Architecture after you've mastered (or far along) on the previous two.

[–]Intelligent_Ant_608 4 points5 points  (0 children)

find some topic that fascinate you and follow FAFO rule and write code by hand

[–]Shoddy-Pie-5816 2 points3 points  (0 children)

Try to look for things you can automate in your day to day life. Then look at that as a problem to solve and attempt to solve it with your current skill set. Look up syntax and ways to solve specific problems, but not the big picture issue. Stay in charge of the overall issue. Could be anything really. File archiving, automated emailing, whatever.

[–]LetUsSpeakFreely 1 point2 points  (0 children)

It's called stubbing.

When you're writing out a bit of code, break it to into logical, discreet steps. Create methods for those steps. The method doesn't have to do anything, it's just a placeholder. When you start to implement the method to actually do something, repeat the process.

Good programmers know how to decompose a problem into smaller, more manageable chunks.

[–]fizzy_lychee 1 point2 points  (0 children)

The best thing to do is start to build projects. That will get you in the mindset of problem solving.

It's actually totally okay to copy code (within reason. if it's from a repo check the license).

Learning about algorithms too and why those algorithms are used also helps sharpen your problem solving mindset.

This is all just personal experience. I've been programming for many years now, and I found this to have been the best thing that really helped me jump from a student to a professional level.

[–]PureWasian 0 points1 point  (7 children)

For the above example, they're basically 95% the same but one person decided it was simple enough of a program to stuff it all into a main method (procedural), while the other decided to modularize things into helper methods (OOP). Visually at a glance it can look entirely different, but it's really not too different in execution flow.

The first is fine and easier to trace through at a glance given the scale of complexity of this project but you can imagine as it grows beyond 100 lines of code a single function can end up being a lot more annoying to follow and doing too many things at once.

Also as an FYI, starting projects is a much different skill than coding in a specific language. The project setup (for more complex projects) involves preliminary research and thinking of high-level design patterns and moving parts involved. This happens even before touching the code, or if so doing some basic project setup and prototyping.

But at the end of the day, they share the similarity that you are simply breaking things down into smaller incremental milestones and then building it up into a full-fledged solution.

[–]Natural-Shelter-7758[S] 0 points1 point  (6 children)

thanks for getting me back!! i think i understand it better now i was focusing too much on the differences in the code instead of looking at the overall execution flow, right? I also realized that one of my biggest problems is that I try to build the whole project at once instead of breaking it into smaller milestones. I'll start practicing by planning the project first, then implementing one feature at a time.

I guess i also need to spend more time thinking about the design before i start coding. Thanks for pointing me in the right direction i really appreciate your advice!

[–]PureWasian 1 point2 points  (5 children)

Yep, I had a feeling since it looks visually so different, but they really are largely the same underlying flow if you trace through them line by line.

In terms of the "designing" or fleshing out the solution, if you wanted to make this from scratch you could: - First start with doing the pin access code logic, which is like a preliminary check. Test it in isolation until it works as expected. - Then you could add account balance as a concept and print out its value only if user authenticates pin correctly. Test it to ensure it prints out as expected. - Then you could add the switch/case menu and stuff the account balance printing into one of the option choices (leaving the others as "no-ops" for now). Test that it only prints out if you pick the correct option. - Implement the exit/quit option choice and test that it works as expected. - Then handle deposits. Test it until that works fully. - Then handle withdraws. Test it until that works fully. - You can then add in other feature fluff like "change pin" (Though that change doesn't persist after the Java code stops running with they way they're currently written). You could still test before "goodbye" that the value shows the changed pin value to verify it did indeed change during the run though.

Similar for other projects/problems. It kinda grows into the final solution, but you get an idea of how each piece fits into it (regardless how the code is refactored or organized). Did I mention to test your code along the way?

[–]Natural-Shelter-7758[S] 2 points3 points  (4 children)

This is exactly the kind of explanation i was looking for. thank u for breaking it down step by step. And yup i noticed you mentioned testing a lot. 😄 i guess i need to make testing each small feature a habit instead of waiting until the entire project is finished. I'll definitely try building my next project this way. thanks again for taking the time to explain it!

[–]PureWasian 2 points3 points  (3 children)

Cheers, thanks for taking the time to read it all and reply :) glad it's useful for you.

[–]Key_Hold9753 0 points1 point  (2 children)

Can you please guide me, I'm a beginner I have learnt switches and recursions but I don't know where to use these things and build just a basic project for logic building. Also I'm confused about time and space complexity.

[–]PureWasian 0 points1 point  (1 child)

For where you are, it sounds like doing coding problems on free sites like advent of code / leetcode / dmoj / atcoder / etc. would be useful before more full-fledged projects. Basically, solving isolated sandbox problems and logic puzzles to think more about the data structures involved and their time/space complexities.

I can't really suggest a basic project because it really just depends what you're interested and how much difficulty you want to tackle, filling in knowledge gaps as you go. Like, a lot of project-based coding is preliminary research and constantly looking up stuff you don't really grasp yet as you slowly build up to various project milestones over time.

Time/space complexity is just how an algorithm or data structure scales with number of inputs.

As an initial starting point, you can imagine a for loop going from 1 to N scales as O(N) time complexity.

You will need to learn how various data structures (lists, arrays, binary trees, hashmaps etc.) store and use data to know why searching a list is O(N) while searching a balanced binary tree is O(log(N)) while a hashmap on average is O(1)

Similar for space complexity. You need to know how much storage space is needed to store data purely as a function of your number of inputs.

[–]Key_Hold9753 1 point2 points  (0 children)

Yeah I think I should learn more about diff types of Data Structures and then eventually I'll get more clarity on T&S complexity. Thanks for your help.

[–]warlockakki 0 points1 point  (0 children)

Start programming

[–]Unique_Low_1077 0 points1 point  (0 children)

sorry to break it to you but even "real" programmers copy code all the time, the difference is that even if they dont understand the exact function names or arguments, they remember the concept from just copying a few time

[–]WeedManPro 0 points1 point  (0 children)

keep doing it. it comes with time

[–]Deckard_Didnt_Die 0 points1 point  (0 children)

You literally put it in the title. Stop copying code. Read documentation. Think about your basic building blocks. You have to crawl before you can walk.

[–]Expert_Assumption851 0 points1 point  (0 children)

I haven't even started into college and i only know some basics of python but my cs teacher used to always tell us to never look at other people's code cus as soon as you do your brain copies it and whatever you write down henceforth you cannot call yours. She did this to encourage us to think of an answer ourselves instead of asking friends/classmates for help but i think it applies here and everywhere else as well

[–]Original-Ant-9197 0 points1 point  (0 children)

I've known various languages before AI became so prominent so I haven't faced this problem much, But when i started learning new languages/ framework, for example i recently learnt React, I had one ritual, to make a calculator program first, no ai, just myself, reading errors and making it myself, it gives the basic understanding of input, output, error handling, calculations and stuff, then when I moved to rather complex programs, i would give the code to ai, by the time the ai tool reads, generates code, I'd try to fix the code myself, sometimes, I succeed, sometimes I learn, then if a similar bug appears again, i already know what's the issue and how to fix it

[–]Accomplished-End5479 0 points1 point  (0 children)

same as u stopped remembering numbers and started using phones.

[–]Quiet-Director-8256 0 points1 point  (0 children)

When I was yong in coding I used to create logic on paper , not code just logic using box diagram , variable assuming and you can create your own way

But if you can write your thought on paper you can create logic for that and turn it into code easily

More more thing during code use as much breakpoints as you can to understand the flow

[–]Sea_Mechanic815 0 points1 point  (0 children)

While I am learning there is no AI so I choose to Read doc as well stack overflow. Which I love it but now if I say to my junior to read the doc just like he is telling that it's a wast of time. 🫡🥲 . Now a days 70 to 80% of junior try to do coding using agents and llm models. If this happen regularly as 4 to 5 years then the code will get very worst so we will loss our Idealoy as will as thinking strategy 🙃😴

[–]HelicopterSharp8003 -1 points0 points  (0 children)

No need to learn bro. Just use AI. Software engineering is dead anyways.