I have been teaching various subjects in programming for a couple years. What I struggle with most is getting the students engaged in the basics - the first few lectures.

For example, it's simpler to come up with a design pattern or a hands-on project when you are talking about intermediate or advanced subjects like database connectivity, security, networking, and so on. There's so much more to work with in those later topics. Where I have trouble is with the absolute basics - the data types and basic logic statements. It's hard to think of a sample project that is simple enough to build without getting too advanced too quickly, but still enough of a challenge to get them experience with the basics.

I get a lot of comments from students saying that they learn the material better when there is a hands-on project to do, yet for something as simple as data types, this is difficult to come up with.

Class Setup: It is a professional setting and I have been given two different formats to use. One format is an hour lecture with an hour lab or coding exercise afterwards, once a week, and the other is a condensed workshop format where students watch videos on their own about the material and then they come to a workshop for Q&A about the video content, and then we spend most of the time on a lab or exercise. The videos take the place of lectures, that way we have more time in class for in-person interaction and Q&A during hands-on project work. The workshops are two hours long, and take place every three weeks, and the videos they watch cover material from three of the subject units from the standard format.

Class Scope: As for the class topics, the class is on Java and we go from the very beginning, primitive data types and logic, for those who have never used Java or even studied programming, then we move on to object oriented design, logging and string processing, collections and streams, working with input/output, exception handling, working with tools like Eclipse and Maven, writing test code, and by the end of the class we go through database operations, security and threading, web services, and more advanced language topics like generics and lambda expressions.

Audience: The audience varies pretty widely but everyone has at least a bachelor's degree in a technical field, most of them in computer science or CIS. It is as varied as your average IT workplace would be.

Does anyone have any ideas, or know of a coding project (of any size) that would be effective at helping students grasp the more basic subjects (like data types, language syntax, and logic), and yet interesting enough to keep them engaged and want to finish it?

EDIT: As suggested by eykanal, I reverted this question to its original form which is specific to computer science. I understand that when a question concerns graduate level pedagogy as this does, it is still on-topic.

EDIT2: I've added more information about the class setup and audience that I typically work with.

We basically made a one dimensional battleship game just to start with, then converted it to 2D and talked about data types and arrays and such, then converted it to an object oriented design, then upgraded it to have saved games (for I/O and exception handling material), etc.

  • Perhaps generalize it to how to ensure active classroom engagement. Student engagement in a subject is likely to impact further academic performance.
    – Compass
    Feb 6, 2017 at 19:43
  • As an aside, you might be interested in Karel
    – Compass
    Feb 6, 2017 at 19:45
  • Thanks all for the suggestions - I've updated the question to be more on-topic.
    – Tim
    Feb 6, 2017 at 20:09
  • Tim - Thanks for the edits. Unfortunately, I disagree with @DavidRicherby... our FAQ clearly states that questions about "university-level pedagogy" are on-topic. Your original question, assuming it was about university-level teaching, was acceptable as-is. I recommend reverting the edits, as the current version of the question is so broad as to be unanswerable.
    – eykanal
    Feb 6, 2017 at 21:02
  • 2
    "You don't usually work hands-on with Hamiltonian mechanics" This is one of the strangest things I have ever heard. It's hard to think of an activity which is not an example of Hamiltonian mechanics. Feb 6, 2017 at 23:04

3 Answers 3


Create games that apply some basic concepts. You'll need a progressive set of games. Start out by setting up your game board (homemade is fine) and your paraphernalia. Your student will prick up his ears right away. Explain the basic concepts needed to play the first game. The game should be exciting but quick.

Each set of paraphernalia should have a number of variant games that can be played with that set.

Suppose a game involves converting a decimal number to Base 2. You don't need to explain in detail, prior to playing the game, WHY computer scientists are interested in Base 2.

Many games will involve rolling one or more dice and then doing something that requires applying some technique.

Example: each player will, on his turn, roll five 0-1 dice (each side shows either a zero or a one). These five digits define a five-digit binary number. Write down the number you've rolled. Now figure out what that number is in Base 10. Say the answer is 12. Move your guy 12 spaces on the game board. Set up your game board like a simplified Chutes and Ladders, to make it exciting.

Edit #1: Responding to the new version of the question. It is tempting to want to give students the background information needed before giving them a hands-on project, because from a teacher's point of view, that is the most efficient way for the learning to take place; but sometimes it's useful to throw something at the students and let them flounder a little. Then you'll have their attention when you explain why something didn't work, and what's really going on behind the scenes. Have you ever tried that?

