tag:blogger.com,1999:blog-29719356377276363662024-03-08T10:39:52.356+00:00Teaching Programming at UniversityFor people teaching programming in Higher EducationTim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.comBlogger23125tag:blogger.com,1999:blog-2971935637727636366.post-2526332543274341222021-01-05T16:49:00.000+00:002021-01-05T16:49:58.050+00:00Automated Python Marking
<p>Each year at our department 300+ new students learn Python using a tutorial (Jupyter notebooks). They need to complete exercises (Jupiter notebooks) using a cloud facility like colaborator. In October 2020 we attempted to mark these exercises using automation. This replaced 75 expensive and tiring person-hours of face-to-face interaction. As an extra challenge we didn't change the exercises (many of which used asserts anyway). The first batch of 10,000+
programs were non-graphical, which helped. This document reports on the results. Marking needs to be part of a wider framework, so help provision is considered here too.</p>
<h2><a name=context></a>Providing support</h2>
<p>
In the past, support was an online Forum and a daily face-to-face drop-in help desk, neither of which were used much, (especially given the size of the cohort). Marking was done face-to-face. Covid forced us to reconsider these procedures. We decided to advertise to students a range of methods of getting help - </p>
<i>
<ul>
<li> You may well need to re-read the provided notebooks several times. Everything you need to know is there. If you rush too quickly to the Exercises you might be able to muddle through the early ones, but sooner or later you'll get stuck.
<li> The "Ask a Question" Forum on the Moodle page is open all the time. Anybody can answer. Posts can lead to a Zoom dialog if you want.
<li> The "Support Chatrooms" on the Moodle page are open 2-3pm. One helper per chatroom. Posts can lead to a Zoom dialog if you want.
<li> Other tutorials - one reason we teach Python is that there are many online tutorials to suit all tastes. The main Python site has a list for beginners on <a href="https://wiki.python.org/moin/BeginnersGuide/Programmers">https://wiki.python.org/moin/BeginnersGuide/Programmers</a></li>
<li> The University provides general and specialist courses - see <a href="https://training.cam.ac.uk/ucs/search?type=events&query=python">https://training.cam.ac.uk/ucs/search?type=events&query=python</a>
<li>Online help - If the local Forum doesn't suit you, try <a href="https://stackoverflow.com/questions/tagged/python-3.x">https://stackoverflow.com/questions/tagged/python-3.x</a>. If you don't know what an error message (e.g. "'NoneType' object is not subscriptable") means, just copy/paste it into a search engine. Read <a href="https://stackoverflow.com/help/how-to-ask">How do I ask a good question?</a></li>
</ul>
</i>
<p>Virtual support seemed to work ok (help-support costs were 30% of last year's - even so, the helpers during the 2-3pm sessions often had nothing to do for complete sessions). 85 questions were asked on the Forum in 6 weeks during Mich 2020. Students liked sending screendumps rather than code (e.g. <a href="apythonanswer.png">this</a>) See <a href="http://www-h.eng.cam.ac.uk/help/tpl/onlinehelpdesks/">online helpdesks</a> for information about how we used Moodle's facilities.</p>
<p>Marking was a trickier issue.</p>
<h2><a name=simplemarker></a>simplemarker</h2>
<p>Many automarkers (some commercial) are available - see <a href="#Availableproducts">the list below</a>. Many are language neutral. Most compare the program output with expected output (sometimes demanding an exact match). Some integrate with databases.</p>
<p>Merely comparing program output with expected output restricts the type of questions that can be asked, so we wrote our own <a href="https://gitlab.developers.cam.ac.uk/eng/ics/devops/python-ia-marking"><code>simplemarker</code></a> program. Given a folder of students' replies to a programming exercise, and a list of tests, <code>simplemarker</code> </p>
<ul>
<li> checks to see if the programs ask for user input
<li> checks for infinite loops
<li> checks to see if the programs pass a set of tests
<li> optionally checks for duplicate replies
<li> returns lists of files that pass, etc.
</ul>
<p>Here's the code fragment for marking the solutions to the exercise about writing an "is_odd" function</p>
<pre>
testisodd1={"FunctionExists": {"FunctionName":"is_odd"}}
testisodd2={"CheckReturnValue": {"FunctionName":"is_odd","Input":3,"Returns":True}}
testisodd3={"CheckReturnValue": {"FunctionName":"is_odd","Input":4,"Returns":False}}
d=marking.simplemarker("testfolder", [testisodd1,testisodd2,testisodd3],label="Mark is_odd",hashcheck=True)
printanswers(d)
</pre>
<p>and here's the output</p>
<pre>
*** Mark is_odd
PASS - ['abc123.py', 'tl136.py']
FAIL - ['sms67.py']
ASKS FOR USER INPUT - ['xxx.py']
INFINITELOOP - ['yyy.py']
HASH -
b5db5badc627e448e07616fcd606064a 2
</pre>
<p>(the last line means that 2 solutions have the same checksum, which would be suspicious with a large number of programs)</p>
<p>The tests available are</p>
<ul>
<li> Does a named function exist?
<li> Does a named function (or the whole file) contain a particular string or regex?
<li> Does a named function (or the whole file) have less than (or more than) a specified number of lines?
<li> Is the named function recursive?
<li> Given the specified input, does a named function return the specified value?
<li> Does the file print the specified output?
<li> Does a new file which contains a named function and some specified extra lines produce the specified output when run?
</ul>
<p>The aim wasn't for complete automation in the first year, but to reduce the need for human interaction using the real-life sample set to refine the simplemarker program.</p>
<h2><a name=Theprocess></a>The process - benefits and problems</h2>
<p>Students submit a zip file of 6 jupyter notebooks via Moodle (our CMS
system). 100 lines of bash/Python code extract the python programs and generated images from these,
putting them into an appropriate folder (there's one for each exercise)
and reporting on missing programs. 1000 more lines of Python code (still under development) do the marking, producing a "Right" or "Wrong" result for each file, and sometimes diagnosing the problem. At the end there's a list of students/program that have failed.</p>
<p>The process for milestone 2, Mich 2020 was</p>
<ul>
<li>In Moodle, choose the "Download all submissions" "Grading action" </li>
<li>Unzip these into an empty folder - I did
<pre>
mkdir /tmp/marking
cd /tmp/marking
unzip ~/Downloads/*notebooks*7-12*.zip
mv */*zip .
rm -rf *_file_
</pre>
</li>
<li>Create a folder for each exercise (actually, each cell of an exercise). Extract the programs and png files (the png files are the program's graphical output) -
<pre>
bash ~/python-ia-marking/extractallmilestone2
</pre>
In each folder there's a <i>CRSID</i>.py file for each student, and a <i>CRSID</i>.png file if graphics were produced
</li>
<li>Mark -
<pre>
python ~/python-ia-marking/do_the_markingMilestone2.py
</pre>
</li>
</ul>
<p>This outputs lists of CRSIDs of passes and failures for each question. For milestone 2 on an old laptop it takes about 20 minutes.</p>
<h3>Benefits</h3>
<ul>
<li>More rigorous, consistent checking of straightforward issues.</li>
<li>The ability to check for cheating</i>
<li>Gathering statistics to identify what students struggle with -
<ul>
<li>Well over 10% of students fail to extract the 3rd column of a matrix using slicing (they extract the wrong column, a row, or list each element). Anything not tested by asserts
is likely to have a rather high fail rate.</li>
<li>Over 20% of students fail to use recursion when asked to write a recursive factorial
function - they iterate (thinking this is recursion) or call math.factorial.</li>
<li>For milestone 1 in Mich 2020, 294 corrections were requested from 199 students. Many re-corrections were requested too.</li>
</ul>
</li>
</ul>
<h3>Problems</h3>
<ul>
<li><i>Submission trouble</i> - The instructions were "<i>The single zip file you submit should have your ID, a full-stop, and a "zip" suffix in its name and nothing else (e.g. tl136.zip). It should contain only the 6 notebook files, the files having the suffix ipynb</i>". About 5% of students submit wrongly - multiple files instead of a single file, wrongly named single file, pdf files archived, suffices removed from all the archived files, oriental characters added to the suffices of archived files, zip files archived, etc.</li>
<li><i>Remoteness</i> - When the course was C++ and lab-based (timetabled to run twice a week), it was possible to check that students were keeping up (marking was done in each session). Struggling students could be given extra help, often benefitting from long 1-to-1 discussions. When the course became python and self-taught in 2016, students who self-identified as weak could (and did) regularly visit the daily helpdesks and get individual tuition. Of course, unconfident student could still hide away, but opportunities were there. Covid has increased the difficulties that staff have identifying and contacting the students who most need help.</li>
<li><i>Pedantic automation</i> - I soon realised during the trial run that automation would reject many programs that human markers would accept. When asked to write a function called <code>area</code>, many students wrote <code>Area</code>, <code>triangle_area</code>, etc. When asked to print a value out they only calculated it. Pedantry is part of computing, but it can detract from the learning experience.</li>
<li><i>Expert programmers need more feedback</i> - Having spent time doing the optional sections and finding ingeniously short answers, students want more than a "No news is good news" or "Congratulation! You've passed" response.</li>
<li><i>Poor programmers need more feedback</i> - Telling students that they need to re-do a question is frequently unproductive. As is telling them to read the question more carefully (see the next section).</li>
<li><i>Students finish the exercises without trying to understand the material</i> - This common problem is made worse by the remote learning context. It's not unusual for students to bypass much of the teaching material, starting by looking at the exercises (which are in separate documents from the tutorials). Only if they get stuck will they refer back (very selectively) to the tutorial. Consequently when they are told why their program fails they can't correct it because they don't understand the helper's description of the mistake. They don't know what recursion or dictionaries are (one student asked me if a vertical dictionary was ok). When asked to create a list, they use the common meaning of "list" rather than the Python concept. They don't understand the difference between a function printing the answer and returning the answer (after all, both appear on screen). I tell them to read the teaching material and ask questions about <i>that</i> before attempting the exercises. Face-to-face interaction is needed at this point.</ul>
<p>In Mich 2020 milestone 1 I used automation to filter out correct entries, looking at the files flagged as wrong. When I mailed students for corrections I always explained briefly what was wrong. All the students who failed to use recursion when asked to received the same bulk-mailed message. In most other cases I needed to send different messages to subsets of students whose solution failed.</p>
<p>I invited students to mail me or come to the daily helpdesk if they wanted feedback.</p>
<p>In Mich 2020 milestone 2, things were smoother. And I realised that graphical output could be extracted from notebooks.</p>
<h2><a name="Exampleofstudenterrors"></a>Example of student errors</h2>
<p>Getting students to correct their code isn't a trivial matter. Students are asked to "Write a function that uses list indexing to add two vectors of arbitrary length, and returns the new vector. Include a check that the vector sizes match, and print a warning message if there is a size mismatch." They're given some code to start -</p>
<pre>
def sum_vector(x, y):
"Return sum of two vectors"
a = [0, 4.3, -5, 7]
b = [-2, 7, -15, 1]
c = sum_vector(a, b)
</pre>
<p>Over 20% of students failed this exercise. It (and a question about dictionary manipulation) was the most re-corrected exercise. Several things (many not tested by asserts) can go wrong -</p>
<ul>
<li>They forget entirely to check vector lengths</li>
<li>They check vector lengths, but outside of the function (they check the lengths of a and b before calling <code>sum_vector</code>). Explaining why this is bad can take a while</li>
<li>They overwrite the given x and y values in the function - e.g. <code>x== [0, 4.3, -5, 7]</code>, etc. (perhaps because they have to use variables called <code>a</code> and <code>b</code> when calling the function, but the function wants variables called <code>x</code> and <code>y</code>). </li>
<li>They check vector lengths in the function, in the loop they use to sum the vectors</li>
<li>They check vector lengths in the function, but only after they've tried to sum the vectors</li>
<li>They check vector lengths in the function before they sum the vectors, and they print a message if there's a mismatch, but they don't return, so the program crashes anyway</li>
<li>They check vector lengths in the function at the right time, bypassing the maths if there's a mismatch but forgetting to print a message
<li>If there's a size mismatch they return a string containing the warning message</li>
<li>If there's a size mismatch they return <code>print('Size mismatch')</code> without appreciating what they're returning.</li>
</ul>
<p>I've had situations where, when told about the first error listed here, they make the second error. When told about the second error, they make another one. And so on! They're blindly jumping through hoops.</p>
<h2><a name="Examplesofstudentsinefficiencies"></a>Examples of students' inefficiencies</h2>
<p>Some long-winded ways of solving problems aren't bugs, but a human, face-to-face marker would fix them on the spot. Here are some examples -
</p>
<ul>
<li><i>String repetition</i> - a question begins by giving them a passage from Shakespeare, asking them to produce a string that repeats it a 100 times. A few students use copy/paste</li>
<li><i>Dice outcomes</i> - a question asks them to repeatedly roll a simulated die and collect results. Instead of using "<code>frequency[outcome]+= 1</code>"
several students try something like
<pre>
if outcome == 1:
no1 += 1
elif outcome == 2:
no2 += 1
elif outcome == 3:
no3 += 1
elif outcome == 4:
</pre>
Fortunately it's only a 6-sided die.
</li>
<li><i>String comparison</i> - a question asks them to write a <code>__lt__</code> method. This involved string comparison. Dozens of students instead of using <code>self.surname < other.surname</code> write something like
<pre>
if len(self.surname) < len(other.surname):
for i in range(len(self.surname)):
if alphabet.index(self.surname.upper()[i]) < alphabet.index(other.surname.upper()[i]):
return True
elif alphabet.index(self.surname.upper()[i]) > alphabet.index(other.surname.upper()[i]):
return False
</pre>
etc., etc.
</ul>
</ul>
<p> I don't think a programming course should let these pass. We could identify at least some of these by checking on the program/function length, but human follow-up is required.
</p>
<h2><a name=Thefuture></a>The future</h2>
<ul>
<li><code>automarker</code> changes -
<ul>
<li>Diagnosing common bugs so that students can be told more precisely what's wrong with their code. By anticipating and testing for common bugs (rather in the way that multiple choice options anticipate common mistakes) perhaps better diagnosis is possible. I started doing this for milestone 2 when I realised that students were often summing the 3rd row of a matrix rather than the 3rd column.</li>
<li>Diagnosing common style issues.</li>
<li>Add mail=yes/no from=<i>emailaddress</i> message="" fields for each test to facilitate automation of mailed feedback</li>
<li>Mailing students about all their mistakes in one go, rather than mailing students question by question.</li>
<li>Listing students who did the optional questions, so they can be praised and encouraged.</li>
</ul>
</li>
<li>Some changes in the questions' wording and greater ruthlessness in rejecting invalid submissions would save a lot of time.
<ul>
<li>When an question asks then to produce and print a list, they're likely to print a sequence of items (i.e. a list rather than a <i>Python</i> list). Maybe we could tell them the name that the list should be given.</li>
<li>Some exercises look optional to some of them though they're compulsory. Exercise 06.3 only has an editable cell under the optional part, so they didn't do the first part (or they made a new cell for it). But all the questions have this layout with cells at the end, so I don't know why 06.3 is a problem.</li>
<li>Some exercises (e.g 05.2) encourage the use of multiple cells to write the code in. Students used 1-4 of the cells. One cell would be easier for the automarker</li>
<li>Maybe more of the open-ended parts of questions could become optional - in 05.1 for example.</li>
</ul>
</li>
<li>An interactive system? - students could drop files into a webpage and get instant feedback.</li>
<li>Automarking needs to be part of an integrated support environment. Perhaps automarking should be a first phase dealing with the bulk of submissions, then humans should deal with the more problematic cases. Demonstrators could deal with students who did the optional extras, or who wanted more feedback on style, etc.</li>
</ul>
<h2><a name="Availableproducts"></a>Available products for marking</h2>
<ul>
<li>
<a href="https://github.com/marovira/marking">https://github.com/marovira/marking</a> - (Developed for first year courses at UVic). Any deviation from the expected output (whitespace, spelling, capitalization, new lines, etc) will be flagged as an error
<li>
<a href="http://web-cat.org/">http://web-cat.org/</a> - "It is highly customizable and extensible, and supports virtually any model of program grading, assessment, and feedback generation. Web-CAT is implemented as a web application with a plug-in-style architecture so that it also can serve as a platform for providing additional student support services". Free.
<li>
<a href="https://github.com/autolab">https://github.com/autolab</a> - "Web service for managing and auto-grading programming assignments". Deals with course administration too - see https://autolab.github.io/docs/. Tango does the marking. "Tango runs jobs in VMs using a high level Virtual Memory Management System (VMMS) API. Tango currently has support for running jobs in Docker containers (recommended), Tashi VMs, or Amazon EC2." But it seems to be more of a framework for automarking, each course-leader having to produce assessment code
<li>
<a href="https://pypi.org/project/markingpy/">https://pypi.org/project/markingpy/</a> - same philosophy as my attempt, though more sophisticated. It can do timing tests. Alas the link to the docs is broken - https://markingpy.readthedocs.io.
<li>
<a href="https://www.autogradr.com/">https://www.autogradr.com/</a> - Not free.
<li>
<a href="https://github.com/GatorEducator/gatorgrader">https://github.com/GatorEducator/gatorgrader</a> - same philosophy as my attempt. Has tests like "Does source code contain the designated number of language-specific comments?", "Does source code contain a required fragment or match a specified regular expression?", "Does a command execute and produce output containing a fragment or matching a regular expression?"
<li>
<a href="https://github.com/apanangadan/autograde-github-classroom">https://github.com/apanangadan/autograde-github-classroom</a> - "Currently, grade-assignments.py will get stuck if one of the student repos goes into an infinite loop."
<li>
<a href="https://github.com/cs50/check50">https://github.com/cs50/check50</a> - using YAML files it's easy to check if programs produce the right output for specified input. But I don't think it can do other checks.
<li>
<a href="https://classroom.github.com/assistant">https://classroom.github.com/assistant</a> - "Track and manage assignments in your dashboard, grade work automatically, and help students when they get stuck"
<li>
<a href="https://github.com/jupyter/nbgrader">https://github.com/jupyter/nbgrader</a> - an extension for notebooks that uses asserts. I think we use it.
<li>
<a href="https://github.com/kevinwortman/nerfherder">https://github.com/kevinwortman/nerfherder</a> - "a collection of Python hacks for grading GitHub Classroom repositories."
<li>
<a href="https://github.com/Submitty/Submitty">https://github.com/Submitty/Submitty</a> - "Customizable automated grading with immediate feedback to students. Advanced grading tools: static analysis, JUnit, code coverage, memory debuggers, etc."
<li>
<a href="https://www.codio.com/features/auto-grading">https://www.codio.com/features/auto-grading</a> - Not free.
</ul>
Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-73692222105051147712017-04-20T09:36:00.002+01:002017-04-20T09:36:58.654+01:00"The Clean Coder" by Robert C. Martin (Pearson Education, 2011)<p>The full title is "The Clean Coder: a code of conduct for professional programmers". "<span class=quotation>In the pages of this book I will try to define what it means to be a professional programmer. I will describe the attitudes, disciplines, and actions that I consider to be essentially professional</span>" (p.2)</p>
<p>The book contains many opinions, some repeated. I'll organise the quotes into sections.</p>
<h2>Management</h2>
<ul>
<li>"<span class=quotation>It is not your employer's responsibility to train you, or to send you to conferences, or to buy you books</span>"
(p.16)</li>
<li>"<span class=quotation>Good managers crave someone who has the guts to say no. It's the only way you can really get anything done</span>" (p.26)</li>
<li>"<span class=quotation>Here are some examples of words and phrases to look for that are telltale signs of noncommitment: ... "We need to get this done" ... "I hope we can meet again some day" ... "Let's finish this thing</span>" (p.48)</li>
<li>"<span class=quotation>when professionals say yes, they use the language of commitment so that there is no doubt about what they've promised</span>" (p.56)</li>
<li>"<span class=quotation>Professional development organisations allocate projects to existing gelled teams, they don't form teams around projects</span>" (p.170)</li>
</ul>
<h2>Working practises</h2>
<ul>
<li>"<span class=quotation>The only way to prove that your software is easy to change is to make easy changes to do. And when you find that the changes aren't as easy as you thought, you refine the design so that the next change is easier</span>" (p.15)</li>
<li>"<span class=quotation>Why do most developers fear to make continuous changes to their code? They are afraid they'll break it! Why are they afraid they'll break it? Because they don't have tests!</span>" (p.15)</li>
<li>"<span class=quotation>When you have a suite of tests that you trust, then you lose all fear of making changes. When you see bad code, you simply clean it up on the spot ... the code base steadily <i>improves</i> instead of the normal rotting that our industry has become used to</span>" (p.81)</li>
<li>"<span class=quotation>Here is a <i>minimal</i> list of the things that every software professional should be conversant with:
<ul>
<li>Design patterns. You ought to be able to describe all 24 patterns in the GOF book and have a working knowledge of many of the patterns in the POSA books.</li>
<li>Design principles. You should know the SOLID principles and have a good understanding of the component principles</li>
<li>Methods. You should understand XP, Scrum, Lean, Kanban, Waterfall, Structured Analysis, and Structured Design</li>
<li>Disciplines. You should practice TTD, Object-Oriented design, Structured Programming, Continuous Integration, and Pair Programming</li>
<li>Artifacts: You should know how to use: UML, DFDs, Structured Charts, Petri Nets, State Transition Diagrams and Tables, flow charts, and decision tables</li>
</ul></span>" (p.18)</li>
<li>"<span class=quotation>If you are tired or distracted, <i>do not code</i></span>" (p.59)</li>
<li>"<span class=quotation>Nowadays when I feel myself slipping into the Zone, I walk away for a few minutes. I clear my head</span>" (p.62)</li>
<li>"<span class=quotation>Choose disciplines that you feel comfortable following in a crisis. <i>Then follow them all the time</i>. Following these disciplines is the best way to avoid getting into a crisis</span>" (p.153)</li>
<li>"<span class=quotation>programmers do not tend to be collaborators. And yet collaboration is critical to effective programming. Therefore, since for many of us collaboration is not an instinct, we require <i>disciplines</i> that drive us to collaborate</span>" (p.75)</li>
<li>"<span class=quotation></span>The three laws of TDD [Test Driven Development]
<ol>
<li>You are not allowed to write any production code until you have first written a failing unit test</li>
<li>You are not allowed to write more of a unit test than is sufficient to fail - and not compiling is failing</li>
<li>You are not allowed to write more production code that is sufficient to pass the currently failing unit test</li>
</ol>" (p.80)</li>
<li>"<span class=quotation>[Model Driven Architecture] assumes that the problem is the code. But code is <i>not</i> the problem. It has never been the problem. The problem is <i>detail</i></span>" (p.201)</li>
</ul>
<h2>Testing</h2>
<ul>
<li>"<span class=quotation>QA Should Find Nothing</span>" (p.12)</li>
<li>"<span class=quotation>For some reason software developers don't think of debugging time as coding time</span>" (p.69)</li>
<li>"<span class=quotation>Writing these tests is simply the work of specifying the system. Specifying at this level of detail is the only way we, as programmers, can know what 'done' is</span>" (p.105)</li>
<li>"<span class=quotation>Make sure that all your unit tests and acceptance tests are run several times per day in a <i>continuous integration</i> system</span>" (p.110)</li>
<li>"<span class=quotation>It should be QA's role to work with business to create the automated acceptance tests that become the true specification and requirements document for the system</span>" (p.114)</li>
<li>"<span class=quotation>
<ul>
<li><b>Unit tests</b> - written by the programmers, for programmers ... before the production code is written</li>
<li><b>Component tests</b> - The components of the system encapsulate the business rules, so the tests for those components are the acceptance tests for those business rules ... written by QA and Business with help from development</li>
<li><b>Integration tests</b> - They do not test business rules ... they ... make sure that the components are properly connected and can clearly communicate with each other ... typically written by the system architects ... typically <i>not</i> executed as part of the Continuous Integration suite, because they often have longer runtimes</li>
<li><b>System tests</b> - They are the ultimate integration tests. ... We would expect to see throughput and performance tests in this suite</li>
<li><b>Manual exploratory tests</b> - These tests are not automated, <i>nor are they scripted</i></li>
</ul>
</span>" (p.116)</li>
</ul>
<h2>Misc</h2>
<ul>
<li>"<span class=quotation>FITNESSE is 64,000 lines of code, of which 28,000 are contained in just over 2,200 individual unit tests. These tests cover at least 90% of the production code and take about 90 seconds to run</span>" (p.80)</li>
</ul>
Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-58562192311162539262016-01-18T09:24:00.000+00:002016-01-18T09:26:47.415+00:00The psychology of programmers<p>Psychology is of interest to programmers when designing GUIs, etc., and of use to educationalists when designing programming courses. Here I'm more concerned with identifying the psychology traits that are more common (or useful) in programmers. When Gerald M. Weinberg wrote "The Psychology of Computer Programming" (1971) he said "<span class="quotation">What traits, then, would give an indication of potential failure in a programmer? We can speak on this subject only from anecdotal material, for there have as yet been no formal studies of this question</span>". Since then more studies have been done, but I've had trouble finding material. Here I'll provisionally assemble information about aptitude tests, anecdotal material and academic findings.</p>
<p>A programmer is often part of a team, so individuals can afford to have a narrow range of skills. A lone programmer may need to have the skills of a team, so the literature about teamwork is relevant too.</p>
<h2>Team requirements</h2>
<p>
If you can employ several people your team might well comprise: Project Manager, Product Manager, Architect, User-interface designer, End-user liaison, Developer, QA/Testers, Toolsmith, Build Coordinator, Risk Officer, End-user documentation specialist (Survival Guide p.105). These don't always get on with each other. If they're all one person, beware! It's unlikely that one person will be strong in all phases of development.</p>
<h2>Aptitude tests</h2>
<p>The material at <a href="http://www.kent.ac.uk/careers/tests/computer-test.htm">Kent University Careers</a> is typical. It says that the non-programming tests deal with "logical reasoning, numerical problem solving, pattern recognition, ability to follow complex procedures and attention to detail". </p>
<p>They suggest some other attributes that are also required by programmers and other computing professionals</p>
<ul>
<li>Time management
<li>Creativity
<li>Teamwork
<li>Determination
<li>Clear, concise documentation
<li>Ability to quickly learn new skills and update existing ones by teaching yourself.
<li>a receptivity to new ideas:
<li>reasonably quick coders, although accuracy is more important than speed
</ul>
<h2>Computational Thinking</h2>
<p>Many of the above skills have been clumped into the concept of <a href="https://en.wikipedia.org/wiki/Computational_thinking">Computational Thinking</a>.
According to its advocators, <a href="http://www.google.com/edu/computational-thinking/what-is-ct.html">Computational Thinking</a> "involves a set of problem-solving skills and techniques that software engineers use to write programs ... However, computational thinking is applicable to nearly any subject. ... Specific computational thinking techniques include: problem decomposition, pattern recognition, pattern generalization to define abstractions or models, algorithm design, and data analysis and visualization".
</p>
<h2>Psychology research</h2>
<p> According to <a href="http://www.humantechnology.jyu.fi/articles/volume4/2008/ge-sajaniemi.pdf">Psychology of programming: Looking into Programmers' heads</a> by Jorma Sajaniemi (2008) "Psychology of programming (PoP) is an interdisciplinary area that covers research into computer programmers’ cognition; tools and methods for programming related activities; and programming education. ... During the past two decades, two important workshop series have been fully devoted to PoP: the Workshop on Empirical Studies of Programmers (ESP), based primarily in the USA, and the Psychology of Programming Interest Group Workshop (PPIG), having a European character".
</p>
<p>
The paper lists work that has looked at correlations between programming success and some other property - "field dependence (e.g., Mancy & Reid, 2004), inclination to systematic behavior (e.g., Dehnadi, 2006), or self-efficacy (e.g., Wiedenbeck, LaBelle, & Kain, 2004). Jones and Burnett study spatial ability and find a positive correlation between mental rotation ability and programming success in their paper “Spatial Ability and Learning to Program.”"
</p>
<p>In <a href="http://softwarecreation.org/2008/five-big-personality-traits-of-a-programmer-do-they-matter/">Five Big Personality Traits of a Programmer. Do They Matter?</a> it's suggested that "Some traits are more beneficial for the software development: Explorer [high Openness], Focused [high Conscientiousness], Extravert. Other could also nicely compliment each other like Focused Preserver or Open-Minded Challenger. Some traits could be dangerous for the project and team like Nervous Preserver or Agressive Challenger."</p>
<p>According to Renata McGee, "Computer programmers are very detailed thinkers and are able to excel in their positions due to the various traits and skills they possess.
Professionals with ISTJ (Introverted, Sensing, Thinking, Judging) personality types have natural skills that are beneficial to this line of work, according to the Myers-Briggs Type Indicators (MBTI) assessment personality test."</p>
<p>According to the more recent "What makes a computer wiz? Linking personality traits and programming aptitude" by Timo Gnambs" in the <a href="http://www.sciencedirect.com/science/journal/00926566/58">Journal of Research in Personality</a>, Volume 58, (October 2015) programming ability is positively correlated with introversion, though it's more strongly correlated with "openness to experience". It's not correlated with agreeableness or neuroticism.</p>
<h2>Anecdotal evidence</h2>
<ul>
<li><a href="http://www.thebioneer.com/hackers-brain-the-psychology-of-programming/">Adam Sinicki</a> thinks that
<ul>
<li> "The seasoned coder is someone who looks for shortcut ways to achieve tasks and who is resourceful enough to find unconventional solutions to problems. This requires you to first learn the system or the context you’re working in and then to find exploits within it. Sometimes this is referred to as ‘systems thinking’.
</li>
<li>We use our working memory to store information, so when you’re imaging what a line of code does, you have to store the variables and the ideas you’re testing out, there. So when you’re thinking of a sequence of events, you need to keep the line of logical reasoning held in your working memory – which is where the similarity to math comes in. This is crucial for ‘abstraction’.
</li>
<li>the brain areas involved with abstract thought are actually the same as those associated with verbal semantic processing</li>
<li>So the coder’s brain is good at abstraction, language and short term memory – at least in theory. It should be creative at problem solving and resourceful.
How about attention?
Actually, this is something I have very little problem with when programming and I’d say that most coders I’ve met feel the same way. Concentrating on coding isn’t the problem: it’s stopping that’s hard.</li>
</ul>
</li>
<li>Paul Graham in "Hackers and Painters"(O'Reilly, 2004) writes that
<ul>
<li><i>Hacking and painting have a lot in common. In fact, of all the different types of people I've known, hackers and painters are among the most alike</i> (p.18)</li>
<li><i>Because hackers are makers rather than scientists, the right place to look for metaphors is not in the sciences, but among other kinds of makers</i> (p.25)</li>
<li><i>Computer science is a grab bag of tenuously related areas thrown together by an accident of history, like Yugoslavia ... It's as if mathematicians, physicists, and architects all had to be in the same department</i> (p.18)</li>
</ul>
</li>
<li>LarryWall in "Programming Perl" (1st edition), O'Reilly and Associates writes
<ul>
<li> "We will encourage you to develop the three great virtues of a programmer: laziness, impatience, and hubris."</li>
</ul>
</li>
<li>Rob Walling on <a href="http://www.softwarebyrob.com/2006/08/20/personality-traits-of-the-best-software-developers/">Personality traits of the best software developers</a> writes
<ul>
<li> "the more I looked at what makes [phenomenal developers] so good, the more I realized they all share a handful of personality traits ... Pessimistic ... Angered By Sloppy Code ... Long Term Life Planners ... Attention to Detail"</li>
</ul>
</li>
<li>Me -
<ul>
<li>I think programmers can go up and down layers of complexity quickly, collapsing and expanding concepts as they go.</li>
<li> They don't need 1-1 modelling - i.e. can cope with distance between the target and the representation (Recipes vs meals; Music scores vs performance).</li>
<li>I think they're likely to be chess players (<a href="https://en.wikipedia.org/wiki/Matthew_Sadler">Matt Sadler</a> is a particular example).</li>
<li>I'd imagine that they tend to be field-independent, and can assess their own work in a more egoless fashion than others often manage.</li>
</ul>
</li>
</ul>
<h2>Selection by psychological traits</h2>
<p>In <a href="https://www.newscientist.com/article/dn23596-rise-of-the-autistic-workforce/">New Scientist</a> it was reported that SAP were selecting autistic people. Their move was sparked by successful results from employing a small group of people with autism in India as software testers. It is now expanding its autistic workforce in Ireland, Germany and the US.
</p>
<h2>Sources</h2>
<ul>
<li>"Software Project Survival Guide" by Steve McConnell, Microsoft.</li>
<li>"Understanding the Psychology of Programming at Devx" by Bryan Dollery.</li>
<li>"The Psychology of Computer Programming" by Gerald M. Weinberg</li>
<li><a href="https://www.interaction-design.org/literature/conference/empirical-studies-of-programmers">Empirical Studies of Programmers</a></li>
<li><a href="http://www.ppig.org/">Psychology of Programming Interest Group </a></li>
<li><a href="http://ppig.org/sites/default/files/2015-PPIG-26th-proceedings.pdf">PPIG conference proceedings, 2015</a></li>
<li><a href="http://softwarecreation.org/2008/five-big-personality-traits-of-a-programmer-do-they-matter/">Five Big Personality Traits of a Programmer. Do They Matter?</a></li>
<li><a href="http://analytics.ncsu.edu/sesug/2005/SER06_05.PDF">Laziness, Impatience, Hubris: Personality Traits of a Great Programmer</a> (John E. Bentley)</li>
<li><a href="https://storify.com/unbiasedab284/computer-programming-skills-and-traits-programmers">Computer Programming - Skills And Traits Programmers Possess</a> (Renata McGee)</li>
</ul>Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-35650519446087385582015-09-15T11:16:00.003+01:002016-01-06T10:23:24.616+00:00"Hackers and Painters" by Paul Graham (O'Reilly, 2004)<p>Subtitled "Big ideas from the computer age", the book considers the social and psychological factors that encourage start-up companies, then provides opinions on computing languages. The author's start-up company produced what he considers the first web-based app. It was written mostly in Lisp. He sold out to Yahoo. </p>
<h2>The nature of programming</h2>
<ul>
<li><i>When I finished grad school in computer science I went to art school to study painting ... Hacking and painting have a lot in common. In fact, of all the different types of people I've known, hackers and painters are among the most alike</i> (p.18)</li>
<li><i>Because hackers are makers rather than scientists, the right place to look for metaphors is not in the sciences, but among other kinds of makers</i> (p.25)</li>
<li><i>hackers start original, and get good, and scientists start good, and get original</i> (p.26)</li>
<li><i>Computer science is a grab bag of tenuously related areas thrown together by an accident of history, like Yugoslavia ... It's as if mathematicians, physicists, and architects all had to be in the same department</i> (p.18)</li>
</ul>
<h2>Languages</h2>
<ul>
<li><i>A language can be very abstract, but offer the wrong abstracts. I think this happens in Prolog, for example</i> (p.150)</li>
<li><i>Inspired largely by the example of Larry Wall, the designer of Perl, lots of hackers are thinking, why can't I design my own language? ... The result is ... a language whose inner core is not very well designed, but which has enormously powerful libraries of code for solving specific problems</i> (p.153)</li>
<li><i>Cobol, for all its sometime popularity, does not seem to have any intellectual descendants ... I predict a similar fate for Java</i> (p.155)</li>
<li><i>I have a hunch that the main branches of the evolutionary tree pass through the languages that have the smallest, cleanest cores. The more of a language you can write in itself, the better</i> (p.157)</li>
<li><i>Semantically, strings are more or less a subset of lists in which the elements are characters ... Having strings in a language seems to be a case of premature optimization .... Instead ... have just lists, with some way to give the compiler optimization advice that will allow it to lay out strings as contiguous bytes if necessary</i> (p.160)</li>
<li><i>Somehow the idea of reusability got attached to object-oriented programming in the 1980s, and no mount of evidence to the contrary seems to be able to shake it free. But although some object-oriented software is reusable, what makes it reusable is its bottom-upness</i> (p.163)</li>
<li><i>There seem to be a huge number of new programming languages lately. Part of the reason is that faster hardware has allowed programmers to make different tradeoffs between speed and convenience</i> (p.164)</li>
<li><i>The trend is not merely toward languages being developed as open source projects rather than "research," but toward languages being designed by the application programmers who need to use them, rather than by compiler writers</i> (p.166)</li>
<li><i>Lisp was a piece of theory that unexpectedly got turned into a programming language</i> (p.186)</li>
<li><i>Lisp started out powerful, and over the next twenty years got fast. So-called mainstream languages started out fast, and over the next forty years gradually got more powerful, until now the most advanced of them are fairly close to Lisp. Close, but they are still missing a few things</i> (p.186)</li>
<li><i>Perl ... was not only designed for writing throwaway programs, but was pretty much a throwaway program itself</i> (p.206)</li>
<li><i>in practice a good profiler may do more to improve the speed of actual programs written in the language than a compiler that generates fast code</i> (p.209)</li>
</ul>
<h2>Misc</h2>
<ul>
<li><i>This is the Computer Age. It was supposed to be the Space Age, or the Atomic Age</i> (p.ix)</li>
<li><i>research must be original - and as anyone who has written a PhD dissertation knows, the way to be sure you're exploring virgin territory is to stake out a piece of ground that no one wants</i> (p.20)</li>
<li><i>two guys who thought Multics excessively complex went off and wrote their own. They gave it a name that was a joking reference to Multics: Unix</i> (p.52)</li>
<li><i>If you want to keep your money safe, do you keep it under your mattress at home, or put it in a bank? This argument applies to every aspect of server administration: not just security, but uptime, bandwidth, load management, backups, etc.</i> (p.75)</li>
<li><i>The average end user may not need the source code of their word processor, but when you really need reliability, there are solid engineering reasons for insisting on open source</i> (p.149)</li>
<li><i>As technologies improve, each generation can do things that the previous generation would have considered wasteful</i> (p.159)</li>
</ul>
Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-71965146684261998772015-03-30T09:10:00.002+01:002022-06-01T16:47:13.979+01:00Using Software Metrics in Automated Assessment<p><img src="http://www.timlove.org.uk/img/codelens3.jpg" style="float:right">In an attempt to make assessment of code less subjective I've tried using <a href="http://cccc.sourceforge.net/">cccc</a> to gather software metrics for a year's worth (about 40 programs) of interdisciplinary projects, hoping that some of the values will correspond to human-assessed Software quality or the general performance. The task is quite tightly constrained, so I was hoping that differences between metrics might be significant, though the task involved electronics and mechanics too, and students could choose whether to use O-O or not.</p>
<p>The cccc program measures simple features like lines of code, lines of comments, etc., but also it measures "information flow between modules" and "decision complexity". It's easy to use. The only problem in practice is that it needs to be given all and only the code used to produce the students' program. Some students' folders were very messy, and their version control was little more than commenting/uncommenting blocks of code, or saving old files with names like "nearlyready.cc". Some teams had main programs that incorporated calibration and testing code whilst others wrote separate programs to perform these tasks. I tried to data-cleanse before running cccc, but the project was too open-ended to make comparisons fair.</p>
<p>I can't see any correlations useful to us, though there's a great variety of code statistics (the code/comment ratio ranging from 1.3 to 59 for example). As a rule of thumb (and unsurprisingly) it seems that teams who use more than 1 source file tend to get decent marks. Those with a few physical source files but only one logical file (e.g. a main.cc with</p>
<pre>
#include "linefollow.cc"
#include "actuator.cc"
</pre>
<p>etc.) tended to fare poorly. Here's some sample cccc output along with the human marks.</p>
<table><tr><td style="border-style: solid; border-width: 1px">Feature </td><td style="border-style: solid; border-width: 1px"></td><td style="border-style: solid; border-width: 1px"></td><td style="border-style: solid; border-width: 1px"></td><td style="border-style: solid; border-width: 1px"></td><td style="border-style: solid; border-width: 1px"></td><td style="border-style: solid; border-width: 1px"></td><td style="border-style: solid; border-width: 1px"></td></tr>
<tr><td style="border-style: solid; border-width: 1px">Num of modules (NOM) </td><td style="border-style: solid; border-width: 1px">1</td><td style="border-style: solid; border-width: 1px">1</td><td style="border-style: solid; border-width: 1px">4</td><td style="border-style: solid; border-width: 1px">14</td><td style="border-style: solid; border-width: 1px">30</td><td style="border-style: solid; border-width: 1px">5</td><td style="border-style: solid; border-width: 1px">1</td></tr>
<tr><td style="border-style: solid; border-width: 1px">Lines of Code (LOC) </td><td style="border-style: solid; border-width: 1px">565</td><td style="border-style: solid; border-width: 1px">6229</td><td style="border-style: solid; border-width: 1px">1730</td><td style="border-style: solid; border-width: 1px">1794</td><td style="border-style: solid; border-width: 1px">849</td><td style="border-style: solid; border-width: 1px">829</td><td style="border-style: solid; border-width: 1px">1291</td></tr>
<tr><td style="border-style: solid; border-width: 1px">McCabe's Cyclomatic Number (MVG) /NOM</td><td style="border-style: solid; border-width: 1px">80</td><td style="border-style: solid; border-width: 1px">78</td><td style="border-style: solid; border-width: 1px">597</td><td style="border-style: solid; border-width: 1px">331</td><td style="border-style: solid; border-width: 1px">120</td><td style="border-style: solid; border-width: 1px">132</td><td style="border-style: solid; border-width: 1px">212</td></tr>
<tr><td style="border-style: solid; border-width: 1px">Lines of Comment (COM) </td><td style="border-style: solid; border-width: 1px">132</td><td style="border-style: solid; border-width: 1px">223</td><td style="border-style: solid; border-width: 1px">165</td><td style="border-style: solid; border-width: 1px">831</td><td style="border-style: solid; border-width: 1px">308</td><td style="border-style: solid; border-width: 1px">14</td><td style="border-style: solid; border-width: 1px">320</td></tr>
<tr><td style="border-style: solid; border-width: 1px">LOC/COM </td><td style="border-style: solid; border-width: 1px">4.28</td><td style="border-style: solid; border-width: 1px">2.78</td><td style="border-style: solid; border-width: 1px">10.4</td><td style="border-style: solid; border-width: 1px">2.15</td><td style="border-style: solid; border-width: 1px">2.7</td><td style="border-style: solid; border-width: 1px">59</td><td style="border-style: solid; border-width: 1px">4.03</td></tr>
<tr><td style="border-style: solid; border-width: 1px">MVG/COM </td><td style="border-style: solid; border-width: 1px">0.6</td><td style="border-style: solid; border-width: 1px">0.35</td><td style="border-style: solid; border-width: 1px">3.6</td><td style="border-style: solid; border-width: 1px">0.39</td><td style="border-style: solid; border-width: 1px">0.3</td><td style="border-style: solid; border-width: 1px">9</td><td style="border-style: solid; border-width: 1px">0.66</td></tr>
<tr><td style="border-style: solid; border-width: 1px">Information Flow measure/NOM </td><td style="border-style: solid; border-width: 1px">0</td><td style="border-style: solid; border-width: 1px">0</td><td style="border-style: solid; border-width: 1px">0</td><td style="border-style: solid; border-width: 1px">0</td><td style="border-style: solid; border-width: 1px">22</td><td style="border-style: solid; border-width: 1px">0</td><td style="border-style: solid; border-width: 1px">0</td></tr>
<tr><td style="border-style: solid; border-width: 1px">Software Mark (human)</td><td style="border-style: solid; border-width: 1px">56</td><td style="border-style: solid; border-width: 1px">53 </td><td style="border-style: solid; border-width: 1px">71</td><td style="border-style: solid; border-width: 1px">67</td><td style="border-style: solid; border-width: 1px">75</td><td style="border-style: solid; border-width: 1px">66</td><td style="border-style: solid; border-width: 1px">62</td></tr>
<tr><td style="border-style: solid; border-width: 1px">General Performance (human)</td><td style="border-style: solid; border-width: 1px">65</td><td style="border-style: solid; border-width: 1px">50 </td><td style="border-style: solid; border-width: 1px">80</td><td style="border-style: solid; border-width: 1px">65</td><td style="border-style: solid; border-width: 1px">75</td><td style="border-style: solid; border-width: 1px">60</td><td style="border-style: solid; border-width: 1px">60</td></tr></table>
<h2>What CCCC measures</h2>
<p><a href="http://sourceforge.net/projects/cccc/reviews?source=navbar">CCCC</a> creates web-page reports. It measures</p>
<ul>
<li>Number of modules NOM</li>
<li>Lines of Code LOC</li>
<li>McCabe's Cyclomatic Number MVG</li>
<li>Lines of Comment COM</li>
<li>LOC/COM L_C</li>
<li>MVG/COM M_C</li>
<li>Information Flow measure ( inclusive ) IF4</li>
<li>Information Flow measure ( visible ) IF4v</li>
<li>Information Flow measure ( concrete ) IF4c</li>
<li>Lines of Code rejected by parser</li>
<li>Weighted Methods per Class ( weighting = unity ) WMC1 </li>
<li>Weighted Methods per Class ( weighting = visible ) WMCv </li>
<li>Depth of Inheritance Tree DIT </li>
<li>Number of Children NOC (Moderate values of this measure indicate scope for reuse, however high values may indicate an inappropriate abstraction in the design)</li>
<li>Coupling between objects CBO (The number of other modules which are coupled to the current module either as a client or a supplier. Excessive coupling indicates weakness of module encapsulation and may inhibit reuse)</li>
<li>Information Flow measure ( inclusive )</li>
<li>Fan-in FI (The number of other modules which pass information into the current module)</li>
<li>Fan-out FO (The number of other modules into which the current module passes information)</li>
<li>Information Flow measure IF4 (A composite measure of structural complexity, calculated as the square of the product of the fan-in and fan-out of a single module)</li>
</ul>
<p>McCabe's Cyclomatic Complexity is a measure of the decision complexity of the functions. Information Flow measure is a measure of information flow between modules </p>
<h2>See Also</h2>
<ul>
<li><a href="http://www.researchgate.net/publication/255700741_First_Experiences_in_Using_Software_Metrics_in_Automated_Assessment">First Experiences in Using Software Metrics in Automated Assessment</a> (Pribela I., Rakić G., Budimac Z.)</li>
<li><a href="http://crpit.com/confpapers/CRPITV114Cardell-Oliver.pdf">How can software metrics help novice programmers?</a> (Rachel Cardell-Oliver)</li>
</ul>
Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-33700033802405472552014-12-24T12:16:00.000+00:002014-12-27T10:44:41.977+00:00"Geek Sublime" by Vikram Chandra (Faber and Faber, 2014)<p>The author's written some very respectable novels and stories, but he was also a programmer and a computer consultant - a self-confessed geek. The blurb says "What is the relationship between the two? Is there such a thing as the sublime in code? Can we ascribe beauty to the craft of coding?" but only a small proportion of the book directly deals with that. He begins by pointing out some people's attempts to relate programs and arts</p>
<ul>
<li><span class=quotation>According to Graham, the iterative processes of programming - write, debug (discover and remove bugs, which are coding errors, mistakes), rewrite, experiment, debug, rewrite - exactly duplicate the methods of artists</span> (p.2)</li>
<li><span class=quotation>'Let us change our traditional attitude to the construction of programs: Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do'</span> (Donald Knuth - literate programming)
</li>
<li>"<span class=quotation>Of all the different types of people I've known, hackers and painters are amongst the most like</span>" (Paul Graham) (p.2)
</li>
</ul>
<p>He points out that US and Indian computer cultures are different</p>
<ul>
<li>
<span class=quotation>In a 2013 interview, the executive chairman of Google, Eric Schmidt, said, "Forty per cent of the startups in Silicon Valley are headed by India-based entrepreneurs"</span> (p.75)
</li>
<li>
<span class=quotation>This [Indian] educational process, with its obsessive emphasis on examinations and rankings, produces legions of rote learners, mark grubbers, and cheaters. It causes casualties - 7379 students committed suicide in 2010, at increate of 26 per cent over 2005</span> (p.77)
</li>
<li>
<span class=quotation>the proportion of undergraduate computer-science degrees awarded to women in the US has declined from 37 per cent in 1984 to 18 per cent in 2010 ... Meanwhile, in India, the trend has gone in the other direction ... in 2003, 32 percent of the Bachelor of Engineering degrees in computer science and 55 per cent of the Bachelor of Science degrees in computer science were awarded to women</span> (p.80)
</li>
<li><span class=quotation>research in countries as varied as Iran, Hong Kong, Mauritius, Taiwan, and Malaysia has yielded results consistent who those found in studies in India, showing that there is nothing about the field of computing that makes it inherently male. Varma's conclusion is blunt: 'The gender imbalance in the United States seems to be specific to the country; is not a universal phenomenon</span> (p.83)</li>
</ul>
<p>He quotes some interesting facts about computer languages</p>
<ul>
<li><span class=quotation>COBOL .. still processes 90 per cent of the planet's financial transactions, and 75 per cent of all business data (p.128)</span>
</li>
<li>
<span class=quotation>Malboge ... is so impenetrable that it took two years after the language was first released for the first working program to appear, and that program was not written by a human, but generated by a computerized search program that examined the space of all possible Malboge programs and winnowed out one possibility</span> (p.130)
</li>
<li><span class=quotation>The open-source database SQLite, at the time of this writing, has 1177 times the amount of test code as it does program code</span> (p.155)
</li>
</ul>
<p>He deals with Indian theories of aesthetics</p>
<ul>
<li><span class=quotation>It is the very artificiality and conventionality of the aesthetic experience, therefore, that makes the unique experience of <i>rasa</i> possible</span> (p.150)
</li>
<li>
<span class=quotation>The speech of the poet can be effective even when it doesn't obey the rules of everyday language. According to Abhinavagupta, even the denotative and connotative meanings are only aids to the production of <i>rasa</i>, unessential props which can sometimes be discarded</span> (p.155)
</li>
<li>
<span class=quotation>Indian movies mix emotions and formal devices in a manner quite foreign to Western filmgoers; Indian tragedies accommodate comedic scenes, and soldiers in gritty war movies can break into song ... This is why the Aristotelian unities of British and American films seemed so alien to me</span> (p.161-2)
</li>
<li>
<span class=quotation>Mary Douglas writes ... 'ring composition is extremely difficult for Westerners to recognise.' ...
...
When I was writing my first book, I had never heard the phrase 'ring composition,' but the method and its specific implications and techniques came readily to hand because - of course - I had seen and heard it everywhere. What I wanted within the nested circles or chakras of my novel was a mutual interaction between various elements in the structure</span> (p.165)
</li>
<li>
<span class=quotation>Shulman writes that in India, reiterations and ring compositions 'speak to a notion of reality, in varying intensities and degrees of integrity, as resonance, reflection, or modular repetition understood as eruption or manifestation (avirbhava) from a deeper reservoir of existence</span> (p.167)
</li>
</ul>
<p>Then he gets into Indian metaphysics and Tantric practices, the role of woman in Indian culture, Sanskrit and the consequences of the Empire. Finally he returns to the literature/programming issue -</p>
<ul>
<li>
<span class=quotation>programmers ... often seem convinced that they already know everything worth knowing about art ... to make art, you don't have to <i>become</i> an artist - that anyhow, is only a pose - you just analyse how art is produced, you understand its domain, and then you code art</span> (p.209)</li>
<li>
<span class=quotation>For my own part, as a fiction writer who has programmed, thinking and feeling as an artist is a state of being utterly unlike that which arises when one is coding</span> (p.210)</li>
<li>
<span class=quotation>To compare code to works of literature may point the programmer towards legibility and elegance, but it says nothing about the ability of code to materialize logic ... Most discussions of the beauty of code I have encountered emphasize formal qualities of language - simplicity, elegance, structure, flexibility ... But programs are not just algorithms as concepts or applied ideas; they are algorithms in motion. Code is unique kinetic. It acts and interacts with itself, with the world. In code, the mental and the material are one. Code moves. It changes the world</span> (p.221)</li>
</ul>Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-60243827973451289222014-08-05T13:05:00.001+01:002014-08-05T14:40:06.652+01:00"The Art of UNIX Programming"<p>This book's by Eric S. Raymond, published by Pearson Education. Though it dates from 2004 it's still interesting. It filled some gaps in my knowledge.</p>
<h2>Misc</h2>
<ul>
<li>"There is evidence [Hatton97] that when one plots defect density versus module size, the curve is U-shaped and concave upwards" (p.86)</li>
<li>"second-system effect" - "the urge to add everything that was left out the first time around" (p.29).
"third-system effect" - "after the second system has collapsed of its own weight, there is a chance to go back to simplicity and get it really right. The original Unix was a third system" [after CTSS and Multics] (p.29)</li>
<li>"Holding down the shift key required actual effort: thus the preference for lower case, and the use of "-" (rather than the perhaps more logical "+") to enable options" (p.242)</li>
<li>"marshalling" means "serialising"</li>
<li>"A program is transparent when it is possible to form a simple mental model of its behaviour that is actually predicive for all or most cases" (p.133)</li>
<li>"Software systems are discoverable when they include features that are designed to help you build in your mind a correct mental model of what they do and how they work. (p.133)</li>
<li>"Threading is a performance hack ... they do not reduce global complexity but rather <i>increase</i> it" (p.159)</li>
<li>"Despite occasional exceptions such as NFS and the GNOME project, attempts to import CORBA, ASN.1, and other forms of remote-procedure-call interface have largely failed - these technologies have not been naturalized into the Unix culture" (p.178)</li>
<li>"Today, RPC and the Unix attachment to text streams are converging in an interesting way, through protocols like XML-RPC and SOAP" (p.179)</li>
<li>"Unix was the first production operating system to be ported between differing processor familes" (p.393)</li>
</ul>
<h2>Programs</h2>
<ul>
<li>"Emacs stands for Editing MACroS" (p.351)</li>
<li>"<i>yacc</i> has a rather ugly interface, through exported global variables with the name prefix <tt>yy_</tt>. This is because it predates structs in C; in fact, <i>yacc</i> predates C itself; the first implementation was written in C's predecessor B" (p.353)
</li>
<li>scp calls ssh "as a slave process, intercepting enough information from ssh's standard output to reformat the reports as an ASCII animation of a progress bar" (p.169)</li>
<li>"No discussion of <i>make(1)</i> would be complete without an acknowledgement that it includes one of the worst design botches in the history of Unix. The use of tab" . The author said that he "had a user population of about a dozen, most of them friends, and I didn't want to screw up my embedded base. The rest, sadly, is history"</li>
</ul>
<h2>Languages</h2>
<ul>
<li>"Outside of Fortran's dwindling niche in scientific and engineering computing, and excluding the vast invisible dark mass of COBOL financial applications at bank and insurance companies, C and its offspring C++ have now (in 2003) dominated applications programming almost completely for more than a decade. It may therefore seem perverse to assert that C and C++ are nowadays almost always the wrong vehicle for beginning new applications development. But it's true; C and C++ optimize for machine efficiency at the expense of increased implementation and (especially) debugging time" (p.323) </li>
<li>"C++ is anti-compact - the language's designer has admitted that he doesn't expect any one programmer to ever understand it all" (p.89)</li>
<li>"Python is "generally thought to be the least efficient and slowest of the major scripting languages, a price it pays for runtime type polymorphism" (p.337) "it encourages clean, readable code and combines accessibility with scaling up well to large projects" (p.338)</li>
</ul>
<h2>O-O</h2>
<ul>
<li>"The OO design concept initially proved valuable in the design of graphics systems, graphical user interfaces, and certain kinds of simulation. To the surprise and gradual disillusionment of many, it has proven difficult to demonstrate the benefits of OO outside those areas" (p.101-2)</li>
<li>"Unix programmers have always tended to be a bit more skeptical about OO than their counterparts elsewhere" (p.102)</li>
<li>"a lot of programming courses teach thick layering as a way to satisfy the Rule of Representation. In this view, having lots of classes is equated with embedding knowledge in your data. The problem with this is that too often, the 'smart data' in the glue layers is not actually about any natural entity in whatever the program is manipulating - it's just about being glue" (p.102)</li>
<li>"One reason that OO has succeeded most where it has (GUIs, simulations, graphics) may be because it's relatively difficult to get the ontology of types wrong in those domains" (p.103)</li>
</ul>
<h2>Quotes by others</h2>
<ul>
<li>"This is the Unix philosophy: Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface" (Doug McIlroy)</li>
<li>"La perfection est atteinte non quand il ne reste rein à ajouter, mais quand il ne reste rien à enlever" (Antoine de Saint-Exupéry)</li>
<li>"C++: an octopus made by nailing extra legs onto a dog" (anon)</li>
<li>"Beauty is more important in computing than anywhere else in technology because software is so complicated. Beauty is the ultimate defense against complexity" (David Gelernter,"Machine Beauty: Elegance and the Heart of Technology")</li>
<li>"When in doubt, use brute force" (Ken Thompson)</li>
<li>"If you know what you're doing, three layers is enough; if you don't, even seventeen levels won't help" (Padlipsky) </li>
</ul>
Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-15327493431319617352014-05-06T14:59:00.002+01:002022-06-01T16:48:32.678+01:00Which computing language for engineers?<p><img style="float:right" src="http://www.timlove.org.uk/img/realengineering.jpg" />At our site we teach general engineering - students amongst other things can learn AI, Economics, and bridge-building. Which language should they be taught? Though their needs are different from those of Computing students and of more specialist (e.g. Electrical) Engineering students, their programming needs may be extensive. In <a href="https://www.academia.edu/2403279/Teaching_Introductory_Programming_in_Tertiary_Engineering_Education">Teaching Introductory Programming in Tertiary Engineering Education</a> M.G. Rashed points out that "Computers are increasingly used for a variety of purposes in engineering and science including control, data analysis, simulations and design optimization. It is therefore becoming more important for engineering students who are computer science non-major, to have a robust understanding of computing and to learn how to program". It's over 15 years since we last changed the primary language (I've found a document from 1996 which addresses the issue - <a href="http://www2.eng.cam.ac.uk/~tpl/SteveYoungCCC_26-11-96.pdf">Teaching Programming in the Engineering Tripos</a>). In that time much has changed in the world of engineering, so a review of our language choice is timely.
<table border=1 style="float:right">
<tr><td><b>Year</b></td><td><b>Event</b></td></tr>
<tr><td>1985</td><td>Pascal as a 1st language</td></tr>
<tr><td>1996?</td><td>Matlab as a 2nd language</td></tr>
<tr><td>1997</td><td>C++ as a 1st language</td></tr>
<tr><td valign="top">???</td><td>Compulsory computing questions<br />in the 1st year
exams.</td></tr>
<tr><td>2008</td><td>Vacation C++ exercise</td></tr>
<tr><td>2010</td><td>1st week Lego Mindstorms (Matlab)</td></tr>
<tr><td>2012</td><td>C++ course flipped - 25% more labs<br /> at the expense of lectures</td></tr>
<tr><td>2014</td><td>Scratch used in a prelim exercise</td></tr>
</table>
</p>
<h2>Factors</h2>
<p>Firstly then, what factors could influence our choice, and how have those influences changed over the years? Here are a few -
</p>
<ul>
<li><i>The history and culture of the department</i> - the department tends to teach the fundamentals in a non-specialist way for the first 2 years of a student's career</li>
<li><i>The value of programming in general</i> - When I was taught Latin at school I was told that it was good for me, it trained my mind. Nowadays Mandarin might be taught on the grounds that it's a common language, or Esperanto because it's an easily learnt, well-designed one. Similar differences of opinion apply to the reasons for teaching computing languages. Programming skills might have intrinsic value or be widely transferable. According to its advocators, <a href="http://www.google.com/edu/computational-thinking/what-is-ct.html">Computational Thinking</a> "involves a set of problem-solving skills and techniques that software engineers use to write programs ... However, computational thinking is applicable to nearly any subject. Students who learn computational thinking across the curriculum begin to see a relationship between different subjects as well as between school and life outside of the classroom. Specific computational thinking techniques include: problem decomposition, pattern recognition, pattern generalization to define abstractions or models, algorithm design, and data analysis and visualization".</li>
<li><i>The value of programming for engineering</i> -
M.G. Rashed thinks that "The primary target in teaching computing is to
enable the students to convert engineering problems into pseudo-code. ... The conversion of this pseudo-code into a program written in one
programming language is of secondary importance because it is, in principle, an algorithmic procedure and
requires less intellectual effort. ... In the teaching practice, the algorithmic problem-
solving and implementation tasks are often entangled simply because the students need to test an algorithm they
invented by implementing it. Consequently, the choice of the teaching language should be governed by which
language provides the best support to the student in performing the implementation part of the problem-solving
task by removing any extra stumbling blocks. For this reason the usefulness of the language after graduating or
speed of execution will not be the prime factors when making the choice."</li>
<li><i>Requirements of other courses</i> - some other courses assume specific aspects of computing competence.</li>
<li><i>Students' previous experience</i> - <img style="float:right" src="http://www2.eng.cam.ac.uk/~tpl/img/raspberrypi300.jpg" />
A long time ago many students arrived with some programming experience thanks
to home micros running BASIC and schools equipped with BBC micros. Then skills fell
away. More recently, with free Linux being available, and raspberry Pi kits on sale, there's been a recovery in
programming skills, but only amongst the computer literate, meaning that the
distribution of our intake's computing skills is more bi-polar than ever.</li>
<li><i>Students' expectations</i> -Though they may program less than earlier generations did, they use computers far more.
<img style="float:right" src="http://www.timlove.org.uk/img/compicons.gif" />In particular they rather expect there to be an app for everything - to supply documentation, to provide an interface to hardware (instead of a remote being provided, etc). They may hope that what they produce looks rather like an app.
</li>
<li><i>Industry relevance</i> - Anecdotal comments from staff suggest that some companies aren't convinced that we are preparing our students for
programming. C is more useful for embedded systems than C++. Matlab experience is often requested. One problem is that the needs of industry change, and aren't easy to predict long enough in advance. The invention of the WWW and cheap, small
processors has led to the use of GPS and intelligent sensors in civil
engineering projects. Google Maps and Google Apps enrich projects as well as
aid communication between workers. One student wrote to me that "surely as a professional chartered engineer if you need to do some programming/coding you would hire a professional who would do it in no time at all plus do it correctly" but it would be a shame if the engineer got ripped off because they hired professionals to write trivial or poorly-spec'd software.</li>
<li><i>Language features</i> - ease of use, expressiveness - Despite the popularity of languages such as
FORTRAN and C/C++, there has been much debate about the suitability of these languages for education,
especially when introducing programming to novices. These languages have not been designed specifically for
educational purpose, nor do they make for easy use of the WWW or creation of GUIs. Interpreted languages are growing in popularity (the image is from the M.G. Rashed paper).<br>
<img style="width:400px" src="http://www.timlove.org.uk/img/2graphs.png" />
</li>
<li><i>Programming paradigm</i> - Our approach emphasises the procedural aspects of C++, downplaying O-O in order to introduce more problem-solving practise.</li>
<li><i>Availability of compilers, IDEs, and teaching materials</i> - We've had some trouble providing easily-installed C++ IDEs across platforms. All the teaching materials are on the WWW. Web2 technology has been exploited -
<ul>
<li>Documentation for the 1AC++ Mich course is now WWW-based with online PHP-based teaching
aids.</li>
<li>A 2nd year C++ course went a step further, incorporating online marking.</li>
<li>The Mars Lander project uses CamTools to host documentation and student-staff communication</li>
</ul>
Sometimes (to facilitate automated assessment for example) the presentation framework imposes limits on the nature of the course.
</li>
<li><i>Availability of teaching staff</i> - With class sizes of 90 or so, computing practicals require several skilled helpers. </li>
<li><i>Learning styles</i> - Teaching remains based on practicals with demonstrator support. There are fewer lectures. Independent study has been encouraged by providing the MDP disc, giving
help to students installing compilers on their own machines, and changing
teaching material so that documentation is on the WWW, the exercises
requiring the minimum of extra libraries.</li>
</ul>
<h2>Trends</h2>
<p>One needs to assess trends with caution. Wikipedia's <a href="http://en.wikipedia.org/wiki/Measuring_programming_language_popularity">Measuring programming language popularity</a> page lists, amongst others</p>
<ul>
<li><a href="https://sites.google.com/site/pydatalog/pypl/PyPL-PopularitY-of-Programming-Language">PYPL PopularitY of Programming Language Index</a> - created by analyzing how often language tutorials are searched on Google. Java's twice as popular as any other language</li>
<li><a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html">TIOBE</a> - counts web pages. C comes just ahead of Java</li>
</ul>
<p>Within education, statistics are perhaps more reliable</p>
<ul>
<li><a href="http://www.korwe.com/sites/default/files/attachments/asnapshotofcurrentpractices.pdf">A Snapshot of Current Practices in Teaching the Introductory Programming Sequence</a> (2011) points out that for CS0 ("an
introductory course with no prerequisites, involving at least some
programming, that does not count towards the major") Alice was top, though there "is a tremendous variety in approaches". In CS1 the results were: Java 48%, C++ 28%, Python 12%.</li>
<li><a href="http://www.infoworld.com/d/application-development/python-bumps-java-top-learning-language-245774">An InfoWorld article</a> (2014) quotes results from an Association for Computing Machinery survey - "Eight out of the top 10 universities now use Python to introduce programming"; "Python has been growing in popularity in the educational realm for at least the past few years, though this survey is the first to show it has eclipsed Java, which has been the dominant teaching language for the past decade".</li>
<li><a href="https://www.seas.upenn.edu/~eas285/Readings/Pears_SurveyTeachingIntroProgramming.pdf">A Survey of Literature on the Teaching of Introductory Programming</a> (from the ACM Special Interest Group on Computer Science Education, 2007?) gives a useful overview and annotated bibliography. It points out that
<ul>
<li>"Three decades of active research on the teaching of introductory programming has had a limited effect on classroom practice"</li>
<li>"Today, C, Java and C++ top the list of the most widely used programming languages, both in industry and education"</li>
<li>"Studies have found that market appeal/industry demand/student demand is one of the most important factors affecting language choice in computer science education"</li>
</ul>
</li>
</ul>
<p>Within the general trends there's significant variation - for example, Stanford have a <a href="http://web.stanford.edu/class/cs101/">course based on JavaScript</a>.</p>
<p>Also there's an increasing use of Moocs.</p>
<h2>Candidate languages</h2>
<p>The SIGCSE report mentioned above says "An appropriate language can only be chosen after course goals and learning outcomes have been specified". FYI, our 2013-14 doc said</p>
<p><i>Aims</i><br>
The aims of the course are to:</p>
<ul>
<li> Give a good understanding of basic design methods and techniques and emphasise, in particular, the need to produce well-structured, maintainable computer software.</li>
<li> Reinforce the IA practical classes in C++ programming and provide a firm foundation for IB practical work.</li>
</ul>
<p><i>Objectives</i><br>
As specific objectives, by the end of the course students should be able to:
</p>
<ul>
<li> Understand the nature of software engineering and the software life cycle</li>
<li> Appreciate the need for structured programming in software engineering projects.</li>
<li> Be able to write well-structured programs in the C++ programming language to solve practical problems.</li>
<li> Understand the sources of errors in numerical programming and how to guard against them.</li>
<li> Appreciate the issue of complexity in algorithm design, with particular reference to searching and sorting algorithms.</li>
</ul>
<p>
I think the languages below are the most commonly mentioned at CUED as options - </p>
<ul>
<li><i>Matlab/Octave</i> - Students use this in week 1. Only in year 2 are they more formally taught it. Matlab has a large range of material produced by univs for ugrads, much of it with a math/engg bias. In a <a href="http://www.mathworks.co.uk/company/newsletters/articles/teaching-computer-programming-to-first-year-engineering-students-with-matlab-and-an-ebook.html?reload=true&s_v1=61114751_1-D246V">Mathworks newsletter</a>, staff at Vanderbilt University write that "engineers from five major companies ... credited MATLAB with helping them become more efficient and achieve time reductions 'from a week to 15 minutes' and 'from several months to weeks'" citing an automotive engineer’s statement that "MATLAB was a de facto industry standard". Many engineering-related <a href="http://www.mathworks.co.uk/matlabcentral/fileexchange/">routines and program</a> are available.</li>
<li><i>Python</i> - According to Charles Dierbach ("Journal of Computing Sciences in Colleges" 29, 6 (June 2014)), "The Python programming language has been quickly gaining popularity over the past few years as a language of choice for CS1 courses. Some estimates put the rise in use at forty-percent a year". "The Python programming language has been around since its development by Guido van Rossum around 1991. One of the main features of the language is code readability (sometimes described as "executable pseudocode"). Python is an interactive programming language, using dynamic typing. It is also a hybrid language, supporting the imperative, object-oriented and functional programming paradigms. Although used as a scripting language, it is also used for the development of full-scale programs." The University offer courses in Python for number-crunching, etc. Many engineering-related <a href="https://pypi.python.org/pypi">packages</a> are available.</li>
<li><i>C++/Objective-C/C#</i> - Students use C++ for about 20 hours in year 1 and at least another 8 hours in year 2. In a Cambridge university <a href="http://people.ds.cam.ac.uk/nmm1/C++/index.html">C++ course</a> it says "Unless you are already a programmer, you are very strongly advised to learn Python first ... learning another programming language would also do. “Programmer” does not mean in Visual Basic, Excel or even most uses of Matlab; it means in Python, Fortran, C, Pascal etc. It surprises most people, but learning simpler languages first often saves time overall. ... You can learn to use any of these (even Fortran) to a comparable level in about 20% of the time that you will need to learn C++" </li>
<li><i>Java</i> - one piece of 3rd year coursework currently requires students to write Java. Their C++ experience is presumed to be a sufficient prerequisite.</li>
</ul>
<h2>Multilingualism</h2>
<p>Are there advantages in principle in exposing students to several languages? Ultimately it's unavoidable, though perhaps initially it confuses people. We don't compare/contrast languages. We tend to leave that to the students. </p>
Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-78298157793120606672014-03-27T15:26:00.002+00:002021-03-18T08:38:20.815+00:00Some educational myths<p>Well, not myths really, but it's sometimes worth challenging cherished notions</p>
<h2>Deep down, students know what's good for them</h2>
<p>In "Student interest and choice in programming assignments" (Journal of computing in small colleges 26, 6 (June 2011)) Lisa Torrey surveyed 14 students to find out what motivates their choice of programming exercises. She'd hoped that students would choose programs at the optimal level of challenge but found that "<i>students disproportionately chose to write less challenging programs than their interest patterns had suggested</i>". She felt that "<i>many students would choose easy programs that happen to contain other interesting factors</i>".
</p>
<p>
In March 2014's "Assessment and Evaluation in Higher Education", Felton and Mitchell claim (providing some evidence) that "<i>Faculty who lighten workloads and inflate grades buy high SET [Student Evaluation of Teaching] ratings and popularity for their courses</i>". Older staff are less prone to doing this.
</p>
<h2>The more a topic's taught, the more students will learn</h2>
<p>In "When do students learn? Investigating factors in introductory courses" (Journal of computing in small colleges, 2012) it said - "<i>we found that instructional time spent on a topic often has a far weaker
connection to student learning levels than does instructor emphasis. ...
Just spending more classroom teaching time on a concept will not improve
student learning as much as an instructor placing greater emphasis on that
concept ... For CS1, there were few topics for which there were
statistically significant correlations between instructional time and
student learning</i>".
</p>
<h2>The better the teacher's presentation, the more the students learn</h2>
<p>In the May 2013 issue of "Psychonomic Bulletin and Review" it reported that "<i>When a presenter is seen to handle complicated information effortlessly, students sense wrongly that they too have acquired a firm grasp of the material</i>". They're more confident, but perform no better.</p>
<p>In "The Times Higher" (30/5/13, p.7) it's reported that "<i>lecture fluency did not significantly affect the amount of information learnt</i>".</p>
<h2>Clarity is good</h2>
<p>In <a href="http://people.uncw.edu/tothj/Extra-Credit-Papers/Oppenheimer-The%20Secret%20Life%20of%20Fluency-TICS-2008.pdf">The secret life of fluency</a> Daniel Oppenheimer wrote that for some exercises, "<i>participants were significantly more likely to detect the error when the question was written in a difficult-to-read font. This suggests that they were adopting a more systematic processing method and attending more carefully to the details of the question</i>".
</p>Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-51851468158941692682013-12-30T11:04:00.001+00:002013-12-30T11:04:21.119+00:00Supporting LaTeX<p>When I began working in a university, part of my job was supporting a group who used LaTeX. They used Unix systems, and I maintained LaTeX on them. Installing could sometimes be a slog - fonts were a hassle, and packages kept appearing and re-appearing with inter-dependencies. I produced some handouts to help people with LaTeX. LaTeX2e appeared, which helped.</p>
<p>Time passed. The web was invented, so I put the handouts online, first as postscript docs, then PDF, then HTML/MathML. A web search for <tt>Tim Love LaTeX</tt> reveals that those docs have been widely copied. Documents like <a href="http://www.tex.ac.uk/tex-archive/info/lshort/english/lshort.pdf">The Not So Short Introduction to LaTeX2e</a> by Tobias Oetiker et al, <a href="http://www.dickimaw-books.com/latex/novices/">LaTeX for Complete Novices</a> by Nicola L.C. Talbot and <a href="http://www.tex.ac.uk/tex-archive/info/epslatex.pdf">Using Imported Graphics in LaTeX and pdfLaTeX</a> by Keith Reckdahl have taken away the need for books, though the TeX Book is still useful.</p>
<p>As Word improved, LaTeX use seemed to recede, recovering as Linux appeared, LaTeX distributions became more stable, and cross-platform front ends like <a href="http://kile.sourceforge.net/"> Kile</a> and <a href="http://www.xm1math.net/texmaker/">Texmaker</a> were developed. pdfLaTeX became the predominant latex processor, DVI files becoming a rarity. As web pages grew in sophistication, LaTeX->HTML convertors became less fashionable (I used to generate PDF and HTML files from LaTeX masters, but tend to maintain the files separately now). The <a href="http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/LaTeX_intro.html">LaTeX page</a> in our help system grew. I started giving talks on LaTeX for beginners and for report writers. Some staff made their undergraduate students learn LaTeX.</p>
<p>The CTAN sites became more comprehensive. A <a href="http://texcatalogue.sarovar.org/">searchable catalogue</a> appeared. Usenet newsgroups became Web forums, and sites like <a href="http://latex-community.org/">latex-community</a> and <a href="http://tex.stackexchange.com/">tex-latex stackexchange</a> attracted beginners and experts. </p>
<p>The LaTeX community has always been mutually-supportive and widely dispersed. Local support is much less necessary than it used to be, but sometimes it helps provide continuity. A Ph.D student who'd been to my talks and had read my handouts produced a class to support local thesis writers and left it with me when he left. It proved popular - our 3rd most popular help-system page. Another student who'd been to a talk improved the class in 2013 - it's available <a href="http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/ThesisStyle/">via our help system</a>.</p>
Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-14749193984280853122013-12-19T15:17:00.002+00:002022-06-01T16:49:45.224+01:00Space, time, and C++ source code<p>In "Scientific American", December 2013, it said of reading texts in general that "<span class=quotation>When we read, we construct a mental representation of the text that is similar to the mental maps we create of terrain and indoor spaces</span>". Students new to programming may have trouble when facing source code if they create inappropriate maps. I think that the more linear (more like prose) the code is, the easier it is for these students to understand. If execution starts at the top of the file, and ends at the end, so much the better.</p>
<p>Some deviations from linearity are fairly easy for beginners to understand because they're like those used in prose. Difficulties arise when the same part of text is executed multiple times, and/or when there isn't 1-to-1 mapping between the script and behaviour. In one exercise that we give students, we provide the source code of a function to simulate rolling a single dice - <tt>int RollDie()</tt> - and ask them to write a routine to simulate rolling 2 dice for a board game. Rather than write a function that returns <tt>RollDie() + RollDie()</tt>, some students create 2 copies of <tt>RollDie()</tt>, calling them <tt>RollDie1()</tt> and <tt>RollDie2()</tt>, then write a function that returns <tt>RollDie1() + RollDie2()</tt>, so that the conceptual 1-to-1 mapping is preserved. In this case, the fact that real world objects are being simulated may complicate the picture, but using rather more abstract maths proofs as a model introduces other misunderstandings. </p>
<p>In this article I'll consider how some features of C++ hinder the type of mental representation that students are used to. Conceptually, the text of a program is more like assembly instructions for flat-pack furniture than a novel. I'll also point out how some analogies to illustrate how languages work don't help - maths in particular can be a "false friend".</p>
<h2>Loops</h2>
<p>Small loops aren't too hard to understand - a temporary eddy in essentially linear code</p>
<p><img src="http://www.timlove.org.uk/img/while.png" style="float:right"><tt>while</tt> loops are more linear than <tt>for</tt> loops. In a <tt>while</tt> loop the lines that are repeatedly run are contiguous and in order; control takes only one step back.</p>
<p style="clear:both"><img src="http://www.timlove.org.uk/img/for.png" style="float:right;clear:both">In a <tt>for</tt> loop, the locus of control passes through the terminating condition, the body of the code, then back to the last statement, then back again, to the terminating condition before executing the body code again</p>
<h2 style="clear:both">Functions</h2>
<p>As far as locus of control is concerned, simple functions aren't too bad. They're rather like footnotes - you jump to them and jump back again, carrying on from where you left off. Conceptually you can in-line them. Recursion is more complicated - essentially, multiple copies of the recursing code have to be imagined if the one-to-one correspondence between text and action is to be retained.</p>
<h2>False friends - maths and time</h2>
<ul>
<li>After
<pre>
int y=2;
int x=y*3;
y=4;
</pre>
what value has <tt>x</tt>? People familiar with maths might give the answer 12, because they treat <tt>x=y*3</tt> as a symbolic assignment, x being re-evaluated whenever needed.
</li>
<li>In a maths proof, variables are usually symbolic, and at any time can have any value. In contrast, variables in languages like C++ always have a particular value. In
<pre>
int i=0;
while (i<3) {
cout << i;
i++;
}
</pre>
the single textual <tt>i</tt> variable in the expression <tt>i<3</tt> has successively the values 0, 1, 2 and 3. The value changes in a way that the value of maths variables don't. The text in a proof is usually processed linearly - a particular <tt>i</tt> always means the same thing. Exceptions are in "proof by cases" where the reasoning branches (the "4-color problem" was solved using such a proof - a computer program), and "proof by induction".
</li>
</ul>
<h2>Discontinuities</h2>
<p>The distance between a language and its meaning is emphasised when a small change in the language can greatly change behaviour (and vice versa). C++ has several problems of this nature.</p>
<ul>
<li>
<pre>
int x[12];
</pre>
creates an array of integers whereas
<pre>
x[12];
</pre>
doesn't create an array. It refers to a single element in an array, one which isn't in the array created using <tt>int x[12];</tt>.
</li>
<li>The following loop
<pre>
int i=0;
while (i<3) {
cout << i;
i++;
}
</pre>
terminates, whereas the similar
<pre>
int i=0;
while (i<3); {
cout << i;
i++;
}
</pre>
runs forever.
</li>
<li>
The lines
<pre>
char c='0';
int i=0;
string s="0";
</pre>
produce variables that all look exactly the same when printed using <tt>cout</tt>, though they're not the same at all.
</li>
<li>
The lines
<pre>
if (x < 4)
</pre>
and
<pre>
if (x << 4)
</pre>
do different things. The meaning of "<<" depends on context - here it bitshifts but with <tt>cout</tt> it does something different. It never means "a lot less than".
</li>
</ul>
<h2>Conclusions</h2>
<ul>
<li>Introduce students to <tt>while</tt> loops before <tt>for</tt> loops.</li>
<li>The use of flowcharts might help students who are processing the source code as if it were prose. Alternatively, it might help to use a debugger as a code-animator - see below </li>
<li>Code-folding editors are useful - they offer a way to make existing code into a "black-box" once it's stable, so that students don't become distracted by verbose detail.</li>
<li>Avoid recursion</li>
<li>If the meaning of something depends on context, the students need to be able to identify the limits of that context</li>
<li>Be prepared to introduce the idea of idioms. If you're learning English, then analysing the phrase "It is raining" down to the word-level is unhelpful - "what does <i>it</i> refer to?" is a linguistics question. Similarly, breaking down something like
<pre>
while(fileInput >> str) {
cout << str ;
}
</pre>
into its constituent parts can easily be overdone by beginners who've been told to analyse, but haven't been told when to stop - "what is inside an <tt>ifstream</tt>"? They <i>do</i> need to know that it reads successive words from a file into the string called <tt>str</tt> until there are no more words left.
</li>
</ul>
<p><img src="http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/1AComputing/Mich/simplemovie2.gif" style="float:right" /></p>
Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-65295132494098286462012-08-20T11:43:00.000+01:002012-11-29T11:17:13.030+00:00Making Programming Easier for Beginners<h2>Introduction</h2>
<p>In the days when home computers had BASIC it was common for bright children to write little programs - egg-timers, etc. They gained experience of programming as a concept, but just as importantly they got practise at making mistakes and fixing them.
</p>
<p>
In the Windows/Mac era this option was no longer available. Some of the older lecturers here say they have noticed a consequent reduction in programming skills amongst our new students.
</p>
<p>
It's been suggested that the <a href="http://www.raspberrypi.org/">Raspberry Pi</a> might be used as a way to encourage entry-level home programming in the future. And perhaps schools might deliver more programmers to universities. But for now we have to cope with a significant minority of students arriving without programming skills. This leads to student anxiety when they're at their most vulnerable, poor end-of-year results, and perhaps an under-use of computing in their career.
</p>
<p>
In this document I consider the factors involved with these difficulties. The problem goes beyond being purely cognitive. Some students seem to acquire something like a phobia about the subject (not helped by the public perception of Computing being a male, nerdy, obsessive topic).
</p>
<p>Attempted solutions aim to</p>
<ul>
<li> Develop programming skills (or aid the transfer of other skills)</li>
<li> Reduce the anxiety levels associated with the topic thus aiding the learning process.</li>
<li> Identify the students who'd most gain from extra help once term starts.</li>
</ul>
<h2>What is hard about computing</h2>
<p>
Computing languages are unlike anything else that students are likely to have done. They're not even like maths. Compilers are unforgiving - always criticising and never praising. Students' programming skills span a wider range than that of any other examined skill, so non-programmers will feel stupid right from the start. Comments similar to the following are common - "It's too hard"; "It's too easy"; "Other people find it easy. Why do I find it so hard?"; "If it mattered we'd have been taught it already"; "arbitrary rules, it's all about jumping through hoops".
</p>
<p>It may be that we're trying to teach topics that are known to be difficult but that only a few students will ever need. We teach a compiled language (C++) though few student will use one. Speed of execution is rarely a critical factor in student programs, but a significant factor in our choice of language.</p>
<p>
People know which topics students find difficult. It's less clear how to exploit this knowledge.
In "When do students learn? Investigating factors in introductory courses" ("JCSC", 2012) it said "we found that instructional time spent on a topic often has a far weaker
connection to student learning levels than does instructor emphasis. ...
Just spending more classroom teaching time on a concept will not improve
student learning as much as an instructor placing greater emphasis on that
concept ... For CS1, there were few topics for which there were
statistically significant correlations between instructional time and
student learning. ... Interestingly, three topics, control structures,
subroutines/functions, and types, had weakly negative correlations."
</p>
<h2>Easing the Learning Curves</h2>
<p>One can broadly categorize the problem areas as follows - <i>Algorithms</i> (What to do), <i>Implementation</i> (How to do it) and <i>Psychology</i> (Finding a congenial context within which to learn). Each category has a learning curve that can be made more shallow. Each has been targeted by educationalists
</p>
<h3>Algorithms</h3>
<p>The idea of planning for eventualities that might occur during the planners' absence is not a scenario
that students have much experience in. Also programming involves much more failure (error messages) than success, which distresses beginners. Solutions to these difficulties include getting students to
</p>
<ul>
<li> begin solely with algorithms - flowcharts, paper exercises involving recipes, etc</li>
<li> begin with easier algorithms - "Add 2 numbers"; "Write a times table". These tasks are
boring but at least they let students focus on the implementation.
</li>
</ul>
<h3>Implementation</h3>
<ul>
<li> Re-order the topics (e.g. delay the introduction of functions, Object-Orientation etc.)</li>
<li> Expand the documentation at the start of the course - offer cribsheets, etc.</li>
<li> Change the language</li>
<li> Write tools targeted to help the student with specific, known problem areas (we've written animations and teaching aids - e.g. <a href="http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/C++forloop.php">'for' loop help</a></li>
<li> Use a new language just for the start of the course - Interpreted languages help accelerate the edit-run cycle, reducing the psychological consequences of errors.<br />
Some sites use Scratch to narrow the gap between
algorithms and implementation - the programs are flowcharts. One paper reported that "not only did Scratch excite students at a critical time (i.e., their first foray into computer science), it also familiarized the inexperienced among the with fundamentals of programming without the distraction of syntax".<br />
Jonathan D. Blake wrote that "Research has shown that assignments that provide early feedback and early success (and that are compelling and visual) are important in improving not just retention, but also gender equity" ((JCSC 26, 6, p.126). Languages like Turtle Graphics make feedback more visual (especially if they use robots -
students can then see the physical consequences of their work).
</li>
</ul>
<h3>Psychology</h3>
<ul>
<li><i>Computer-based Teaching</i> - a supportive development environment can be developed (one that attempts to diagnose errors, for example). But this is likely to be language-specific and expensive to produce</li>
<li><i>More Interesting algorithms</i> - If the task is
interesting enough, students will be more stubborn when dealing with
implementation issues. Students' supposed interest in computer games has been used to incite interest. Lisa Torrey "concluded that the most important interest factors were graphics, usefulness and entertainment value".</li>
<li><i>Working in Teams</i> - This might help some to learning without exposing their ignorance to staff. Some students like to be taught via the language of their peers. However, the results are patchy and over-praised by students. Also, girls get a lot more help than boys.</li>
<li><i>Offer a choice of slow and fast courses, or easy and hard questions, or extra help</i>.
Lisa Torrey found that given a choice, "students disproportionately chose to write less challenging programs than their interest patterns had suggested". She felt that "many students would choose easy programs that happen to contain other interesting factors" ("Student interest and choice in programming assignments", JCSC 26, 6)<br>
Extra help can be made available
<ul>
<li> Making help available by phone or e-mail, or having a drop-in surgery</li>
<li> Offering 1-to-1 tuition</li>
<li> Online self-help (or supervised) groups (could offer marks for the quality
of involvement; could use Skype).</li>
</ul>
</ul>
<h2>See Also</h2>
<ul>
<li><a href="http://www.eis.mdx.ac.uk/research/PhDArea/saeed/paper1.pdf">The camel has two humps (working title)</a> Saeed Dehnadi and Richard Bornat,
School of Computing, Middlesex University, UK, 2006
</li>
</ul>Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-69391540522718402402012-08-14T17:34:00.003+01:002012-10-31T09:01:53.474+00:00Using Scratch to prepare students for programming<p><a href="http://scratch.mit.edu">Scratch</a>, first launched in 2005, is considered one of the best languages for introducing children to programming. Some universities are beginning to introduce Scratch into introductory courses. </p>
<h2>Scratch</h2>
<p><img style="float:right;" src="http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/1AProgrammingClub/scratch1.png" />Scratch programs are flowcharts that the programmer constructs by dragging blocks around the screen. The blocks are shaped so that they click together if the "syntax" is correct. It lacks methods (functions), so it doesn't use parameters or return values, but it does have Events and Threads, both of which are important in modern computing.
</p>
<p>Extensions to Scratch exist that add functions, etc - see for example <a href="http://byob.berkeley.edu/">Build Your Own Blocks</a>. Scratch 2.0 is beginning to be used - it has procedures, webcam support, Lego support and even support for cloud programming.</p>
<h2>Harvard</h2>
<p>Harvard tried Scratch in a "Harvard Summer School's Computer Science S-1: Great Ideas in Computer Science", the summer-time version of an introductory course at Harvard College. Details are at <a href="http://cs.harvard.edu/malan/publications/fp079-malan.pdf">http://cs.harvard.edu/malan/publications/fp079-malan.pdf</a>. They used Scratch to introduce the idea of programming and set some exercises before moving on to Java - "Though some
students spent only 2 or 3 hours on their first problem set, others spent
upwards of 20, implementing projects more advanced than any of those
written in lecture." One student wrote "Though I did not yet know how to create a <tt>for</tt> loop, I knew when a
<tt>for</tt> loop was necessary because I had used loops in my Scratch program."</p>
Encouraged by this, the staff introduced Scratch on the full undergraduate course.
CS50 is Harvard College's introductory course for majors and non-majors. Typical enrollment is 300 students. Scratch is used in the first two
lectures and the first assignment; the rest of the course is taught in C,
PHP, and JavaScript. Details are on <a href="http://infoscratch.media.mit.edu/SIGCSE2010Workshop">http://infoscratch.media.mit.edu/SIGCSE2010Workshop</a></p>
<p>
Documention and initial Scratch code is available. See <a href="http://cs.harvard.edu/malan/scratch/printer.php">SCRATCH for Budding Computer Scientists</a> (a tutorial).
</p>
<h2>Berkeley</h2>
<p>In 2009 Berkerley trialed a course based on Scratch which they later introduced in an alternative introductory computing course.
<a href="http://www.eecs.berkeley.edu/news/cso.pdf">http://www.eecs.berkeley.edu/news/cso.pdf</a> describes the reasoning behind the course changes, noting that
</p>
<ul>
<li>Scratch supports some advanced (Web 2.0) ideas. It allows students to upload their
finished graphical programs to the web which can then be run online in a web browser,
downloaded, modified (or, "re-mixed") and re-uploaded.</li>
<li>Scratch encourages broader participation - the report gives statistics on female and hispanic participation. They write that "We have a longstanding goal to provide alternative paths to prepare students for CS61a.
The traditional path to CS61a, of taking the AP computer science test, suffers from little
participation by populations that are typically under-represented in computer science." </li>
</ul>
<h2>Wisconsin</h2>
<p>Their notes are at <a href="http://pages.cs.wisc.edu/~dusseau/Classes/CS202-F11/">http://pages.cs.wisc.edu/~dusseau/Classes/CS202-F11/</a>.
The weekly exercises for this course are online - e.g.</p>
<ul>
<li><a href="http://pages.cs.wisc.edu/~dusseau/Classes/CS202-F11/Assignments/hw1">week 1</a> - exploring the Scratch website, playing a game and answering a survey</li>
<li><a href="http://pages.cs.wisc.edu/~dusseau/Classes/CS202-F11/Assignments/hw2">week 2</a> - "this homework has two parts. In Part A, you'll use Scratch to draw an interesting picture. In Part B, you'll analyze different scripts written in Scratch and decide if they have the same functionality or not."</li>
</ul>
<p>This course develops the social networking aspect. One of the first tasks the students are asked to do is upload a photo of themselves.</p>
<h2>Rutgers</h2>
<p>Their <a href="http://www.rutgers.edu/about-rutgers/demystifying-comp-sci">Programming for the Masses</a> course uses Scratch. Though it's not a programming course, students do learn to write short programs. One development
of this is the <a href="http://www.readwriteweb.com/archives/rutgers_university_project_uses_scratch_to_make_ho.php">Scratchable Devices</a> project where students can program their household devices. Using devices are equipped with an XBee module connected to Arduino microcontrollers, they can switch lights off and on by clapping, etc.</p>
<h2>Ohio State University</h2>
<p>In an Outreach course they offer some partly working scratch files ("Save the Turtle", etc) and invite the student to modify them. Their document is worth reading for the exercise - <a href="http://www.cse.ohio-state.edu/~paolo/outreach/ScratchSE/LabOverview.doc">http://www.cse.ohio-state.edu/~paolo/outreach/ScratchSE/LabOverview.doc</a></p>
</p>
<h2>Kent State University</h2>
<p>Their introduction to computer science uses Scratch then JavaScript. Few details are online - <a href="http://www.cs.kent.edu/~volkert/10051/">http://www.cs.kent.edu/~volkert/10051/</a><p>
<h2>Conclusions</h2>
<h3>Pros</h3>
<ul>
<li>Reputable universities have already done a lot of the work that we'd need to do. Proposals for course-changes, Scratch tutorials and exercises for students are all online.</li>
<li>Some students have an impoverished mental representation of programs - they don't "chunk". Scratch programs match my internal representation of simple programs - objects are nearly independent and have dynamic internal structure.</li>
<li>Though not many Universities are officially using Scratch, the more advanced school and OutReach exercises offer sufficient challenges for students-to-be. See for example <a href="http://nebomusic.net/PolyRobotProject.html">NeboMusic Polygon Robot exercise</a></li>
</ul>
<h3>Cons</h3>
<ul>
<li>Scratch leads more naturally to Object-orientation, a trend that some universities have been distancing themselves from. Moreover, it segues poorly into initial C++ exercises like "get the user to type 2 numbers in. Display the sum" or "print the 5 times table"</li>
<li>Scratch bypasses most of the language features that C++ students find most difficult.</li>
<li>Quite a lot of the excitement of using Scratch is the social-network aspect, but this needs some management</li>
</ul>
Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com2tag:blogger.com,1999:blog-2971935637727636366.post-35793721518093866382011-07-13T15:51:00.007+01:002011-11-23T18:19:18.800+00:00C++ function problems<p>This page shows some of the students' imaginative attempts at solving one
part of the <a href="http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/1AComputing/Mich/">1st year Michaelmas computing course</a>. The task is one that's been on
the course for years, but this year we spoonfed them less. The students
would have the same difficulties in many other languages, though C++
provides rather more challenges than Matlab (for example) would.
</p>
<h2>How we introduce functions</h2>
We explain functions gradually, using a mixture of explanation and practical
work. The explanations include animations, diagrams showing functions as boxes
with inputs and outputs, and sections entitled
<ul>
<li><a href="http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/1AComputing/Mich/#Functions">Functions</a></li>
<li><a href="http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/1AComputing/Mich/#Standardfunctions">Standard
functions</a></li>
<li><a href="http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/1AComputing/Mich/#Morefunctions">More
functions</a></li>
</ul>
<p>We tell then that they have to do 3 things when writing functions: write a prototype, write the function, and call the function. The practical work begins with a gentle learning curve as follows
<ul>
<li>We show them <tt>is_even</tt> (a function that determines whether an
integer is even) and give them a program that uses the function to see
which integers in the range 1 to 10 are even. Then we ask them to
produce a similar program to identify multiples of 3. This requires them
to modify the code trivially, but we insist that they change the name of the
routine (so they have to change the call and prototype too).</li>
<li>We get them to write a times-table program using a <tt>timesby7</tt>
function that we provide (the program will be similar to the above program)</li>
<li>We get them to write a program with just a main function, then get them to
restructure it without changing its output so that it has main and
another function.</li>
<li>Then we get them to write bigger programs with functions written from scratch</li>
<li>Then we get them to use library functions.</li></ul>
Common problems include
<ul>
<li>
Thinking that the prototype
<pre>
int fun(int number);
</pre>
means that they have to call <tt>fun</tt> with a parameter called "number".
We could get them to write the prototype as
<pre>
int fun(int);
</pre>
but that's not considered good style
</li>
<li> Thinking that the prototype
<pre>
int fun(int number);
</pre>
calls the routine. We could
ask them to prove to us that it does - by adding a <tt>cout</tt> call to the function.
</li>
<li>Thinking that if a function prints out the answer, that's the same as returning it.</li>
</ul>
<h2>Playing with dice</h2>
<p>About half way through their Michaelmas term work when they've already used
functions we give the 1st years the following code</p>
<pre>
int RollDie()
{
int randomNumber, die;
randomNumber = random();
die = 1 + (randomNumber % 6);
return die;
}
</pre>
We say
<hr />
<p><i>
Each time the function random() is called, it will return a random positive integer. Work out what the ... function does and how it works.
</i></p>
<hr />
<p>One student didn't know how to search for "%" on a web-page, hence couldn't
find where we'd described what the "%" operator did. I worry about students' webskills sometimes.
</p>
Then later in the handout we say
<hr />
<p>
<i>
You've already seen the RollDie function that simulates the rolling of a single die. Copy it into your new file. Now write a function called Roll2Dice to simulate the rolling of 2 dice (call RollDie twice and return the sum of the answers). Before going any further, test it. If it doesn't work, neither will your full program! Here's a main function you could use
</i>
</p>
<pre>
int main() {
srandom(time(0));
cout << "Roll2Dice returns " << Roll2Dice() << endl;
}
</pre>
<i>
You'll need to add prototypes for RollDie and Roll2Dice too.
</i>
<p>
<hr />
<p>
This task contrasts with last year's work where after we gave them the code
for <tt>RollDie()</tt> we gave them the code for a routine with the
prototype <tt>int RollManyDice(int M)</tt> (though we didn't provide the
prototype or the final <tt>return ... </tt> line of the function). We made the change
because we'd rather students programmed something simple themselves than
merely
type in more complex code than they don't understand.
<p>
Here's a list of solutions that students have tried
</p>
<ol>
<li>Several start by writing this prototype
<pre>
bool Roll2Dice()
</pre>
because the first function introduced to them returns a bool.
</li>
<li>A few start by writing this prototype
<pre>
int Roll2Dice(int RollDie(),int RollDie() )
</pre>
because RollDie is "needed" by Roll2Dice, I presume.
</li>
<li>Some do this
<pre>
int Roll2Dice()
{
int randomNumber, die;
randomNumber = random();
die = 1 + (randomNumber % 12);
return die;
}
</pre>
(returning an integer from 1 to 12) or this
<pre>
int Roll2Dice()
{
int randomNumber, die;
randomNumber = random();
die = 2 + (randomNumber % 11);
return die;
}
</pre>
(returning an integer in the range 2 to 12, all the outcomes
equally likely) or this
<pre>
int Roll2Dice()
{
int randomNumber, die;
randomNumber = random();
die = 1 + (randomNumber % 6);
return 2*die;
}
</pre>
(i.e. rolling a die and doubling the outcome).
I think these examples illustrate that common sense suffers when
students are struggling with C++.
</li>
<li> Quite a few people start by writing a new function to simulate the 2nd die.
<pre>
int RollDie2()
{
int randomNumber2, die2;
randomNumber2 = random();
die2 = 1 + (randomNumber2 % 6);
return die2;
}
</pre>
<p>
Some then try doing
<pre>
int total=die+die2;
</pre>
later in their program rather than calling the functions, not realising
that <tt>die</tt> (in RollDie) and <tt>die2</tt> (in RollDie2) are unavailable. At this point some
students create global variables <tt>die</tt> and <tt>die2</tt> while still
creating the local instances of <tt>die</tt> and <tt>die2</tt> - which
silences the compiler but isn't the correct solution.
</p>
<p>
Others write a Roll2Dice() function that
calls RollDie() and RollDie2() to get the correct answer. Perhaps the existence of 2
dice makes them think they need 2 functions - I suspect they wouldn't write 2
functions to calculate the square roots of 2 numbers, or write 10 functions to
roll
10 dice.
</li>
<li>The next is one of the most common solution, not calling the provided RollDie
function at all.
<pre>
int Roll2Dice()
{
int randomNumber, die, randomNumber2, die2;
randomNumber = random();
die = 1 + (randomNumber % 6);
randomNumber2 = random();
die2 = 1 + (randomNumber2 % 6);
return die+die2;
}
</pre>
</li>
</ol>
<h2>Conclusions</h2>
I was hoping for
<pre>
int Roll2Dice() {
int die1=RollDie();
int die2=RollDie();
int sum=die1+die2;
return sum;
}
</pre>
or even just
<pre>
int Roll2Dice() {
return RollDie() + RollDie();
}
</pre>
<p>It's easy enough in a handout to explain how to write correct code, but
this year we didn't want to tell them exactly what to type. Just about
everything that we didn't dictate to them produced errors that revealed a
lack of understanding. I think it would
be counter-productive to anticipate and correct these misunderstandings by
putting a list of what <b>not</b> to do in the handout - it would confuse
them.
Besides, it's useful to have these conceptual errors exposed as early as
possible as
long as demonstrator help is available.</p>
<p>Some of the solutions above are correct and the students often understand
what they've written, so there's a case for letting them get on with it,
but they're going to have bigger problems later if these conceptual
hurdles aren't tackled now. (I once looked at a IIB project student's
final program. It barely used functions. By factorising repeated code
I reduced the line-count to 30% of the original. Worrying).</p>
<p>
Some students are clearly just guessing as they go along, looking for any lines
of code that look as if it should be copied. It would help if they revised
earlier work, or trace their finger along the locus of control, explaining it
line-by-line. Others start with a reasonable idea of what to do but make small mistakes that lead to bigger ones
as they try to silence the compiler at all costs. It would help if they could
identify run-time errors as soon as possible, but iterative
development is something they only slowly learn, and besides, not all
of them know what results to expect.
</p>
<p>
Understanding functions remains a problem. We introduce functions by
analogy with mathematical functions, but in C++ they can see inside the
black-box that is the function, and once they do, they find it hard to
treat the function like a black-box ever again (it becomes a physical thing
occupying space, rather than a concept). As an educational aid it helps to have an editor that
collapses functions.
</p>
<h2>Frequencies</h2>
<p>We get the students to run routines like Roll2Dice() and record the outcomes.
They find
</p>
<pre>
int outcome=Roll2Dice();
frequency[outcome]=frequency[outcome]+1;
</pre>
<p>hard to understand, which isn't so surprising given that after 6 hours of practicals</p>
<ul>
<li>a few students still don't know how to add 1 to a simple variable. </li>
<li>more than a few students have "no idea" how to write a line that "creates an array called
frequency big enough to store 6 integers". I left one such student to read
the documentation for a few minutes, but when I returned to him he was none
the wiser. The <a href="http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/1AComputing/Mich/#Arrays">Arrays
section of the doc</a> might be sub-optimal, but it can't be that bad -
it's much the same as last year's.
</li>
</ul>
Even those who <i>do</i> understand arrays have trouble with the code quoted
above, though they're
happy with
<pre>
int outcome=Roll2Dice();
if(outcome==1)
frequency[1]=frequency[1]+1;
if(outcome==2)
frequency[2]=frequency[2]+1;
...
</pre>
I've tried to spell out a 2-page explanation of the shorter version as a
<a href="http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/FAQ.html#counting">
Frequently Asked Question</a> but some people don't understand that either.
When the penny drops they sometimes remark "that's clever". Then they
try to be too clever and do
<pre>
frequency[Roll2Dice()]=frequency[Roll2Dice()]+1;
</pre>
<p>
wondering why it fails (they're calling Roll2Dice twice, so the RHS and LHS may
refer to different array elements). Having fixed it they put the line in a loop. A few students
do this
</p>
<pre>
int tries=0;
while(tries<100) {
int outcome=Roll2Dice();
frequency[outcome]=frequency[outcome]+1;
frequency[outcome]=0;
tries=tries+1;
}
</pre>
<p>
Why is <tt>frequency[outcome]=0;</tt> there? Well, one student said that it was in an earlier loop
so they thought they'd better put it in this loop too.
</p>
<p>In short, there are still many indications that a non-trivial minority of
students are just fumbling blindly through. If anything, the changes to the
course this year make it easier for demonstrators to identify the students with severe
problems - it's harder for students to bluff their way through.
</p>
<p>According to "Validating an instructor rating scale for the difficulty of CS1 test items in C++" (Lulis and Freedman, JCSC 27, 2 (December 2011)) "faculty members disagree amongst themselves as to the difficulty level of questions involving functions", much more so than for questions involving other topics.</p>Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-22271982282354771302011-06-02T09:50:00.006+01:002011-06-09T13:31:54.061+01:00Online help systems<p>On 29 June 2011 I'm attending a UCISA symposium on "Advisory and IT Support" about "Producing a service desk good practice guide - Measuring the service desk". A parallel session that I'd also have liked to attend was from University of Lincoln - "A project, led by ICT, focused on changing the ICT and Estates service by embedding a new culture across both departments that delivers excellent, consistent service, underpinned by a robust framework of technology, processes, learning, development and support". As preparation I thought I'd summarise our experiences.</p>
<p>Changes in user skills and expectations regarding the WWW offer challenges and opportunities for information providers, but it's far from being merely a technological issue that can be solved by a new piece of software. As Lincoln has discovered, culture (amongst staff as well as amongst users) and processes matter, and need to be understood. MIT have produced a report on their attempt to update their system - see the <a href="http://kb.mit.edu/confluence/download/attachments/5900554/Nercomp+Hermes+presentation.pdf">Nercomp Hermes presentation.pdf</a>. They say that a culture of "Knowledge Centered Support" involves developing "knowledge as part of problem-solving process - When you solve a user’s problem, document it". Inhibitions to this included</p>
<ul>
<li>Wiki markup (or browser support for WYSIWYG editors)</li>
<li>Time pressure (for frontline support, primarily)</li>
<li>Different self-imposed “standards” for publication</li>
<li>Unease with public information, even if there’s nothing inherently confidential</li>
<li>"Ownership": if I write about it, I might have to support it</li>
</ul>
<p>Their list of "Lessons Learned" included</p>
<ul>
<li>"It's harder to get contributors than we thought"</li>
<li>"Did not set up a tracking mechanism up front.
Can't tell who's looking at what."</li>
<li>"Get buy-in from decision makers to make "executive"
decisions setting expectations for internal IS&T
groups to contribute information"</li>
<li>"Need to be clear about what information goes
where, e.g. website versus knowledge base"</li>
<li>"Ongoing maintenance is required to keep content
fresh."</li>
<li>"There's a need for an advocacy role"</li>
</ul>
<p>Their project had definite end date and finite resources and a special one-time allocation of funds, which helped to force things forward.</p>
<p>Many of these finding chime with my observations - see the <a href="#Searching">Searching</a>, <a href="#Culture">Culture</a>, <a href="#DistributedAuthorship">Distributed Authorship</a>, and <a href="#Solutions">Solutions</a> sections below. My department has had an online help system since 1994, several authors having produced pages. Our oldest page was last modified at "1995-01-06 12:41:20 GMT". A 1997 version of our front page is still online</p>
<div style=alignment:center>
<table>
<tr><td><a href="http://www2.eng.cam.ac.uk/~tpl/helparticle/help1997.jpg"><img height=250 src="http://www2.eng.cam.ac.uk/~tpl/helparticle/help1997.jpg"></a></td></tr>
<tr><td>Oct 1997 (traffic 33k pages/day; click to zoom)</td></tr>
<tr><td><a href="http://www2.eng.cam.ac.uk/~tpl/helparticle/oldhelp2010.jpg"><img height=250 src="http://www2.eng.cam.ac.uk/~tpl/helparticle/oldhelp2010.jpg"></a></td></tr>
<tr><td>Aug 2010 (traffic 201k pages/day; click to zoom)</td></tr>
</table>
</div>
<p>Apart from
the house styling, you'll see that little has changed on the surface - even in 2010 it was
still described as the "hypermedia help system"! In 1996 I wrote a
little <a href="http://www-h.eng.cam.ac.uk/help/DPO_system/reports/help.html">review
of the help system</a> where I mentioned that</p>
<ul>
<li>"We are encouraging (not very successfully) admin and teaching staff to
maintain their own material." </li>
<li>"We have regular users of our system who still don't use e-mail let alone
the help system, so personalised user education is still necessary."</li>
<li>"[people are] Over-using brute-force searches" </li>
</ul>
<p>We had a help-search facility but I don't know what it was - Google hadn't really
take off by then. Maybe we already used <tt>swish</tt>, an earlier version
of <tt>swish-e</tt> a public-domain
indexing facility.
</p>
<p>Keyword searching wasn't the only
option for users - we offered "task-based" and "subject-based" trees of
links, and pages had at their foot a list of related pages so that users could
browse around. In those days there were several sites (e.g. Yahoo) that maintained a hierarchy of
links to pages so that people could browse as an alternative to word-searching when they wanted to find
something out. Even in 1996 however, people preferred brute-force
searches though their search terms were often more hopeful than precise.</p>
<p>Between 1996 and 2003 the amount of material
grew, as did the variety of types (PHP, movies and databases appeared). Our
dependance in the help system as a front-line service grew too - in our introductory
letter to new undergraduates we wrote "The department has an extensive help system ... which has answers to many questions people
ask about the Engineering Department computer system. Please look at
this first and if you cannot find an answer there consult the
Department's Computer Operators". The
success of Google meant that more than ever, users word-searched for information
rather than browsed through hierarchies. Google ranks pages in a way that satisfied most users.
Customised site-specific searches can be set up using google, but there are
difficulties using Google to look for local information because some of it was domain and/or password protected.
</p>
<p>
The growth in local material hadn't matched growth globally. Many of the documents we wrote in the early years had been superceded by documents elsewhere. Because of the increased performance of the internet there was not even a speed advantage to having local documentation.
</p>
<h2><a name="Searching">Searching</a></h2>
<p>By 2003 it was clear that university establishments might have special requirements when it
comes to searching. The <a
href="http://web-support.csx.cam.ac.uk/confarchive/UKHECant/canterburyhandout.pdf">Search
facilties for UK HE web sites</a> paper (written by a Cambridge webmaster)
dates back to 2003 and lists some useful alternatives.</p>
<p> Troubles that people searching our site have are that </p>
<ul>
<li>It can be hard to think up useful search terms for questions involving
a lack of understanding rather than a simple lack of information</li>
<li>Many queries involve generic computing terms (e.g. "open", "windows",
"word") which makes ranking more difficult.</li>
<li>Coverage will be patchy with some common questions not covered while other
obscure topics might be covered in a depth that swamps the results of
searches. If a user fails to find information in their first help-search
(which is likely) they'll be wary of using it again. At least Google comes
up with <i>something</i> even if it's not locally relevant.</li>
</ul>
<p>A 2007
consultant's report about the University site noted that local searches still posed problems - "Most of the
[users'] complaints about the site fell into three areas:" the
first-mentioned being "inadequate search facility: It was generally felt
that an external google search yielded more appropriate and better
presented results than the search function on the existing University
website". The report went on to say that "As a minimum Google search should
be implemented across site content .... Adoption of a University-wide
meta-tagging is a prerequisite and a major editorial undertaking that
should be done as part of the initial content rework". However, this
recommendation seems not to have been adopted by the University</p>
<h2><a name="Culture">Culture</a></h2>
<p>The department's help system has a rather elite target audience who are
science-literate, but can be naive computer-wise. Amongst the opinions about the Help System are these -</p>
<ul>
<li>That it in some sense belongs to the Computer staff (it does)</li>
<li>That it in some sense belongs to a small subset of Computer Officers (it
doesn't. Any CO or operator can contribute)</li>
<li>That pages have to be written in HTML using the current house style (they
should. Example pages are provided)</li>
<li>That authors will get mailed if a page is wrong (they will if links go bad,
or if mistakes are noticed in a popular page)</li>
<li>That it's old-fashioned static HTML (most of it is static HTML)</li>
<li>That material is hard to find</li>
</ul>
<p>Some of these beliefs inhibit page production</p>
<ul>
<li>If a person thinks that they're not allowed to write pages, they
might add them to their research group's web
site or to their personal pages)</li>
<li>An author might rather not write a page at all than have to maintain pages long-term.</li>
<li>If the help system aims to replace work done by people, those people will be
out of a job (or at least will have to do less pleasant work)</li>
</ul>
<p>Some of these beliefs inhibit users trying the help system</p>
<ul>
<li> For the 50% of students who use Facebook at least once a day, the help
system will look old</li>
<li>The un-Googly search looks unfriendly</li>
</ul>
<p>Though the skills that web users employ to further their hobbies aren't
always used in their academic work, the gap between the help system and other
information systems has widened recently.</p>
<h2><a name="DistributedAuthorship">Distributed Authorship</a></h2>
<p>From the start, pages in the help system were owned and looked after by many people, though a small number of people write most of the pages. Initially a few central pages were owned by
webadmin and the rest were in folders owned by individuals, making for
easy management and identification of ownership. Each page
mentioned its author, so bug reports could easily be directed to the right
person, and (except for the top level) folders didn't contain files with a variety of owners.
</p>
<p> There are disadvantages to this (e.g. when people leave, their pages
need to be moved) but when we tried having more central pages authored by a role
rather than an individual, mail to that role-name was left unanswered. It can
take over a year for an incorrect sentence to be removed from a page, even
with reminders.</p>
<p>Multiple authorship introduces other problems too - the standard of the HTML
varies widely, and also when an author produces a new page they need to tell
other authors to link to it.</p>
<h2> <a name="Solutions">Solutions</a></h2>
<p>In 2009 a student created a pilot system based on Wordpress blog software, hoping to leave behind some of the above-mentioned beliefs. It shares many design ideas with MIT, though we were unaware of MIT's plans at the time.</p>
<ul>
<li>Comments can be added by anyone to pages</li>
<li>A WYSIWYG editor and form-based input means fewer errors and easier authoring</li>
<li>Pages can be drafted so that someone else can authorise them.</li>
<li>There's more automated page- and link-checking</li>
<li>It's a blog, and blogs aren't old fashioned - they're fun (User 2.0).</li>
<li>When a new page is created it appears immediately in other
pages' "related links" lists</li>
<li>Authors can add a comment to other pages, mentioning their new page. Better still, each page has an auto-generated "Related Pages" section at the end that lists pages with related tags.</li>
<li>a Wiki-style option is possible, letting authors reversably change other
authors' pages</li>
<li>A WYSIWYG editor will guarantee more consistent (but not necessarily better)
HTML</li>
<li>The system automatically records authorship</li>
<li>line managers can list all the pages written by particular authors, along
with modification dates.</li>
</ul>
<p>"The Corporate Blogging Book", Debbie Weil (Piatkus, 2006) looks at issues
relating to the introduction of blogs into an e-mail-literate workplace.
It mentions inhibitions</p>
<ul>
<li>If bosses don't blog, why should the employees?</li>
<li>Some users and management think that time will be wasted (it will, if the
resulting pages aren't used and advertised by staff)</li>
<li>People who are confident enough writers to post e-mail have doubts about
producing web pages (because of larger audience, and uncertainty about etiquette)</li>
</ul>
<p>The book also mentions advantages, some of which haven't yet been mentioned</p>
<ul>
<li>RSS feeds help reduce bulking mailing</li>
<li>Less distance between "us and them" - students and staff</li>
</ul>
<p>For more details, see the student's <a href="http://www2.eng.cam.ac.uk/~tpl/helpsystems/FinalReport.pdf">Final Report</a></p>
<p>Meanwhile, in October 2010 we gave the old material a new front page</p>
<div style=alignment:center>
<table>
<tr><td><a href="http://www2.eng.cam.ac.uk/~tpl/img/helpOct2010.png"><img height=250 src="http://www2.eng.cam.ac.uk/~tpl/img/helpOct2010.png"></a></td></tr>
<tr><td>Oct 2010 (click to zoom)</td></tr>
</table>
</div>Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-50711474594186803542011-04-27T10:42:00.005+01:002011-04-29T08:45:19.864+01:00Teaching O-O<p>We teach using Matlab and C++ so we could teach programming in an Object-Oriented way. Post-2008, Matlab's O-O support has become neater, and has more features - listeners; something similar to Java's <tt>final</tt>, etc, but we don't talk about that aspect of Matlab. Undergraduates define their own C++ classes in the 1st year, but only in an optional 3rd year course do they really get introduced to O-O. There's not really enough time to push multi-paradigm programming at them. They would end up forgetting how to write loops, or whether arrays begin at 0, and they'd more often do things like getting programs to print the final results by putting the output code into a destructor, or using objects merely to modularise code.</p>
<p>In a way you might think engineering suits O-O - re-usable components and interfaces are common to both fields - but engineers also know about K.I.S.S. and over-engineering.</p>
<p>In "Python for Teaching Introductory Programming: A Quantitative Evaluation" (Jayal et al; Italics V.10.1 Feb 2011) they say they "found four experimental studies that compare object oriented approach with the traditional procedural approach". One "by Reges (2006) has found significant gains in student satisfaction and enrolment after replacing the object oriented programming first curriculum with a procedural approach". The other 3 studies found no significant differences. Jayal et al. found that students who started with Python then did Java performed better than students who did Java all the way through the course.</p>
<p>In <a href="www.cs.washington.edu/homes/reges/sigcse/basics.pdf">Back to Basics in CS1 and CS2</a>, Stuart Reges says "Our new version of CS1 looks a lot like a 1980's course taught in Pascal. We have gone back to procedural style programming. I
was motivated to do this after attempting and failing to teach a
broad range of introductory students at the University of Arizona
using an 'objects early' approach. I found that my best students
did just fine in the new approach, but the broad range of midlevel
students struggled with the object concept". The course begins by using Java with a lot of <tt>public static</tt> methods. He writes "Our switch to static methods has allowed us to bring back the problem solving aspects of the course that we thought were so
important in the 1980's" adding that "even though Java is not an ideal choice for our CS1, we continue to use it because of its payoff in our CS2 course."
</p>
<p>If that reasoning applies in a Computer Science course it applies even moreso to Engineering, I'd have thought. So should O-O stand for "Objects-Overrated"?</p>Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-73307964618421018322011-04-14T14:30:00.003+01:002011-06-08T11:59:48.588+01:00"Coders at Work" (edited by Peter Seibel, Springer-Verlag, 2009)<p>"Coders at Work" (edited by Peter Seibel, Springer-Verlag, 2009) has
interviews with several famous programmers. Most use Emacs and debug
using print statements. Most try to understand code in several ways -
bottom-up, top-down, following the effects of a user action (e.g. deleting a
character in an editor), looking at data structures, etc. Here are some quotes that might be of use</p>
<h2>C++</h2>
<ul>
<li>"C++ is just an abomination", Zawinski, p.10</li>
<li>"[C++'s] syntax is terrible and totally inconsistent and the error messages,
at least from gcc, are ridiculous", Fitzpatrick, p.63</li>
<li>"I don't like C++; it doesn't feel right", Armstrong, p.224</li>
<li>"given the kinds of goals that I have in programming, I think the decision
[for C++] to be backwards-compatible with C is a fatal flaw ... C
fundamentally has a corrupt type system", Steele, p.355</li>
<li>"Google is C++, strictly C++. It's no big deal programming in C++, but I
don't like it ... by and large I think it's a bad language", Thompson, p.475</li>
</ul>
<h2>C</h2>
<ul>
<li>"C has destroyed our ability to advance the state of the art in automatic
optimization, automatic parallelization, automatic mapping of a high-level
language to the machine", Allen, p.502</li>
<li>"the biggest security problem to befall modern computers is C", Cosell, p.557</li>
<li>"one of the most important revolutions in programming languages was the use
of pointers in the C language", Knuth, p.585</li>
</ul>
<h2>Debugging</h2>
<ul>
<li>"I love strace. Strace, I don't think I could live without", Fitzpatrick, p.79</li>
<li>"I think an hour of [team] code reading is worth two weeks of QA",
Crockford, p.103</li>
<li>"we have found fuzz testing to be more productive than almost any other
kind of testing", Eich, p.138</li>
<li>"the most important [debug] tools for me are still my eyes and my
brain. I print out the code involved and read it very carefully ... So long
as I can put <tt>print</tt> statements in the code, and I can read it
thoroughly, I can usually find the bugs", Bloch, p.189-190</li>
<li>"most of my subjects have found that the hardest bugs to track down are in
concurrent code", Seibel, p.xiii</li>
<li>"the first thing I will try is dropping in print statements to see if it
will help me, even though that is probably the least effective for dealing
with a complicated bug. But it does such a good job of grabbing the simple
bugs that it's worth a try", Steele, p.365</li>
<li>"I don't know of anybody who [uses print statements] if they have the
choice of using a good debugger", Ingalls, p.405</li>
</ul>
<h2>Gender</h2>
<ul>
<li>"Recently I realized what was probably the root cause of [the glass
ceiling]: computer science had emerged between 1960 and 1970. And it mostly
came out of the engineering schools ... And the engineering schools were
mostly all men in that period", Allen, p.510</li>
<li>"A lot of people think it's the games and the nerdiness of sitting in front
of a computer all day [that making computer science unappealing to
women]. It's going to be interesting how these new social networks online
will have an effect", Allen, p.513</li>
<li>"the conventional wisdom at the time ... said that women made good programmers because they pay attention to details ... today ... they're great on teams because they like to collaborate", Allen, p.507, 509</li>
</ul>
<h2>Miscellaneous</h2>
<ul>
<li>"We installed some buttons on the computer, because you could do that, at the time and one was a panic button. When the program appeared to loop one could just press the panic button", Allen, p.488</li>
<li>"I remember reading books about languages that I had no way to run and
writing programs on paper for languages that I'd only read about", Zawinski, p.2</li>
<li>"I despise [perl]. It's a horrible language", Zawinski, p.11</li>
<li>"One of the jokes we made at Netscape a lot was 'We're absolutely 100
percent committed to quality. We're going to ship the highest-quality product
we can on March 31st'", Zawinski, p.34</li>
<li>"On [Google's] top six or seven languages, there's a really strict style
guide", Fitzpatrick, p.72</li>
<li>"I had a friend who had some iptables rule that on connection to certain IP
addresses between certain hours of the day would redirect to a 'You should
be working' page", Fitzpatrick, p.73</li>
<li>"most of the security problems that we've seen in operating systems over
the last few years are a consequence of ++. In my programming style now I
don't use ++ anymore, <i>ever</i>", Crockford, p.106</li>
<li>"I think threads are an atrocious programming model", Crockford, p.121</li>
<li>"I'm not an object-oriented, design-patterns guy", Eich, p.138</li>
<li>"I can't even remember which [UML] components are supposed to be round or
square", Bloch, p.181</li>
<li>"the best existing multithreaded building blocks are in Java", Bloch, p.198</li>
<li>"I think the lack of reusability comes in object-oriented languages, not in
functional languages. Because the problem with object-oriented languages is
they've got all this implicit environment that they carry around with them", Armstrong, p.213</li>
<li>"with very difficult problems I quite often start right by writing the
documentation", Armstrong, p.231</li>
<li>"From what I've seen of programmers, they're either good at all languages
or good at none", Armstrong, p.235</li>
<li>"I don't think software is fractal ... I think the things that happen when
systems get large are qualitatively different from the things that happen as
systems go from being small to medium size", Deutsch, p.421</li>
<li>"garbage collection fights cache coherency massively", Thompson, p.472</li>
</ul>
<h2>About the programmers</h2>
<ul>
<li>Jamie Zawinski (Xemacs, Netscape, Mozilla)</li>
<li>Brad Fitzpatrick (LiveJournal, memcached, Google)</li>
<li>Douglas Crockford (Yahoo! Invented JSON)</li>
<li>Brendan Eich (Netscape, Mozilla, Invented JavaScript)</li>
<li>Joshua Bloch (Chief Java Architect at Google)</li>
<li>Joe Armstrong (invented Erlang)</li>
<li>Guy Steele (Lisp)</li>
<li>Dan Ingalls (Smalltalk)</li>
<li>L Peter Deutsch (Ghostscript)</li>
<li>Ken Thompson (Unix)</li>
<li>Fran Allen (IBM, compilers)</li>
<li>Bernie Cosell (PDP-1)</li>
<li>Donald Knuth (TeX, algorithms)</li>
</ul>Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-29880089571606719982011-03-28T09:00:00.005+01:002011-05-05T12:11:27.652+01:00Teaching Aids<p>The evaluation of new courses isn't always easy, especially when technology's involved. There's the</p>
<ul>
<li><i>Hawthorn Effect</i> - students work harder when they know evaluation is happening</li>
<li><i>Novelty Effect</i> - some students like playing with new tech (the effect soon wears off)</li>
<li><i>??? Effect</i> - students are affected by the increased motivation and interest of the staff</li>
</ul>
<p>It's likely that the course needed an overhaul anyway, so even a less innovative re-write might have been popular</p>
<p>I went to a talk recently about the effect new tech might have on education. One person pointed out that years ago lap-tops were going to revolutionize education, but it hasn't really happened. Before that there was computer-aided-education (too often rote-learning). I think the web has changed things, more by evolution than revolution - information and help's more readily available. For computing there are Forums where sensible questions get quick and informative answers. There are Web pages covering issues that students might get stuck on - pointers, O-O, etc. Students no longer need to struggle on without documentation. Meanwhile however, the method of teaching programming doesn't seem to have changed much. Textbooks have become more varied (more jokes, more games) but the mainstream books haven't changed much. For C++ we suggest that students get Deitel and Deitel. The text (1600 page of it) is multicolored, there are asides in the margin and an associated Web site but the pattern remains of telling students about a concept then getting them to write a program that uses the concept. Some online books like <a href="http://math.hws.edu/javanotes/">Introduction to Programming Using Java</a> (David J. Eck) have embedded Applets, which can be useful.</p>
<p>I've tried a few things</p>
<ul>
<li><a href="http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/C++function.php">C++ function teaching aid</a></li>
<li><a href="http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/C++forloop.php">C++ "for" loop teaching aid</a></li>
<li>Simple animations <img src="http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/1AComputing/Mich/simplemovie2.gif" /></li>
</ul>
<p> and a lecturer's written MetaCard animations. I've rewritten the 1st year C++ course and put it online. Though it's traditional in structure, it has links to supplementary material that students wouldn't follow were the links on paper. And we offer short and long versions of the document.</p>
<p><img src="http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/1AProgrammingClub/scratch1.png" alt="scratch" style="float:right"> For other subjects I think the availability of Apps (simulations, periodic tables, movies, animations) has assisted greatly. Not so in HE Computer Science. Facilities like Scratch are great, but have their limits. So what's next?</p>
<ul>
<li><i>E-books</i> - Most student work is still submitted on paper, and many handouts are on paper. A local department thinks it would be cost-effective to supply each student with an e-book loaded with course PDFs. The killer app is a program that makes freehand PDF annotaion easy</li>
<li><i>Tablets/Slates</i> - In group activities with computers, it's typical for one person to hog the mouse. Tablets make the work more collaborative</li>
<li><i>GPS</i> - Field trips, etc benefit from cameras with GPS</li>
<li><i>Smartphones</i> - Students seem more likely to do something (e.g. provide feedback) if there's an App for it</li>
</ul>
<p>but perhaps collaborative tools will make the most difference in the end. Google Docs can be used as a document collaborative tool: it's online, with version control and change tracking - and it's free.
</p>Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-16513965942891154702011-02-08T11:40:00.002+00:002011-03-08T09:22:51.889+00:00Legacy Code<p>"Since most computer science majors will face the horror of being assigned to a legacy system at least once in their career, computer science education should prepare them in a more scientific fashion by perhaps incorporating code discovery techniques in a software engineering course ... [they] may come away with a greater appreciation of the need for traditional, methodical software engineering techniques, as well as styles for surveying in the messy real world of legacy code" (JCSC 25,6 (June 2010)).Mark Meyer and Kevin Mastropaolo</p>
<p>
Many experienced programmers try to understand code in several ways -
bottom-up, top-down, following the effects of a user action (e.g. deleting a
character in an editor), looking at data structures, etc. Though there's no substitute for experience, some books and web pages exist.
</p>
<ul>
<li>"Working Effectively with legacy code", M.C.Feathers, Pearson Hall</li>
<li><a href="http://www.objectmentor.com/resources/articles/WorkingEffectivelyWithLegacyCode.pdf">Working Effectively With Legacy Code</a> - a 12 page PDF article where he says
<pre>
The general legacy management strategy is:
1. Identify change points
2. Find an inflection point
3. Cover the inflection point
a. Break external dependencies
b. Break internal dependencies
c. Write tests
4. Make changes
5. Refactor the covered code.
</pre>
</li>
<li><a href="http://www.slideshare.net/apolci/working-with-legacy-code">working with legacy code</a> - slides of a talk</li>
</ul>
<p>Another option is to use something like <a href="http://www.stack.nl/~dimitri/doxygen/">doxygen</a> which as well as generating HTML or LaTeX files from a set of documented source files can also extract the code structure from undocumented source files by means of "include dependency" graphs, inheritance diagrams, and collaboration diagrams.</p>
<p>We ran a project for students many years ago where students were given code that they had to build on. The project's remained popular. We've upgraded the sample GUI code, but the rest of the code has barely changed in a decade, and we don't intended to change it. In some senses, the older it gets the better. Some student feel the need to overhaul the code (replacing error codes by exceptions, etc) and usually break it.</p>
<p>If you're setting up such a project you might find it hard to acquire suitable legacy. You may need to write retro-style code yourself.</p>Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-45028194488241917852011-01-17T08:16:00.008+00:002012-11-09T09:20:06.122+00:00Working in Teams<p>Having written about student projects it's natural to talk about working in teams because that's how much of our project work is done - students like it that way, and the lessons learnt are useful beyond software-writing - beyond academia too.
Again, I'll start with a checklist</p>
<ul>
<li><i>Team size</i> - We use 2, 3, or 6 (the 6 being split into 3 pairs)</li>
<li><i>Who chooses teams?</i> - We sometimes impose and sometimes let the students choose. Both options have pros and cons. With a yearly intake of 300+, letting students choose their own teams can be time-consuming, and self-selected teams might be rather unbalanced. There may be non-academic reasons for controlling team-selection (a mixed of genders and background, for example)</li>
<li><i>Within a team, who does what?</i> - Sometimes there are clear roles within a project. Sometimes the tasks are much less clearly delineated. For marking purposes staff need to know who did what.</li>
<li><i>Is there a team leader?</i> - Specifying that there should be one enforces a structure onto the team</li>
<li><i>Planning overhead</i> - What team-related milestones and deliverables are requested? An initial presentation? Gantt charts? Milestones? Some individuals who wouldn't plan a private project can see the point of planning when part of a team.</li>
</ul>
<p>I like the idea of psychologically-profiling team-members at the start with a quick quiz, to see if the results are predictors of team dynamics. We don't do that, but one project does ask teams to complete a form at the end showing what percentage of the total workload each member did.</p>
<p><img width="500px" src="http://www2.eng.cam.ac.uk/~tpl/img/teambalance.png" /></p>
<p>The same project also attempts to assess the time taken on the project and how much staff time was used (staff time is estimated to cost up to 250 pounds/hour)</p>
<p><img src="http://www2.eng.cam.ac.uk/~tpl/img/costs.png" /></p>
<p>Though students in general like working in teams, it can be a wounding experience. If team-members clash, how interventionist should staff be? Some staff involve themselves closely with teams and pro-actively influence dynamics. People at other sites sometimes offer mediation services. If staff leave groups to sink or swim, some will sink, and some innocent passengers will go down with the ship. We've had some generally popular team-based courses scoring un-exceptionally on end-of-year surveys because a few disgruntled individuals giving courses a zero rating. Reports include comments like "It quickly became apparent XXX did not have the self-discipline or dedication to be an effective team manager ... His tendency to speak to others in an authoritative manner despite the lack of useful input/output from himself created dissatisfaction amongst other team members."</p>
<p>By the end of a project, team dynamics can get out of hand. After 4 weeks, a team member was late for a final session. One of his team members growled "[He] does less damage when he's not here. I don't want him touching the code ever again."</p>
<p>Teams can also have problems if one person is repeatedly absent. For this reason we're tough on attendance.</p>
<p>We use online forums to encourage teamwork (and to give us a chance to identify teamwork problems) </p>
<p>According to "Pair Programming Illuminated" by Williams, L. and Kessler, R. (Addison-Wesley) students who work in pairs enjoy the work more, are more confident, and get better grades. Students typically ask half as many questions. <a href="http://portal.acm.org/citation.cfm?doid=1060071.1060075">Pair-programming helps female computer science students</a>
suggests that pairing is particularly beneficial for women.
On the other hand there are courses (e.g. at the University of Washington) that have given up pair programming and have found that students get better grades (though the improvements may not be attributable to the teamwork decision).</p>
<p>In "Journal of Computing Sciences in Colleges" (Volume 28 Issue 2, December 2012) Tom Rishel describes a course where 5 teams simultaneously did some projects that had 5 development stages, each team working on a different project for each stage.</p>Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-75677254854435592452011-01-14T13:25:00.011+00:002018-06-20T14:29:49.609+01:00Gender<p>Though the percentage of female students in the university is about 50%, the Engineering department figure is more like 25% (which is better than the UK engineering average of 14%). You'd have thought that once people have gone into Engineering, they might as well do Computing (in for a penny in for a pound) but in our 3rd year software project the figure's below 10% (0% some years).
It's not just us of course; at Harvard computer science is the most gender-skewed subject, with women comprising only 13 percent of undergraduate CS majors. The proportion of female CS majors is similar at some of Harvard’s peer institutions - Princeton is 19 percent, and Stanford is 14 percent.</p>
<p>The problem goes back a long way. According to Fran Allen the ratio in computing might be engineering's fault - "Recently I realized what was probably the root cause of [the glass
ceiling]: computer science had emerged between 1960 and 1970. And it mostly
came out of the engineering schools ... And the engineering schools were
mostly all men in that period"</p>
<p>4 issues are commonly mentioned in the documentation. As the authors point out, dealing with these points will improve the popularity of the subject in general as well as increase the female intake.</p>
<ul>
<li><i>Lifestyle</i> -
<ul>
<li>"A lot of people think it's the games and the nerdiness of sitting in front of a computer all day [that makes computer science unappealing to women]. It's going to be interesting how these new social networks online will have an effect" (Fran Allen)</li>
<li>"[women] attach their interest in computing to other arenas, to a social context that's more people-oriented. We refer to this as computing with a purpose as opposed to programming for programming's sake or a totally technology-centric focus. But the curriculum and culture does not acknowledge this interdisciplinary, contextual orientation toward computer science." (Jane Margolis and Allan Fisher, "Unlocking the Clubhouse: Women in Computing")
</li>
</ul>
At engineering, we might not be too badly off in this respect: computing is only a means to an end, and we have students working on Design, Medical software, Green Technology, 3rd World technology, Teaching Aids, etc.
</li>
<li><i>Career Options</i> - It is sometimes thought that computing jobs reward those prepared to obsessionally work long hours. There are many 9-5 computing jobs nowadays, and many uses of computing in the humanities. I've been involved with computing projects about garden design, poetry, etc.</li>
<li><i>Role Models</i> - our head of department is female. The IT group I'm in has about about 20% females. It's difficult getting female staff/p-grads involved with introductory computing - there aren't many of them in the first place, and they don't want to spend their teaching time on introductory courses as role models. </li>
<li><i>Pre-university qualifications/experience</i> -
<ul>
<li>"We also found because of early socialization in schools and at home, and a sort of early claiming of the computer as a boy's toy, that girls who wanted to major in computer science and got into one of the top computer science departments in the country actually came in with less hands-on experience. Although there was absolutely no difference in ability, there was a difference in experience, which then led to a difference in confidence during the program." ("Unlocking the Clubhouse: Women in Computing", Jane Margolis and Allan Fisher)</li>
</ul>
The choices made at school can be restrictive. At our department there are people in touch with developments in pre-univ education, and we run OutReach courses, bringing schoolchildren into the department. Elsewhere, girl-only summer schools are run.</li>
</ul>
<p>Some other places have attempted remedies.</p>
<ul>
<li>Several CS professors [at Harvard] indicated that encouraging more women to study the subject was among their top priorities for the future. "It’s something that we talk about a lot," said Associate Dean for Computer Science and Engineering J. Gregory Morrisett. "We are coordinating with a bunch of departments around the world and are trying a lot of different things in the hopes that we will uncover some of the issues and correct for them." (from <a href="http://www.thecrimson.com/article/2010/4/9/cs-women-female-computer/">The Crimson Harvard</a>)</li>
<li>They improved the situation at Carnegie-Mellon -
<ul>
<li>"There's been an attempt to teach computing in a more interdisciplinary way. Also, the university accounted for the different levels of experience - one of our findings being that women came in with different levels of experience, but there was no difference in ability."</li>
<li>"A new set of courses was introduced in the first year, allowing everyone to self-select where they wanted to be according to their experience, and then everyone would be at a similar level by the second year. That means you wouldn't have students with little experience sitting next to someone that's been hacking their whole life and then get really discouraged." </li>
</ul>
</li>
</ul>
<h2>See Also</h2>
<ul>
<li><a href="https://quillette.com/2018/06/19/why-women-dont-code/">https://quillette.com/2018/06/19/why-women-dont-code/</a></li>
<li>"A deficit of women in computer science: a student's perspective" (JCSC 26,3 (January 2011), by Anna Mikesell and George Rinard)</li>
<li><a href="http://www.cs.cmu.edu/afs/cs/project/gendergap/www/index.html">Women in Computer Sciences:
Closing the Gender Gap in Higher Education</a> (Carnegie Mellon)</li>
<li><a href="http://en.wikipedia.org/wiki/Women_in_computing">Women in computing</a> (Wikipedia)</li>
<li><a href="http://www.zephoria.org/files/NICReport.pdf">New Image for Computing</a> ("while 67% of all boys rated computer science as a “very good” or “good” career choice, only 9% of girls rated it “very good” and 17% as “good.” Digging down deeper, it is fascinating to note that there’s a gender gap between boys and girls when it comes to feeling that “being passionate about your job” is “extremely important” (F: 78%, M: 64%), “earning a high salary” is “extremely important” (F: 39%, M: 50%), and “having the power to do good and doing work that makes a difference” is “extremely important” (F: 56%, M: 47%)").</li>
<li>"Women and Gaming: The Sims and 21st Century Learning", Hayes et al. ("most [females] chose what are known as “casual” games, such as Solitaire, Tetris and Bejeweled. ... Unfortunately, casual games lack a critical capability that may give boys a leg up – modding. Modding allows users to modify or create part of the game. For example, players can create new maps or scenarios that others can use. The process of modding helps gamers develop advanced computing skills.
Serious gamers and modders also form communities that provide informal learning and a peer network. It’s like the old boys’ network, only the venue is games rather than golf courses. ... Over the course of Hayes’ research, games have opened up more to women. And products such as the Wii are radically transforming the demographics of gameplay by bringing gaming to people who would never have pursued traditional computer games. Hayes suspects that the increase in games on cell phones and PDAs will change the gaming landscape as well.")</li>
<li>"A note on performance and satisfaction of female students studying computer science" by Ivanovic Mirjana et al (ITALICS Volume 9 Issue 1 February 2010) - "Numerous research results have shown a significant lack of female students enrolled in Computer Science studies at the universities worldwide ... Moreover, it is a recognized fact that those few women who stay in the field discontinue their studies more often than their male colleagues."</li>
<li><a href="http://www.nytimes.com/2008/11/16/business/16digi.html">What Has Driven Women Out of Computer Science? </a></li>
<li>"Why are women underrepresented in Computer Science? Gender differences in stereotypes, self-efficacy, values, and interests and predictors of future CS course-taking and grades" by Sylvia Beyer (Computer Science Education
Volume 24, Issue 2-3, 2014, p.153-192)</li>
<li>"Women in maths-intensive fields move from undergraduate to graduate school to tenure-track professorships at rates comparable to men. In contrast, in [life sciences, psychology, and and social sciences] they tend to drop out of the pipeline more often" - see <a href="http://tinyurl.com/q2ze3bg">http://tinyurl.com/q2ze3bg</a> (2014) - Diane F. Halpern (Minerva Schools at the Keck Graduate Institute) notes that "the report paints a complex picture of the contributors to gender imbalances within the sciences, a picture that challenges traditional beliefs regarding the role of discrimination in perpetuating the gender gap."</li>
<li>High Emotional Intelligence in women is linked to higher truancy, drugs and violence. In men the opposite is true (from the Journal of Forensic Psychiatry and Psychology)</li>
<li>Autistic-spectrum shy girls are less likely to be diagnosed (and helped) than similar boys</li>
<li>
<span class=quotation>the proportion of undergraduate computer-science degrees awarded to women in the US has declined from 37 per cent in 1984 to 18 per cent in 2010 ... Meanwhile, in India, the trend has gone in the other direction ... in 2003, 32 percent of the Bachelor of Engineering degrees in computer science and 55 per cent of the Bachelor of Science degrees in computer science were awarded to women</span> ("Geek Sublime" by Vikram Chandra (Faber and Faber, 2014, p.80)
</li>
<li><span class=quotation>research in countries as varied as Iran, Hong Kong, Mauritius, Taiwan, and Malaysia has yielded results consistent who those found in studies in India, showing that there is nothing about the field of computing that makes it inherently male. Varma's conclusion is blunt: 'The gender imbalance in the United States seems to be specific to the country; is not a universal phenomenon</span> ("Geek Sublime" by Vikram Chandra (Faber and Faber, 2014, p.83)</li>
</ul>Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-2520334832733081122011-01-10T09:00:00.002+00:002011-05-11T11:47:35.528+01:00Which language?<p>A long time ago many students arrived at our department with some programming experience thanks to home micros running BASIC, and schools equipped with BBC micros. Then skills fell away. More recently, with free Linux being available, there's been a recovery in programming skills, but only amongst the computer literate, meaning that the distribution of our intake's computing skills is more bi-polar than ever.</p>
<p>Meanwhile, the use of computing in engineering has increased enormously, and new, computing-based areas of engineering have emerged. The invention of the WWW and cheap, small processors has led to the use of GPS and intelligent sensors in civil engineering projects. Google Maps and Google Apps enrich projects as well as aid communication between workers. Computer simulations and CAD continue to replace their predecessors.<p>
<p>The curriculum has slowly changed. In 1997 we moved from teaching Pascal as a first language to teaching C++ (well, C really). Later, there were compulsory computing questions in the 1st year maths examination. In 2003 we offered the <a href="http://www-mdp.eng.cam.ac.uk/web/CD/">MDP disc</a> so that students could run a C++ compiler on their home machines. In 2008 we introduced a C++ summer project. In 2010 first years used Lego MindStorms in week 1, programming using Matlab.</p>
<p>Some of these initiatives aimed to inspire students or offer opportunities for those interested in computing. Other initiatives sought to improve the skills of the less capable students, or encourage a more self-taught approach but we still introduce programming concepts formally using a compiled language and a mixture of practicals and lectures. The increased freedom of choice means that students can more easily avoid programming, thus magnifying the bi-polar distribution of our intake's skills. Attempts have also been made to introduce programming into more engineering courses. In recognition of the need for proficiency in more than one language, Matlab/Octave is now taught (a vehicle for teaching about algorithms) to 2nd years.</p>
<p>Though the C++ course has always received above average results in student feedback, exam performance suggests that many people don't revise the subject. Also feedback from staff and older students hasn't been so encouraging - it's said that the course doesn't prepare people for the kind of programming they'll later need. Programming is used increasingly across all engineering disciplines, and C++ isn't the "swiss army knife" that students want.
</p>
<p>C++ was never intended as a "teaching language" but it has withstood the test of time. It's used to write anything from operating systems to embedded programs in hardware. It can be used to introduce all the programming paradigms that have emerged over the years - procedural, object-oriented, generic, etc. It's used here in 2nd and 3rd year practicals (interfacing with low-level hardware and electronics), and a 3rd year software project. Though it's not used in very many 4th year projects, knowledge of C++ is useful for projects that involve Java, C# or Objective-C.
Its use has become more focussed over the years as alternatives have emerged. In 2009 we adjusted the C++ course to exploit the teaching potential of the web technologies now available.</p>
<ul>
<li> The new version separates the reference and lab-instruction aspects, so that during the practicals students are only told about what they need for the practicals. They are encouraged to experiment as they read, and to look details up online - web-access is assumed.
</li>
<li>Because it's a web document we can add some interactive tests and offer students novice/expert choices. This also saves 10,000 sheets of paper. We've taken care that the web pages print out well, in case student want paper versions.
</li>
<li>Some other departments in Cambridge and in the States leave students to their own devices. Without going that far, we'd like to make students more self-reliant and more able to continue work at home. To that end we've dropped the graphics in this course.</li>
<li>The theory in particular (but also the exercises in the practicals) used to emphasise Numerical Analysis. This emphasis has been reduced in favour of problem solving, but the need to retain examinable material is a constraint.
</li>
<li>The impression that demonstrators gained in the past was that some students never recovered from the first impression that computing was hard. Though the material covered is nearly the same as before (casts have been dropped, C++ strings are used more, and classes are used in an exercise rather than just appearing in an appendix), the initial learning curve is shallower and the emphasis is on using C++ to solve problems. No C++ history is mentioned. There are no comprehensive lists of available features.
</li>
<li>Initially a reduced set of C++ facilities is taught. C++ is an old language. Though new, safer features and notation have been developed to supercede older ones, the old ones are still legal. We introduce the newer or easier approaches first (especially if they're more like the maths or Matlab/Octave equivalents), then other notations later.
<ul>
<li> We introduce <tt>i=i+1</tt> long before <tt>i++</tt></li>
<li> We introduce <tt>and</tt>, <tt>or</tt> and <tt>not</tt> rather than
<tt>&&</tt>, <tt>||</tt> and <tt>!</tt> for logical operations</li>
<li> We use braces around the body of <tt>while</tt>, <tt>for</tt> and <tt>if</tt> code, even if the body is only one line of code. This eliminates some common bugs.</li>
<li> We use <tt>while</tt> loops before <tt>for</tt> loops. Experience has shown that many students never understand <tt>for</tt> loops, forgetting the notation entirely, thinking that the condition is an "until" rather than "while" condition, or thinking that
<pre>
for (int i=0; i<4;i++)
cout <<i;
</pre>
<p>is somehow equivalent to </p>
<pre>
int i=0;
i<4;
i++;
cout <<i;
</pre>
</li>
</ul>
Once the concepts are clear, the more common (albeit more obscure) alternatives are mentioned.
</li>
</ul>
<p>The result's an online <a href="http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/1AComputing/Mich/">C++ course</a>. While I was at it I converted it to Python, trying to change as little as possible - see the <a href="http://www-h.eng.cam.ac.uk/help/languages/python/tutorial/">Python course</a></p>
<p>Python is popular within the University, even for "Scientific Computing". I can see its role growing within the Engineering Department too. We're now in a more polyglot, mash-up age. Matlab for example has about 2.5M lines of C, 1M lines of Java, 0.5M lines of Fortran and about 2.5M lines of its own scripting code. But C++ (the Latin of programming languages) remains: though the first official reference guide for the C++ was published over 25 years ago, it's used in modern applications by Halo, Amazon, Google, Mathworks, Microsoft, Apple, etc. According to the October 2010 figures by TIOBE Ranking Index, JAVA and the C family remain the 2 most popular languages.</p>
<p>Before C++ becomes too complacent though, here are some quotes from "Coders at Work" (edited by Peter Seibel, Springer-Verlag, 2009), which has interviews with several famous programmers.</p>
<ul>
<li>"C++ is just an abomination", Zawinski, p.10</li>
<li>"[C++'s] syntax is terrible and totally inconsistent and the error messages, at least from gcc, are ridiculous", Fitzpatrick, p.63</li>
<li>"I don't like C++; it doesn't feel right", Armstrong, p.224</li>
<li>"given the kinds of goals that I have in programming, I think the decision [for C++] to be backwards-compatible with C is a fatal flaw ... C fundamentally has a corrupt type system", Steele, p.355</li>
<li>"Google is C++, strictly C++. It's no big deal programming in C++, but I don't like it ... by and large I think it's a bad language", Thompson, p.475</li>
</ul>
<p>And here's another quote - "We sold our programming soul when we began teaching the pedagogically unsound and intellectually ugly languages C and C++ to beginners" - David Gries (IEEE Computer, October 2006, p.81).</p>
<h2>See Also</h2>
<ul>
<li>"Language Considerations in the first year CS curriculum" by Jonathan D. Blake (JCSC 26, 6 (June 2011)). He says "Research has shown that assignments that provide early feedback and early success (and that are compelling and visual) are important in improving not just retention, but also gender equity" (p.126). He used to teach Java in years 1 and 2, then taught Ruby followed by Java, then someone else used Python and Java. He found that both Ruby and Python made the transition to Java harder than expected. He tried Groovy then Java, which simplified the transition but introduced other problems. Currently he's using Scala and Java.</li>
</ul>Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0tag:blogger.com,1999:blog-2971935637727636366.post-53923744594094828202011-01-04T11:14:00.003+00:002011-05-05T12:07:56.609+01:00Open-ended computing projects<p>We run a 3rd year project for 20+ students (teams of 3) which lasts 4 weeks and lets them choose how to fulfill the task. To make it more fun we modify the requirements a week before the deadline, the hope being that if their work is well structured, the modifications won't be too onerous.</p>
<p>We also offer 4th year projects for individuals which last half their final year where there's considerable scope for flexibility - within reason they can come up with their own project titles. Here are 3 examples -</p>
<ul>
<li><a href="http://www2.eng.cam.ac.uk/~tpl/asp/">Analysing Sound Patterns</a></li>
<li><a href="http://www2.eng.cam.ac.uk/~tpl/chess/">Chess Annotation</a></li>
<li><a href="http://www2.eng.cam.ac.uk/~tpl/helpsystems/">Online help systems</a></li>
</ul>
<p> Other places (computing departments in particular) offer more project coursework - e.g.</p>
<ul>
<li>iPod Touch development (podcasted lectures are online)</li>
<li>Producing add-ons for free-ware (GIMP, Mozilla, etc)</li>
</ul>
<p>Such projects often appeal to students (and in retrospect are thought to be very useful). Students mention projects in CVs and they're a popular interview topic.
They bring together many issues at the heart of Software Engineering
but present difficulties to staff</p>
<ul>
<li><i>Project acceptance</i> - how carefully should the student's suggestions be assessed?</li>
<li><i>Evaluation</i> - how can dissimilar projects be compared fairly?</li>
<li><i>Copying</i> - how much copying is there in an adaption? Should suspicions be raised if the source of a very similar product appears during (or just after) the student's project?</li>
<li><i>Staff Workload</i> - if the students have freedom of language, platform, etc, help is going to be hard to provide.</li>
<li><i>Student non-productive work</i> - if the student is trying to contribute to a big project there might be required procedures, packaging, version control, documentation, etc that take up too much time</li>
</ul>
<p><img src="http://code.google.com/appengine/images/appengine-noborder-120x30.gif"
alt="Powered by Google App Engine" style=float:right />In our situation we would like to bring some aspect of engineering into the project (for years 1 and 2 anyway) but WebApps are so prevalent nowadays that one could almost consider them as examples of basic programming so
one option might be to use <a href="http://code.google.com/appengine/docs/whatisgoogleappengine.html">GoogleApps Engine</a> as a platform. The online documentation tells people how to download the software and has a staged example which is easy to work through (Java and Python are supported). The resulting web-page + database back-end can be run on the user's machine. Students could then work on their own ideas and upload the result to the GoogleCloud. A set of standard project titles could be offered for the less ambitious.</p>
<p>See Also</p>
<ul>
<li><a href="http://brm.psychonomic-journals.org/content/35/2/251.full.pdf">Using open-source solutions to teach computing
skills for student research</a> (David Allbritain - "In conclusion, a course on programming and Web development designed specifically for psychology students provides students with technical and problem-solving skills that they are then able to apply to their own work and research. An open-source operating system and open-source software contribute significantly to the feasibility and success of the course, both technically in the implementation of the course and pedagogically as well")</li>
<li><a href="http://hal.archives-ouvertes.fr/docs/00/10/98/61/PDF/Amie-EOSdev-1.pdf">Evaluating Student Participation in Open Source Software Development with an
Annotation Model </a> (Robert Charles and Yonglei Tao - "A primary goal for computer science instructors is to
prepare students for the real challenges they will face in
professional software development. ...
As technologies evolve, future developers are more likely
to work from existing or partial systems in order to build
new ones. Hence, it is important for students to gain
experience with complex programs they cannot possibly
redevelop from scratch ... We have also demonstrated how
this model can be used to evaluate the participation of
student/user in a collaborative program development.")</li>
<li><a href="http://www.cs.trincoll.edu/~ram/pubs/SIGCSE09-Morelli.pdf">FOSS 101: Engaging Introductory Students in the Open
Source Movement</a> (Ralph Morelli and Trishan de Lanerolle - "Course content was divided between technical topics related
to the development of free and open source software
(FOSS), including programming in PHP and MySQL, and
readings and assignments related to broader issues about the
societal impact of the open source movement")</li>
<li><a href="http://opensource.com/education/10/11/professors-perspective-landscape-academic-participation-open-source-projects">Student participation in open source projects (A professor's perspective)</a> (Heidi Ellis - "When two groups collaborate, they typically do so to accomplish common goals or to work together towards goals for both groups. In this case, the goals of the two environments differ. The open source environment seeks to create a product that meets user needs. The academic environment seeks to produce students with a certain knowledge and skill set. ... ")</li>
<li><a href="http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4385252">Teaching Software
Evolution in Open Source</a> (Maksym Petrenko,
Denys Poshyvanyk,
Václav Rajlich, and
Joseph Buchta - "Our students have practiced perfective software evolution
on open source projects with sizes up to 68,000
lines of code without difficulty ... We assign each project to a team of four to six students.
Each team has a project manager, a PhD graduate
student assistant responsible for the change requests
and supervision of team members. Project managers also
act as customers when change requests need clarification,
and they resolve team member disputes. ... At the beginning of the course, we select several open
source software systems written in either C++ or Java. ...After the course infrastructure was in place, each
project team required roughly six or seven hours of
the manager’s time in an average semester week and
around 10 to 12 hours in the weeks when build releases
were due. ...
Students’ grades are based on individual effort, group
interaction and communication, and the extent to which
they follow the required SC process. ... Our experience with teaching
software evolution over a two year
period shows that it is possible
to use large-size open source
software in course projects. After
being introduced to the systematic
methodology of software evolution,
students can effectively plan their
efforts and make high-quality evolutionary
changes.) </li>
<li><a href="http://www-h.eng.cam.ac.uk/help/tpl/talks/projman/projman.php">Computer project Management</a></li>
<li>"Good practices for Educational Software Engineering Projects", van der Duim, L. et al, Proceedings of the 29th International Conference on Software Engineering, May 20-26, 2007.
</li>
</ul>Tim Lovehttp://www.blogger.com/profile/00578925224900533603noreply@blogger.com0