CS pedagogy

Pages: 123
I've been thinking about this for the past few years and every time I think about this subject I just keep coming back to this idea, so I wanted to get some opinions. Here's the idea in a nutshell:

It's not possible to teach how to program. Programming is something that is learned.

Simply put, I think there are no courses that teach how to program. The best a teacher can do is teach the grammar and semantics of a language and give a student drills so he'll develop the necessary skills by himself, but if the student doesn't understand on a fundamental level how to express his ideas in the language's building blocks to accomplish a task, there's no way to convey that intuition. I do think "intuition" is the right word. It involves some kind of mindset or pattern of thoughts that cannot be expressed in words, or at the very least that there are no words for.

Thoughts?
Last edited on
Programming is as much art as it is science. Either a student has an innate ability to think in all of code's elegant meanders and pathways, or they don't.

Most people don't, yet they get hired by companies.

I would never be hired for my coding skills, 'cuz I know my limitations and wouldn't really try. I am Salieri, not Mozart.
Last edited on
I don't think that you can be 'taught' how to program as such. A big part of programming is problem solving. You can be shown/taught the skills needed and possibly frameworks to apply them but the creative aspect of problem solving would come from guidance rather than teaching.
Fictional characters Jeeves and MacGyver. Both have vast background knowledge that they have acquired during their lifetime. Both are able to match a new problem to technique that they already know. One prepares in advance, other applies duct tape in situ, but that is an implementation detail.

A teacher can at most supply the background knowledge. The match, apply, and adapt you have to (learn to) do yourself. Well, teacher could show example analysis of a problem; why choose one method over others in that situation. But, there is only so much one can copy-paste ...
Last edited on
Depends.

Some (science and engineering) students are compelled - sometimes kicking and screaming - to take programming as part of their degree course, usually in combination with "numerical analysis", so that they have a genuine reason for doing it. For many who have no aspirations as programmers in the future it would be necessary that they be taught. Some, however, will have a genuine wish to go further, and those should be encouraged to learn (assisted by a good choice of relevant problems). Actually, the same is true for plenty of things beside programming.

I don't know much about Computer Science courses as I didn't do one, and I'm entirely self-taught as a programmer. My observation, for English universities at least, is that "programming" is a surprisingly small part of a CS degree.

However, I would encourage "programming" to be taught in a manner that is reasonably language-agnostic; employers or clients don't always give you a free choice. There is no "One Language to Rule Them" - and some exposure to multiple languages is beneficial, if only to be slightly more "future-proof". Actually, I do quite a lot of practice programming simply rewriting programs in different languages.

Yes, problem-solving is a good, creative way of learning programming. Those problems will be different for different students.
Either a student has an innate ability to think in all of code's elegant meanders and pathways, or they don't.
So knowing how to program is like grace?
https://www.youtube.com/watch?v=ENgJZlmgI6U
I think that's a bit too strong a statement. I do think people are capable of acquiring the intuition to problem-solve if they didn't have it before.

For many who have no aspirations as programmers in the future it would be necessary that they be taught. Some, however, will have a genuine wish to go further, and those should be encouraged to learn (assisted by a good choice of relevant problems).
My contention is precisely that no one is taught, that they can only learn. Some just find that the process comes relatively naturally for them and others struggle a bit more. I would expect that science and engineering students fall more commonly into the former category than the general population.

