Skip to the content.

Code 201 Class 7 Reading Notes

Domain Modeling

Definition; Domain modeling is the process of creating a conceptiual model in code for a specific problem. A model describes the various entities, their attributes and behaviors, as well as the constraints that govern the problem domain. An entity that stores data in properties and ecapsulates behaviors in methods is commonly referred to as an object-oriented model.

Implementation of EpicFailVideo constructor Function.

var EpicFailVideo = function(epicRating, hasAnimals) {
  this.epicRating = epicRating;
  this.hasAnimals = hasAnimals;
}
var parkourFail = new EpicFailVideo(7,false);
var corgiFail = new EpicFailVideo(4,true);

console.log(parkourFail);
console.log(corgiFail);

Summary

  1. When modeling a single entity that’ll have many instances, build self-contained objects with the same attributes and behaviors.

  2. Model its attributes with a constructor function that deifnes and initializes properties.

  3. Model its behaviors with small methods that focus on doing one job well.

  4. Create instances using the new keyword followed by a call to a constructor function.

  5. Store the newly created object in a variable so you can access its properties and methods from outside.

  6. Use the this variable within methods so you can access the object’s properties and methods from inside.

Tables from HTML Book

What’s a table?

A table represents information in a grid format. Examples of tables include financial reports, TV schedules, and sports results.

<—BACK