a thoughtful web.
Good ideas and conversation. No ads, no tracking.   Login or Take a Tour!
comment by o11c
o11c  ·  3191 days ago  ·  link  ·    ·  parent  ·  post: How did you learn programming?

I used to dabble with TI-BASIC on my calculator, but my first real language was Java. I would not recommend it as a first language, it tries to enforce a lot of bad practices.

I would recommend Python and C as first languages, in that order.

It is important to realize that you will not learn programming from any class. It is something you must do yourself. I saw a study recently that said those who excel in programming are those who are able to follow arbitrary but consistent rules, even though they are completely meaningless. Do not attempt to equate programming rules with rules in Real Lifeā„¢

The most important rule I have is "never use global variables", and that includes standard library functions that necessarily imply global variables. The sole exception is writing to `stderr`, which is for debugging only (When e.g. writing a compiler library, error messages go to a user-provided stream). Of course, `main` may pass `stdin`, `stdout`, or `stderr` as an argument to the other functions.

Also, make sure you find a way to enable as many warnings as possible all the time. Consider all warnings as fatal errors, and if you must suppress them, only suppress them around one specific site (e.g. `#pragma GCC diagnostic push/pop` around it)