My observation, for English universities at least, is that "programming" is a surprisingly small part of a CS degree.
Well, that's one piece of evidence that led me to think the OP. In every CS program I've seen, students are not required to know how to program when they start, but they are expected (and indeed required by the nature of the contents) to do it increasingly better as they advance, and there are no programming classes as part of the curriculum along the way. So I'm wondering a) what do students that really struggle do (I would assume fail), and b) whether it is possible that some other preparation (e.g. a strong mathematics background) predisposes students not to struggle hard enough to fail.
Two aspects that go with taught rather than learn (and are not entirely unrelated) are that:
(1) it's often considerably faster to be taught;
(2) "learning" - by which I might really mean "self-taught" - means that you also need to know what is important (let's face it, some websites and even some books do more harm than good) and, if you are taking from multiple sources then it is difficult to wade through different terminology, styles and biases.

The term "learning curve" is relevant. It is useful to be taught to get started ... and then learn (or be "self-taught") as one progresses. In the long term I would definitely favour learn, but to get going it would be useful to be taught.

Last edited on
When I did my Computer Science Degree many, many years ago, my courses were:

Year 1
Mathematics
Hardware design
Electronics
System programming (PDP assembler)
Programming (Pascal)
Databases (or could have Numerical Analysis)

Year 2
Hardware design
Electronics
Operating Systems (PDP)
Compilers (Pascal)
Data Structures & Algorithms (Pascal, Fortran 77, PDP Assembler)
Networking
Microprocessors (hardware/programming using Z80)
Systems Analysis and Information Systems (Cobol 74) (or Numerical Analysis)

Year 3
Hardware design
System design
Operating Systems
Compilers
Networking
Advanced Programming/Algorithms (Algol 68, Snobol, Lisp)
Software Engineering (or Numerical Analysis)
Project

Programming was a major element of the course. Over the 3 years you were formally taught Pascal, Fortran 77, Cobol, Algol68, Snobol and Lisp - and Z80/PDP assembler. All courses (except the hardware/electronics/maths courses) had at least some programming content with the dedicated Programming courses heavy on actual programming.

IMO, being good at maths is an indication that you could be a good programmer, but the reverse is not necessarily true. Not being good at maths doesn't mean you won't be a good programmer.

You can be taught 'the language'. What is far more difficult to teach - but not impossible' - and is really learning, is how to use the constructs of the language to produce a good program. Some have a 'feel' for this and some don't. Really, the only way to get good at programming is to write programs, write programs and write programs. Preferably having them reviewed. Also reading programs that others have written.

Programmers (especially C++ ones) need a 'can do' attitude and be self-starters and enjoy self-study. C++ is a large, professional language that changes about every 3 years. Courses, books etc do not cover the whole of the language. That is up to you to find out what is available.

Many times on these forums there is the comment - 'We haven't covered that yet' or similar. So what. If you only know what you're spoon-fed then your knowledge is going to be very limited. If you don't fancy/want to keep learning then don't do C++. Try Cobol 85.

Last edited on
lastchance wrote:
There is no "One Language to Rule Them"

I would say that there are certain languages that are easier to learn and apply than others– C, Python, and HTML being three of the most popular ones. However, they do all have different applications– C is better for data storage and object-oriented stuff, Python is better for more procedural stuff and workflows, and HTML is good for displaying stuff in Web browsers, assisted by CSS and JavaScript. (This is not from personal experience; I'm not an expert on Python so feel free to correct me).

lastchance wrote:
Two aspects that go with taught rather than learn (and are not entirely unrelated) are that:
(1) it's often considerably faster to be taught;
(2) "learning" - by which I might really mean "self-taught" - means that you also need to know what is important (let's face it, some websites and even some books do more harm than good) and, if you are taking from multiple sources then it is difficult to wade through different terminology, styles and biases.

I am currently teaching myself HTML; and I definitely agree with that. It's going pretty slowly, a lot more so than my C++ courses, several years ago in college. Although that's partly because I am also juggling a job and a photography addiction ;)
Last edited on
a lot of people associate being 'taught' as 'memorizing'. In that sense, 'learning' to program (or do problem solving and related) is very limited: you can memorize patterns that work for a lot of basic cases, even for designs and even for algorithms, but once you exceed your toolbox, you are done and can't function. A lot of coders DO work like this, and they do OK at some jobs. A lot of coding jobs ask for the same ideas over and over, and someone has to do that stuff.

But if you stretch beyond the memorization factor, its more of what you guys were saying, you can guide, but not teach someone to think for themselves. You can give them the basics and encourage them to do new things, but no one can really 'teach' you how to do new things, all they can do is show approaches (which is back to memorization) and give a footing.

So, its a mix of both. There is a memorization aspect, or if not a google aspect (Ive done a dozen programs in languages I did not know, they could have been better, but they worked, thanks to the web) and then there is a whole lot more beyond that. But to an extent, it can be taught, well enough to do some things. Its the 'beyond that' which can't be taught.

You can say the same about many things. Can you teach art?
jonnin wrote:
There is a memorization aspect, or if not a google aspect

Agreed! Like keskiverto said, Jeeves and Macgyver both memorized various methods that served them well in the past, and they used them in new situations, and to good effect (Jeeves did, anyway. Having never seen Macgyver, I cannot speak for him).

But, sometimes a situation calls for something new, and you are forced to innovate. Jeeves does this brilliantly, and so did people like Bill Joy, Richard Stallman, and Linus Torvalds. And this is what makes a great programmer– or really a great anything– the ability to use what you have, and if that doesn't work, to create something new. Or google it ;)
Last edited on
jonnin wrote:
You can say the same about many things. Can you teach art?

There are schools for art ...

There is a slight difference though. Teacher can give vocabulary, grammar rules, and examples of human language, but those do not enable you to write great (novel) poetry (unless you are a Vogon).

Programming produces a novel solution to a problem, not novel content like art does. Or do we include the "invent a problem" into programming? As in "invent a new game idea".
Programming produces a novel solution to a problem, not novel content like art does.
Why doesn't a solution count as content, though? In fact, is programming necessarily distinct from artistic expression? For example, is it not possible to produce programs that, besides solving their intended problems, have aesthetically pleasing structures?
I'd argue programming is not necessarily any less artistic than, say, pottery. Yes, in both cases the final product can be extremely utilitarian, but the craftsman is also perfectly capable of putting something of themselves into their work to make pieces that are distinctly theirs.
> Why doesn't a solution count as content, though? In fact, is programming necessarily distinct from artistic expression?

To that point, I've seen people describe poetry with code https://en.wikipedia.org/wiki/Code_poetry

There are also esolangs that also play on this idea a bit (like one that describes programs as (sometimes valid) cooking recipes or as shakespeare plays).

edit: http://www.irc.perl.org/ also, I personally like to count that camel as art, and its a valid perl program.
Last edited on
I think requiring that a program resemble already existing forms of artistic expression (such as drawings or poems) in order to count as art is too strong a restriction.
For example, if I take that camel and reformat it, is it still art?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
$_ = 'ev
al("seek\040D
    ATA, 0, 0;
    ");foreach(1..3) {
      < DATA > ;
    }
    my @camel1hump; my$camel; my$Camel;
    while ( < DATA > ) {
      $_ = sprintf("%-6
        9 s ",$_);my@dromedary           1=split(//);if(defined($
        _ = < DATA > )) {
      @camel1hum p = split( //);}while(@dromeda
        ry1) {
        my$camel1hump = 0;
        my$CAMEL = 3;
        if (defined($_ = shif t(@dromedary1)) && /\S/) {
          $camel1hump += 1 << $CAMEL;
        }
        $CAMEL--;
        if (d efined($_ = shift(@dromedary1)) && /\S/) {
          $camel1hump += 1 << $CAMEL;
        }
        $CAMEL--;
        if (defined($_ = shift(
            @camel1hump)) && /\S/) {
          $camel1hump += 1 << $CAMEL;
        }
        $CAMEL--;
        if (
          defined($_ = shift(@camel1hump)) && /\S/) {
          $camel1hump += 1 << $CAME
          L;;
        }
        $camel. = (split( //,"\040..m`{/J\047\134}L^7FX"))[$camel1h
            ump];
        }
        $camel. = "\n";
      }
      @camel1hump = split(/\n/, $camel);
      foreach(@ camel1hump) {
        chomp;
        $Camel = $_;
        y / LJF7\ 173\ 175 `\047/\061\062\063\
064\065\066\067\070/;y/12345678/JL7F\175\173\047` / ;
        $_ = reverse;
        print "$_\040$Camel\n";
      }
      foreach(@camel1hump) {
        chomp;
        $Camel = $_;
        y
          /
          LJF7\ 173\ 175 `\047/12345678/;y/12345678/JL7F\175\173\0 47` / ;
        $_ = reverse;
        print "\040$_$Camel\n";
      }
      ';;s/\s*//g;;eval;   eval
      ("seek\040DATA,0,0;");
      undef$ / ;
      $_ = < DATA > ;
      s / \s * //g;(   );;s
      ; ^ .*_;;;
      map {
        eval "print\"$_\"";
      }
      /.{4}/g;
      __DATA__\ 124\ 1 50\ 145\ 040\ 165\ 163\ 145\ 040\ 157\ 1 46\ 040\ 1 41\ 0
      40\ 143\ 141\ 155\ 145\ 1 54\ 040\ 1 51\ 155\ 141\ 147\ 145\ 0 40\ 151\ 156\ 040\ 141\ 163\ 16 3\
      157\ 143\ 151\ 141\ 16 4\ 151\ 1 57\ 156\ 040\ 167\ 151\ 164\ 1 50\ 040\ 120\ 1
      45\ 162\ 154\ 040\ 15 1\ 163\ 040\ 14
      1\ 040\ 1 64\ 162\ 1 41\ 144\ 145\
      155\ 14 1\ 162\ 153\ 04 0\ 157\ 146\ 040\ 11 7\ 047\ 122\ 1
      45\ 15 1\ 154\ 1 54\ 171\ 040\ 046\ 012\ 101\ 16 3\ 16
      3\ 15 7\ 143\ 15 1\ 14
      1\ 16 4\ 145\ 163\ 054\ 040\ 111\ 156\ 14 3\ 056\ 040\ 125\ 163\ 145\ 14 4\ 040\
      167\ 1 51\ 164\ 1 50\ 0 40\ 160\
      145\ 162\ 155\ 151\ 163\ 163\ 151\ 1
      57\ 156\ 056
If not, then it's not the code itself that's artistic, but its formatting.
In my view, the fact that it's both a functional perl program and formatted to look the way it does is what makes it art. Although that being said, I agree there's no reason to limit to existing mediums.
uplime,
Yeah, I think the camel counts as art. I think that no matter if it was random letters or if it was a functional program, it would still be art.

helios
When I ran your reformatted Perl script I got a bunch of random junk that looked like this:
                        '^^FFXX7^     ^FXX77^^`                        
               .mmmm.mmmm.mmmmm.J     L.mmmmm.mmmm.mmmm.               
                       /LLXXJ\\X^     ^X\\LXXJJ/                       
  `^^^^^^^^^^^'     ^^77FFXX7{{         }}FXX77FF^^     `^^^^^^^^^^^'  
           `^^^^^^^^^`^^'''^FXX^       ^XX7^```^^'^^^^^^^^^'           
                      ^`{FFXXXX         XXXX77}'^                      
       '^^'^`^^^7XXX{F}L7XXXXL^         ^JXXXXFJ{7}XXXF^^^'^`^^`       
                          .mmmJ         Lmmm.                          
       '^^'^`^^^7XXX7F\J7XXXJL^         ^JLXXXFL\7FXXXF^^^'^`^^`       
                          .mmmJ         Lmmm.                          
                 .mJFX/LXXXXX'^         ^`XXXXXJ/X7Lm.                 
                `^^^`''^`^^^^^.         .^^^^^'^``'^^^'                
                          `^^FX         X7^^'                          

But when I ran the original, I got:
       .XXXXXXXXXXL      .XXX^XLmm   mmJX^XXX.      JXXXXXXXXXX.       
       JXXXXXXXXXXXL.   .XXXXXXXXXX XXXXXXXXXX.   .JXXXXXXXXXXXL       
     .JXXXXXXXXXXXXXXL. {XXXXXX^^^' `^^^XXXXXX} .JXXXXXXXXXXXXXXL.     
    .XXXXXXXXXXXXXXXXXXL XXXXXXL       JXXXXXX JXXXXXXXXXXXXXXXXXX.    
   mXXXXXXXXXXXXXXXXXXXXXXXXXXXX}     {XXXXXXXXXXXXXXXXXXXXXXXXXXXXm   
  JXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'     `XXXXXXXXXXXXXXXXXXXXXXXXXXXXXL  
 JXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXL 
 XXFXXXXXXXXXXXXXXXXXXXXXXXXXXX'       `XXXXXXXXXXXXXXXXXXXXXXXXXXX7XX 
 XX {XXXXXXXXXXXXXXXXXXXXXXXXF'         `7XXXXXXXXXXXXXXXXXXXXXXXX} XX 
 7X.{XXX}XXXXXXXXXXXXXXXX^7F'             `7F^XXXXXXXXXXXXXXXX{XXX}.XF 
  7}JXXF {XXX}XXXXX XXXXX                     XXXXX XXXXX{XXX} 7XXL{F  
    XXF  {XXX 7XXXX.{XXX}                     {XXX}.XXXXF XXX}  7XX    
   {XX'  {XX} `7XXX} XXX}                     {XXX {XXXF' {XX}  `XX}   
   {XX    7XX.  JXX' {XX'                     `XX} `XXL  .XXF    XX}   
    XX     ^XXmXX^'  {XX                       XX}  `^XXmXX^     XX    
    XX     .JXXX'     XX                       XX     `XXXL.     XX    
   .XX}    XXXXXLm    {XL                     JX}    mJXXXXX    {XX.   
   {XXX.   `^'`^^^'   {XXm                   mXX}   `^^^'`^'   .XXX}   
    ^^^                XXXXm               mXXXX                ^^^    
  mmJX^XXX.      JXXXXXXXXXX.              .XXXXXXXXXXL      .XXX^XLmm 
 XXXXXXXXXX.   .JXXXXXXXXXXXL              JXXXXXXXXXXXL.   .XXXXXXXXXX
 `^^^XXXXXX} .JXXXXXXXXXXXXXXL.          .JXXXXXXXXXXXXXXL. {XXXXXX^^^'
    JXXXXXX JXXXXXXXXXXXXXXXXXX.        .XXXXXXXXXXXXXXXXXXL XXXXXXL   
   {XXXXXXXXXXXXXXXXXXXXXXXXXXXXm      mXXXXXXXXXXXXXXXXXXXXXXXXXXXX}  
   `XXXXXXXXXXXXXXXXXXXXXXXXXXXXXL    JXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'  
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXL  JXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   
    `XXXXXXXXXXXXXXXXXXXXXXXXXXX7XX  XXFXXXXXXXXXXXXXXXXXXXXXXXXXXX'   
     `7XXXXXXXXXXXXXXXXXXXXXXXX} XX  XX {XXXXXXXXXXXXXXXXXXXXXXXXF'    
       `7F^XXXXXXXXXXXXXXXX{XXX}.XF  7X.{XXX}XXXXXXXXXXXXXXXX^7F'      
           XXXXX XXXXX{XXX} 7XXL{F    7}JXXF {XXX}XXXXX XXXXX          
           {XXX}.XXXXF XXX}  7XX        XXF  {XXX 7XXXX.{XXX}          
           {XXX {XXXF' {XX}  `XX}      {XX'  {XX} `7XXX} XXX}          
           `XX} `XXL  .XXF    XX}      {XX    7XX.  JXX' {XX'          
            XX}  `^XXmXX^     XX        XX     ^XXmXX^'  {XX           
            XX     `XXXL.     XX        XX     .JXXX'     XX           
           JX}    mJXXXXX    {XX.      .XX}    XXXXXLm    {XL          
          mXX}   `^^^'`^'   .XXX}      {XXX.   `^'`^^^'   {XXm         
        mXXXX                ^^^        ^^^                XXXXm       
The use of a camel image in association with Perl is a trademark of O'Reilly &
Associates, Inc. Used with permission.


I think that the way the camel script was formatted affected the output. So I think that makes it even cooler, that when you run it it draws camels on the screen.
If you think that's impressive, you should check out the demo scene.
helios wrote:
you should check out the demo scene

What do you mean?
Last edited on
Pages: 123