# Intro to Coding/Programming

**URL:** <https://boards.straightdope.com/t/intro-to-coding-programming/767585>\
**Category:** In My Humble Opinion\
**Created:** [October 3, 2016, 7:37pm UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585 "2016-10-03T19:37:15Z")\
**Posts on this page:** 17\
**Page:** 2

<div class="post-metadata">

**Author:** ![DCnDC](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dcndc/32/2842_2.png) [@DCnDC](https://boards.straightdope.com/u/DCnDC)\
**Post date:** [October 4, 2016, 1:43pm UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/21 "2016-10-04T13:43:25Z")

</div>

[QUOTE= Prof. Dijkstra]  
I think of the company advertising “Thought Processors” or the college pretending that learning BASIC suffices or at least helps, whereas the teaching of BASIC should be rated as a criminal offence: it mutilates the mind beyond recovery.  
[/QUOTE]

Meh. Dijkstra was a very smart man, a genius even, but this statement is elitist bullshit. BASIC may be impractical in today’s world but that doesn’t mean it had no value.

---

<div class="post-metadata">

**Author:** ![bump](https://avatars.discourse-cdn.com/v4/letter/b/7c8e57/32.png) [@bump](https://boards.straightdope.com/u/bump)\
**Post date:** [October 4, 2016, 1:54pm UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/22 "2016-10-04T13:54:04Z")

</div>

> [@JohnGalt](#):
>
> I teach an Introduction to Programming class at a community college,.

He’s pretty modest here, but I think the absolute best way to get into programming (which is something a tad larger in scope than mere coding) would be to take an intro course at your local community college.

You’ll (hopefully) learn the appropriate concepts as well as a lot of the nitty-gritty about actual coding.

The reason I say that programming is separate from coding is because at least in my book, coding is more of a mechanical process of literally stringing together the various keywords and what-not to make a working function or whatever. Programming is larger in scope- it’s about solving the problem using coding skills. An analogy might be that coding is like sawing accurately and hammering nails well, while programming is more like carpentry- knowing when and why to make a certain cut, or to join your boards a certain way, etc…

Coding is something that you halfway end up self-learning from a book anyway (nobody’s going to spend classroom time teaching you the ins and outs of a particular language’s implementation of arrays, for example), but programming is generally something that is taught, and where there are definite best practices that you should learn.

---

<div class="post-metadata">

**Author:** ![ticker](https://avatars.discourse-cdn.com/v4/letter/t/d07c76/32.png) [@ticker](https://boards.straightdope.com/u/ticker)\
**Post date:** [October 4, 2016, 4:11pm UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/23 "2016-10-04T16:11:21Z")

</div>

> [@DCnDC](#):
>
> Meh. Dijkstra was a very smart man, a genius even, but this statement is elitist bullshit. BASIC may be impractical in today’s world but that doesn’t mean it had no value.

At the time of Dijkstra’s diatribe idiomatic BASIC programming was a mass of unstructured GOTO commands, a style of programming abhorred by all sensible people with any exposure to ALGOL 60 and its progeny.

---

<div class="post-metadata">

**Author:** ![iamthewalrus\_3](https://avatars.discourse-cdn.com/v4/letter/i/258eb7/32.png) [@iamthewalrus\_3](https://boards.straightdope.com/u/iamthewalrus_3)\
**Post date:** [October 4, 2016, 4:22pm UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/24 "2016-10-04T16:22:53Z")

</div>

I’ve heard good things about [codeacademy](https://www.codecademy.com/).

I’d recommend Python as your first language. Holy Christ do not start learning to program in C (and I say this as someone who writes C code for a living and thinks its a valuable language to know). You can learn it later, if it turns out you like this stuff.

Reasons Python is a good first language (OP, you don’t have to understand what these mean, they’re really here to make my case to the other coders):

1. It has a C-like syntax, so the things you’ll learn will easily be transferred to any language in the C family (C/C++/Java/Objective C, etc.)

2. You can type code directly into the interpreter rather than screwing around with a compiler.

3. It can be object-oriented, but it doesn’t _force_ you into it like Java does.

4. It enforces good style habits.

5. It’s garbage collected. Memory management is not a _beginner_-level skill.

There are many more, but Python is a great first language.

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [October 4, 2016, 4:37pm UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/25 "2016-10-04T16:37:25Z")

</div>

It’s worth remembering that the “B” in BASIC stands for “Beginner’s”. The language is designed, right from the outset, as a teaching language. As such, it can be good for the new student while simultaneously being terrible for the experienced professional, and a lot (though not all, of course) of the diatribes are really just against it being used in inappropriate contexts.

As for “a mass of unstructured GOTOs”, isn’t that how machine code works, too? I don’t think that any machine code has anything like a FOR loop directly implemented, so the hardcore programmier-than-thou machine coders don’t really have a leg to stand on on that score.

---

<div class="post-metadata">

**Author:** ![Machinaforce](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@Machinaforce](https://boards.straightdope.com/u/Machinaforce)\
**Post date:** [October 4, 2016, 5:04pm UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/26 "2016-10-04T17:04:37Z")

</div>

> [@iamthewalrus\_3](#):
>
> I’ve heard good things about [codeacademy](https://www.codecademy.com/).
> 
> I’d recommend Python as your first language. Holy Christ do not start learning to program in C (and I say this as someone who writes C code for a living and thinks its a valuable language to know). You can learn it later, if it turns out you like this stuff.
> 
> Reasons Python is a good first language (OP, you don’t have to understand what these mean, they’re really here to make my case to the other coders):
> 
> 1. It has a C-like syntax, so the things you’ll learn will easily be transferred to any language in the C family (C/C++/Java/Objective C, etc.)
> 
> 2. You can type code directly into the interpreter rather than screwing around with a compiler.
> 
> 3. It can be object-oriented, but it doesn’t _force_ you into it like Java does.
> 
> 4. It enforces good style habits.
> 
> 5. It’s garbage collected. Memory management is not a _beginner_-level skill.
> 
> There are many more, but Python is a great first language.

Yeah my first experience with this was with intro to C in college. It was…disasterous to say the least.

---

<div class="post-metadata">

**Author:** ![Voyager](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/voyager/32/133_2.png) [@Voyager](https://boards.straightdope.com/u/Voyager)\
**Post date:** [October 4, 2016, 5:12pm UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/27 "2016-10-04T17:12:09Z")

</div>

> [@ticker](#):
>
> At the time of Dijkstra’s diatribe idiomatic BASIC programming was a mass of unstructured GOTO commands, a style of programming abhorred by all sensible people with any exposure to ALGOL 60 and its progeny.

Right. **DCnDC** may not be aware that this was written 40 years ago. The problem with BASIC back then is that it led to an undisciplined programming style. My friends who were CS professors dreaded the incoming freshmen from the '80s who programmed in BASIC on their PCs and so had to be broken of the bad habits they had acquired.

I was a TA for a PDP-11 assembler class in the '70s. Before we let students anywhere near assembly language, we assigned them a Pascal program to do, and then ripped apart their code, especially when they did anything unstructured. That scared them into paying attention to structured programming techniques while writing assembler code. (We also threw away the grade on the first assignment.)  
I suppose no one even uses the term spaghetti code any more. But that kind of code sure existed. I even wrote some myself before I became enlightened.

---

<div class="post-metadata">

**Author:** ![Voyager](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/voyager/32/133_2.png) [@Voyager](https://boards.straightdope.com/u/Voyager)\
**Post date:** [October 4, 2016, 5:17pm UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/28 "2016-10-04T17:17:54Z")

</div>

> [@Chronos](#):
>
> It’s worth remembering that the “B” in BASIC stands for “Beginner’s”. The language is designed, right from the outset, as a teaching language. As such, it can be good for the new student while simultaneously being terrible for the experienced professional, and a lot (though not all, of course) of the diatribes are really just against it being used in inappropriate contexts.

BASIC was invented at Dartmouth long before structured programming existed. It was meant to make lots of students have access to programming on their time sharing system, which was advanced for the day. But as a teaching tool, it is kind of like encouraging students to count on their fingers as an introduction to calculus.

> [@](#):
>
> As for “a mass of unstructured GOTOs”, isn’t that how machine code works, too? I don’t think that any machine code has anything like a FOR loop directly implemented, so the hardcore programmier-than-thou machine coders don’t really have a leg to stand on on that score.

While machine language might not have FOR loops inherent, you can code in it so that you only use FOR loops or WHILE loops. Autoincrement and autodecrement in PDP-11 assembly language actually supported simple FOR loops quite nicely. I would have gone quite mad grading and helping students with their assembly language assignments if we had not forced them into writing structured assembly code.

---

<div class="post-metadata">

**Author:** ![iamthewalrus\_3](https://avatars.discourse-cdn.com/v4/letter/i/258eb7/32.png) [@iamthewalrus\_3](https://boards.straightdope.com/u/iamthewalrus_3)\
**Post date:** [October 4, 2016, 5:37pm UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/29 "2016-10-04T17:37:53Z")

</div>

May I suggest that we move the discussion of the history of various computer languages to another thread? What Dijkstra thought of BASIC and Algol, and how PDP-11 assembly language should be written are completely irrelevant to the question of where the OP should start learning to code, and are just confusing the issue.

---

<div class="post-metadata">

**Author:** ![Telemark](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/telemark/32/372_2.png) [@Telemark](https://boards.straightdope.com/u/Telemark)\
**Post date:** [October 4, 2016, 5:39pm UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/30 "2016-10-04T17:39:55Z")

</div>

> [@Voyager](#):
>
> BASIC was invented at Dartmouth long before structured programming existed. It was meant to make lots of students have access to programming on their time sharing system, which was advanced for the day. But as a teaching tool, it is kind of like encouraging students to count on their fingers as an introduction to calculus.

I was taught by the professors who invented BASIC and it can be used as an effective first teaching tool for programming. But we quickly moved on to C and assembler for the more complex concepts, with some Pascal and Fortran thrown in for good measure IIRC.

---

<div class="post-metadata">

**Author:** ![TriPolar](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tripolar/32/3008_2.png) [@TriPolar](https://boards.straightdope.com/u/TriPolar)\
**Post date:** [October 4, 2016, 5:42pm UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/31 "2016-10-04T17:42:23Z")

</div>

> [@Chronos](#):
>
> As for “a mass of unstructured GOTOs”, isn’t that how machine code works, too? I don’t think that any machine code has anything like a FOR loop directly implemented, so the hardcore programmier-than-thou machine coders don’t really have a leg to stand on on that score.

It’s all GOTOs under the covers. Machining coding hasn’t been done since forever except by crazy people, but assembly language can be structured just as well as any high level language, and with the use of a macro-assembler should always be. C is really just a high level assembler adding better notation for the structures that should have been done with macros. Spaghetti code can be produced in any language, don’t blame the language, blame the programmer.

---

<div class="post-metadata">

**Author:** ![DCnDC](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dcndc/32/2842_2.png) [@DCnDC](https://boards.straightdope.com/u/DCnDC)\
**Post date:** [October 4, 2016, 5:44pm UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/32 "2016-10-04T17:44:47Z")

</div>

> [@Voyager](#):
>
> My friends who were CS professors dreaded the incoming freshmen from the '80s who programmed in BASIC on their PCs and so had to be broken of the bad habits they had acquired.

Which was, as CS professors, their job. But BASIC is what got many of those students to walk through that door in the first place.

Look, I’m aware of the history, the fundamental differences between programming languages, and the differing ideologies within the coding community. The purpose of BASIC was to teach not necessarily even programming, but merely the basic use of computers to people who weren’t scientists or mathematicians.

I am not suggesting anyone code their next project in BASIC. I just get annoyed at the casual dismissal of a tool that introduced the very idea of programming to literally an entire generation of people; it holds an important place in the history of computing, whether you like it or not.

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [October 4, 2016, 5:53pm UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/33 "2016-10-04T17:53:36Z")

</div>

> [@](#):
>
> Quoth **Voyager** :
> 
> While machine language might not have FOR loops inherent, you can code in it so that you only use FOR loops or WHILE loops.

Similarly, you can code in BASIC in such a way that you only use its GOTOs to implement those same loops. And it does even have a FOR construct, albeit not as flexible as the one in, say, C. The problem here is not the tool; it’s in how the tool is used.

---

<div class="post-metadata">

**Author:** ![septimus](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/septimus/32/410_2.png) [@septimus](https://boards.straightdope.com/u/septimus)\
**Post date:** [October 5, 2016, 1:40am UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/34 "2016-10-05T01:40:41Z")

</div>

Obviously higher-level languages enhance productivity, but …  
[QUOTE=carniverousplant]  
One of my professors in graduate school said that machine language made him understand programming.  
[/QUOTE]

I think many beginning programmers are confused by simple concepts like pointers; this confusion disappears if you can think about the real machine.

> [@Chronos](#):
>
> I don’t think that any machine code has anything like a FOR loop directly implemented …

Nitpick: IBM’s System 360 has a BXLE instruction, which effectively implements the C code  
… while ((r1 += r2) \<= r3)  
Obviously labels are needed: there is no machine language idiom for “{ … }”. There’s a BXH for the reverse test; and some other “loop-assistances” in some other machine languages.

---

<div class="post-metadata">

**Author:** ![watchwolf49](https://avatars.discourse-cdn.com/v4/letter/w/e9c0ed/32.png) [@watchwolf49](https://boards.straightdope.com/u/watchwolf49)\
**Post date:** [October 5, 2016, 1:51am UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/35 "2016-10-05T01:51:02Z")

</div>

Huh … my machine came with PHP installed … it does everything I want to do … seemed easy enough to learn as a complete beginner. MySQL is a free download if you want a robust database.

I can say “I front-end MySQL with Firefox.” That really impresses the girls …

---

<div class="post-metadata">

**Author:** ![Voyager](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/voyager/32/133_2.png) [@Voyager](https://boards.straightdope.com/u/Voyager)\
**Post date:** [October 5, 2016, 5:58pm UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/36 "2016-10-05T17:58:42Z")

</div>

> [@DCnDC](#):
>
> Which was, as CS professors, their job. But BASIC is what got many of those students to walk through that door in the first place.
> 
> Look, I’m aware of the history, the fundamental differences between programming languages, and the differing ideologies within the coding community. The purpose of BASIC was to teach not necessarily even programming, but merely the basic use of computers to people who weren’t scientists or mathematicians.
> 
> I am not suggesting anyone code their next project in BASIC. I just get annoyed at the casual dismissal of a tool that introduced the very idea of programming to literally an entire generation of people; it holds an important place in the history of computing, whether you like it or not.

BASIC was invented before structured programming was understood, so I am in no way condemning the language. The problem my friends faced was not that the kids knew about programming, it was that they thought they knew \*\*all \*\* about programming. Structured code is not the only thing - BASIC does not allow you to construct any interesting data structures beyond arrays.  
Yes, you can write structured code in almost any language - but you have to be exposed to it first, and someone learning BASIC from a book back then is not going to be. (This is where this is relevant to how to the learn programming topic of this thread.) If you start with a language which supports structure, you’ll at least get exposed to it.  
And while you can write BASIC like C , you can also write C like BASIC. I’ve seen this, and it ain’t pretty.  
I learned to program before the structured programming revolution, in machine language and Fortran, so I can testify from personal experience that learning how to do it right changes your whole way of thinking, and made me at least a 10x better programmer.  
GoTos have their (rare) uses, but for a first language it might be better to banish them and only allow next and loop exit type statements instead, which provide 99% of the functionality and none of the risk.

---

<div class="post-metadata">

**Author:** ![Voyager](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/voyager/32/133_2.png) [@Voyager](https://boards.straightdope.com/u/Voyager)\
**Post date:** [October 5, 2016, 6:04pm UTC](https://boards.straightdope.com/t/intro-to-coding-programming/767585/37 "2016-10-05T18:04:18Z")

</div>

> [@Chronos](#):
>
> Similarly, you can code in BASIC in such a way that you only use its GOTOs to implement those same loops. And it does even have a FOR construct, albeit not as flexible as the one in, say, C. The problem here is not the tool; it’s in how the tool is used.

The problem is the concept of availability. If your introduction to programming only involves gotos and simple for loops, you are not going to think of better structures in general. Ditto for data structures. (I’ve taught data structures, so I’m a big fan of them.)  
That’s why we forced our class to do the first assignment in Pascal (though we didn’t think of it in those terms.) Get exposed to structure, get your finger burned for not using structure, and you’ll do it right even when you have to construct the structure yourself.  
Hell, my dissertation was about a Pascal-like high level microprogramming language, with a full set of control structures. If you can do it in microcode, you can do it anywhere.

[Previous page](https://boards.straightdope.com/t/intro-to-coding-programming/767585.md?page=1)
