Simple, Compact, Rounded Definition of the term "Programming Construct" A younger friend of mine, a high school student I have been encouraging to take his Computer Studies class seriously, and possibly go for CS in tertiary education, brought this problem to me. He was given a term paper by his teacher in the course of which he had to discuss language constructs in programming.

Being a diligent student, he had done most of the assignment but wanted to impress his teacher in addition with a definition of the term language construct as used in programming. He showed me his jottings from books and on-line but complained he could not find definition he could quote or material simple enough to enable him create a very good definition of his own. In spite of this, he came up with and showed me his definition below:

"a language construct is a part of a program that does
      some special work."

He wanted my opinion on whether the above definition will be satisfactory for his teacher. I was uneasy to say ok/not ok. I felt the definition was too fuzzy but I could not come up immediately with something more accurate YET WITH LANGUAGE SIMPLE ENOUGH to be at his vocabulary level! This is the dilemma. So I searched in the literature available to me, on-line too. I even read this thread on StackOverflow:

https://stackoverflow.com/questions/10057524/what-does-language-construct-mean
and this one on Quora:
 https://www.quora.com/What-is-a-construct-in-programming

I got many explanations but no compact definition. I thought hard about it. I made no headway. I also found this definition from Wikipedia (which incidentally is the only one that came close to a compact definition of the term):

“A language construct is a syntactically allowable part of a
 program that may be formed from one or more lexical
 tokens in accordance with the rules of a programming
 language. The term Language Constructs is often used as
 a synonym for control structure, and should not be
 confused with a function.”

However, the definition was full of jargon and bombast ("syntactically allowable", "lexical ...") which were way over my friend’s head. Furthermore, the last sentence of the Wikipedia definition begged a question of what is and what is not a programming construct. Considering it, shall we say class, object, structures, hash tables and such are not programming constructs?

We tried to pick elements of the Wikipedia definition, translate it to simpler language and incorporate in my friend’s definition, and the result got verbose and so long, it lost the compactness of a definition. The target is to come up with a definition of the term programming construct” that is simple, within the vocabulary level of a high school student, precise enough to clearly delimit the scope of where construct starts and where it ends (so one can easily see what is a construct and what is not). I and my friend have discussed in the last three days on it and we seem to be getting into an intellectual quagmire: the more we try to step forward, the more intractable it gets.

I bring this here because we are teachers. As teachers, we are used to having to define basic concepts. I am hoping to get some precision and lucidity that AUGMENTS my friend’s definition and makes it more rounded. Lets help a serious young man who has done his due diligence and needs some scaffolding. Thanks people.