Edit #2: You could ask the students to program a simple game, and then have them try out their neighbor's program.

  • 1
    Thanks, that's a good idea. I honestly hadn't considered games just due to the audience. I would probably get about half the students thinking "this is stupid, I am 40 years old and not in first grade anymore" and the other half would probably be more engaged and really enjoy the game.
    – Tim
    Feb 8, 2017 at 15:44
  • @Tim - I've used games as programming projects, and, 40 years old or not, I'd be surprised if "half" your students think it's stupid. Most find it fun. Many games prove to be meaningful domains for the concepts you're trying to teach: (Think "Battleship" for two-dimensional arrays, or "Hangman" for string and character manipulation, e.g.) Some very rudimentary concepts can be taught with a game; one of my first projects to teach elementary conditionals and loops was "I'm thinking of a number, 1 through 100" (the user would input a guess, and the program would respond "Higher" or "Lower").
    – J.R.
    Feb 8, 2017 at 17:01
  • @J.R. As I said, it's a good idea and I may even use it. I just don't believe it will prove 100% effective based on knowledge of my audience.
    – Tim
    Feb 8, 2017 at 17:19
  • @Tim - Maybe it would be best to take tutoring out of the question. (You could pose that separately at math educators.) For the teaching you do in the workplace, could you tell us more about the set-up? What are you teaching, how many students per group, how long does a session last, how much do they know before you start? Also, I wonder if your question might get more useful answers on cs.stackexchange.com. Feb 8, 2017 at 18:00
  • @aparente001 Thanks for the suggestions. I looked over CS.SE before posting this, and they don't even have a [teaching] tag. I will add more detail about the setup and audience. This is more related to programming than to math. As to your edited question, yes that is also a common technique that does prove effective. My question is more around a specific project that works well for basic stuff like data types. JR's suggestion of Battleship actually gave me several more ideas of my own.
    – Tim
    Feb 8, 2017 at 18:46

The core problem is that programs that are simple enough for your beginning students are really very dull. I was able to get excited about printing a simple series, but that was in 1967 and I had not grown up with computers.

Much of real world programming is modifying existing programs to add or change features, rather than programming from scratch. I suggest writing a simple GUI program, such as a calculator or game. Each exercise takes the form of a new requirement that is best implemented using whatever has just been taught.

The first exercise would be to add to an existing statistics reporting facility, so that the hooks for collecting the data are already in place, and they just have to calculate e.g. mean and standard deviation.

  • Oh, just printing something sounds boring only as long as you can use your standard library. I remember is was not dull at all, doing that without printf - and without operating system. Mar 22, 2019 at 13:40
  • @VolkerSiegel I agree that bare machine programming makes even basic actions interesting, but it is rather specialized. Mar 22, 2019 at 13:48

After gaining more experience tutoring, both privately and professionally, I’ve come to understand that most beginner students struggle with the same basic concepts, concepts which are very simple but which manifest themselves in difficult and complex ways when applied to a specific problem.

I’ve seen that the most effective technique personally (on an individual scale, not so much a classroom setting as the accepted answer addresses) is to hit the two basic building blocks of all code hard, and breeze over the rest, as the syntax varies wildly from one language to another anyway. The two basic building blocks are logic and loops. Coming in as close third would be functions. Students which can put these basic parts together to solve problems tend to do well, while students who cannot tend to struggle with even the simplest problems.

Declarations and assignments are the next most important bits, but they are simpler to learn and don’t seem to cause continual trouble.

One of the most well-received analogies I’ve found for explaining loops is a washing machine: controls at the top, and the load (code) in the middle. It seems to click quickly with students that it spins through the same code over and over.

For basic logic I just show them simple if statements and explain in terms of language and logic: if you say, “It’s raining” that statement can be either true or false. Computers can easily test this same basic logic to make decisions.

Then I tie it all together with why we use computers in the first place: automating tedious and repetitive tasks (using loops) and making small decisions quickly (using logic).

For functions, the most often misunderstood concept, I explain that a function is like a chapter of a book, and main is like the table of contents. I relate passing by value versus passing by reference using an airplane analogy. Passing by reference means the airline takes your checked bag and when you get it back, it (should ideally) be the exact same bag. While passing by value is like them making an exact replica of your bag and its contents, and upon your return, the copy is destroyed and your original bag returned.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .