reading-notes

🗒️ Class 07

Domain Modeling

  1. Explain why we need domain modeling.

HTML Table Basics

  1. Why should tables not be used for page layouts?

Tables are used to hold tabular data and that is its purpose. It is also because they are not responsive, and can reduce accessibility for the visually impared.

  1. List and describe 3 different semantic HTML elements used in an HTML <table>.

tr is the Table Row Element. It is used to specify what other elements are all on the same line th is the table header. This denotes that an element is a header and not just a regular cell. td is the table data. This holds all the data for the table.

Introducing Constructors

  1. What is a constructor and what are some advantages to using it?

constructor functions are used to create new objects. Some advantages of using constructors is it makes it so much easier to create a new class.

  1. How does the term this differ when used in an object literal versus when used in a constructor?

this in object literals refer to the object it is currently in. With constructors, this gets created when we call the constructor function with the new keyword.

Object Prototypes Using A Constructor

  1. Explain prototypes and inheritance via an analogy from your previous work experience.

When our office got a new financial management system, the consultants came and create “template” roles for existing and key users. After the initial setup, whenever a member of the enterprise software support team needs to create a new user, they would just create a new user based on an existing role that already exists. Prototypes are the Templates or roles we copy and inheritances are the new users inheriting the same properties, roles, restrictions.

NOTE: This is a very common front end developer interview question

Bookmark and Review HTML Table Advanced Features and Accessibility

Lecture Notes

Constructor Functions - A Function that creates objects for us. Typing less & if we know what properties an object has, we can just define those properties in a function so we can create “duplicates” with different values

function Constructor(arg1, arg2){
  this.object1 = arg1; // uses = to assign to `this` and not `:`
  this.object2 = arg2; 

  //doesnt need a return
}

new Constructor(arg1, arg2);

Prototype Object

Object that is inheritied by every object created by constructor. Single place to define property and behaviors that are shared by all object

if a function is used everywhere, make it a prototype.