Programming thread

I would ask the following questions:
  1. Does it sound interesting? Writing a SAT-solver might be interesting for some and terminally boring for others.
  2. How difficult is it? You don't want something trivial you could do in an hour, but you also don't want to do something extreme where you would burn out before finishing it.
Another good source for projects is asking yourself "what programs do I want"?
First one is creating a Space Invaders type of game, second is data visualization and third is web applications. First and third sound neat but I don't know about the second.
 
Powerlevel: I was teaching programming both academically and commercially. Still do it from time to time. Also, doing gamedev-related work.
Programming noob here. For someone who one day wants to make games, what language(s) should I learn? I started with Python because a I heard it was easy to learn but am curious on where to go once I have had more experience with coding.
For starters, this is the money quote:
Learning a language is different than learning how to program.
I'd put it as such: to learn to program, you don't even need a computer. To program is to think, to devise an algorithm relevant to solving the problem at hand. Issues start when you actually want to implement the program and for that you need a programming language, so in practice, when learning programming you will have to learn a programming language simultaneously. But these are entirely different skills.

I'm in the camp "python causes brain damage", as well as JavaScript and Lua. The brain-damagey part comes from the dynamic typing aspect, meaning a variable does not have a type, only the value of the variable has a type. So in python you may assign a number as a value of a variable and on the very next line assign a string. No problemo. In statically typed languages, the variable itself has a type, so you cannot assign a string if you declared that such-and-such variable is of type number.

If you want to make games, you need to learn programming first and foremost. Python is fine in the short run, but as you expand the scope of a project, it will ruin you. You'll hate yourself and the joy of creating will go down the drain, as you hunt for the elusive bugs that would be normally detected by the compiler in a statically typed language.

Depending on how much exercise in Python you already had, I would stick to it for a little more, to develop good understanding of logic, flow control, loops and functions. I would strongly recommend against doing larger projects in python, because brain damage and frustration ahoy. After doing some basic algorithmic exercises (I can send you some and can review the code afterwards if you want), jump ship to anything statically typed. In gamedev nowadays C++ and C# is king. I do the former and have some basic knowledge of the latter.

If you'd rather want to start over with another language and focus entirely on the "learning programming" part, I'd go with Pascal. Yes, I'm serious and can elaborate, but this post is already going for too long and I'd rather not flood the board with unnecessary sperging.
 
Hell, I'm curious why Pascal
I fully understand that it raises eyebrows. Hell, I myself would ridicule that statement ~17 yrs ago, when I was becoming a C++ neophyte after migrating from Pascal. For a few years I even believed that the Python was the way to teach programming, but the experience with teaching college students disabused me of this idea. Not to dickwag, but after having hundreds (maybe more than a thousand?) of hours in instruction experience on various levels of proficiency and various demographics I came to realization that it's either Pascal or C. I'll also try to address why I think LISP-like languages are not suitable.

First of all, I need to touch on the weaknesses of Python for the task at hand. Incidentally, these weaknesses are often praised as features that would actually help develop good practices: low visibility of control flow. To elaborate: separating statements by newline instead of a clear marker like a semicolon; blocking of code via indentation (*); no dedicated entry function like main() in C-like languages; dynamic typing on which I've already written a few screeds. Probably a few more, but these are the ones I got on top of my head.

