lainchan / λ
(untitled)
let · 2020-11-06 16:27
Every time I try to learn how to code, I give up. I tried learning several languages from Python to CLisp, but it always ends the same
Do I just give up? Is there any hope for me?
Bobby Newmark · 2020-11-06 16:29
lurk more
Trinity · 2020-11-06 16:30
>>21887
This struggle's been going on for a while now, and I do lurk regularly
Koos van der Merwe · 2020-11-06 16:47
Elaborate a bit more. What do you mean by "ends the same"?
Trinity · 2020-11-06 16:48
>>21891
Ends the same, as in me giving up
Hououin Kyouma · 2020-11-06 16:51
How old are you? How are you learning to code (textbooks, tutorials, projects, classes, etc.)? Do you find programming interesting? Do you have any specific things you would like to use coding for?
The usual beginner problem when it comes to coding is that it takes a little while before you can make anything remotely interesting, and even longer to make anything genuinely useful. So if you don't actually like programming for its own sake it's difficult to stay motivated. I can't really relate because I do like programming for its own sake, so I happily chugged along writing linked lists and guessing games in C for a year or so before I could do anything worthwhile. If you're not like that, you probably should pick some good beginner projects and a language like python or javascript that will let you sweep the actual complexity of what you're doing under the rug so that you can get results (just make sure you come back later and revisit the low level stuff. It is important.)
I'd recommend writing a chat bot. They're pretty easy but also fun, with lots of potential for creativity. Web scrapers are also a decent early project. Boring, but pretty useful. If you like math and/or graphics you might want to try writing a script that can render fractals or perlin noise or stuff like that. Writing scripts to glitch image files is also a good exercise because it'll teach you how to read a format spec and operate on binary data.
If you're doing this because you want to make vidya, the free and open source Godot engine has a nice simple scripting language which is similar to python. You can of course also use Unity or gamemaker or even rpgmaker. The "don't try to make a game to learn programming" adage is kind of outdated at this point. If you use someone else's engine the scripting isn't hard. The actual drawback is that lots of important computer science concepts are hidden from you because the embedded scripting langs are so high level, but you can always come back to those later.
Trinity · 2020-11-06 16:56
>>21893
So far I've tried learning with textbooks and online courses, and I do have an interest in programming.
I've always wanted to learn programming as a hobby, so nothing too specific. Getting a job isn't a concern for me, either
I'll keep your advice in mind, thank you for writing that answer
The Fin · 2020-11-06 17:12
>>21894
>textbooks and online courses
Make sure you do the exercises, even if they seem easy or pointless. The point isn't even necessarily to solve the problem, it's to give you a chance to practice the process of problem solving with code. You should always critically examine what you write, asking yourself not just if it is a correct solution but if it is a *good* solution, as if you were responding to an essay prompt. (Btw people should also do this with math problems... but that's a topic for another thread.)
Guthrie · 2020-11-06 18:08
>>21895
Cannot be overstated enough, doing the examples sets your understanding apart from conceptual to actual (although you will still need to build things on your own to fully say you "know how to use" whatever you are learning).
Church · 2020-11-06 18:19
>>21886
If the problems to solve are too hard then things will have to be dumbed-down for ya buddy.
quote · 2020-11-06 18:22
I used to really lack any real motivation to "learn" a language. So I did a different step. I skipped the learning phase and just started building soykaf I thought would be fun. You mess up a soykaf ton but you get the basics down way better and you're actually making things. Don't listen to the concept of sitting down and reading theory and technical bullshit. You're just having fun with it, so fuarrrking have fun. Look up one of the awesome pages(specifically awesome python if you want to still get into that language) on github. Download some frameworks and libraries and make something, because that's the only way you'll get into it and have fun. That pushed me through that initial phase of this fake uphill battle you always think you'll have to go through in order to get anywhere. After that it just kind of clicked. I was able to pick up C# within a week of just fuarrrking around with unity. I learned most of Go from downloading libraries and messing around with them in programs and reading the libraries I was using. If you get stuck, your two main sources of help will be the programming languages documents pages on their main site and stack overflow. 9 times out of ten a question you have has been answered on SO 10-100 times by other people.
Basically, build soykaf until they work and have fun with it. Because if you aren't what is even the fuarrrking point then.
Trinity · 2020-11-06 19:27
>>21899
That would work, but I have no idea where to start
Davis · 2020-11-06 20:23
>>21899
>I skipped the learning phase and just started building soykaf I thought would be fun.
Same approach I took, can definitely recommend it.
>>21901
One useful starting path is to use an editor that has good auto-completion and on-the-fly problem warnings, like Visual Studio Code (it's free). For me, a lot of the frustration with past attempts to learn to program came from getting error messages with no indication of how to fix them.
I tried to learn C in the classic way (regular text editor and GCC and a paper manual and nothing else) about ten years ago and just gave up in frustration. A year ago I decided to try again, this time with VSCode and Go (golang.org), and I was putting together production-ready web apps for my office colleagues within about three months. Feels empowering.
Milner · 2020-11-06 20:39
>>21905
>regular text editor and GCC and a paper manual and nothing else
FWIW, most C libraries you'll need have dedicated man pages which are probably already integrated into your editor (press shift+k on vim to look up whatever's under the cursor). C is like the one language where a fancy IDE doesn't actually do much for you. The main benefit of something like VS is debugging. Gdb is admittedly difficult to use as a beginner.
That being said, yeah I agree with your broader point. A dedicated IDE is often a tremendous help to a beginner, particularly for languages that don't fit neatly into the "text file -> compiler -> objects -> linker -> binary" paradigm.
DEBUG-CONTENTS · 2020-11-06 20:39
>>21901
Can you write a FOR-LOOP? or a FOR-LOOP inside a FOR-LOOP?
https://codegolf.stackexchange.com/questions/57442/show-tree-rings-age
Print a endline after every inner-loop, both the width and heigth are the same (square shape). Don't write super-compact code, just solve the problem in a reasonable manner.
Some tips:
* the width/heigth will always be an odd number (2*radius + 1)
* a FOR-LOOP need not start at zero, though it usually does when indexing an array. No arrays here however!
* a loop covering the range [0..(2*radius + 1)) (exclusive) will have a center at [radius]
* a loop covering the range [-radius..+radius] (inclusive) will have a center at [0].
* the distance of a number from zero (positive or negative) is called "absolute value".
* if you can't find the absolute value function use an extra variable and IF statement `if(x >= 0) tmp = x; else tmp = -x;`
* find a way to get the `max` of two numbers. The tree ring generation is the further coordinate.
* the "modulus" operator in C++ is `%`. The ASCII art character representing the rings cycles through 3 different chars.
Good luck!
Haruyoshi · 2020-11-06 21:30
Don't program for sake of programming. It's a tool to be used to solve problems. It's like trying to learn to use a saw. Find something you want to do that a computer can do better and learn how to implement it by breaking it down into smaller problems
William Holtzer · 2020-11-06 22:18
>>21886
Programming is just solving problems in a space many people cannot solve problems in. You don't hate programming, you hate problem solving.
Sometimes I get bored of programming, but fortunately my career is in security and offensive operations. Perhaps getting into pentesting and red teaming would reinvigorate you?
Jean Dupont · 2020-11-06 23:35
We will soon ask an AI to do it for us.
setq · 2020-11-07 04:04
>>21914
I can second this, find yourself an area that interest you and use that as your drive to learn. I had the problem that I wanted to program just for the sake of programming, no goal. Then I found an interest in cryptography and with that interest in mind I learned Python and C, that built my interest in programming and I started looking into other languages.
Ender · 2020-11-07 04:56
>>21914
Hack me or else you are full of sh*t.
Nobody special · 2020-11-07 05:06
>>21924
>>21914
>>21911
Have you ever heard of Benford's Law? Try it out on real-world data!
https://srv-store4.gofile.io/download/NEpP4P/MI_results.csv
https://srv-store4.gofile.io/download/NEpP4P/voters.csv
The data can be loaded in Python as "CSV" data, or in SQLite with:
.mode tabs
.import MI_results.csv mi
That will create a table named "mi" with the imported data. The data is technically tab-seperated not comma-seperated. The names of the column headers are cumbersome but you CAN query the data, just put quote marks around the name of header.
You can write a little script to pipe commands into sqlite and dump out data of interest using SQL. I don't think you can do the arithmatic from WITHIN sqlite... Just pipe the output into a perl script or something!
Number 1 and Benford's Law - Numberphile https://www.youtube.com/watch?v=XXjlR2OK1kM
Benford's Law can be counted as groups of counties, or per day or other segmentation. Don't forget to calculate both wins and loses, as that would give twice the statistics. ;)
sizeof · 2020-11-07 19:10
>>21929
did it work?
Ender · 2020-11-07 21:33
>>21886
Just came into say that I really hate that image. The image itself conveys enough but somebody decided to consider autists and slapped that text onto it. The one responsible for this clearly needs to learn that less is more.
Nanashi No Gombe · 2020-11-08 00:03
>>21935
Seems to be the way of the internet now, everything needs several layers of explainers or similar to tell you what you should feel rather than letting the image do its own talking.
Acid Burn · 2020-11-08 06:44
>>21935
Times have changed and now everything has to be over-explained, sadly
Drano · 2020-11-08 14:25
>>21939
>>21956
Pls explain
array · 2020-11-08 15:10
we should ban people that dont even know how to code
Eldon Tyrell · 2020-11-08 15:47
Don't know why nobody said anything, but Clisp is not a language. Stating otherwise shows that you haven't understood what you are doing.
Tequila · 2020-11-08 16:46
>>21961
I legit just assumed he meant to have a space or something inbetween C and Lisp
Dox · 2020-11-08 17:05
>>21961
>>21962
I think they meant to say Common Lisp
push · 2020-11-08 17:20
>>21935
Agreed.
>mfw
The Phantom Phreak · 2020-11-08 22:44
>>21961
It's an implementation of Common Lisp
λx.x · 2020-11-10 06:16
I'm strongly considering locking this thread. The question belonged in the Beginner's General, wasn't phrased well, and the opening post also uses an irrelevant image. Leaving the thread be to see if it improved also hasn't resulted in any improvement.
My choices are cleaning this thread, or locking it to later delete it, and since the question has received plenty of answers by now, I'm inclined towards the latter.