r/learnprogramming • • May 15 '20

Learn to code TODAY! (Seriously)

Hi guys, I'd like to share my story with coding and when it really started. I know a lot of you guys is having the same struggles I did and I hope this helps.

At first, I didn't understand how some letters on a screen became a whole web store system. It was mystical to me. After some researches, I was told to learn HTML/CSS/SQL/JS/PHP. The starter kit for web development.

So I did, started to learn theories, syntax and when I (thought) finished, I was hopeless. Thinking: "ok, so now I know what is these things and how it works, but how the hell am I supposed to mix it up together and build something meaningful?".

I was stuck. I quit for some time, I didn't knew what was the next step, and searching on the web it looked to me that was a jump from the basics to building complex systems, and I was too dumb for this.

But then, the day that made me a true programmer became! And this is the tip that I thought it might help you guys:

To become a programmer, you have to program. Oh yeah, you already read this on other posts, but it sounds pretentious, right? Like, shut up dude, you already code, it's easy for you to say. Yes, I agree.

The thing is, besides learning syntax and other stuff, do an analysis of yourself. Where are you now? What you already know? What are the things you always see around but have no clue what it is? OOP? API? AWS? What is this? Take notes, search what it is, just to clear your mind. If you have all this information that is kinda blank on your head, it's just overwhelming you. Sounds more difficult than it actually is.

Then when you know what is your level at programming, start taking your own challenges, compatible to that level. Example: I was trying to create a CRUD (Create/Read/Update/Delete) system in Java with SQL, I tried to jump steps and went to youtube tutorials without knowing the basic syntax of both languages, it was frustrating. Then I got back to my "make-a-sum" console programs. After I learned the basics, I finally was able to understand that tutorials properly and then when I watched it again, became natural. It has a lot of things that I didn't knew, but having a solid background for what the tutor was speaking, I was able to study it afterwards.

So, to program: program (but not any or every challenge you found on the internet, but your own challenges, what you are capable to do).

The more I study the more I see is an endless road. The only point you can say: "Ok, now I'm am a programmer!" is when you take challenges and don't give up on them, and make it works. No matter how small is your project.

Search for the zone where is always slightly difficult.

You can become a programmer today, maybe a bad one, but you can start it today! Now, go build something with what you are capable, you'll be a great programmer soon. :)

1.9k Upvotes

144 comments sorted by

View all comments

199

u/Yogi1987 May 15 '20

Thanks man, i needed this. I had couplebof projects which i abandoned in the middle once they become complicated. One thing i need to learn that how to stick to one thing and complete it.

17

u/[deleted] May 15 '20

I look at programming like reading. If you keep starting new projects that's ok, if you abandoned a project and stop programming then that's not good.

The more you do it, the more confident you'll get. It hard to just fail at something for hours. But if you remember those experiences you are more likely to push through to the end.

I see the time I spend just spinning my wheels as a cost for learning something new. The cooler that technology the more it will cost me.

31

u/[deleted] May 15 '20

So I'm a software developer, and on my regular job I don't really need to rack my brains that much, but then one day I woke up, and decided that I really need to up my programming game. That I'm gonna make some really cool projects on my free time, put them on my github, and take it somewhere from there. So after going through a few websites, I land here: https://projecteuler.net/

Now, it's not important for you to be a math whiz to be a good programmer, but a lot of computer stuff is actually built on top of math. And math, if presented properly is cool. Sometimes. Maybe.

So I try to solve the first problem: https://projecteuler.net/problem=1

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

Blah. Run a loop from 3 to 999, have a variable to keep the sum. In the loop, check if the loop counter is divisible by 3 or 5, using a modulo, and then add it to sum. Got the right answer.

Then I went to the discussion page (https://projecteuler.net/thread=1) to see what others were saying about the problem. I saw this solution in php:

$x = 1000; echo 1.5*(int)(($x-1)/3)*(int)(($x+2)/3) + 2.5*(int)(($x-1)/5)*(int)(($x+4)/5) - 7.5*(int)(($x-1)/15)*(int)(($x+14)/15);

I shut down my laptop and went to sleep.

9

u/3-stripes-beanure May 15 '20

Your first solution is definitely how I’d do it. Here, having an understanding of the math makes it easier to write the program. I don’t think there’s any shame in implementing a well known algorithm, as long as you implement it yourself, and there’s also no shame in your solution.

I’ve taken courses in python, java (data structures), Scientific computing (C++), numerical analysis (Matlab), and modelling and simulation (any language we’d like). I’d say that my applied mathematics programs aren’t always the most efficient, and I do use well known algorithms (such as the metropolis algorithm in the Ising model). My programming knowledge is very specific to solving mathematics or physics problems.

I just don’t want you to think your solution is bad or wrong, and also to sort of indicate that finding this problem and looking up ‘algorithm for finding the sum of multiples of x bellow n’ is not cheating as long as it’s not code.

4

u/[deleted] May 15 '20

In this particular case, I believe it's mostly people flexing. A few others have posted solutions in assembly, and without using loops (like this one). But it bothers me that there are people who can come up with such solutions on the fly. In a different place, I can't remember where, I think it was a hackerrank problem, some guy used some bitwise operators in a really smart way and avoided looping or cut down the number of loops in a significant way. How do people learn to think like that?

13

u/travlr2010 May 15 '20

If that solution was well documented with comments in the code, and packaged so it could be called from any program, AND that code is the most efficient in CPU cycles and time, then great.

Otherwise, you're ahead with your code.

There's no shame in brute force. Especially when time and CPU cycles aren't at a premium.

5

u/[deleted] May 15 '20

BRUTE FORCING IS BAAAADDDDDD. jk. My self-made principle, and I'm sure someone famous has probably said this before. Make it work first, then optimize it.

6

u/skeletalfury May 16 '20

“Premature optimization is the root of all evil”

0

u/[deleted] May 15 '20

[deleted]

5

u/UrFreakinOutMannn May 15 '20

Honestly, just looks like calculus. $x == f(x) and then the equation is on the right.

4

u/AdmiralAdama99 May 15 '20

Coding is so effing broad and deep. While Project Euler, Leetcode, algorithms, etc are a significant area that OP should eventually study, I do not recommend it for a web developer starting out.

My advice to OP: get laser focused in what you study. So that you dont try to learn everything, which will cause you to get overwhelmed.

2

u/Pokky_Ninja May 15 '20

I don't know but this made me laugh so damn hard lol.

But it's ok to know your limitation. I would go the same way to solve the problem as you solved it. While the php solution flies over my head.

2

u/[deleted] May 16 '20

I'm a (perpetual) beginner and I'm doing the Coursera Google Python course. His is the only way I really 'know' how to approach the problem. Reading the second answer made me laugh.

I get sort of discouraged because people in the world are so beyond my intelligence. I'm 30 and I feel like I wasted my life so far. It's seriously humbling.