How to get students engaged in more basic topics in programming? 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&amp;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&amp;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.
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.