Instructor guide to creating coding exercises

Add short, targeted coding practice to your Udemy course with coding exercises.

Learners want approachable ways to practice, assess, and apply what they’ve learned. By adding coding exercises to your course, you can provide these active learning experiences in a convenient way.

 


 

Coding Exercise FAQs

 

What is a coding exercise?

📖 A coding exercise is an exercise for learners to practice a particular coding language or framework. Learners are able to check their understanding of a concept covered in your course through automated grading.

How do I get started?

Navigate to the Curriculum page of your course. Click the “+ Curriculum item” button and then Coding Exercise. For more information check out this Help Center article.

When should I add a coding exercise to my course?

Coding exercises should be provided for all important coding-related topics and skills in your course. Key moments to add these practice activities would be:

  • when a course lecture has at least one learning objective related to writing code
  • when a concept taught in a lecture can be assessed through a coding exercise

How many coding exercises should I add to my course?

There is no limit to how many coding exercises you can add to one course, but it is advised to intersperse coding exercises throughout your course for distributed practice. Here are some ideas on how to structure your coding exercises within your course:

  • Include at least one coding exercise per section.
  • Provide multiple exercises on the same learning objective. However, refrain from stacking coding exercises unless you’re providing multiple exercises for the same learning objective.
  • Start some sections with an exercise where a learner tries, lead them to a lecture that explains, then provide another coding exercise in a new context to try again. This motivates learners to find out why they need to learn what is in the lectures in that section.

Can I make money off of the coding exercises I create?

If your course is part of a Udemy subscription plan, the time your learners spend on coding exercises gets added to your engagement revenue.

What coding exercises languages are available?

You can currently create coding exercises in the following languages: C#, C# 11, C++ 20, CSV processing (with Python), HTML, Java 17 (with JUnit5), Java 11, Java 9, JavaScript ES6, Kotlin, PHP 7, PHP 5, Python 3.10, Python 3.8, Python 3.5, R 3.6, React 16, React 18, Ruby, SciPy 1.4 (NumPy, Pandas, SymPy) and SciKit Learn 0.23, SQL, SQLite 3, Swift 5, and Swift 3.

 


 

How to create a coding exercise

Get started creating (or updating) your own coding exercises with these steps: Plan the objective and outcome, create the solution, frame the exercise, and add hints and test cases to help your learners.

 

Plan your coding exercise

Begin creating your coding exercise by defining its learning objective. Start by answering the following questions:

  • What should the learner be able to do if they complete this coding exercise correctly?
  • What skill(s) does this exercise help a learner practice? What skill(s) does it assess?

From there, come up with a coding exercise problem that aligns the desired learning outcomes from above. This problem should be a short chunk of a true authentic task that an engineer/technical employee would do.

💡 Tip! Keep your coding exercises bite-sized.

    • The ideal coding exercise should take an average learner a maximum of 15 minutes to complete. This is the known time frame for microlearning and ensures that this exercise is time accessible.

 

Start with the solution

Backwards planning is recommended when designing your coding exercise. Therefore, once you’ve decided on a coding exercise problem, author the desired solution in full, which includes the evaluation and solution file.

📖 A solution file is the file that serves as the solution of the provided problem definition. Learners are expected to write a similar solution (not necessarily the same) file for the given problem definition. It verifies the provided evaluation file (unit test) is correct.

📖 An evaluation file is the unit test file that checks whether the learner’s solution is actually solves the problem or not. Assertion statements need to be used to verify the solution.

In order to create a new coding exercise, it is required for you to provide solution and evaluation files that can be verified by the system. As a reminder, the solution file is written to verify the evaluation file itself and evaluation file is written to verify learner’s solution is correct or not.

💡 Tip! Generate with AI

For English and Spanish exercises in Python, C++, Java, and Javascript, you can now get some help from third-party artificial intelligence to create your exercise files.

  1. Go to your course’s curriculum page and start creating a new coding exercise in Python, C++, Java, or Javascript.

  2. Navigate to the the second tab “Author Solution”, after adding your exercise title and learning objective on the “Plan Exercise” tab.

  3. Click the new “Generate with AI” button and add in the instructions for your problem.

  4. When you’ve outlined the problem, click “Generate with AI” button and within moments, you’ll see solution and evaluation files generated for your exercise

  5. Carefully review and make changes to perfect your exercise before moving on to the “Guide learners” section.

 

Frame the exercise

After creating the solution, the next step is to clearly communicate the purpose and problem of this exercise to your learners. We recommend the following steps:

  1. Describe what the learner should be able to do if they complete this coding exercise correctly and the skills it helps them practice. You should have defined these answers in the planning stage.
  2. Provide complete and understandable directions on the ‘problem statement’ of the exercise. Make sure that you are providing enough information for your learners to attempt the exercise while still ensuring they are accountable for practicing the skill (or demonstrating their ability to do the work).
  3. Author the starter file.
    📖 A starter file is the code that is needed at the beginning to frame the exercise to keep the learner focused on the targeted skill.

💡 Tip! Establish a clear and consistent naming practice for your coding exercises.

    • Use a consistent and easy-to-find naming convention for all of your coding exercises. For example, all coding exercises start with “Coding Exercise” in the name so learners can easily locate them throughout your course.

📝 Note: Like with all communications to your learners, ensure your instructions contain accurate, grammatically correct, and unbiased language.

 

Enhance with guidance

Test Cases

📖 A unit test is a way of testing a unit – the smallest piece of code that can be logically isolated in a system. In most programming languages, that is a function, a subroutine, a method or property.

You should provide unit tests for solutions to coding exercises so that your learners can receive feedback when they click on “Check solution.” This feedback helps learners identify their mistakes and provides important validation when they succeed.

When creating test cases, we recommend the following best practices:

  • Get specific. A unit test should contain only one logical assertion, meaning it checks only one output of the tested code.
  • Be comprehensive. Unit tests should mock out all external services and state, meaning all of the required behavior is tested. Unit tests catch corner cases and have good test coverage.
  • Clarity is key. Naming of each test should be meaningful, so when learners see the test list, they can easily navigate between them.

 

Related Lecture

Add a recommended lecture in your course that links learners to where they can get more information about the skill they’re practicing.

 

Hints

📖 A hint is a helpful tip to guide learners toward the correct answer when they get stuck in an exercise.

While test case titles already serve as guidance, the “Hints” section should focus more on additional pieces of information that aren’t provided in the instructions or unit tests.

When creating hints, we recommend the following best practices:

  • A hint should jog the learner’s memory of a concept.
  • A hint should give them part of the answer, but not the whole answer.
  • When providing multiple hints, it should be done in a scaffolded order (i.e. smaller hint to more substantial hint) to encourage learners to attempt on their own.

📝 Note: Since hints currently can be shown to learners at all times as they attempt to complete the exercise, only use the “Hints” space to provide extra info that may help the learner complete the exercise without giving away the correct answer to the exercise.

 

Solution Explanation

📖 A solution explanation is further clarification of the correct solution to a coding exercise.

A solution explanation can be useful for learners to validate and/or understand issues with their approach. If a learner attempts your coding exercise and isn’t sure why the solution solves the problem correctly, this is the space to explain. Additionally, for those who got the exercise correct but aren’t sure why, this helps them validate what they did to they solidify their understanding of this concept for future applications.

When creating a solution explanation, we recommend the following best practices:

  • This section can include step by step instructions with code snippets.
  • Always include the “why” behind the steps. This will help the learner reflect on what they did and what they would need to differently if they try again.

 


 

To learn more about the improvements we’ve made to coding exercises, check out this Teaching Center article. Additionally, if you have more questions about how to use the coding exercises tool, check out this Help Center article.

 

Ready to create your course? Let's go!

Create a Course