Now let's compare some contenders with very visible flow control: C, C++, Java, Pascal. I throw away Java in an instant due to not liking teaching by handwaving away public static void main extends fuckery implements wtf keyword fiesta. Obviously with every language I need to introduce some keywords, but Java is so over the top and I need to handwave classes and so much stuff till unspecified "later" that I'd rather just devolve into C or "simplified" C++ (I'll elaborate on that). So there's no real point in Java.

Now let's look at Pascal vs C. I think the first one is slightly easier to grasp due to verbose keywords like begin and end to enclose code blocks, explicit declarations of procedure and function, explicit var declaration blocks and so on. These faculties are highly irritating due to verbosity if one already grasps the terseness of syntax in C, I literally cannot stand reading these keywords. It actually slows down my reading and understanding of the code! But at the same time, I consider it useful for the purpose of learning. I think seeing these words over and over again will burn out the lingo in the brain, which is in many levels useful - you recognize the wording in books, you know how to ask google for help etc.

On top of that, Pascal is a lot stricter with basic numeric types and, in my opinion, has better arithmetic operators. You have `div` for integer division and `/` for real number division. As far as I remember, Pascal's compiler won't allow you to use `/` if the values being divided aren't real numbers! For modulo arithmetic you have `mod` instead of the ugly C-like `%`. For assignments you have `:=` instead of `=` (this one is used for comparisons, like God Dijkstra intended). There's kind of a big deal here, because in mathematics `=` describes a property, a constant, an equation, not a change. I've seen people having some mental block with that part of C. There's no `++` and `--`.

Pascal is a lot more strongly-typed than C. The compiler won't allow you to do many of the stupid things which are perfectly valid syntactically and semantically in C, but are not "what programmer meant" and sometimes outright undefined.

For this reason, if it's up to me to actually teach someone programming, I do a C/C++ hybrid. I basically take C++ compiler and write C code in it, with the exception of using iostream instead of stdio and sometimes using strings instead of const char*. Now don't get me wrong here, iostream is cancer, but at least in remission, yet stdio will cause brain damage and then also cancer upon the programmer and his whole family. C++ is much more strongly-typed than C and has very ugly casting operators, which should actually discourage (ab)using them.

TL;DR - if you were to go on a remote island without internet and wanted to teach yourself programming, bring a Pascal book. If you have a competent mentor, go for very basic C++, bordering on C for much of the time.

Why not LISP-like lang? For the same reason I would not advise starting with assembly. I mean, it's very educating to touch assembly and LISP in one's life to see the underlying atomic structure of the universe, I'd just advise against starting with it.
People keep saying Python is a meme or a cult or brain damage.
Oh yeah, I haven't even got started on the cultish aspects of the crowd, where a bunch of jerkoffs go around telling everyone that you have to use "list comprehensions" and lambdas for everything, because that's "pythonic".

And then there are smug idiots who proclaim python's superiority to anything else because there exists a module that allows you to, I dunno, download a picture and run face detection on it in a few lines of code. Just because there are "modules" (libraries) means python is superior, duh obviously. It isn't quite fair to compare python's standard lib to, let's say, C++'s standard lib. You'd have to give the C++ side of the argument at least the Qt framework to make the comparison's even in the realm of possibility of being in the same ballpark.

(*) Indentation should be made with tabs, space-crowd can go fuck themselves and their backward ways and yes, I can prove that tabs are superior. (**)

(**) May not apply to LISP-like languages. I have too little experience to comment on that, but I expect I'd be right too.
 
I fully understand that it raises eyebrows. Hell, I myself would ridicule that statement ~17 yrs ago, when I was becoming a C++ neophyte after migrating from Pascal. For a few years I even believed that the Python was the way to teach programming, but the experience with teaching college students disabused me of this idea. Not to dickwag, but after having hundreds (maybe more than a thousand?) of hours in instruction experience on various levels of proficiency and various demographics I came to realization that it's either Pascal or C. I'll also try to address why I think LISP-like languages are not suitable.

First of all, I need to touch on the weaknesses of Python for the task at hand. Incidentally, these weaknesses are often praised as features that would actually help develop good practices: low visibility of control flow. To elaborate: separating statements by newline instead of a clear marker like a semicolon; blocking of code via indentation (*); no dedicated entry function like main() in C-like languages; dynamic typing on which I've already written a few screeds. Probably a few more, but these are the ones I got on top of my head.

Now let's compare some contenders with very visible flow control: C, C++, Java, Pascal. I throw away Java in an instant due to not liking teaching by handwaving away public static void main extends fuckery implements wtf keyword fiesta. Obviously with every language I need to introduce some keywords, but Java is so over the top and I need to handwave classes and so much stuff till unspecified "later" that I'd rather just devolve into C or "simplified" C++ (I'll elaborate on that). So there's no real point in Java.

Now let's look at Pascal vs C. I think the first one is slightly easier to grasp due to verbose keywords like begin and end to enclose code blocks, explicit declarations of procedure and function, explicit var declaration blocks and so on. These faculties are highly irritating due to verbosity if one already grasps the terseness of syntax in C, I literally cannot stand reading these keywords. It actually slows down my reading and understanding of the code! But at the same time, I consider it useful for the purpose of learning. I think seeing these words over and over again will burn out the lingo in the brain, which is in many levels useful - you recognize the wording in books, you know how to ask google for help etc.

On top of that, Pascal is a lot stricter with basic numeric types and, in my opinion, has better arithmetic operators. You have `div` for integer division and `/` for real number division. As far as I remember, Pascal's compiler won't allow you to use `/` if the values being divided aren't real numbers! For modulo arithmetic you have `mod` instead of the ugly C-like `%`. For assignments you have `:=` instead of `=` (this one is used for comparisons, like God Dijkstra intended). There's kind of a big deal here, because in mathematics `=` describes a property, a constant, an equation, not a change. I've seen people having some mental block with that part of C. There's no `++` and `--`.

Pascal is a lot more strongly-typed than C. The compiler won't allow you to do many of the stupid things which are perfectly valid syntactically and semantically in C, but are not "what programmer meant" and sometimes outright undefined.

For this reason, if it's up to me to actually teach someone programming, I do a C/C++ hybrid. I basically take C++ compiler and write C code in it, with the exception of using iostream instead of stdio and sometimes using strings instead of const char*. Now don't get me wrong here, iostream is cancer, but at least in remission, yet stdio will cause brain damage and then also cancer upon the programmer and his whole family. C++ is much more strongly-typed than C and has very ugly casting operators, which should actually discourage (ab)using them.

TL;DR - if you were to go on a remote island without internet and wanted to teach yourself programming, bring a Pascal book. If you have a competent mentor, go for very basic C++, bordering on C for much of the time.

Why not LISP-like lang? For the same reason I would not advise starting with assembly. I mean, it's very educating to touch assembly and LISP in one's life to see the underlying atomic structure of the universe, I'd just advise against starting with it.

Oh yeah, I haven't even got started on the cultish aspects of the crowd, where a bunch of jerkoffs go around telling everyone that you have to use "list comprehensions" and lambdas for everything, because that's "pythonic".

And then there are smug idiots who proclaim python's superiority to anything else because there exists a module that allows you to, I dunno, download a picture and run face detection on it in a few lines of code. Just because there are "modules" (libraries) means python is superior, duh obviously. It isn't quite fair to compare python's standard lib to, let's say, C++'s standard lib. You'd have to give the C++ side of the argument at least the Qt framework to make the comparison's even in the realm of possibility of being in the same ballpark.

(*) Indentation should be made with tabs, space-crowd can go fuck themselves and their backward ways and yes, I can prove that tabs are superior. (**)

(**) May not apply to LISP-like languages. I have too little experience to comment on that, but I expect I'd be right too.
I have no experience with Pascal, but C's syntax is terrible and type system but a fig leaf, so from your description it sounds like an improvement.
Regarding Lisps, wouldn't it depend on the dialect?
Scheme is very clean, minimal and elegant. It doesn't feel like lifting the veil of the universe. Describing computations in Scheme feels vary natural, clean, and reasonable. I personally found the functional style way more approachable than the procedural style of programming. Like in mathematics, you don't change anything, you describe what a thing is. It was designed for education and research and I think it does its job well. Same with Racket. Scheme has practically no syntax to learn (all lisps have very little syntax, it's just a AST bro), very few keywords, which frees the student to learn how to actually think, instead of fighting with a missing semicolon.
Common Lisp is cooking with swamp gas.
What do you think about starting out with a typed functional language, like OCaml?
 
Regarding Lisps, wouldn't it depend on the dialect?
I know too little regarding Lisps in general. I was just slightly exposed to reading some Scheme code at the university and at first glance didn't find it too much different "in looks" from LISP. You probably know the reaction people have: "ew, why so many parens everywhere".
Scheme is very clean, minimal and elegant. It doesn't feel like lifting the veil of the universe. Describing computations in Scheme feels vary natural, clean, and reasonable. I personally found the functional style way more approachable than the procedural style of programming. Like in mathematics, you don't change anything, you describe what a thing is.
I fully understand this standpoint, it's just that (in my experience) very few peoples brains are wired that way. People are more imperative than functional and it takes some training to overcome that.

To be perfectly honest, there are some programmers who do wonders with Python or PHP even and couldn't stand statically typed languages and I have no beef with such guys. I'm thinking more of addressing the brains of bottom 80% rather than top 20% of population.
It was designed for education and research and I think it does its job well.
Fun fact, so was Pascal. And in my opinion, it should've stayed that way. There's almost something bad happening with technologies that start "as a learning tool" or "as an personal/internal tool" (PHP!) gaining mainstream traction and being shoehorned into roles it was never designed for in the first place.

Have you read Kernighan's "Why Pascal is not my favorite programming language"? It's a bit dated, due to FreePascal's improvements, but still a fun read when understood in the context of the time it was written in. Favorite part: "There is no escape". Pascal is very rigid and that's OK for learning. But when the rubber hits the real world's road, it stands in the way too much.
Scheme has practically no syntax to learn (all lisps have very little syntax, it's just a AST bro), very few keywords, which frees the student to learn how to actually think, instead of fighting with a missing semicolon.
This "it's just AST" part is exactly what I meant by "exposing the structure of the universe".

What do you think about starting out with a typed functional language, like OCaml?
I did two semesters of that in the university, mostly hated it.
 
I know too little regarding Lisps in general. I was just slightly exposed to reading some Scheme code at the university and at first glance didn't find it too much different "in looks" from LISP. You probably know the reaction people have: "ew, why so many parens everywhere".
There's some chauvinism among Common Lispers which claims LISP (i.e. Common Lisp, CL) is the only one and true lisp. Malarkey. It if has s-expressions, higher order functions, symbols, It's probably a lisp imo. I find the "too many parens" criticism is more common among programmers than folks completely new to the language.
I fully understand this standpoint, it's just that (in my experience) very few peoples brains are wired that way. People are more imperative than functional and it takes some training to overcome that.
Is it the situation, or they're all irrevocably brain-damaged by squaring the circle of how a brain works to begin with? I found functional programming is harder to adopt among more experienced programmers. They will fight it tooth an nail.
In FP-land, who cares about stuff like indices, mutability, or other annoyances?
Could be I'm the weird one.
But when the rubber hits the real world's road, it stands in the way too much.
Same with Scheme. Excellent learning tool, but Guile, a Scheme dialect for general purpose scripting, tries to do too much.
This "it's just AST" part is exactly what I meant by "exposing the structure of the universe".
Only if you try to transform it.
What I was referring to was the fact there is zero ambiguity regarding the order of evaluation, what returns, and what changes.
 
  • Like
Reactions: Knight of the Rope
Is it the situation, or they're all irrevocably brain-damaged by squaring the circle of how a brain works to begin with? I found functional programming is harder to adopt among more experienced programmers. They will fight it tooth an nail.
In FP-land, who cares about stuff like indices, mutability, or other annoyances?
It's both. I admit that I was also very stubborn (or rather, my brain was) when learning FP with OCaml and was relieved when I could finally use the imperative parts of the language (pure functional was mandatory for about two-thirds of the semester). At the same time I noticed that the more mathematically inclined students had easier time grasping the "functionality".

I think that there's a great divide between people who just want to grill do programming and those who are more mathy or CompSci types. I'm of the former type, learning programming by myself and all, yet I have a CompSci degree and was exposed to the theory of computation and the whole nine yards. Most people just want to code or make games (incidentally, that's why I learned programming in the first place) and don't care about "functional purity" or a proper, formal definition of a computation model. Besides, how many people are doing day to day calculations of any kind, yet don't know proper definition of a natural number? And they just...turn off when you're trying to expose the atomic structure. They can't help it. I was kind-of similar type until I found out that I'm fascinated by compilers themselves and delved into gritty details of compiler construction. Yet even today, I can study graph-theoretical or some text processing algorithms to no end, but I'll turn off my brain when presented with a linear programming topic.

Besides, there are those pesky real-world thing like I/O and concurrent programming, where you can't escape the fact that a "state" exists. FP is very useful when applied judiciously, but then again, you can do such selective functional programming in just about any language.
 
Last edited:
It's both. I admit that I was also very stubborn (or rather, my brain was) when learning FP with OCaml and was relieved when I could finally use the imperative parts of the language (pure functional was mandatory for about two-thirds of the semester). At the same time I noticed that the more mathematically inclined students had easier time grasping the "functionality".

I think that there's a great divide between people who just want to grill do programming and those who are more mathy or CompSci types. I'm of the former type, learning programming by myself and all, yet I have a CompSci degree and was exposed to the theory of computation and the whole nine yards. Most people just want to code or make games (incidentally, that's why I learned programming in the first place) and don't care about "functional purity" or a proper, formal definition of a computation model. Besides, how many people are doing day to day calculations of any kind, yet don't know proper definition of a natural number? And they just...turn off when you're trying to expose the atomic structure. They can't help it. I was kind-of similar type until I found out that I'm fascinated by compilers themselves and delved into gritty details of compiler construction. Yet even today, I can study graph-theoretical or some text processing algorithms to no end, but I'll turn off my brain when presented with a linear programming topic.

Besides, there are those pesky real-world thing like I/O and concurrent programming, where you can't escape the fact that a "state" exists. FP is very useful when applied judiciously, but then again, you can do such selective functional programming in just about any language.
I'm not a FP purist, but state sucks and introduces complexity, so it's better to keep it wrangled. Immutability by default goes a very long way towards alleviating most problems with state and with concurrency. Then just do impure IO stuff at the edge
 
I tried Googling this but Google is fucking worthless so I'll just ask it here. How do you program something in 64 bit and/or to multi-thread instead of 32 bit? All I get from Google is "How to install 32 bit software on 64 bit Windows."

This should honestly have a simple or definitive answer but no, apparently that's a bridge too far.
 
You install the compiler toolchain for 64 bit Windows/Linux/etc x86_64 and use it to compile the program. Different programming languages and different operating systems have different ways of using multithreading.
So it's just the compiler that makes the difference?
 
Back