Command Shift

Building Blocks

Welcome to the Building Blocks module! This section dives into the fundamental aspects of JavaScript, covering essential topics through a series of practical exercises and challenges. You'll gain confidence in working with data types, writing functions, and implementing tests to ensure code quality. By the end of this module, you'll be equipped with a solid understanding of JavaScript fundamentals and Object-oriented programming, as well as an introduction to Test-Driven Development (TDD).

Module Overview

1. JavaScript Basics

In the first chapter, you'll explore the core fundamentals of JavaScript. Key topics include primitive data types, data structures, operators, and control flow. The main exercise, "Kata," focuses on writing code to pass pre-written tests, providing a practical approach to solidifying your foundational skills.

  • Learning Objectives:
    • Work confidently with JavaScript data types and structures.
    • Write functions to encapsulate logic.
    • Write tests that describe expected behavior.
  • Challenge: Fork and work on the JavaScript Basics repository, setting up dependencies and preparing your local environment.

2. Introduction to Test-Driven Development (TDD)

In this chapter, you'll learn the essentials of Test-Driven Development using JavaScript. TDD emphasizes writing tests before code, ensuring each function is purpose-built and fully tested. The focus is on using Jest for unit testing and following the DRY (Don't Repeat Yourself) principle for code efficiency.

  • Learning Objectives:
    • Write tests describing expected unit behavior.
    • Use tests to guide code development and refactoring.
  • Challenge: Use the DIY Kata repository, writing and running tests to drive development.

3. Object-Oriented Programming (OOP) - Part 1

This chapter introduces the basics of Object-Oriented Programming (OOP), where you'll create and manage JavaScript objects. The main exercise, "Virtual Pet," allows you to apply OOP principles by building an interactive pet with properties like age, hunger, and fitness that respond to user actions.

  • Learning Objectives:
    • Understand and apply basic OOP principles.
    • Use constructors and prototypes to create objects.
  • Challenge: Build a virtual pet that ages, grows hungry, and requires exercise.

4. Object-Oriented Programming (OOP) - Part 2

In the second part of OOP, you'll dive deeper into JavaScript's object-oriented capabilities by focusing on domain modeling and dependency injection. The "Cruise Ships" exercise will challenge you to manage complex object interactions, teaching you to design and test relationships between objects.

  • Learning Objectives:
    • Explain Object-Oriented Programming and domain modeling.
    • Use dependency injection, mocks, and spies for testing.
  • Challenge: Construct a model for cruise ship functionality, applying OOP principles.

5. Optional Cruise Ship GUI

In this final, optional chapter, you’ll explore building a Graphical User Interface (GUI) for the cruise ship project. This will transform the project from a command-line application to an interactive experience, broadening its accessibility.

  • Challenge: Add a user-friendly interface on top of your cruise ship code, making it visually interactive.

Each chapter builds upon the last, introducing new concepts and reinforcing your learning. Make sure to read through recommended resources and bytes for deeper insight. This module provides a comprehensive foundation in JavaScript, preparing you for more advanced development and testing techniques.

On this page