less_retarded_wiki/programming.md

45 lines
14 KiB
Markdown
Raw Permalink Normal View History

# Programming
2024-03-19 16:01:03 +01:00
*Not to be [confused](often_confused.md) with [coding](coding.md).*
2023-01-02 20:57:18 +01:00
2024-10-15 22:22:58 +02:00
Programming is the act, [science](science.md) and fine [art](art.md) of writing [computer](computer.md) [programs](program.md); it involves creation of [algorithms](algorithm.md) and [data structures](data_structure.md) and implementing them in [programming languages](programming_language.md). It may involve related activities such as [testing](testing.md), [debugging](debugging.md), [hacking](hacking.md) and drinking coffee.
2023-10-26 22:28:40 +02:00
You may also encounter the term [coding](coding.md) which is used by [noob](noob.md) [wannabe programmers](soydev.md), so called "coders" or [code monkeys](code_monkey.md). "Coding" doesn't reach the quality of programming, it is done in baby handholding languages like [Python](python.md), [JavaScript](javascript.md) or [Rust](rust.md) by people with very shallow knowledge of technology and its context, barely qualified to turn on a computer (like [jewtubers](youtube.md)), who have flooded the computer industry since it became lucrative. It is mostly done for money and/or creating an image for oneself. What they do is not real programming. Do not try to imitate them.
2024-02-21 09:18:07 +01:00
At high level programming becomes [spiritual](spirituality.md). Check out e.g. [zen](zen.md) and the famous [Tao of Programming](tao.md) (yes, it's kind of a [joke](jokes.md) but it's rooted in the reality of a common hacker's mindset, programming can truly be kind of a [meditation](meditation.md) and pursuit of enlightenment, often leading one to asking deeper questions about the world). Many people say that learning programming opens your eyes in a certain new way (with some however claiming the contrary that programming will rather close your eyes), you then see the world like never before (but that's probably kind of true of almost all skills taken to a high level so this may be a [shit](shit.md) statement). Others say too much programming cripples you mentally and gives you [autism](autism.md). Anyway it's [fun](fun.md) and changes you somehow. **Programming requires a good knowledge of advanced [math](math.md)**. Also probably at least above average [IQ](iq.md), as well as below average social intelligence. Being a [white](white.md) [man](man.md) is an advantage.
2024-01-27 01:10:20 +01:00
**Can you do programming without math?** Short answer: no. Long answer: no, you can't.
2023-03-21 21:26:47 +01:00
## How To Learn Programming And Do It Well
2024-04-28 20:29:29 +02:00
*See also [programming tips](programming_tips.md) and [exercises](exercises.md).*
2023-09-15 21:00:01 +02:00
2024-09-07 16:47:08 +02:00
Anyone can (and probably should) learn at least the basics of programming -- even if you just aim to maintain a small server or make a website, you will probably have to learn how to write a simple [script](script.md), and it won't be too difficult, you can learn this from a programming cookbook, just like you can learn to prepare a simple meal without having to become a master chef. Here however we will now assume you aspire to become a GOOD programmer, that you feel programming is something you want to dedicate part of your life to and that it's something you feel joy about for its own sake. How to tell if you're meant for this? You should just feel it. Every true programmer will be able to tell you the story of when he became charmed, when he first saw a computer and realized its potential, when someone showed him a programming language and at that moment the revelation struck him when he saw: "my God, this machine does EXACTLY what I tell it to." Normal people are just like "oh, that's cool", but the chosen ones just become overwhelmed by excitement, the thought of so many possibilities immediately floods the mind. A normal man perhaps thinks it will simplify his taxes, a true programmer instead can't stop thinking about how to "abuse" (or more correctly *[hack](hacking.md)*) the machine to do something no one thought about before, no matter practical utility, appreciating just the intellectual value. If this is you, read on.
2023-11-29 15:46:05 +01:00
At first you have to learn two basic rules that have to be constantly on your mind:
1. **You cannot be a good programmer if you're not good at [math](math.md)** -- real programming is pure math.
2024-02-18 17:14:46 +01:00
2. **[Minimalism](minimalism.md) is the most important concept in programming.** If you don't like, support or understand minimalism, don't even think of becoming a programmer.
2023-11-29 15:46:05 +01:00
2024-09-07 16:47:08 +02:00
OK, now the key thing to becoming a programmer is learning a **[programming language](programming_language.md)** very well (and learning many of them), however this is not enough (it's only enough for becoming a [coding](coding.md) monkey), you additionally have to have a wider knowledge such as general knowledge of [computers](computer.md) ([electronics](electronics.md), [hardware](hardware.md), theory or [computation](computation.md), [networks](networking.md), ...), tech [history](history.md) and culture ([free software](free_software.md), [hacker cutlure](hacking.md), [free culture](free_culture.md), ...), [math](math.md) and [science](science.md) in general, possibly even society, [philosophy](philosophy.md) etc. Programming is not an isolated topic (only coding is), a programmer has to see the big picture and have a number of other big brain interests such as [chess](chess.md), voting systems, linguistics, physics, [music](music.md) etc. Remember, becoming a good programmer takes a whole life, sometimes even longer.
2023-03-21 21:26:47 +01:00
2023-10-26 22:28:40 +02:00
**Can you become a good programmer when you're old?** Well, as with everything to become a SERIOUSLY good programmer you should have probably started before the age of 20, the majority of the legend programmers started before 10, it's just like with sports or becoming an excellent musician. But with enough enthusiasm and endurance you can become a pretty good programmer at any age, just like you can learn to play an instrument or run marathon basically at any age, it will just take longer and a lot of energy. You don't even have to aim to become very good, becoming just average is enough to write simple gaymes and have a bit of fun in life :) Just don't try to learn programming because it seems cool, because you want to look like movie haxor, gain followers on youtube or because you need a job -- if you're not having genuine fun just thinking before sleep about how to swap two variables without using a temporary variable, programming is probably not for you. **Can you become a good programmer if you're black or [woman](woman.md)?** No. :D Ok, maybe you can, but all the above applies, don't do it for politics or money or followers -- if you become a seriously based programmer (from [LRS](lrs.md) point of view) of unlikely minority, we'll be more than happy to put an apology here, in ALL CAPS and bold letters :) Hopefully this will inspire someone...
2023-03-21 21:26:47 +01:00
2024-09-07 16:47:08 +02:00
**Which programming language to start with?** This is the big question, it also depends on how talented and hardcore you are. Though languages such as [Python](python.md) or [JavaScript](javascript.md) are objectively really REALLY bad, they are nowadays possibly the easiest way to get into programming -- at least the "mainstream" kind of -- so you may want to just pick one of these two if you just want to start more slow and casual, knowing you'll abandon the language later to learn a real deal such as [C](c.md) or [Forth](forth.md) (and knowing the bad language will still serve you in the [future](future.md) in some ways, it's not a wasted time). Can you start with C right away? It's not impossible for a smart guy but it WILL be hard and there is a big chance you'll end up failing, overwhelmed, frustrated and maybe even never returning to programming again, so be careful. In *How To Become A Hacker* [ESR](esr.md) actually recommends to learn C, [Lisp](lisp.md) or [Go](golang.md) as the first language, but that recommendation really comes to aspiring [hackers](hacking.md), i.e. the most talented and ambitious programmers, so think about whether you fit in this category. Absolutely do NOT even consider [C#](c_sharp.md) (shit, unusable), [Java](java.md) (shit, slow, bloated, unusable), [C++](cpp.md) (like C but shit and more complicated), [Haskell](haskell.md) (not bad but non-traditional, hard), [Rust](rust.md) (shit, bad design, unusable), [Prolog](prolog.md) (lol) and similar languages -- you may explore some of them later tho (the weird ones, not the bad ones). Whichever language you pick for the love of god **avoid [OOP](oop.md)** -- no matter what anyone tells you, when you see a tutorial that uses "classes"/"objects" just move on, learn normal [imperative](imperative.md) programming. OOP is a huge pile of shit meme that you will learn anyway later (because everyone writes it nowadays) so that you see why it's shit and why you shouldn't use it. Also don't let them sell you any kind of new shiny [paradigm](paradigm.md) that's currently trending on [TikTok](tiktok.md) -- learn IMPERATIVE PROGRAMMING and cover your ears when someone talks about anything else. So to sum up, here are some comments on individual languages you might consider:
- [C](c.md): Hardcore choice, only for the real smarts. It's a very good language and you will have to learn it one day anyway, but for absolute beginners may be too much to handle.
- [Python](python.md): Objectively ugly but extremely beginner friendly, simple to use, quite simple to learn, will teach you all the basic concepts. Relaxed choice but you have to keep in mind you'll switch one day.
- [JavaScript](javascript.md): Alternative to Python, similarly friendly to noobs, maybe a tiny bit harder to use, but will allow you to make fun visuals (in web browser) very easily and has a syntax closer to C (so in this learning JavaScript can make you better ready for learning C).
- [Pascal](pascal.md): Language that's kind of dead (though not completely) but which is actually quite nice in that it's very close to C while having been designed as an educational language. Still a more difficult language (has pointers, manual [memory management](memory_management.md), static typing, ...). Consider it an alternative to C if Python/JavaScript still look way too shitty to you.
- [Lisp](lisp.md): Language that's pretty elegant but dissimilar to other ones here and a bit obscure (for example in that there are MANY different dialects of it), it's nice and useful but also a bit niche. Only consider it if you know a bit what's going on and you have a special reason you'd want to learn it (for example if you're an [Emacs](emacs.md) user).
- [Assembly](assembly.md): Really, really hardcore choice, only for the most oldschool masochists who want to learn programming like they did back in the 1960s, from the very [bottom](low_level.md) up. This will be yet harder than C. Probably only consider this if you know you're a borderline genius and love to fiddle with computers at very low level, messing with [hardware](hw.md) and [electronics](electronics.md). Basically if you're aiming to making your own computer from the ground up.
- [PHP](php.md): Just to offer yet more choice, however PHP is rather discouraged as it's not a super nice language and is also not as much used anymore. It's simpler than C, in the league of simpler languages, and will allow you to program server side stuff, so maybe look into it if you want to make things on the web, like turn-based browser games or search engines.
- [Go](golang.md): Rather discouraged but offered for more variety, it will be on the level of C and is actually marketed as "new C", however it has some [modern](modern.md) shit, really only consider Go if for some reason you want to learn a harder, lower level language while really really refusing to learn the other languages like C and Pascal for some weird reason.
2023-03-21 21:26:47 +01:00
2024-09-07 16:47:08 +02:00
{ I really started programming in [Pascal](pascal.md) at school, it was actually a good language as it worked very similarly to C and the transition later wasn't that hard. ~drummyfish }
2023-03-21 21:26:47 +01:00
2024-09-07 16:47:08 +02:00
**[Games](game.md) are an ideal start [project](project.md)** because they're [fun](fun.md) (having fun makes learning much faster and enjoyable), there are many noob tutorials all over the Internet etc. However keep in mind to **start EXTREMELY simple.** -- this can't be stressed enough, most people are very impatient and eager and start making an RPG game or networking library without really knowing a programming language -- this is a GUARANTEED spectacular failure. At the beginning think in terms of "snake" and "minesweeper". Your very first project shouldn't even use any [GUI](gui.md), it should be purely [command-line](cli.md) text program, so a text-only tiny interactive story in [Python](python.md) is possibly the safest choice as a first project -- if you are feeling more ambitious, try to write the same thing but in [C](c.md). Once you're more comfortable you may consider to start using graphics, e.g. Python + [Pygame](pygame.md) (or, again, C + [SAF](saf.md) or [SDL](sdl.md) if you want a better language), but still [KEEP IT SIMPLE](kiss.md), make a flappy bird clone or something. As you progress, consider perhaps buying a simple toy computer such as an [open console](open_console.md) -- these toys are closer to old computers that had no operating systems etc., they e.g. let you interact directly with hardware and teach you a LOT about good programming by teaching you how computers actually work under the hood AND, by having weak hardware, not allowing you to write shitty code. Whatever language you start with, it is unavoidable that one day you will have to make the big step and **learn [C](c.md)**, the most important language as of yet, but if you see you're struggling with a simpler language, be sure to only start learning C when you're at least intermediate in your start language (see our [C tutorial](c_tutorial.md)). To learn C we recommend our [SAF](saf.md) library which will save you all headaches of complex APIs and your games will be nice and compatible with you small toy computers.
2023-03-21 21:26:47 +01:00
2024-09-07 16:47:08 +02:00
As with everything, you learn by doing -- reading is extremely important and necessary, but to actually learn anything you have to spend thousands of hours practicing the art yourself. So **program, program and program**, live by programming, look for ways of using programming in what you're already doing, try to automatize anything you do, think about programming before sleep etc. If you can, **contribute to some project**, best if you can help your favorite [FOSS](foss.md) program -- try this at least once as being in the company of the experienced just teaches you like nothing else, a month spent contributing to a project may be worth two or three years of just reading books. If you're [extremely asocial](avpd.md), the alternative is to just [fork](fork.md) someone else's program and trying to modify it -- this way you'll at least learn to understand someone else's code and you'll see how someone experienced writes the code.
2024-02-10 12:19:55 +01:00
2023-03-21 21:26:47 +01:00
TODO