I am spending part of this weekend preparing for a presentation I’m delivering this coming week for the Boston/New England Windows Phone User and Developer Groups. My upcoming presentation software development-focused and, as is usually the case, I will be using demonstrations of programming techniques to enforce the learning. After close to 20 years of developing this type of content for training and presentations in many different programming languages and technologies, I still face the same dilemma regarding the approach I take to the application code I present.
In an ideal world, a teacher strives to make learning content as relevant to the “real world” as possible as a way of reinforcing the the concepts being presented. When learning mathematics, for example, the reinforcement of an equation is often demonstrated by placing it in a real-world scenario (presenting the dimensions of a room and asking for the square and/or cubic feet the room occupies, for example). By putting concepts to use in real world situations more often than not helps in the grasping of the concept and increases comprehension for the learner. In the ideal world, a learning content developer would normally strive to place everything into a real world context. However, the “ideal world” brings with it some distinct challenges and drawbacks.
When developing learning content, the developer is often constrained by any number of factors, including (but not limited to) -
- Time to deliver the material. We all would love to have unlimited time to learn, but time is simply not that available. As a result, the content creator is often constrained by how much time can be allocated to teach a concept. The more complex the real world example is, the more time it takes to teach.
- The pre-existing knowledge of the learner. For “advanced” learning content, prerequisite knowledge is usually assumed. As a result, the information used to build the real world scenario is often easily understood by the learner and can be delivered in a shorter timeframe. For “introductory” learning content, however, real world scenarios often will take more time to build than the concept they are trying to teach.
- Complexity of the real world scenario in relation to the concept being taught. I find this constraint to often be the most dangerous when building learning content for software development as its impact is felt in multiple dimensions (more on this shortly).
As a learning content developer, the challenge becomes finding a successful balance between providing real world applicability without causing a “tipping point” due to constraints that diminishes the overall goal – to teach a concept that is both comprehendible and retainable to the learner.
When developing learning content for software development, the time and knowledge constraints are usually obvious to me and are relatively easy to manage. I know how much time I have to deliver the material, so I therefore control the scope of how much I can teach in the time allotted. I generally know the baseline knowledge of learners receiving the material (at least when I set the goals for learning and prerequisite knowledge; we’ve all had people in a room who don’t meet the prerequisites). The complexity constraint is the one battle for the content developer that is most difficult to manage. The best explanation of this can be made by example.
Suppose I want to teach the concepts of data access to a new programmer. I could simply provide the minimal amount of application code to demonstrate this concept. However, one could argue that I am not being “real world enough”. So, how do I make for a more realistic example? I could (and often do) provide a context for accessing the data. Perhaps a simple application with a user interface that, when the user provides some input or action, retrieves data and displays it. While this may still seem rather simple, the additional number of lines of application code to make this happen can be in the tens (or even hundreds, depending on the programming language). Depending on the example and the pre-existing knowledge of the learner, the complexity of this additional code can become a distracter to the more important concept being taught. I liken it asking someone to extract a single fact out of a chapter in a textbook; while you can eventually find that nugget of information, you also run the risk of being distracted by all the other information that the chapter provides (as an aside, this is why I have never liked any teacher who “teaches from the textbook”). As an example of how this issue of complexity can apply to teaching programming, consider the following two code examples. Both attempt to teach the concept of retrieving application settings from Isolated Storage in Silverlight for Windows Phone 7 -
Example 1
IsolatedStorageSettings mySettings =
IsolatedStorageSettings.ApplicationSettings;
txtName.Text = (string)mySettings["Name"];
Example 2
private void getSettings()
{
IsolatedStorageSettings mySettings =
IsolatedStorageSettings.ApplicationSettings;
if (mySettings.Contains("Name"))
{
txtName.Text = (string)mySettings["Name"];
}
if (mySettings.Contains("Address"))
{
txtAddress.Text = (string)mySettings["Address"];
}
if (mySettings.Contains("Zip"))
{
txtZip.Text = (string)mySettings["Zip"];
}
}
The first example is quite literally the most basic of programming code demonstrating the steps of getting an instance of of the application’s settings and extracting a single piece of information from those settings. Useful syntax, but not a lot of real world context. The second example does the same, but comes from a very simple application that includes a user interface with three fields. The application logic also does a bit of checking to see if the setting even exists before exacting the setting for each field. Just this little bit of adding real world context has added complexity to the code sample. Note that I could have gone even more “real world” in the coding techniques used for error handling and “best practice” that would would have resulted in more distraction (questions like “why are you using a ‘using’ statement?” or “What is this generic collection syntax really about?”). In even the most simplistic of examples like the ones shown here, it becomes clear that “real world” leads to “complexity” in code, and complexity in code runs the risk of reducing the ability to comprehend and retain the primary learning objective; in this case, how to retrieve a setting from the application’s isolated store. As a content developer, this is an example of having to deal with one type of complexity – code complexity. However, this complexity runs the risk of being made exponentially more difficult to manage if another real world concept is introduced.
I have had both the fortune and misfortune to work on a number of projects over the years that attempt to create a “reference application” for learning. In these situations, the goal is well-intentioned. An application is created that is real world in nature and provides by code example the best practices for achieving the required business goals of the application. I have always liked the idea of a reference application, but only when used in a proper context for learning. Unfortunately, reference applications are misused.
In almost all of the cases where I have been involved in developing a reference application, a design goal is being able to repurpose the application code to teach every learning concept, regardless of context of the learning objective or knowledge of the learner. Translation – make the reference application code apply even to introductory learning objectives. This goal invariably fails miserably for introductory training for two reasons. The first reason is one I have already introduced in terms of code complexity. When a code sample from a reference application is used to teach a basic concept, there is typically an incredible amount of “distracting” code associated with it. As a result, the learner is either trying to wade through a lot of potentially unfamiliar application code to find the relevant learning material, or is being confused by code that they have yet to learn about. Even if an instructor or material can help to point the learner in the right direction, the collateral code can often lead to confusion or a desire to understand that which is not intended to be learned about at the moment. As an instructor, I cannot tell you how many times I have had students “wander from the path” when it comes to these situations, resulting in difficulty in learning the current learning objective and spending value time discussing/covering information not intending to be covered. If this level of complexity is not difficult enough to overcome, reference applications usually introduce a higher level of distraction for learning – the business process learning complexity.
Imagine that I were to hand to you a text book written in your native language. This book covered a business concept of which you had no prior knowledge or exposure (for arguments sake, let’s say quantum physics). Within this book lies a specific bit of knowledge I want you to learn. While you can read the words in the book, many of those words, sentences and paragraphs will relate to concepts totally foreign to you, and will require you to learn them in order to learn the true objective. In other words, I need you to learn about other secondary knowledge prior to learning the primary objective. This is the additional complexity that using a reference application often adds to learning about programming.
Because reference applications are designed to present application code in a real world context, they are fundamentally designed to solve a business (not technical) problem. They often take the form of solutions around order entry systems or customer relationship management. When I have been asked to teach from a reference application, many of the learners in my audience usually have no business experience in these areas. Even if I am teaching experienced application developers, I often find myself explaining the business rationale that makes up the code rather than the primary learning objective. For example, I cannot recall how many times I have found myself explaining in a programming class why an order entry system does not actually delete cancelled orders, instead marking them as “deleted” in a field in a record. This discussion did not come about because I was teaching order entry concepts; it occurred when I was teaching how to update a record in a database (the primary learning objective). Business learning, therefore, becomes a distracter to the true learning objective.
Reference applications do have a place in the bigger picture of education for application programmers. However, it is in the context of the first word of their definition – reference. I find reference applications to be most useful in the same way as other reference materials; when they are used after primary learning is achieved and the learner wants to learn more. Most importantly, reference applications are most useful when the learner is not constrained by time or business complexities that exist in a classroom or introductory learning. Reference applications are most useful in advanced and self-paced learning scenarios.
If you’ve managed to get this far in your reading, you’re likely wondering what the proverbial “moral to the story” is here. As I mentioned at the onset, I am once again tasked with the development of learning content for software developers. Over twenty years of developing and delivering content of this type, for structured multi-day classroom learning to 90-minute presentations, has taught me a very valuable lesson – there is a difference when presenting application code for learning purposes in comparison to developing actual applications. When I “code to teach”, I have one goal in mind – to present the code in a way that makes my audience understand and retain a learning objective. Anything that distracts from this objective does nothing to serve the audience. While getting more “real world” might help in achieving a learning objective, it can hurt it as well. It is also often very easy for the content creator to leverage existing application code to teach, be it from a formal reference application or even code “just lying around”. When you use code of this type, however, you should carefully consider the implications. Put yourself in the shoes of your intended audience and ask -
- “What am I trying to learn here?”
- “When I look at this code, do I see what it is I am trying to learn?”
- “How much help do I need to find the relevant code?”
- “Does looking at the code make me think of questions not related to what I am trying to learn?”
Only by finding a balance between learning objectives and the real world they reflect will your code help your audience to become good programmers.