Just a lucid, compact and rounded definition at the vocabulary level of a high school student please. (I will ensure you are acknowledged in my friend's paper if your definition is not an extension of his, and is used by him).

Rephrasing

  a language construct is a part of a program that does some special work

This is indeed too vague. First of all, every program is built specifically to do a particular job. "Special" is subjective, often synonymous with "custom tailored" and thus any program can be called a "special work". By logical extension, any part of a program is therefore part of that program's special job.

The quickest (but not perfect) fix here would be

  a language construct is a part of a language that does some special work

It's still too vague, but it hits the nail more on the head. Constructs are very specifically not something you've written yourself, i.e. they are not part of your program but were already part of the language/compiler.

More specifically, I would define a language construct as a predefined operation of the language, i.e. it is not something that developers must build for themselves.

Learners don't yet grasp the big picture

...by semantical definition of what a learner is.

  I could not come up immediately with something more accurate YET WITH LANGUAGE SIMPLE ENOUGH to be at his vocabulary level!

In software development, where everything is so abstract, you only understand a given name (= dictionary entry, vocabulary) when you understand the underlying concept. If your friend does not have a particular word in their vocabulary, they do not understand the underlying concept.

In a way, their inability to define what a language construct is specifically proves that they either don't know what a language construct is, or they don't understand some key concepts that language constructs (and their definition) inherently rely upon.

The purpose of providing this definition to the teacher is not to give the teacher some wisdom that they already have. The purpose is for your friend to show that he knows it.

The proper solution for this is for your friend to either dig deeper into the concepts that he's trying to tackle, or to not overreach at the moment.

Overly complex definitions

  “A language construct is a syntactically allowable part of a program that may be formed from one or more lexical tokens in accordance with the rules of a programming language. The term Language Constructs is often used as a synonym for control structure, and should not be confused with a function.”

This sounds like a quote from the Architect in The Matrix, who is often ridiculed for using near-nonsensical liguistic complexities merely as an affectation.

I could delve into abstract analogies as to why the Architects innate desire to abstract and define is very similar to what you're trying to do, but I'm instead going to focus more on the specifics of software engineering.

Languages vs frameworks

  Considering it, shall we say class, object, structures, hash tables and such are not programming constructs?

A language is different from its framework, and this is a very important distinction (that your friend may not understand yet).

Take the example of C# and the .Net Framework. IEnumerable<T> is part of the .Net framework, it is not part of the C# language. However, interfaces and generic type parameters are part of C#.

In the end, an application is just layers upon layers code, where any layer tends to rely on the predefined concepts in the layer beneath it. As a basic model:

The language provides language constructs and a syntactical definition
A framework extends functionality by creating additional predefined concepts which rely on the language constructs
An application relies on its framework (and language) and can rely on all predefined concepts at its disposal in order to achieve its goal in the best way possible.

To you as an application developer, the lines between language features and framework features can be muddied (because it doesn't really matter to you where it comes from). But for framework designers and language designers, these distinctions are incredibly important.

At a base level, a language is globally pervasive whereas a framework can be avoided selectively. For example, I am able to write my own IEnumerable<T> as long as I avoid namespace conflicts with my framework's IEnumerable<T>. Good practice suggests I don't do this, but I am technically able to do so.

However, I am never able to use for or switch anywhere in my code for anything other than referring to my language's constructs. Good/bad practice doesn't even come into it, it's just outright prohibited to repurpose these constructs as their definitions are globally persisted through all of the code (written in that particular language).

Education through definition

  The target is to come up with a definition of the term programming construct” that is simple, within the vocabulary level of a high school student

When you drill down into software development, things become more complex, not less. The diligence you are putting effort into is what is leading you to the increasing complexity.

Ask a beginner programmer what a "hello world" application does. Now ask them on the intricacies of how these characters are displayed on the screen. They are patently unable to do the latter because you're asking them something they do not yet grasp, yet they already display top-level knowledge by being able to understand the purpose of a "hello world" application.

  I am hoping to get some precision and lucidity that AUGMENTS my friend’s definition and makes it more rounded. Lets help a serious young man who has done his due diligence and needs some scaffolding. Thanks people.

Your question is based on the underlying principle that one learns by observing strict definitions and derives understanding from them. I want to challenge that frame of mind, especially in the field of software engineering.

The vast majority of good developers I've worked with are all "hands on" developers. They learn by doing, and their vocabulary naturally grows with their skill. If you put these developers in a classroom and get them to learn definitions of things they do not yet understand, or have not yet encountered in practice, they are going to either actively reject or genuinely forget the intricacies you've poured into these definitions.

I'm not saying that it's impossible to learn the theory before the practice, but for abstract fields such as software development it's so very fickle to understand a theoretical definition without misinterpretations if you don't have practical experience to rely on. It's not impossible, but it is highly improbable.

  Just a lucid, compact and rounded definition at the vocabulary level of a high school student not explanations please.

Abstract concepts don't work without practical examples. You cannot teach a child what addition is without at some point having used physical objects to show addition in reality.
You can teach a child to blindly accept and parrot the symbology of 1 + 1 = 2, but they won't understand what it represents in the real world. Furthermore, if they only recognize the symbology and not the meaning, then they will be unable to answer 2 + 2 or 1 + 1 + 1 as they cannot apply the general concept of addition as they have not yet understood it.

Compared to children, adults are significantly less capable of deriving understanding from parroted information. Compared to adults, software developers are even less capable of doing so; and those that do blindly accept and parrot things often end up stagnating in their job by repeating what they know instead of perpetually reevaluating their approach.

Abstractions stem from practical applications, not the other way around

Your friend's definition of a language construct should not be the start of their understanding on what a language construct is. Their ability to define a language construct is the resulting proof that they have understood what a language construct is.

Don't pour your effort into definition. Pour your effort into practical experimentation. The definition will naturally come from your practical experience.


Once implicit/inferred typing is introduced, how can I impress upon students the importance of not abusing it? I typically have the same students two semesters in a row, for programming I (VB.NET) and programming II (C#). In our early, impressionable time together, I stress to these students (high-schoolers) and show them by example (I write lots of code for them) the importance of writing clear, readable code, which is partly achieved by explicitly specifying types for all variables (at first I do not tell them there are other options)

However, at some point, I have to reveal to my students that they can, indeed, declare a variable as an Object (i.e. Object x = new Horse("Silver");) and that it can hold anything; or, that they can declare a variable as var (i.e. var y = "foo";) and that the compiler will figure out what type it is. Some of them discover this on their own, of course.

Then I inevitably have students who abandon the good habits they had formed and want to make everything an Object, or declare everything as var (note I realize this is not equivalent in the language, but students tend to abuse the usage in the same way). I am always torn about how insistent to be that they revert, because I know the use of var in C# is controversial in the industry. (See the SO discussion use of var in C# for an example). Plus, the more savvy students are hanging out in SO anyway, and they see some questions and answers that lack explicit typing and other good programming habits.

My question is, since these students are still learning, and since it is my classroom after all, should I emphatically require that they always explicitly specify types unless absolutely necessary? (Of course, sometimes it is justifiable, preferred, and necessary NOT to). And, if I do require it, how can I explain the (in my opinion) sloppiness they sometimes see in online communities?

Then I inevitably have students who abandon the good habits they had
  formed and want to make everything an Object, or declare everything as
  var.

These are very different situations. As you observe, the use of var in C# is controversial, but using object as the type of all variables (and then needing to cast any time you want to actually use the variable) is not controversial: it's just wrong.

The first page of answers on the linked SO question about var in C# is incomplete. It doesn't mention that using var can avoid bugs due to typing in one edge case: foreach (var foo in foos) vs foreach (Foo foo in foos). For legacy reasons, if foos is a System.Collections.IEnumerable but not a System.Collections.IEnumerable<> the latter is equivalent to foreach (Foo foo in foos.Cast<Foo>()), which is not especially obvious. (In fact I misremembered and was corrected in comments, which reinforces the advantage of using var here).

TL;DR: blanket prohibitions on var are almost certainly going too far.

  My question is, since these students are still learning, and since it
  is my classroom after all, should I emphatically require that they
  always explicitly specify types unless absolutely necessary? ...
  And, if I do require it, how can I explain the (in my opinion)
  sloppiness they sometimes see in online communities?

var is far from the only controversial subject in programming praxis. The solution in industry is the style guide: whether as a formal written document or as an informal internalised set of opinions which are imparted to new team members by word of mouth when they submit changes which violate the house style. If you're explicitly preparing your students for industry, it is perfectly reasonable to dedicate a bit of time to explaining the concept of the house style, and then when you introduce new material to explain the house style you will enforce for that feature.

The really heavy-duty approach would be to prepare a full industry-style style guide and then to produce a series of increasingly large subsets so that every couple of weeks you can give them a link to an updated style document which specifies how to use the new features you just introduced, or the new features you're about to introduce, and highlights the additions from the previous one.


What would be a good analogy for IP addresses and ports? What would be a good way to describe ports?  I learned about it using this analogy, but it seems pretty inadequate to me:

IP addresses are like street addresses of apartment buildings, and ports are like the apartments therein.

IP addresses are not segmented as a street address is, and second, apartments don't seem at all analogous to ports in terms of behavior.

I used seats in the room.

The classroom has an address. So, if someone wanted to come and talk to one of the students they would come down the hall and into my room.

But, that only gets them to the room (server). They need to talk to a specific person, so they go to seat 17 so they can talk to Bob.

So Bob's socket is room.123:17.

I tried once to continue and the floor became cable runs, each hallway was a subnet, the corners were routers, and the school map was DNS. That pushed it a little too far :)

Did find though that most kids had at least a passing understanding of ports. Most of them had opened ports on their home routers to play games over the internet.


How to provide individual grades for group project work? I teach undergraduate programming project courses and have traditionally given the same project grade (about 45% of the semester grade) to everyone on each team, unless a team member's participation was clearly minimal, in which case I deduct points from that student's project grade, but I do not add points to other teammates'.

A student complained about their grade not reflecting the amount of work they put in, which was substantially more than their other teammates. I can sympathize with the complaint, although I pointed out to the student that I had followed the syllabus and project grading guide and that they had learned more and would get a better letter of recommendation than students who contributed less.

I would like for students' project grades to reflect their contributions, but just grading projects is time-consuming and difficult enough. What ways have teachers found to provide individual grades on team projects?

In "Assessing Individual Contributions to Group Software Projects" (WCCCE '03), William Gardner discusses a number of strategies for adjusting team programming project grades for individual performance and ends by recommending a "share-out" approach:

  The essence of share-out is that each student is conceptually given a
  pot of points, and must allocate them among their peers based on some
  stated criteria. The allocation then represents that student’s
  numerical evaluation of his or her team members.

  In order to provide a straightforward, effective criterion for the
  sharing out, each student was given 100 points and told to allocate
  them according to the amount of credit each team member deserved in
  terms of the total project work. The term “credit” was intentionally
  selected to be both intuitive and elastic, a single metric that could
  easily serve as a proxy for time and quality of effort....

  Students were required to give themselves at least 100/N points, in
  recognition that there would likely be little enthusiasm for
  self-incrimination, but then the self-evaluations were not averaged in
  with those of the team members. With this constraint in place, ethical
  struggles over whether to admit one’s own poor performance were
  shunted aside. If some students really performed poorly, their team
  members could do the dirty work; their own confessions were not
  required, nor could their grade be inflated by making phony claims.

The paper provides further details.

Update: Since the paper is 14 years old, I contacted the author to ask if he has any updates. He kindly replied that he had not taught a software engineering course since then so had no further experience to report and that he stands by his recommendation.


Need a good "streaming" software for coding tutorials/workshops I'm doing a coding workshop and I can't seem to find a good way to stream a part of my screen (or some windows in my screen) into a projector. I only need the code editor and terminal/command prompt windows to show to the students. I didn't want to mirror my screen since I have slide notes and reminders only for me (as the presenter). So what I was thinking is to extend my screen into a projector (or to simulate, a second screen), and have a software streaming (mirroring) a part of my orig. screen into that second screen.

This is so the students can see what I'm typing into the code editor and terminal. I also have slides that I want to be in that projected screen.

But I still need a part of my orig. screen hidden for my notes.

I used VLC to stream desktop but it's a pain to setup and there is some lag into the stream.

The description may sound confusing but you could imagine just what you would do if you have three things to show to the students.
Your code editor, terminal and your slides. But you also have slide notes and some other notes for yourself.

Any good ideas?

I work on a Macintosh, but assume similar capabilities are available on other systems as well. My systems support multiple monitors and each monitor can show a separate desktop (or a section of a larger desktop). A window in one desktop can simply be dragged to another. If you just connect your regular monitor to one (physical or virtual) port and the projector to another, you will have what you want. If you don't have physical ports a junction/splitter may be required to support the multiple monitors so long as the software will support it.

You could, possibly, have two monitors and a projector with the projector mirroring one of the monitors so as to make your own workflow easier.

This assumes, of course, that you are interested in a face-to-face situation, not remote students.


Any materials on fractional/quotient languages? In Hopcroft-Motwani-Ullman there are exercises on this topic. What is another good reference (textbook/website) for fractional/quotient regular languages, possibly with examples?

An Introduction to formal Languages and Automata
Included in the University of Nottingham's Languages and Computation Course resources

The book An Introduction to Formal Languages and Automata  by Peter Linz can be used as an alternative or complement to Hopcroft-Motwani-Ullman.

An excerpt from

The latest edition of Linz’s theory textbook follows the same outline as the previous one: it begins with a chapter on mathematical preliminaries; moves through the Chomsky hierarchy (regular, context-free, and recursively enumerable languages, with a brief mention of context-sensitive languages); and concludes with one chapter each on the topics of undecidability, alternate models of computation, and complexity classes.

The presentation suits your needs : gives formal definitions, provide examples, give mathematical justifications (usually complete proofs), and end with a set of exercises. Solutions to some of the exercises appear in the appendix.

More than anything else, the book needs to provide readers with a broader framework that naturally motivates the many topics covered. Instructors looking for a general reference on automata and formal languages, or a textbook for a mathematically sophisticated audience, should take note that Linz’s book lacks a comprehensive bibliography (the one-page list of references consists primarily of other theory textbooks).

Overall, the work is appropriate for the author’s stated purpose: a textbook for an introductory undergraduate course on the theory of computation—provided that the students have sufficient mathematical preparation.


Is it bad to introduce language features in ways that are different than they will be used in practice? I found the following example in chapter two of Annotated Algorithms in Python (PDF)

>>> for i in [1, 2, 3]:
... print i
... continue
... print 'test'
1
2
3

This does demonstrate what continue does, but you would never write something like this in real code. You would just leave out continue and print "test" entirely. It seems like this example might be counter-productive.

Another type of example that I have seen elsewhere that I think might be counter-productive is indexing into string literals. For example, in some languages you can write the following:

"Hello World!"[0]

which would evaluate to "H" but if you actually wanted an expression that evaluated to "H", you would just use "H"!

Does it make sense to use contrived examples like this, or is it likely to introduce confusion in students?

This sort of thing is perfectly valid and valuable, provided that students already understand the underlying structure. So if they understand your first loop without continue (but with the print in place) the adding continue lets them see the effect dramatically.

The same is true of your second example. If they understand strings as arrays or lists (or ... whatever term is appropriate in your language) then introducing the [] "box" operator as selection makes sense.

But I wouldn't write a large program as an exemplar of good programming if it had these kinds of things.

But note also, that throwing in a continue in a loop is sometimes good for debugging, so it isn't entirely useless as a technique in "real" programming.

tl;dr teaching by showing modifications to a known base is fine.

By the way. In some languages asking students to decipher obfuscated code can be a useful exercise to make sure they know the basic rules. Asking them to clean it up is even better.


How bad is a Computer Science course that doesn't teach Design Patterns? I'm at final year of my graduation in Computer Science in Brazil. The university that I study is one of the best in the country and my passion is for Software Engineering. It disappoints me, in Software Engineering classes, that no Design Patterns are taught at all, my professor only commented about their existence. From my point of view, this is terrible for every student, because the problems in the real world, both in academia and in the industry, can be more easily handled with a good choice of design pattern. So I'm thinking, this can reduce the quality of the course?

There is more to a CS degree than programming and more to programming than Design Patterns. I'm actually an expert in such things and have designed and published a few as a committed member of the patterns community. If I were teaching you programming in some object-oriented language you would certainly learn about and use many such patterns, but you might never hear the names, just the usage as good ways to write programs in a certain set of languages.

However, I have a friend, also in the community, who is well known and has designed many things fundamental to areas of programming languages who doesn't use the standard design patterns you are probably thinking of at all. The reason is that he programs in LISP and CLOS, not Java and C++. His informed opinion about the design patterns is that they are merely corrections for flaws in certain languages, primarily C++. Many of the kinds of things that design patterns accomplish in C++ are done in more natural ways within Common Lisp itself without needing any such mental tricks.

So, it may well be that your curriculum is flawed, but not teaching the patters in the Gang of Four book is not the only indicator. (Some of those authors are friends of mine, in fact).

Moreover, there is more (much more) to CS than programming. Have you learned data structures and algorithms? Have you learned architecture and databases? Have you learned data communications and concurrency? Have you learned to work in teams on large projects? Have you learned to think abstractly and to decompose problems and compose solutions? Those are vitally important too.


How widespread is the use of the PEP/8 assembly simulator in education? For teaching assembly language and computer architecture, are any other platforms besides PEP/8 used, and if so, what are they called and how widespread are they?

Or more generally, how is assembly language usually taught at the college level? I need more information than just my personal experience in one class.

I ask because I have created a similar but more powerful platform and need to comprehensively evaluate the existing systems for my research project.

I haven't been able to find an authoritative source about PEP/8 but this powerpoint describes it pretty well:

PEP/8 Overview

Basically it is a very simple virtual machine that teaches the basics of assembly programming.

I think that PEP/8 too simple and would support teaching with real architectures, as some of you have mentioned.

I have studied at several public schools in California and PEP/8 is used universally here.

At Colorado State University we teach the LC3 assembly language. A quick search for LC3 assembly language shows links to courses at multiple universities. Our course is normally taken by students in the second year and has three primary subject areas.

C language - students already have at least two semesters with Java, so the programs are more advanced, frequently including an assembler and/or simulator for the LC3.
Assembly language - students learn the assembly and write programs for 16 bit floating point math and learn how the run time stack is used in function calls (commonly in the context of a recursive function).
Hardware - students study hardware using Logisim. They commonly design some of the control for the LC3 machine.

In looking at other schools, I have found several that use subset of MIPS. I hope that helps


Curriculum choice for AP Computer Science A We are currently researching what curriculum to use/adapt for the 2019-2020 school year. It will be our first year offering AP CSA. The students taking the class will have had 3-7 years of computers science classes and plan to go into a computer science program.
Anyone have strong feelings on what AP CSA curriculum to use?

With the amount of preparation you're describing, the only thing your students will likely need is a course that teaches them Java syntax and object oriented programming, as the AP CSA exam assumes knowledge of Java:

  SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA.

(from https://apcentral.collegeboard.org/pdf/ap-2020exam-sample-questions-computer-science.pdf)

Code.org has a nice list of Java curricula that specifically target the AP CSA outcomes, but really any "Fundamentals of Java" course or online tutorial would likely be just fine.


Should test cases be made available to students for assessed assignments? A number of the assignments I've completed during the course of my undergraduate degree have been assessed partially using automated tests. These have never been available to students prior to the assignment submission, but I know this isn't the case at some universities. It would seem difficult to me to get less than 100% if all the test cases used for grading were released prior to the assignment deadline (provided the student gave enough time to the assignment).

In some cases, the feedback I've received has indicated that my submission failed a number of automated tests - but the test cases were never made available to students and I was left unsure as to what I had done wrong in my work and how I could improve next time.

In other cases, the test cases were made available after the assignment grades were released. I much preferred this approach, because I could see exactly where I'd gone wrong and the whole process felt fairer.

Should automated test cases be released and if so, at what point should they be released?

My best practice would be to provide students with test cases and require them to submit additional test cases with their code. Then run everyone's test cases against everyone's code. Let the students know that they will get extra credit if their tests break anyone's code. That will put them in a mindset of creating tough tests and writing bullet-proof code, rather than stopping when the pass the provided tests.


Encouraging Critical Thinking On Programs Before Students Write Them I frequently teach our CS1 class (taught in Java), and have noticed a problem with critical thinking/planning skills on programs of any substantial size. This seems to be related to two problems: (1) not fully internalizing what tools are available to them (e.g., String methods like charAt, length), and (2) not thinking through/planning ahead/leaving enough time when writing their program. I would like to foster these skills, but I am at a loss. This is a class of complete programming novices. Most students have no prior experience. Some students have a little prior experience in some OOP language, but it is usually self-taught with little regard to breaking down larger problems.

The first problem seems easy enough (encourage students to write a glossary of tools we learn with examples - we only require knowledge of a handful of methods), but students rarely do it. The second problem has been a white whale of mine for the past year and a half. I teach activity diagrams and model problem solving in class, but when I try to require activity diagrams as part of program submission, I mostly get students who solve the program first, then reverse engineer their diagram. I would love to require their diagrams to be submitted ahead of time for feedback, but I do not have the time to grade it before the program is due. I do have some students who show up to office hours and never pull out their computer - they just draw diagrams with me, and they are fantastic students. But, they are the minority.

I fully believe these skills are just as important, and perhaps more important, than eventually writing that correct program, but the program of course is what they need to be able to do. How do I teach/evaluate these skills effectively in class in light of all the other material that needs to be covered?

I agree very much with ctrl-alt-delor that the level of "total novice" might be rather early to introduce larger-scale meta-design techniques into coursework.  The work being done at that level simply does not require (at a cognitive level) such deep planning to execute properly.  Since the need is not self-apparent, efforts to bring it into their work will typically feel like extra, needless work.

If you would like to help them understand how to use plans (and how to utilize good, structural thinking), here is a way you might go about it.  Provide a diagram in class, and talk through it as a group.  Next, ask the students to work with a buddy to make a series of modifications for different purposes.  At the end of this exercise, they will have several different diagrams.

Ask them to choose one of their diagrams, and imagine that some other coder will have provided some source code that attempts to follow their specification.  However, it is their job to verify that the code that they receive truly will work as specified.  They should now work with their buddy to design the trickiest test cases that they can think of!

You can encourage this by enthusiastically placing great examples of test cases on the board as students come up with them.  "Look, how wonderful! Testing for the empty string!"  Or "Using a negative number is a great way to try to trip things up!  Great thinking!"

Finally, whichever project they chose for their test code, they should actually program as a lab.  (This could be done as paired programming or as solo work.)  When they submit their lab, they will provide a UML diagram, thoughtful test cases, and their coded solution.

Congratulations! You've now integrated student choice, prior design, unit-testing (well, the core of it anyway), pair programming, and created an assignment that is harder to cheat on than the standard mainstays (like sorting algorithms) in a way that feels natural and un-forced.


Any tools or frameworks for visualisation of algorithms? I would like to make animation of algorithms in order for students to see the flow of an algorithm in a visual way.
Like an alternative to https://visualgo.net/en
I want to make custom animations like this.
Thanks in advance!

Actually, a few years ago, there was a large effort to work on algorithm visualization and many tools were developed. Tom Naps led part of that effort, but I suspect he is now retired.
But a simple google search for "algorithm visualization" will turn up quite a lot of both tools and people.
They aren't hard to build, actually, if you use a language like Java that has a large and sophisticated graphics library.


Learning in a developing field I'm reading quite a bit about quantum computing, especially optical quantum computing. Part of the problem is even the all-encompassing bible of quantum computing (Nielsen and Chuang, Quantum Computing and Quantum Computation) has only 10 pages on this particular physical realization. Other textbooks, by the time they're published, are already out of date. Hello, reading scientific papers!

Of course, there's a problem associated with that - results are retracted, new ones encompass and expand upon old, and papers are rather notorious for being difficult to slog through. Having slogged through a few myself, I can tell you that notoriety is well-deserved. Worse (for the self-learner), most papers are focused on only a specific problem.

All this isn't to say that papers are bad, just that sometimes other materials can be nice, and learning from just papers is difficult.

How can one find materials other than papers to learn from in a developing field?

I find conferences are good for learning in new fields. Most of them cater to academics but many industry researchers present at them as well. For example Microsoft Research sends people to a lot of mostly academic conferences. ACM and IEEE Computer Society both have conferences. Besides the papers that are presented, often including more material and details than the written papers, there is the opportunity to discuss recent developments with practitioners.


How to avoid misconceptions about while loop when using null loop Is it problematic to teach students to use an empty while loop to create an until loop? If so, what learning progressions avoid the problem? The question is an empirical one, but reasoned hypotheses and evidence would both be welcome.

Background and Context

Several thousand US middle schools and several thousand US high schools have VEX robotics equipment and RobotC licenses as contractual vestiges of Project Lead The Way (PLTW) engineering programs for middle and high schools. RobotC is a proprietary language from an institute associated with Carnegie Mellon University.

RobotC does not have an until (condition) do {} structure.
http://www.robotc.net/forums/viewtopic.php?f=55&t=3059 . The PLTW curriculum uses a "Natural Language" module of RobotC that includes wait-until functions like waitUntilDistanceSensorLessThan(200), but these cause the robot to be incapable of responding to input during the wait-until statement.

In the middle school where I am teaching, my predecessor assembled the VEX kits into  "squareBots," a design suggested by VEX and RobotC. The robot is equipped with two motors driving left and right sides of an eight-inch square chassis, equipped with a set of sensors. The robotics equipment engages kids, but the RobotC language has inherent problems pedagogically; this question is about one such problem in particular because I think the question is more broadly applicable than just RobotC.

The problem

To implement a wait-until algorithm capable of executing other code while waiting, I've tried teaching the idea to use

while (waiting-condition) {
  //empty loop
}

I have wondered if more students stumble with later more complex programs when I introduce the empty loop as the students' first experience of while statements. I intend to set up an experiment to verify this anecdotal observation and am fishing for ideas about the two treatments to compare.

One example of a learning progression that seems to do better

For example, I think students do better with later, more complex programs if, before using the empty while as a wait-until, they modify an infinite while loop such as

sensorValue[LED] = 0;
//VEX uses LEDs in sensor ports and configures & assigns them as an output
while (true) {
    if (sensorValue[alertButton]) {
        sensorValue[LED] = 1;
    }
}

To add some context from the chat room conversation: This is part of a larger course that introduces technology in an applied fashion. The segment with the robot is 10 days and the students have not necessarily programmed elsewhere.

Empty while loops

I would recommend against beginning with any empty loops for your students.

All the looping constructs are best understood when presented in manner that fulfills the purpose they were created for. An empty loop, using any of the available constructs, is using the loop for a purpose other than what it was designed for. If the loop is being placed so that you can add functionality later, at least replace the comment so that it is clear something is planned for inside the loop later. If you are using the PLTW "Natural Language" module, and start with the function

waitUntilDistanceSensorLessThan(200)

you can expand the lesson by replaceing that with the loop:

while (sensorValue[distanceSensor] >= 200) {
  // Things to do while the robot moves closer
}

That way you are not presenting an "empty" loop, but one that is planned for a purpose, and that purpose just happens to be "to be determined." Don't leave it that way either, but fill it with something real before executing the program. The comment line is showing the development process of changing the first version into a useful version. The next step is to then put something there, even if it just flashes the LED as the robot advances to the target.

while vs until

Some programming languages have an until control statement, others do not. Many of those which have both a while and an until separate their usage by having the while test the condition before the loop executes, and the until tests its condition after the loop executes. In hypothetical syntax they are commonly like this:

set(testCondition);
while (testCondition == TRUE) {
    doThisFunction();
    doSomeOtherFunction();
    update(testCondition);
}

do {
    doThisFunction();
    doSomeOtherFunction();
    update(testCondition);
} until (testCondition == TRUE)

Syntactically, the until loop is guaranteed to execute at least once and the while loop may not execute ever.

Many languages which do not have an until control statement still provide for testing before or after execution of the loop. In the case or RobotC, the language of this question, the syntax is like this:

while(SensorValue(sonarSensor) > 20)  // while the Sonar Sensor reads data greater than '20':
{
    motor[rightMotor] = 50;               // run 'rightMotor' at power level 50
    motor[leftMotor]  = 50;               // run 'leftMotor' at power level 50
}

and

do
{
    motor[rightMotor] = 50;  // run 'rightMotor' at power level 50
    motor[leftMotor]  = 50;  // run 'leftMotor' at power level 50
    bursts = bursts + 1;     // increment 'bursts' by 1
    wait1Msec(3000);         // wait for 3000 milliseconds before continuing
}while(bursts < 3)         // while 'bursts' is less than 3:

Source RobotC Wiki: Control Structures

That still leaves the testCondition as an issue, however. Based on the English usage, from which most programming languages derive their meaning, "while" and "until" are opposites. "While" implies that something is not done unless the test is true. "Until" implies that something is done unless the test is true. The while loop exits when the test condition is false (fails), the until loop exits when the test condition is true (passes). Using that, for a language which lacks the until control statement, the same functionality can be created by using a negative test. Thus until (done) becomes while (notDone), or if the language uses this syntax, while ( ! done). Thus until's usage can be created when needed. In the case of RobotC it's even possible to create the common version of a tail-test by using do {} while (! done)

Note: Perl has taken the while vs until concept and extended it into the realm of the if statement by creating an unless test:

unless (testCondition) {
    say "testCondition is FALSE";
}
else {
    say "testCondition is TRUE";
}

Limited prior programming exposure

All the above, absent the motor and sensor parts, really applies to any programming related course. It can even help prepare students for what they will encounter "in the wild" with other languages not covered by the course. The specifics of this question, however, with its short duration and unknown, but probably limited, prior programming by the students, creates extra concerns.

As made clear in one comment in chat, the students may not even understand the concept of statement block and there is precious little time to explain all the details of programming, let along all the possible variations. With the objectives of awareness/excitement about career paths in mind, planning ahead and having some of the desired variations pre-built might be helpful. For example, the first two code segments could be saved, and quickly "built" with the students. A third variation, which might be attractive to the students, is to have the LED flash faster as the distance closes with the target. Using guessed numbers for examples here, with numbers found to be useful in the lab replacing mine, the original waitUntilDistance.... line could be replaced with something like this:

int totalDistance = 500;
while (sensorValue[distanceSensor] > (totalDistance/25)) {
  sensorValue[LED] = 1;
  delay(300 * sensorValue[distanceSensor] / totalDistance);
  sensorValue[LED] = 0;
  delay(200 * sensorValue[distanceSensor] / totalDistance);
}
sensorValue[LED] = 1;

That will give a duty-cycle of 60% and an initial frequency of 2 flashes per second, and a final frequency of 50Hz. Another chance to reinforce some math and science, increase the engagement with the robot, and not introduce new programming concepts.

In consideration of the limited time and limited programming exposure before this segment, I think that introducing the empty loop

while (waiting-condition) {
  //empty loop
}

will cause more students to stumble, and not necessarily later. The emptiness might make apprehending the statement block concept more difficult than it already is. I'm also not so sure you should even divert into the infinite loop of while (true) {} at all. If you do use the LED-alertButton combination you presented in the question, modify it to respond as a toggle rather than a one-shot that turns on and then appears to ignore all future button presses. The program might loop forever, but it will look to the students like it turns on the LED and then stops responding.


Strategies for independent learners to identify gaps in their knowledge One common concern many independent learners of computer science and tech have is figuring out what they "don't know". More specifically, the concern is that since they've never been formally educated in CS, their knowledge might have "blind spots", which can cripple them when they start working on more complex projects or try and get a job. (For example, somebody who didn't know that data structures and algorithms were a thing will very likely struggle on most standard tech interviews).

I interact with/help self-learners on a fairly regular basis, and am never quite sure what to tell them when this question comes up.

One strategy, of course, is to simply give them a list of things they ought to know -- there are many articles that give a good overview of topics covered by a standard CS degree, for example (example 1, example 2). However, this strategy doesn't generalize well: once you move on to trying to learn about something not on some list, you're back at square one.

The other strategy I try suggesting is to just read random highly-upvoted posts on StackOverflow and news aggregate sites like Hacker News -- I've personally found you tend to pick up a good awareness of different CS and tech topics almost by osmosis if you do this. However, this strategy is also flawed: it's a random and slow process, and isn't guaranteed to be comprehensive. (If a topic isn't trendy, it's likely you'll never stumble across it.)

This brings me to my core question: what are some effective meta-strategies suitable for self-learners that help them identify gaps in their knowledge?

I'm hoping for strategies that are either more generalizable or more systematic then the two I listed up above.

First off, it's worth mentioning that everybody has these "blind spots" or gaps in their knowledge. Nobody can know everything, and some of the smartest people I've met are very open about that fact. I think a big part of being a good programmer is being comfortable with the unknown. What makes a good programmer isn't that they can write code, it's that they can learn how to write code.

In that regard, a self-learner already has a lot going for them. Because it's not really about memorizing stuff: it's more about the ability to do research, consult documentation, try stuff out, and see what happens. So the best thing somebody can learn is the ability to learn, if that makes sense.

I'll also say that for me, the thing that really took my knowledge to the next level was when I started answering questions. So I'd say your recommendation of checking out posts on Stack Overflow is on the right track, but I'd encourage novice and intermediate programmers to go a step further and try to answer questions as well. If Stack Overflow seems overwhelming (it was for me at first), then maybe join a forum and start answering questions there.

If you're only familiar with if statements, then start answering questions about if statements. Eventually you'll see a question that also involves a for loop, so to answer that question you do some research on for loops. Then you start answering for loop questions, and eventually come across a question about functions... That's a contrived example, but the general flow is pretty much exactly what I experienced. Even after a formal education, it really opened my eyes up to how much I didn't know!

Find a community, share your work, talk about programming. This is one way the gaps get filled in with a formal education, so it stands to reason that this would help with a self-learner as well.


Clear example of the Object-Relational Mismatch An important issue in programming is the Object-Relational Mismatch, but I have not seen any good explanations that use familiar terms. I came up with one involving a Family Tree application.

The idea is to store data rows that include name information and foreign keys to both parents and a spouse. (Can also store useful info like birth date, birthplace, gender and so on.) This table would obviously contain reflexive relations (self-joins) on these three foreign keys. No information about the relationships such as brother, nephew, grandparent and so on can or should be stored in this table.

The application would pull in all of this data in to a tree structure, and based on who is selected as the focus person ("me" in the tree), all of the relationship titles can be 'computed' and displayed. They are me-centric and so are not part of the data, only part of who is centered in the display.

This example points out the many and very vivid differences between a data storage method and an Object-Oriented view of data:

the data rows simply have links to parents and a spouse
data rows cannot contain any relationship titles (brother, etc.)
the display can show all of the titles relative to who is "me"
changing the "me" pointer in the display relabels all the relationships
all relationships of any generation previous and successive can label themselves in the display

This shows the differences between data in a database and objects at run-time very clearly. I have not seen this example given anywhere else. Does it explain the "Object-Relational Mismatch" in a useful way?

I'm not seeing an explanation of object-relational mismatch there for two reasons:

What are the objects? You've sketched a database table definition and a visualisation, but I don't see a sketch of the application program's structures.
As far as I can see, all of the additional information in the visualisation can be made available in a purely relational database view. I've done this kind of hierarchy visualisation with CTEs.


Why Computer Science students learn Digital Logic Design? Is there any relationship between a computer science student and DLD course? I am studying BSE and we are studying DLD in my second semester. We've learned so many things about DLD but nothing is related to the CS or SE. It's all about gates and related to Electrical Engineer.
Is there any need of DLD in Software Engineering? While the main thing which is concern for us is Programming Languages and Computers System?

Logic is used A lot in programming.

There is little difference between hardware and software. It is just an implementation detail. The choice of what goes where is a balance between cost and speed, but where ever it goes it is just logic: if you implement it in Python, C♯, assembler, HTML, electronics, or mechanical.


What are good projects for metaprogramming? When I teach metaprogramming like dynamically defining methods and method delegation, students usually understand what it is fairly quickly because it's simply a dynamic way of doing something they've already done. I now want to assign them a project that utilizes the metaprogamming I've taught. I'm having trouble thinking of a project to assign them which would be made significantly easier by using metaprogramming. The only use I know of is in a DSL. Creating a DSL is a rather large project to assign a group of high school students, so I'd prefer something smaller.

Specifically this project is for fairly advanced students working with ruby, but more general answers are better.

So, what projects could you assign to illustrate the utility of metaprogramming?

During lecture, my students and I recreate Javascript objects in Ruby. In Javascript, these two lines are synonymous:

config['indent'] = 2;
config.indent = 2;

Ruby doesn't support this duality natively, but metaprogramming makes it possible.

We create a class AutoObject that internally stores a dictionary to hold all of the object's properties. Its method_missing consults this dictionary when something like config.indent is executed. If the method name suggests an assignment, it updates the dictionary. If it's a read of an existing property, it returns the value. Otherwise we raise an exception.

Once the automatic properties are in place, it's not much more work to add serialization and file I/O. By the end, we are reading and writing configuration files that are useful for any application.

ActiveRecord does something similar when it automatically creates an object and its interface based only on the database schema.


Easy to use database for HS students I'm a web design teacher and I teach 9th graders (14 year olds) in the US.

Currently the 9th grade curriculum in my HS programme teaches students CSS, HTML and JavaScript. Students can create buttons, forms, navigation bars, and other fun things at the end of the course.

I was wondering - I want students to be able to get data from a database so they can inject data onto their websites.

Is there any easy to use database platform that would allow 9th graders to enter data easily (like Google Sheets), and pull data using client-side JS?

Even better would be that there already exists an API for getting queries so I don't have to teach SQL?

Just looking for ideas! Even instructions on how to build the service myself would be great.

Is there any easy to use database platform that would allow 9th graders to enter data easily (like Google Sheets), and pull data using client-side JS?

Given that you're thinking about Google Sheets as a data entry method, I understand that your goals don't extend to getting the students to implement server-side form handling. But in that case, why do you need a database? It seems to me that the requirements given can be met perfectly well by a hand-coded JSON file.


Teaching when to use MyBlocks While mentoring a FIRST® LEGO® League team, I had a chance to show the kids (who are in an elementary school) how to use the My Block Builder tool while programming their LEGO® Mindstorms robots.

  A My Block is a combination of one or more blocks that are grouped into a single block. Once a My Block is created, you can use it in multiple programs.
  From: LEGO® Mindstorms EV3 Information

It's like defining an external function, but with blocks, and makes for great program shorteners (instead of having 20 or so blocks, 2 or three times, the students learn to make one single My Block, 2 or three times).

However, the students seem to be forgetting, repeatedly, that this tool exists. Only when I point out "why not use a My Block, instead of copy-pasting a lot of blocks?", do they use the My Block tool.

I'd like them to understand when they should use My Block, (and hopefully why, because it might give them insight on external functions later on, should they choose to study CS) without having me point out the tool. There are many use cases for My Block, so giving them a list of situations doesn't work (I've tried, to incredible failure).

What can I do to help the team members understand when they can and should use My Block?

Four relatively easy ideas would be to:

Conduct periodic code reviews where you point out style issues like these. If you make code reviews a regular thing, the repetition should hopefully help students eventually start using functions independently. Since your students are in elementary school, this should obviously be a very lightweight and informal code review.
Develop an automatic style checker for whatever language you're using to perform these sorts of style checks for them. (Hopefully, whatever language you're using is exportable into a text-based or otherwise structured format that actually does permit this sort of analysis.)
Heavily emphasize that if the students are at any point copying-and-pasting, they're doing something wrong. Make it clear that copying-and-pasting is a sin. (This is assuming whatever language you're using is actually usable enough to make this a truth rather then a lie.)
Give them a short style guide to follow; include a note about eliminating redundancy using functions/myblocks in the style guide. This will probably be more effective with older students.

If you have control over how students learn to code, a broader (and probably more effective) strategies would be to teach students how to use your MyBlocks/functions first and foremost, almost before anything else.

That is, teach them the absolute bare minimum functionality to make something happen, then teach them how to decompose a large problem into smaller subtasks, and have them create a MyBlock for each subtask. I would do this first, before teaching them things like control flow, variables, etc... Basically, make the idea of "refactoring" and "identifying subproblems" one of your first lessons.

The hope is that if you make using functions/MyBlocks one of your very first lessons, they're less likely to pick up the bad habit of writing redundant code.


Teaching students to hunt for and debug their own errors I'm sure we've all had this kind of conversation:

Student: Mr. Choirbean, my code is crashing.

Teacher: Okay, what error is it giving you when you crash?

Student: Error message?  Was there one of those? I don't know what it said.

Teacher: (sighs) Okay, there's always an error message.  Let's run it again and see...

Students who can find and fix their own bugs are empowered and more successful. So, how do you foster independence in your budding debuggers?

Debugging is more a craft, an art, than a science. That's where the pedagogical challenge lies.
That said, here are a handful of tools/techniques I used to varying success:

Model the debugging process. I would project sample working code, break that code, and talk through the error messages (and how to read them). Trying to instill the patience and thoroughness required is harder than explaining the actual errors.
Give students broken code... One of the first review activities I did at the end of a unit involved having students correct broken code. Missing semi-colons, commas in for-loop declarations where semi-colons should be, misspelled function names, errant brackets. This is the opposite of the above, and students should work in both directions: break working code; fix broken code.
...to correct by hand. This is where differentiation can shine. It might take reading printed code to recognize where there is a problem. Take time to fix errors off the screen in order to make them more recognizable on the screen.
Not all errors are created equal. Just because a program runs doesn't mean it's free from bugs. This can be the most pernicious because everything appears to be correct on the surface. The Debugging appendix of Think Java is a great resource for this issue. Having students categorize errors into types further solidifies the understanding of bugs and how to eradicate them.
When in doubt, print yourself a message. While it can lead to messy code as debugging messages get commented out, I'd rather a student have messy, working code with signs of thoughtful debugging than clean code that is broken or incorrect vis-a-vis its spec.

In the end, students need to build their pattern recognition, and that comes with a lot of time and a lot of focused practice. There is also an inevitable connection among debugging skill, programming environment, and language. My students were better at C than Python when it came to fixing their programs. That's due to several factors: C being less forgiving, Python feeling simpler leading to carelessness, and the IDE trying to be helpful with errors as students wrote Python. In C, it took the compilation step to find an error whereas Python would identify warnings immediately, a "feature" that muddied the debugging process.


How to adapt pair programming to a shared terminal environment like Cloud9? Pair programming rather than solo programming is best practice in the CS classroom. Online IDEs like Cloud9 allow both members in the pair to work in a shared environment like google docs: working with independent keyboards and mice. What are effective practices for students working side-by-side to collaborate in such an environment?

I've experimented in my classroom and have arrived at my own solution, but I think the question deserves crowd creativity and crowd evaluation.

Note: I've experimented with Cloud9 in both online and onsite instruction, with different results. This question is about students working onsite, side-by-side.

Background:

Extensive use of pair programming in the K-12 environment is best practice over solo programming. Pair programming increases persistence and engagement, and reduces frustration and boredom. See for example Hanks et al. (2011) Pair programming in education: A literature review. Computer Science Education 21:2.

Schools are increasingly using Chromebooks, which preclude a locally installed IDE. Computer science is being taught in an increasing number of sections on a school's master schedule, precluding instruction exclusively in a desktop computer lab environment. Effectively teaching programming using Chromebooks is important.

I tend to avoid multiple students working on the same code simultaneously (Google Docs style) because it's really difficult to assess what has been done by each student or to stop one student dominating whilst the other doesn't understand what's happening. Either that or students tend to get distracted by what the other is writing.

Having said that, you could try:

One person writes code whilst the other writes comments. This forces the two to discuss both what they're doing and what they're planning to do next.

Other paired programming techniques that don't involve simultaneous access:

Allocating a 'driver' and a 'navigator' to each pair of students: the navigator isn't allowed to touch the mouse of keyboard. The driver has to follow the navigator's instructions. Students swap after a set time.
Sabotage and share: get students to make deliberate syntax / runtime / logical errors in their code then share a link to their code in a shared document / forum. Get students to record each error they find and fix. Award points per bug fixed.


Pseudocode or Flowcharts? For GCSE CS in the UK, students have to analyse, design, code, test and review a solution to a problem.

For the design section of their project, students have to plan out the algorithm for each part of their coded solution. They can choose to use pseudocode or flow charts as long as they show the logic and programming constructs that they'll use.

Here's a link to a typical task that students have to complete

My question is this: which is better for planning a set of algorithms: pseudocode or flow charts?

By better I mean faster, more accurate, easier to understand and/or gives a better chance of scoring higher marks.

Neither is always better, and both have their strengths.

The idea of scoring higher marks as a criteria for better is going to be unpredictable without knowing who is granting those marks. Someone who is heavily in favor of one style over the other may grant higher marks to low quality uses of their favored style than they would to high quality answers in the other style.

The idea of being faster is both personal and situational. If someone is more comfortable using one over the other, they will usually be faster with that style, whichever it is. Some projects seem to do better in one style than they do in the other, even when the person doing the project is proficient in both styles. This is related to the strengths and weakness of each style.

Pseudo code is more free-form, and allows one to concentrate on how to solve the problem or design the algorithm without having to choose the proper symbol to draw, or how to leave room for other branches on the chart. Pseudo code is also closer to the programming statements that will be used, eventually, to implement the algorithms, and can speed up the coding process. Being free-form makes it harder to spot missed checks on conditionals. It is also harder to see the overall pattern of a larger algorithm in pseudo code.

Flowcharts diagram the algorithm in a visual manner that makes the entire algorithm visible. When the logic gets complex, this visual representation enhances the ability to trace all branches and confirm that every conditional has been fully handled. It can also show cases where things are getting to complex, and need to be re-factored. The downside to this visual representation is that the creator frequently needs to interrupt their work on the algorithm to make adjustments to the chart, or to redraw sections that no longer fit on the page/screen they are using. These points are even greater detractors when the flowcharts are created on paper rather than in a program designed for flowcharts.

The apparent speed gains from pseudo code's closeness to the final language can be offset by the error checking, and corrections needed, but not spotting logic error in the planning, which is one of the strengths of a flowchart. In addition, the larger picture view provided by the flowchart that can lead to re-factoring, can lead to more compact and efficient code, which is a gain every time the program is executed, even if it took longer to code the first time.

Ideally the students should be taught each method, using exercises that are both a good fit and a bad fit for that method. After leaning the two methods they should have exercises that help them learn how to select the proper one for a given situation. While it may not be appropriate for the classroom, often a programmer on a larger project will use both methods: the flowchart to see the whole picture, and plan the program's overall flow, and pseudo code for many of sections seem to be compact or straight forward.

Bottom line is that the best one to choose is the one that gets the job done right the first time. A fast solution, which then needs lots of corrections is not so fast after all, and a pretty picture of the program can still have logic errors if the programmer is not looking at the real problem the correct way.


Would it be beneficial to learn computer science (or other computer related stuff) from 5-6 year old material? There are so many resources on the internet for self-learning computer science, such as the MIT OCW courses. However, some of those courses are around 5 to 6 years old taught in 2012 or 2013.

There are good books on computer science but they are expensive so I proceeded for the pdfs but they sometimes are available only of the old edition for the same around 5-6 years old.

Would it be beneficial to learn from them? what about computer networking?

For many things it is possible, even advantageous, to learn from older books and materials. But it also depends on your goals. Computer Science, like any field, has some things that are fundamental and the fundamentals change only very slowly. The major programming paradigms, for example, were all created in the previous century. The fundamentals of compiling programs haven't changed in a long time.

Also, while some areas have shiny-bright new stuff, a beginning student isn't going to study those first, but only after gaining some background in things that haven't changed in a long time.

So, if you are a student, seeking a broad understanding of the field, then older materials won't be a handicap, though at some point you will want/need to learn the newer bells and whistles.

But if you have a specific need, such as learning some specific technology at the expense of other things, then you should probably go with recent materials, even knowing that some of the details you learn will, themselves, change in a few years.

Even networking has a lot of fundamental ideas that need to be understood before you can grasp the details of the latest networking protocols.

Let me give an example. Recent versions of Java have introduced "exciting" new capabilities, including function abstraction. The beginning student won't study those things at the beginning, however, but will be more concerned with creating good OO programs. If you study Java from older materials, but also study something of functional programming (say Scheme or Haskell), also from old books, the new features of Java won't be a surprise to you. On the other hand, if you are faced with an eventual exam (such as the Advanced Placement CS-A) exam, then you need to study from materials that will prepare you for the questions that will be on that exam - likely newer books.

But in general, many of the older books are true classics that will give you a deep understanding of fundamental things that make it possible for you to move easily into new things as they are introduced. Learn what is important. It is even enlightening to adapt old ideas, such as top-down-program-decomposition, to newer frameworks and to understand why things change. But that also requires background in the fundamentals.

Since you also mention online courses, you should note that a course from a few years ago is almost certainly still relevant. This is partly due to the fact that the creators of such courses are generally highly skilled and also value the newest ideas. It is very likely that the courses were very current at the time of creation, as well as being grounded in fundamental knowledge.

As a final note, it is also sadly true that some of the older books have not been updated and the key, deep, ideas in them are not readily available elsewhere. The newer books may not incorporate the ideas of the older books so you may even lose something by only learning from the latest materials. I have one example of a book that had a truly excellent first edition (a Java textbook). The second edition, however, left out many of the parts that made the first so excellent, however. This is due to the unfortunate practice of book publishers to emphasize new editions whether they are an improvement over the old or not.


What are good class exercises on design patterns? When I teach a programming course, I like to spend 10-20 minutes in each lesson on some programming exercises that the students do in class. This lets me see whether the students understand the material, and also help them with technical problems they encounter.
My next lesson is about design patterns, and I wonder what kind of programming exercises can I give?

EDIT: I am teaching classic design patterns, to 2nd year students who already know to program in Java. I will probably teach patterns such as Factory, Prototype, Adapter, Composite, Proxy, Observer, Template.

Design patterns covers a broad area. I'm going to assume that your students are beginners, more or less.
Elementary Patterns
A few people have developed some interesting elementary patterns for things as simple as loops and selection: http://www.cs.uni.edu/~wallingf/patterns/elementary/
These patterns help students program at the lowest level and, after introducing the patterns you can easily come up with small exercises that see whether the students actually use the patterns to guide their programming. Any exercise that requires a sequential if structure can have the students factor out the structure as a method and apply the "Return, Not Else" pattern, for example. There are many possibilities.
Organizational Patterns
In addition to coding patterns, organizational patterns can be used to both teach beginners good skills that will serve them well in the classroom and later in employment. For example, you can consider Extreme Programming (XP) or Scrum to be defined by simple pattern languages in which the practices are the individual patterns. Some of those practices may not be appropriate for beginners, but others are just good practice. For example, Pair Programming and Test First Development work well together and help students solve their programming problems. An in-class exercise in which you let students practice just those two skills under your guidance is, in my experience, very valuable. I've also presented larger projects to students as a deck of "stories", the Product Backlog that gives beginners an overall decomposition into the parts of the solution they need to build. Often this is better than a narrative explanation of the problem when the still have no design skills.
Classic Patterns.
Many of the classic patterns are amenable for use in the beginner's curriculum. They will likely do these things anyway, but by formalizing the discussion of them introduces them to the value of patterns. For example Iterators are now ubiquitous in many languages. If you are doing GUI programming then the Observer Pattern is now standard. At a slightly higher level Model-View-Controller (MVC) can be discussed. This gives you a good way to discuss separation of concerns in programming. You can also organize your course so that you make it clear that, say, at the beginning the students build a Model without concern about how it is manipulated. It has a public interface of a few methods only. Then, once you have a model you can talk about the possibilities of (perhaps multiple) views and the associated controllers. But this is an organizational issue about the course. If they have to just build everything, they might wind up with a "Big Ball of Mud" (a pattern in fact, but not a good one).
Once the students are familiar with the idea of patterns you can introduce them to more complex ones with many parts. I find the Strategy and Null Object patterns to be useful in teaching polymorphism. With these patterns you can modify the behavior of an object dynamically, which leads you to program by composition (an object has interesting parts), rather than by inheritance. For example a situation in which an object must perform in one way the first time it is sent a message, but otherwise thereafter can use strategies, formalizing the behaviors, without using ad-hoc if-statements.
I realize I haven't given you many "exercises" here. My suggestion is that you can adapt many/most of the ones you are already familiar with to the use of patterns.
Pedagogical Patterns
You can also formalize your teaching methodology using patterns, so that your student interactions are guided by well-tested methods (patterns) that can make you a better teacher and make it obvious to you (and maybe to your students) why you do the things you do in the course.


Difference between a Bachelor's degree and a Master's degree in CS I have just graduated from university with a B.S. in Economics. I am looking into changing fields into something less abstract and more practical, Computer Science.
I have the choice between a couple options.
Either a two year bachelor's degree with a two year master's degree in computer science.
Or a four year bachelor's degree in computer science engineering. You can call it software engineering.
I'm wondering if there are any concrete differences between the options.

From my experience in Canada, a master's is about specializing and focusing on a particular topic within the field while a bachelor's is about becoming a practitioner within the field.
If, as you state, your goal is to obtain a more practical degree then both options can do that but in different ways:

A four-year bachelor's degree will provide you with breadth in CS;
A 2-year split master's will teach you the basics of CS to allow you to focus on a particular area within CS in your master's.

If you are looking to leverage your existing Economics with CS somehow then the master's is what you are looking for because you are adding CS to Economics.  If you are looking to become a computer scientist or programmer / software engineer, then the bachelor's is what you are looking for.  You will still learn (or be expected) to program in a master's in CS but you will be less focused on that in a master's than a bachelor's.
Note that at the end of either program you will have a CS degree, but you will have different skills and its which skills you are looking to obtain that should help with your choice.


How to integrate CS when learning about DNA/RNA/protein I'm looking for activities that can integrate computer science into lessons about DNA, RNA, and proteins in a middle school (ages 12 to 14) science class. Our school is using the NGSS and CSTA standards. The students understand a few basic concepts about these topics, but they're generally beginners.

The activities should

Reinforce or teach computer science age-appropriate knowledge, skills, concepts, and practices
Reinforce or teach about DNA, RNA, or protein molecules and the processes that relate to them
Demonstrate the interdisciplinary nature of computer science
Engage students with active learning

Create a DNA-like representation for the alphabet

This activity establishes a background experience that can later be used when teaching that DNA and computer data are sequences of discrete values. Each student picks three colors and creates a 27-character table showing all permutations of "codons" of the colors, akin to the 4^3 DNA codons representing amino acids. This activity was implemented in a U.S. grade 7 science classroom. An example of the student work is shown below, although the printed worksheet was revised after the pilot to make more explicit connections to both computer science and genetics.

Sample student work:


Teaching pointers (C) to a Java guy I have already looked at this and this, but it does not help me at all.

I am teaching a guy who is something of a Java expert. Unfortunately, due to the mandatory-ness of the university curriculum, he is forced to downgrade himself to learning C. ( I use the word downgrade in a strictly technical sense, no offence meant to people who are fans of C ). The thing is, I am able to get him through the whole C syllabus except for pointers.

More importantly, we want to use pointers inside structs, which are actually declared in a header file. I am teaching him to build sharable  c libraries/header files. If you need more details, let me know in the comments, and I can share the code I am using in a repo and so on.

Update 1 - I am also looking at this, but its not very clear to me. I haven't used C in a decade, so all this is a little blurry for me.

Update 2 - getting even more specific, what is really happening in these two lines, that I am putting in the header file. I am defining the samplestruct in the corresponding .c file.

typedef struct samplestructrec *samplestruct;
typedef struct samplestructrec samplestruct;

A little Hungarian

As @talhaIrfan says, the problem is mostly syntax.

This is what I discovered when I was struggling with pointers, while at university. Other students that I introduced the idea to would start to improve shortly after learning this technique. I have also introduced it in professional environments, where the bug rate subsequently reduced.

You can do a lot to improve syntax by introducing a little Hungarian notation (I do not advocate too much of this, just enough).

You need to be consistent, unambiguous, and clear. It should allow you to read your code more easily.

I always use an underscore to separate the Hungarian notation from the rest of the name. I always append type information to the end of the name (this is consistent with what the C libraries do).

I chose a set of symbols

_pt for pointers.
_t for types, this is what the C libraries use.

Examples:

typedef struct samplestructrec *samplestruct_pt_t;
typedef struct samplestructrec  samplestruct_t;
samplestruct_t *samplestruct_pt;

Summary

Always choose good name for you objects, and don't do too much Hungarian. When I was programming in C++, we also had at the beginning of a name p_ for parameters, l_ for local, m_ for a member variable (We did this to avoid name collisions, in retrospect I think that these 3 were not needed. We could have used this. instead of m_). That was it just 5 Hungarian pre/post fixes. You don't need any more, probably less, in a strongly typed language.


The Fifth Element or What Elements Are Correlated With CS Success and Does It Matter? After a long search a colleague says that the only 'predictor' of computing ability seems to be Autism, and that only with a low correlation (60%, whatever that means). But in our experience of teaching students with various disabilities, including mild forms of Asperger's, we find that even this is all over the map: One student was an amazing programmer but could not finish assignments because the temptation to always add more was so high, another could not see past tiny details that became fixations. Another could not generalize past results to new slightly different situations. Another could easily do the work, but was bored and uninterested.

So it seems that this element Au is not the gold that it would seem to be, yet no other elements have turned up to predict success.

My observations over 4 decades have been that many people can learn to do tasks involving computers which amount to configuration or customization within a limited domain, but that conceiving of algorithms or new data types is not going to come to them easily. (And if work or school is far too hard, one will not be successful.) In fact, a lot of my early programming career was devoted to converting tasks from programming to customization, just so that we could free up our programmers to do the complex stuff. What causes or indicates this difference in people - some easily learn programming, others not? Is there another element at stake, like Intelligence? But there is no definition or agreement on that either...

I am thinking that 'real' programming ability is a "rare earth", and not something widely found, yet the modern world seems to require increasing numbers of this material (so many jobs going unfilled, projects failing, etc.) If we cannot dig it up, or transmute it from other material (schooling) or find a substitute, then what can be done? This site itself seems to be faltering from lack of participation, which suggests that Teachers are unusual also. Can they and their students be mass-produced?

As I indicated in my other question, I have found that there are always a few students who don't seem to get it.  This leads me to suspect that there may well be some small number of persons who are so disadvantaged that it may be effectively impossible for them to become strong programmers.
However here are a few words of cautions:

Even if this is true, what of it? The fact that I have not figured out how to teach Johnny how to code does not necessarily mean Johnny is incapable, and I am still obligated to keep trying to find new ways to reach him.  If, in fact, he really is incapable, I will ultimately fail, but I have no way to distinguish between him and Samantha, who is entirely capable, but has yet to have some key piece of information click into place.

The number of people should be quite small.  For me it has run around 5-10% of students.  I work with a "gifted" population, so that number might be a little smaller than would be found in other populations, but it shouldn't be wildly different.  As you have pointed out, general brightness is a poor indicator.
If you're finding that >25% of your students are seriously struggling, then there are additional factors beyond "student ability" that you need to be examining.


Python function has access to global variables, and doesn't need passed arguments When teaching functions in Python I get a little annoyed that the code below actually prints out the greeting. I know the preferred way would be to pass in the name, but, for students, if it works then why do something more complex. I want to teach them how to pass in arguments but if they mess up and forget it will still work. Thoughts about how to approach situations like this without being convoluted or contrived?

def greeting():
    print("Hello " + name)

name = input("Enter your name: ")
greeting()

Your example demonstrates how to declare and use a function with a parameter, but not why they should do so.

Actually, there are no reason (for them) why they should bother with a new concept (function) instead of writing

name = input("Enter your name: ")
print("Hello " + name)

which can be done with the programming elements they already know. And is both shorter and simpler,

So, how to sell functions with parameters to beginners?

they avoid code duplication (the example should contain several calls)
they are called with different values (so parameters is the simplet way to transmit information)
they implement a decomposition of tasks into subtasks (the sooner they practice the procedural approach, the better)

Here is an example:

def draw_line(width, end, middle):
    line = end + middle*(width-2) + end;
    print(line)

def draw_rect(height, width):
   draw_line(width, "+", "-")
   for  line in range(height-2):
      draw_line(width, "|", " ")
   draw_line(width, "+", "-")

def draw_square(side):
    draw_rect(side, side)

def main(args):
    draw_square(3)
    draw_square(5)
    draw_square(7)

Actually, I use Processing with a group of students. Most of them total beginners. The first motivation for functions is decomposition.

After they draw a simple figure with a few predefined function calls, as fill() to select a fill color, rect() and ellipse(),  they are taught to split the work into user-defined functions

void draw() {
    draw_sky();
    draw_beach();
    draw_sunset();
}

and parameters are then used for similar parts occurring at different places

void draw_seabird(int x, int y) {
   ....
}


How can I convince my fellow CS teachers that reaching every student is a worthwhile goal? I tried hard, in the latter part of my career, reach every student in every class period that I taught. That this may be an unreachable goal is of little interest to me. I think that I must do this.

It seems common to teach to some perceived ideal level, especially in courses that depend fundamentally on traditional lecture. Some teachers focus on the best students, hoping the "average" students will do ok and largely ignoring the less-than-average. Some teach to "the middle" - at least, as they perceive it. Few seem to aim for the bottom, leaving the best students to learn on their own.

I want to give everyone something to advance their learning in each class period. Not everyone in a course will want or need the same things.  I want to give them each the things that they will judge valuable. I have a few ideas, most involving active learning techniques and student teams, following a structure into which each student can fit their own goals, and find satisfaction achieving those goals. Traditional A-F grading is a poor vehicle for this.

I don't think spending a lot of effort on reaching the unreachable is productive. Some students will be in your class for the wrong reasons and may be uninterested in any reasonable of success. To make this achievable, make the following assumptions:

The student population is diverse in background, preparedness, skill, and drive.
The students have different personal goals.
All students want to learn
All students can be convinced to put some effort into the process.
It is the student who will judge whether he/she learned something of value.
The "something" learned can be different for each student.

The somewhat transcendental question is: How can I convince others to reach for this goal?  How can we be convinced to try to set the conditions so that they can all be reached - continuously in every class period?

Please don't...

...give the students who are ahead more of the same kind of work to do. Please. That's just boring. If they get it, they get it.
...make groups by mixing the students who are ahead with the students who are behind - often, the students who are ahead won't teach the behind students, but will just do the whole thing themselves. I say this from personal experience, and my friends' experience.
...categorize students by listening to them, or watching them, or their friends, or anything like that. I know one of the shyest people ever in class, but with her friends, she's talkative, and excited about tons of different things. I know another person who isn't classified as "gifted" by my school, but we have had multiple very interesting talks about physics. There's also people out there with autism or Asperger's (I know one there, too) who have a harder time with some things that to us seem "normal" but are actually quite intelligent.
...listen to stereotypes (this goes with the previous point) - the girl in our school that was voted "most likely to be an olympian" is also in the gifted program, and so on. The nerd stereotype also isn't often fulfilled - I have friends who are very intelligent but also dress nicely, do not have trouble with social interaction, etc. Though of course, people can fulfill the nerd stereotype, or whatever stereotype. Just be able to see past that.
...think that those who are a little behind aren't working hard, or aren't interested. There's people out there who don't care, but those people often hide from sight those who do.
...expect less of certain groups. It is hard to rise above expectations. I remember reading about an experiment that was done, where teachers were given a student group (none of whom were gifted) and were told that a few students were gifted. By the end, they were gifted, because the teachers had treated them differently. From personal experience - I've been given assignments that were just kind of easy (for a lot of people). Did those people go for the really hard option (not provided for extra credit)? No. Why would you? I certainly didn't. Have high expectations for everyone. (According to BenI., this is called the Pygmalion Effect.)

Know...

...that reaching every person takes more work than aiming at a medium. There's no curriculum that can be created in advance that will tell you about the student who's got dyslexia, the student who's tired of school because it's too easy, the student who is tired of being looked at as average, the student who has depression...every student is different. These are people we're talking about here, with personalities, hopes, and dreams.
...I have been inspired by teachers. Why is it important to reach every student? Because you will never know what will happen when you do. I once talked to someone who was kind of interested in physics about, I don't even remember, quantum mechanics, I think. I'm definitely a nerd, so I was really excited talking about it. And they said, "You have any books you can loan me?" That was kind of an understatement =P We've had multiple physics conversations since then.
...Be EXCITED! You get to show the next generation why your subject is awesome! I know it sounds exaggerated, but people feed off of excitement. Have you ever been in a baseball game, and the whole crowd is cheering, and even though normally you wouldn't bother, you're up on your feet chanting with everybody? I have a teacher who is so incredibly excited about their class. They joke around, they jump up and they make their point, you can just tell that they love what they do. I mean, you chose this for a job. Make it fun. Love what you do, and I guarantee you people will notice.

Often, an amazing way to persuade people is by showing them. As they say, a picture is worth a thousand words (though I'd say a demonstration is worth ten thousand). So, in this case, try to show other teachers with your class. One of my teachers is kind of an amazing guy. He teaches 8th grade science. So he made up a few songs, and sang them in front of the class (which to a bunch of adolescent awkward teenagers was kind of jaw-dropping), and taught us about the layers of the Earth that way. And he told stories to make a point. I really think everyone in the class liked him, as a person at least. And he told us at the beginning of the year that every one of us could get an A, if we worked hard enough, that he would make sure of that.

And the other thing about this is most teachers, I think, know that they should try to reach everyone. It's a matter of doing it. Another teacher of mine pulled a couple of us aside and told us we were to be her guinea pigs - she was trying to start figuring out a system to start trying to reach some of the different levels of students. So I'd say, most people recognize it - then take the plunge! Ask students to help you out. In the end, though, it's the teacher's choice to do that.

Another thing I should point out - yes, there are kids out there who are total jerks, or who seem not to have picked up that yes, they are in 9th grade, and yes, acting like a 3 year old is no longer an option, but there are also tons of kids out there who are more mature than some adults. Please, don't blow us off.


Resources for the Praxis CS Test Current middle school/high school teachers in my state who want to obtain an additional license to teach computer science (notably AP CSP/CS A) must pass the Praxis computer science test (5651). I'm looking for study materials, particularly in two areas:

Additional practice tests that are aligned with the content areas covered by the test. For example, one subarea is about CS pedagogy, and I would be interested in seeing more questions in that category.
Resources that cover the coding/data structures component in pseudocode (what Praxis uses) rather than a specific language.

This is not an answer.

I see what you mean, looking at: https://www.ets.org/s/praxis/pdf/5651.pdf

They have an example:

// precondition 1: A is an array
// precondition 2: The length of array A is n.

but then they have a for loop over the array that looks very c like:

for (int j=1; j<= n-1; j = j + 1)

then they assign

int temp = A[j]

Now if I assume this is C-like, I just skipped the first element, if I assume this is Pascal-like, then I have the first element.

So this can be difficult to wrap your head around when you are in an exam situation.  It does seem that they are trying very hard not to trick you, using the comments and such.  But it would be pretty easy to ask, "Does this function correctly caclulate..." and then give you options of (A) Yes, (B) Errors and you really have to look around for how this thing is supposed to work in the first place.

I also can say that it is a little bit annoying to have to wonder if they are going to use other strange nomenclature for other functions in the code, for example how do they do exponents? (x^2, or something else?), how about mod?  I'm sure there are more things to worry about.

Good luck!


Should I start out as a “junior developer”? I am sorry if this is not the right place to ask this, but I would really like to know.

I have finished a computer programming bootcamp and found I took to programming deeply. Some of my course mates have found jobs which are not 'junior developer' jobs (i.e. jobs which focus heavily on feature building, rather than on QA, etc...).

I would like to take the course of maximum learning, so is doing a typical junior developer job an important stepping stone on the way to being a great developer? The bootcamp did not teach TDD, so perhaps a 'junior' pathway is a sensible one.

Thank you for any thoughts.

Feature building is a junior developer job. It's also a senior developer job. Feature building is part of any developers job.

QA is testing of those features. If you become a QA specialist you won't be developing features at all. You also won't be using TDD. TDD comes before the code under test. Not after.

QA testers come in two types: manual testers and automation testers.  Automation testers are often feature developers as well.

If someones convinced you that newbies must start in QA they've feeding you crap and I wouldn't want to work there.

Some shops don't even have QA roles because the developers test the crap out of their own stuff and then hand it to a peer to test it again with fresh eyes. Some do all that and then still hand it to a QA group who spend all day doing nothing but gleefully breaking software.

QA is a speciality in and of itself. It's a mindset as much as it's ever a job title.

But QA is not where newbies need to start and it's not a dumping ground for sub par developers. QA is where you put your best or it's not QA.

At the end of the day, a junior developer is just someone who might learn a thing or two from a senior developer.

As for the career advice find people doing these jobs and ask them what their day is like. That will tell you what you're likely to learn in those roles.