How to become a competent coder? - I was advised to cross post here.
-
[email protected]replied to [email protected] last edited by
as in printing
\a
in c? It was one of my first ones too. -
[email protected]replied to [email protected] last edited by
actually create code that works as intended intentionally, and not through trial and error / stack overflow.
When do we tell them?
-
[email protected]replied to [email protected] last edited by
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.
-
[email protected]replied to [email protected] last edited by
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.
-
[email protected]replied to [email protected] last edited by
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.
-
[email protected]replied to [email protected] last edited by
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
-
[email protected]replied to [email protected] last edited by
That was my first too! Followed by
BEEP
BEEP
BEEP -
[email protected]replied to [email protected] last edited by
Looks perfect to me!
Hell, resembles my first variation of the code back around the year 1999
-
[email protected]replied to [email protected] last edited by
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.
-
[email protected]replied to [email protected] last edited by
sshhhh let the kid develop a bit of impostor syndrome first
-
[email protected]replied to [email protected] last edited by
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...
-
[email protected]replied to [email protected] last edited by
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.
-
[email protected]replied to [email protected] last edited by
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.
-
[email protected]replied to [email protected] last edited by
Proceed way past 26 if you want more accuracy, assuming the CPU can handle more accuracy (most likely these days)..
-
[email protected]replied to [email protected] last edited by
Sounds like you're just still in the same boat as op.
-
[email protected]replied to [email protected] last edited by
DO BEEP LOOP UNTIL BEEP = BOOP
-
[email protected]replied to [email protected] last edited by
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.
-
[email protected]replied to [email protected] last edited by
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
-
[email protected]replied to [email protected] last edited by
Trial and error has no direct connotation to bumbling fools. You’re projecting your own insecurities
-
[email protected]replied to [email protected] last edited by
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.