Cant do programming exercises. Are they must have for learning?
Posted by Jureczeg0@reddit | learnprogramming | View on Reddit | 64 comments
I can do few of them but really easy one but it doesnt matter if they are from book (automate the boring stuff) or from codewars etc. im just too fucking stupid for almost any of them. Are they really THAT neccesery for learning how to program feature projects?
desrtfx@reddit
How will you be able to solve complex problems if you can't solve simple ones?
You need to practice. You need to work your way up from simple to increasingly more complex.
Budget-Isopod-5349@reddit
this is the problem, there is no such thing as simple or complex one. In end it only took some 350 pages to prove 1+1=2
MissinqLink@reddit
I can’t turn the pedals. Are they really necessary to ride a bike? -Literal logic of my 4 year old
RedRedditor84@reddit
Not if you always go down hill.
NewLegacySlayer@reddit
Lol does that mean ai is a car?
No need to learn how to ride a bike if you can drive
PurpleSparkles3200@reddit
Only an American would say something like that. In other parts of the world, people who have cars often ride bikes.
C0rinthian@reddit
lol ai might speed up your boilerplate, but if you don’t have the expertise to properly prompt AND verify the output, you’re cooked.
allium-dev@reddit
Question for you. When you're reading automate the boring stuff, are you doing it with a python REPL open, typing in every line of code the book shows you? If not, start again from the beginning and do that.
One thing I see a lot from beginners is they're not running code nearly often enough. They get an idea that they have to write a whole working solution before running any part of it. Then they get frustrated when it spits out all sorts of errors.
I've been a working developer for over a decade, and I constantly run individual lines of code to make sure they're doing what I want. Often, I'll pull out even smaller sections than one line.
A lot of people are recommending practice, which is good advice, but I would suggest trying to practice at a microscopically small level first. On the order of one line or expression at a time in the REPL. I think it will really help you solidify your knowledge and is a helpful practice long term.
NetRunner333@reddit
I'm a beginner too and in my class there's a lot of people who do not know how to use the debugger of the IDE... I'm one of them and i saw a lot of videos trying to explain it but i really don't understand it, Is there any advice i can take to run code and analyse it? I really want to get my degree and your comment took my attention because, that's my problem, I don't run my code and i know that's bad, but, how can I solve this?
allium-dev@reddit
I largely agree with numeralbug. A debugger is a very powerful tool, that will be very helpful when you're working on larger projects but for now just the basic "run" button in your IDE and print statements are probably enough.
At this stage, if you feel like you're not running you code enough, and you're using a compiled programing language (one without a repl), I would give you three tips to run you code more:
Create a second "test" project that starts with just the "hello world" stucture and use it to try running short snippets of code as you go.
As you write your code, make sure it compiles and runs after ever small change. Click that run button constantly. Even if you're not done, getting into the habit of having it running will help. This may mean you write your code in a slightly different order.
As you're writting code, put printing/logging statements all over it. Print out the value of variables, or even just "got to line 123". Over time, you'll develop a sense for what makes a useful print statement for debugging.
Good luck!
numeralbug@reddit
This may be an unpopular opinion, but: I don't think it helps beginners to learn how to use a debugger at the same time as learning the basics of their language. Modern IDEs are incredibly complicated and contain hundreds of tools, and are designed for professional developers working on projects consisting of thousands of files. Beginners need to learn how to analyse their code *by eye* first.
Do you know how to compile and run a hello world program in your language? If so, then that's all the tools you need for now (until your teacher introduces something new). If not, then you have more fundamental problems than debuggers.
NetRunner333@reddit
Thanks! That's a very eye opening comment to read, then I'm going to try my best to keep going and get that degree
POGtastic@reddit
One extremely annoying tendency that they'll do is to write some code and ask "Is this right?" Run the code!
allium-dev@reddit
I don't find it annoying necessarily, it's a different mindset. In most subjects you don't have the ability to check if you're correct without consulting an expert. In software we're uniquely lucky to have access to an "expert" in the form of the compiler / interpreter. Some learners just haven't realized that yet.
The learners who I see being most successful are the ones who are constantly experimenting. They run into error a lot (like all of us!), but they learn from the errors.
I find it also helps to take a value-neutral view of getting an error. Before running a line of code, come up with a hypothesis for what it should do, if you get an error, it's not a bad thing it's just evidence for or against your hypothesis.
ActiveSalamander6580@reddit
My first reach would be unit tests, unless you're going to keep rewriting those lines of code to make sure you didn't induce an unwanted side effect or behaviour.
RazarTuk@reddit
Yep. Like when I did Advent of Code this year, there was a lot of intermediate output. It was comparatively rare that I would just write something all in one go
HolevoBound@reddit
You aren't stupid. You just need to practice.
rab1225@reddit
Try a different approach to them.
I encountered those before. Turns out it is just my brain.
My brain doesnt like to solve things that are just numbers and symbols.
i was bad at normal math.
but i was excellent in physics and chemistry even if they have math.
it was the same to me in programming. so whenever i encounter stuff that are just math problems, i turn them into something tangible or can be used in real life.
try that as that might have just been it.
armahillo@reddit
It sounds like you might meed to spend more time on the concepts in those exercises
C0rinthian@reddit
You’re not “too fucking stupid”. Fuck off with that self-sabotage.
Can you program a feature project? If yes, then they aren’t necessary. If no, then you need to learn more.
Buntygurl@reddit
Stop with the bogus resistance and make a decision about whether you want to learn or not.
Unless you are already producing applications that the world cannot do without, then, yes, you do need to that work, in order to learn.
Buntygurl@reddit
Read other people's code, starting with what it produced and ask yourself how that happened, and then work back to see how they did it. There's an abundance of free source code that's easily accessible. Get familiar with a debugger of your choice, load the code and observe what happens.
Focusing too hard on how to get to a result from square one is always daunting.
Turn it around and follow the path from the end back to the start.
Coding is just a tool that translates what you want to happen into demands. requests and commands to make that happen. It requires proficiency in a certain language, just as getting the order you want in a restaurant in a foreign land is far more likely if you speak the local language.
To do that, you have to learn that local language and forget about how you think that it should be. It doesn't matter how you think that it should be because everyone else there gets the job done in the best way that works.
Stop thinking that you know better. Suspend all of your resistance and let the environment around you teach you the language that you need to get the order that you want.
summonthejson@reddit
What I guess is that you are trying to do these challenges on your own with limited usage of help or at least considering that it's the goal.
So here's a treat for you: absolutely no professional programmer is able to do majority of challenges without help.
Instead of focusing on doing them on your own, use all possible resources you can. AI, videos, documentation, whatever gets you to the solution. This process of going from "i dont have f*** clue" to "i made it" is actually what programming is about.
You don't have to worry about not being able to do all challenges. Or understanding what you actually did. It's just a fun way to experience the code with good approach. The understanding will come with time just like puzzle falling into the right places.
KoyaAndy18@reddit
is there a set of questions in leetcode but for php. i tried navigating study plans and i cant seem to find one that is specific for php
rustyseapants@reddit
Get off reddit and think "Do I really want to learn something new?"
MeepleMerson@reddit
They are necessary. They are the simple problems whose solutions allow you to solve more complicated problems. If you don't master the basics, you simply can't proceed to the more general and practical aspects of programming. Your attitude should be that you must solve each one and understand it as a foundation for your further development.
gms_fan@reddit
Yes, you need to be able to do coding exercises. Otherwise, what have you learned?
If the ones you are looking at are too complex, then dial it back until you find a level you can manage and work up from there.
spacemunkey336@reddit
Yes, they are necessary. Practice.
Alternatively, programming might not be for you. Programming isn't for everyone, contrary to popular belief.
seriousgourmetshit@reddit
Wtf kind of question is this lol? How are you going to do hard stuff if you can't and won't practice the easy stuff?
shekhspear@reddit
A lot of helpful advice here. Here is my 2 pennies.
As a developer, learning is a life long activity. I happen to stumble upon a Japanese method known as “ShuHaRi” that might help alter your perspective and get better.
https://medium.com/skilluped/shuhari-the-stages-of-learning-to-mastery-b6c48e4714e1
HTH. All the best.
kschang@reddit
How would you know if you are capable of "feature projects" if you can't even do book exercises?
Either_Mess_1411@reddit
I have never learned using LeetCode problems, and am now working in a senior level position. so I don’t deem them necessary for learning. BUT if you know how to code and solve problems, you will automatically be able to solve most LeetCode problems. So if you can’t, you are not there yet, so use them as learning excersises.
Especially if you are still in entry-level positions. Because LeetCode is „the“ industry standard to measure your coding abilities.
TommyTheTiger@reddit
Sorry to say it, but people have vastly different starting abilities in coding. Some people can make it look easy, for others it takes hard work, and for others, it may be that their efforts would be better spent elsewhere on things that come more naturally to them.
elroloando@reddit
Hahahahahahahaha
I thought you were going to say: shit man, all exercises even Hell Level are too easy for my super-developed mind. Pufffffff
akaleonard@reddit
Unfortunately you do need those. I will say that these types of problems are difficult even the easy ones. It takes awhile to get comfortable solving them. My recommendation is to make sure you're very confident in the language you're using to write them, and find one easy problem to *attempt* a day. Make sure struggle on it for a while (at least a good 30minutes to and hour) trying to figure it out before you look up how other people did it. You'll be solving them in no time if you do that. - source: I did it.
Significant-Syrup400@reddit
From my understanding this is literally what programming is. There is no shortcut once you finally run into things that you don't understand. You need to solve the simpler problems and understand them, or you will never be able to tackle the actual more complicated ones that you'll be facing as part of the job.
pirateelephant@reddit
It’s more than just what programming is. It’s what is needed to wire yourself for success. OP has run into a common misconception among people who have worked many entry level jobs. They think they know things about other people and how things operate.
As many are only looking to find the easy way to increase their compensation. Drastic change in their cost to benefit ratio. Aka higher compensation for less or same level of work.
True Development of anything requires true real effort- and not just physically. Specifically intentional mental effort that builds on abilities and skills to eventually persevere past a workload that cannot by definition easily overcome with the tools you started with. Otherwise you were already developed and could already find a job that would compensate you what you want.
Idealization of success and a goal ignores the path and steps to get to the direction one desires
Shwayne@reddit
Yes and the only reason you can't do them is lack of practice, not how smart you are. You can't recognize the pattern that leads to the solution. Being unable to write basic algorithms is really bad.
ActiveSalamander6580@reddit
Not at all. I was taught programming professionally with no prior experience, but had to pass some logical thinking tests to get the role.
They showed me the docs for the language and gave me a ticket to implement, have been solving problems since!
Solve problems, make mistakes and learn from them so you don't make them again.
baubleglue@reddit
I am not familiar with those specific exercises, but I suspect they ask you to make some useful working program. You should be worried if you can't solve more specific exercises related to the topic you learn right now (the type you have in the end of chapter).
Pacyfist01@reddit
I can guarantee you that you will have at least one of those exact exercises during any technical interview for a junior developer position.
RazarTuk@reddit
As an example of this: Rails generally does a good enough job abstracting things that, in the vast majority of situations, you don't even need to learn SQL. However, it's still using SQL behind the scenes, and I have encountered times where also being familiar with SQL helped me debug what was going wrong
victotronics@reddit
Also known as "all abstractions leak, sooner or later".
RazarTuk@reddit
If you're curious:
Because of differences between how Ruby handles
nil
and how SQL handlesNULL
, ActiveRecord has to translate any.where
clauses with an array containingnil
intoWHERE var IN /* most of the array */ OR var IS NULL
. However, there's a bug in Rails <5 where that makes it forget it's a where clause associated with whatever variable. Meanwhile, in Rails 4, they added an.unscope
method, which lets you remove just the clauses associated with a particular column, as opposed to how.unscoped
resets the scope completely, including removing the implicit where clauses from joins. You can probably tell where this is going. We had a where clause with a nullable boolean, and because, for whatever reason, we were using Rails 4 despite it having hit EOL, we were running into this issue. So as the single weirdest bug fix I've ever written, I changed.where(var: [false, nil])
to.where.not(var: true)
Proof_Individual_402@reddit
Pseudocode is your friend
BrokeEconomist@reddit
I don't like pseudocode. If my logic is off I can't get any feedback.
Existing-Bit-4160@reddit
Could you give some examples for projects? ,I d be interested to try out Rust .
GameDestiny2@reddit
Okay so, you can’t even do the basic programs you said directly yourself? What… do you think you’re going to be doing in these “future projects”? People can correct me here if I’m wrong, but coding starts and remains to be coding at every level. And frankly the learning curve tends to spike exponentially in complexity once you do “real” programs.
tcpukl@reddit
It's as fundamental as addition for maths.
PhilosopherDapper401@reddit
There's no way you can already know how to solve all the problems at once, this takes time, codewars for example has very complex challenges, and others that are very simple, start with the simple ones and develop your ability to solve them, and once again, this takes time, practice and study.
LuccDev@reddit
You need to practice somehow, if exercises don't work for you, then maybe doing a project works. But in any case, just reading won't cut it, you need to bang your head on an actual problem, that's true for most human learning, not just programming.
So, maybe what will work for you is to find a project that you like, and practice on those, instead of meaningless exercises. If I can give you an example, one of my very first project was building a mini online game with phaserjs and websocket communication. It sucked, I never finished it, but it was a good practice
Madison_Free_Man@reddit
You have to learn how to solve problems, yes. Keep pushing through the frustration, that's when the learning happens.
HolyPommeDeTerre@reddit
Is the problem you don't understand the problem ?
Downtown_Berry1969@reddit
You probably aren't too stupid, just try thinking of the solution, you will probably get it, I used to get stuck on problems while studying Structure and Interpretation of Computer Programs. When I get stuck on a problem I would just go away from the problem for a while and then work on it, maybe you will stumble on the solution while you are showering, who knows?
csabinho@reddit
Practice is mandatory for learning. Yes.
icyhotquirky@reddit
How are you going to solve, idk, (6+3*9)/11 if you don't know how to solve 2+2?
Practice more. It's very frustrating at first but at some point it will click if you really try to understand how the whole solution works
MentalNewspaper8386@reddit
Read the first couple of chapters of Think Like a Programmer by Spraul. The first examples don’t use a programming language. Then they use C++ but it’s a good read even if you don’t know any. (Or learn some basic C or C++). It’s not about language features but how to solve problems which is actually where you’re struggling.
xXShadowAssassin69Xx@reddit
You don’t have to know everything by heart. Just Google little things here and there like syntax questions or “is there a function that does XYZ?”. Programming is much more about understanding what needs to be done by a program than it is being able to character for character write out a function from memory
sayasyedakmal@reddit
No need to stress out. Just do.
If you cant do something, take a break. Perhaps try simpler problem.
Try to identify which part/concept/something that you dont understand and try find solution on the net. Chances are the problem you face already have solution somewhere.
Remember not to stress out. Your journey is long.
hagerino@reddit
Yes solving these are kind of fundamentals. It teaches you the basic elements of programming. Start with more easy ones, like reversing strings, calculating prime numbers, count occurences of something etc.
If it's still too hard for you, or you don't have fun doing these, you should consider switching the area of studies.
zomgitsduke@reddit
And the biggest thing to keep in mind is that you don't need to find the optimized solution on your first try. My first attempt at string reversal would probably include putting the characters into a "holding tank" in reverse order, then fetching them from said tank.
Not optimal in any way, but you do this, then try a few other methods, then you look at more elegant solutions to see what they look like as well.
data-crusader@reddit
Learning via projects was easier for me than learning via exercises.
Projects gave me a goal to work towards.
Honestly, during the coding interview on my first job, they gave me FizzBuzz and I had to look up something simple, like for loop syntax. I ran the program probably 20 times before “submitting” (we were on one of those platforms where they watch you code, in the hotel lobby with 4 people watching and I was nervous AF).
I thought I’d failed for sure, but afterward the main interviewer said he loved that I just ran the program to test the output rather than trying to get it perfect, and that every engineer has to look stuff up. Got the job.
throwaway6560192@reddit
I thought you were talking about LeetCode, but ATBS and CodeWars exercises are very simple — at least to start.
I'll say go on and try to program whatever project you actually want to make — but don't be surprised if it has difficulty >= what you found in the exercises.
Lose the "I'm too stupid" preconceived notion. It never helps.
Remarkable-Map-2747@reddit
I mean, I prefer hands on projected based learning. Seems like you learning Python, id recommend the book Python Crash Course By Eric Mathes.
Its a journey for the most part man, from not knowing a language at all, its good that you even can complete one. But if you find something your interested in tahatbwiuld be nice to have a script for, that will aid in it as well.
When it comes to coding you get better by doing,