cross-posted from: https://lemmy.world/post/24857168
I would like to code for a living and to contribute to open source projects and things, but my coding skills are absolute shit after taking online courses and watching video tutorials. How can I learn to code for real?
What I would like to learn is algorithms, web development (“full stack”), how layouts work (both in like kotlin compose and HTML) and how to read other peoples code. Maybe thats more than I can chew, but its probably good for me to try out many things before getting settled on one.
Now I have been coding for a while already (~ 4 years), but I kind of feel like I need more guidance to be able to actually create code that works as intended intentionally, and not through trial and error / stack overflow. As for what level i am at, CS50 is probably my only qualification, I have played around with APIs (I.E. making discord bots), and made some html “apps” (horribly made, but things like the “genius” game and a calculator) and “prototype” react websites (as in, really bare bones, barely working).
I do plan on taking CS or something similar, but i’m not yet in college, and I would like to have a good head start before getting there.
Sorry for my bad English, and any help is appreciated.
Unironically this.
The entire IT world is held together with spit and sellotape.
Work on your own projects and it will come naturally, it’s the best way to thoroughly learn a language (probably JS in your case). Try to really understand the basics (like OOP), it’s knowledge which will both translate to other languages and help you learn frameworks/libraries. Instead of relying solely on tutorials, try reading the documentation, it will give you a more thorough understanding (if it’s good), also stack overflow isn’t cheating, you can’t always remember everything. Trust me, you are already way ahead of others if you plan to take CS.
Write code, lots and lots of it. Make it really good, clean code. Rewrite it multiple times if that’s what it takes to get it clean. Developing those instincts puts you way ahead of just reading about another damn framework.
And then cry when you land your first development job, knowing that you’ll never get to build anything so clean and effective that will actually get implemented in the real world.
The idea is to develop keen instincts so your code comes out nice on the first try, without needing rewrites. To do that, you have to start out by rewriting a lot. You are after a fluency of style, which is somewhat independent from deep thinking. Compare being a profound musical composer who sweats blood over every note, with being a competent (not necessarily great) improviser who, given any request, can bang out something listenable immediately without too many bum notes, without thinking too hard.
Ideally you want both. Computer science education gives you the profound compositional knowledge. Improvisation needs lots and lots of practice at the basics. So code a lot. It makes everything else easier.
I would also say participate in code reviews, analyze others code from your own perspective. Depending on the quality of course, you can pick up on new concepts or approaches that didn’t occur to you when writing on your own code
you’re not yet in college and have been coding for 4 years?
You already have a head start. Most of my Comp Eng classmates hadn’t written a hello world when they started. Go through your CS, get one or more internships, and you’ll have some perspective.
Why does everyone seem to thump on ‘Hello World’ as their first program?
My first program was BEEP
At least I learned that the computer could follow commands.
as in printing
\a
in c? It was one of my first ones too.I was 15 years old. QBasic + BEEP was amazing to me at the time.
That’s when I learned words could tell a computer what to do.
That was my first too! Followed by
BEEP BEEP BEEP
DO BEEP LOOP UNTIL BEEP = BOOP
actually create code that works as intended intentionally, and not through trial and error / stack overflow.
When do we tell them?
i hate this joke.
yes, trial and error is part of the process, but that does not mean we are bumbling fools that don’t know how or why things work. trial and error is part of any complex endeavour or learning new things.
when i started programming i struggled with getting stuff to compile, because i didn’t know the language i was using well, i later struggled with getting my code to work on other machines because i didn’t understood how to package it.
we absolutely get more competent, but we use complex tools to do complex stuff and we seldom have to produce the exact same thing twice, so of course we often find ourselves in somewhat uncharted territory.
Chill, hatred is too strong for this. Jokes are rooted in reality but that doesn’t mean that they describe the full reality.
I’ve been programming and tinkering with computing systems for a long time. Every time I start a new project with some new tech, I end up with 1000 tabs open in various mixtures of docs, AI, stackoverflow, reddit; and discord, slack; etc. hunting for answers or resolutions to similar situation to some particular nuanced problem I’m experiencing. It doesn’t mean that I’m an idiot just that I’m trying to do something that I haven’t done before.
It’s taken me many cycles to break myself out of the samsara loops of “I don’t know how to do this so I suck.” Imposter Syndrome is real but eventually we work through it to a healthy perspective of “I don’t know how to do this… yet, but I’m going to have to struggle through it to earn this knowledge.”
deleted by creator
that this does not make us fools is exactly what i wrote.
i am just tired of that “joke” that developers don’t understand their own work. its neither funny nor does it help anyone.
sshhhh let the kid develop a bit of impostor syndrome first
Sounds like you’re just still in the same boat as op.
That’s a rather disrespectful thing to say. But I’ll play and assume you weren’t trying to be a jerk.
Sounds like you’re just still in the same boat as op.
I disagree. It’s a natural part of the cycle of learning new things, and when is software development not about learning new things?
Aside from what everyone else is saying, don’t use dependencies that you don’t have to. Particularly don’t use big “frameworks”. If you use any dependencies, use tiny, focused ones that do one thing. The more code there is underneath what you’re writing, the more likely it will cause problems that you will internalize. I’ve seen it many times. Spring (Java), for instance, will do something not as advertised, and devs will think they’re bad coders because they “can’t write code that works as it’s supposed to.” Avoiding that vicious cycle will make you a better coder in the long run.
Also, when things aren’t working with your dependencies, do google for fixes, but don’t google too long. If you haven’t got a solution after an hour of no progress, look at your dependencies’ source code until you understand why and how to fix it.
How did you determined that your coding skills are “absolute shit”?
If you plan to study CS having qualifications and personal projects and stuff, you’re very likely already ahead of the curve; you already have the head-start you want.
In general,
- invest into what interests you or has use for you; code a tool you use or need, look at a project you use or you have interest in; personal investment drives you forward with interest and motivation
- smaller projects are easier to read and get into than larger projects
- [many if not most] public (same as private projects) may be in a bad or awful state, but you can still learn from them
- nothing is as good for learning as working on a project with a good mentor
- prefer official resources, tutorials and guidance over third parties, if available; they will more likely be more up-to-date and more likely better than the other way around
- studying computer science can teach the leap from coding to software engineering; mentoring can too
- experience, both amount and variance, drives all you do
- there’s a lot of resources for many things to read and learn
You listed algorithms first, I think that’s a well scoped, reachable goal, with many resources available. Increasing that scope, meaning also effort and risk of giving up, you could combine algorithms with a visualization, e.g. drawing on a HTML canvas. Now you have a well scoped project, where you visually see progress, and meet two of your learning goals of algo and web.
You’ll learn algorithms on college, there’s no rush to that.
If you want to learn how to read code, well, the best way to learn that is by doing. The same applies to web development and UI design. Make something, and read your dependencies.
You’ll formalise your knowledge in college, for now just work on whatever you enjoy most without worrying too much about what its teaching you.
The best way to learn is to just do it! When I’m starting out with something I generally have a few ideas of basic things I could do with it, generally that’s making simple CRUD apps (when I started using Axum I made a simple API that returns json from a file directory as long as the directory is formatted as: /type/name. Then I went and made a website using vanilla js/html/CSS and made everything run using the backend).
This second project is great because there’s always something else I could do like auth, like not doing a post and redirect to the same page for updates, like creating dynamic client & employee pages, like using an actual db instead of a script to make CSV files as a db. IMO, THIS is where you learn things.
When I first started out, I was working on things I found fun like a damage calculator for a game I was playing or a simple habit tracker that just incremented a number for a particular chore or task.
Eventually things got more and more complex until I did enough to impress the first company that hired me.
From what you wrote, it sounds like you’re off to a great start already. Just keep at it!
My suggestion which you seem to be doing is just to continue making things that are useful for yourself and others. Helped me a bunch in my early career. I could tell you so many stories …
If you want a headstart, I’d recommend looking into other kinds of languages, such as lisp, assembly, smalltalk and prolog. You will probably have classes on those in college (at least I did have mandatory ones), and it can take a while to wrap your head over such different programming styles.
And it also helps wonders to make you into a versatile programmer - since you would be vaguely familar with most of the different styles of languages there are, picking up a any new language will be a lot faster, since it will probably be similar to one of the above mentioned.
I’ll be random and toss you a BASIC bone…
FUNCTION CalcPI# X# = 0: Y# = 1 FOR N% = 1 TO 26 R# = SQR(X# * X# + Y# * Y#): X# = X# / R#: Y# = Y# / R# P# = (2 ^ N%) * SQR((X# - 1) ^ 2 + Y# * Y#): X# = X# + 1 NEXT CalcPI# = P# END FUNCTION
Figure it out, or not. 26 is not exactly fixed, the higher that number, the more accurate π is…
I will try to guess how that works!
keep in mind that I have no clue on how BASIC sintax works lol
1 -> function declared
2 -> variable x and y initiated to values 0 and 1.
3 -> for loop created that goes from 1 to 26 (updating variable N)
4 -> Variable R is created, its value is the square root of (x^2 + y^2). Xs and Ys values are set to be themselves divided by R.
5 -> P variable created (it stores the value of PI), and set to (2 ^ N) * square root of (x - 1) ^ 2 + y ^ 2. Lastly X is increased by one
6 -> Proceed only after for loop is done
7 -> return the variable P(I do recognize I just transcribed the code, and I also made an implementation in python of it, lol)
now for why that works ill figure another time, its 12:30 pm here and I am eepy :). But I have recognized that X tends to 2 and Y to 0.
and I am pretty sure this implements the algorithm of creating higher and higher “resolution” circles so starting with a triangle and adding more and more vertices (vertex?). Ill edit in the full explanation late :)
here is my implementation:
def CalcPi(): X = 0 Y = 1 P = 0 for i in range(1,26): R = sqrt(X**2 + Y**2) X = X/R Y = Y/R P = (2**i) * sqrt((X-1)**2 + Y**2) X += 1 return P
Proceed way past 26 if you want more accuracy, assuming the CPU can handle more accuracy (most likely these days)…
I’m impressed!
Too lazy to test your version of the code, cuz I don’t think I even need to. You understand the code from the start!
Wonderful! I love my π circles round…
Looks perfect to me!
Hell, resembles my first variation of the code back around the year 1999
I believe the formatting issue is because the triple back tick is on a line with other text. In most markdown flavors triple backticks should be on blank line (with some exceptions for hinting at syntax highlighting). Slack’s is the only dialect I’ve seen that specifically strips newlines from triple backticks and I hate it.
I just tried an edit to add blank lines before and after the backticks, now happy formatting!