Skip to content

oldd/encapsulation

 
 

Repository files navigation

Module: Encapsulation

"Encapsulation is one of the fundamentals of OOP (object-oriented programming). It refers to the bundling of data with the methods that operate on that data. "

Overview


Module Summary

Encapsulation is the idea of grouping together your data with the functions that use it. That's it! (for now :) There are many ways to achieve this, but the end result is code that is easier to understand and nicer work with.

Heads up! In this module you'll be encountering some of the most important (and most challenging!) aspects of the JavaScript language this, inheritance & classes. These are all features of JS that allow you to encapsulate functions & data for readable, reusable code.

Along the way you will get your first introduction to one of the main programming paradigms in JS: object oriented. At their simplest level, programming paradigms are just different answers to the same question "How will I group my data and my functions?".

TOP


Learning Objectives

Programming Skills

  • Object Oriented Programming
    • Refactor projects from last module into OOP projects
  • Data-first development
    • Understanding applications as Data + User Interactions
    • Developing from the "inside" out: Writing the core object before the user interface
    • Explain what a schema is and why it's useful (PS. it's like tests, but for data!)
    • Use the JSON schema specification to document your program's data
    • Use a schema validation library to grantee the integrity of your project's data
  • Debugging:
    • Bugs are when you don't understand what your code is doing, not when your code doesn't understand what you want it to do! The computer is always right :)
    • Stepping through your programs with the Browser and Node.js debuggers
    • Using the debugger, console.assert, assert (in Node) and breakpoints for native debugging
    • Refactoring & testing segments of code you don't understand / are not working
  • Understand Behavior vs. Implementation
    • Behavior: The test cases that a function does and doesn't pass. What the function does.
    • Implementation: The actual lines of code written. How memory is manipulated so that the behavior happens.
  • Testing
    • Learn to predict what will happen instead of describing what did happen
    • Testing each step of your project before moving on
    • Using the native Node.js module assert
    • Writing & using popular testing libraries (jasmine & mocha)

Isolating JavaScript (study JS outside of applications)

  • Understand this
    • Be able to refactor functions into methods
    • Be able to refactor methods into functions
    • Plan and implement objects based on User Stories
  • Understand getters and setters
  • Understand the class keyword
    • Be able to refactor between constructor functions & classes
    • Use classes to create simple programs

Integrating JavaScript (JS embedded in applications)

  • Understanding your projects as being first an object, and second a user interface
    1. Object: what data is stored in your application, and how can users interact with it? (Data & Logic)
    2. User Interface: what does a user see on the screen? (styles & DOM)
    3. User Interactions: how does the user interface connect with the core object? (listeners & handlers)
  • DOM Components
    • Create functions and methods that return DOM elements
    • Reuse the same components in different places on your site

TOP



Hack Your Future: Belgium

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 68.7%
  • CSS 18.7%
  • HTML 12.6%