Home Blog Pages Sprint-3 Tech

Sprint 3 Technical

An analogy to describe the differences between HTML and CSS

Imagine a hugggge battleship, the HTML is the blueprints of the ship and all the items that will go inside the ship. The CSS is the specific camouflage colour scheme and interior design of the Ship, where things will be placed and in what relation to the other items inside.

Explain control flow and loops using an example process from everyday life

Control flow is basically the order of when instructions will happen. We need this so that whatever we are actually trying to achieve doesn’t just come out in one big mess all at once or cause some unplanned outcome! For instance when teaching someone how to drive a car; first, fill the boot up with petrol then put your bags in the fuel tank. After that turn the car on and whilst looking forward put the car in reverse and put your foot down flat to the floor until you reach your destination. Sounds perfect right? hmmm perhaps not, we need some flow to these instructions a bit more order. In terms of Looping (when we want something to repeat itself until a certain thing happens and then it stops). For example a refrigerator is designed so that you can set the desired temperature. If the temperature rises above this setting it will fire up the cooling system and keep going over and over until it reaches the temperature we have set it to operate at. when it reaches it the cooling system will turn off. The fridge runs on that type of Loop of instructions in a certain order (control flow ) to meet the desired outcome (keep our food fresh and beer cold)!

Describe what the DOM is and an example of how you might interact with it.

The Document Object Model or ‘DOM’ is what allows connection and a relationship between different elements of a project we have. It represents a page as objects and nodes everything in our page has a specific nodes attached to it. As in the first example of the battleship we had HTML, CSS and if we throw in Javascript as well, we could say it would be the electrical board to make things happen and the Dom would be the nuts and bolts that hold every part of the ship together as one. It connects all elements of the ship with each other, so they can operate in sync for the desired mission and operation. It is what our browser uses to make sense of everything. When using javascript to edit or input manipulate your page you would be making use of the DOM whilst doing it as this allows the changes to happen as it is the binding agent between all elements of the page.

Explain the difference between accessing data from arrays and objects.

An array which is basically a list of things , can store data in an ordered list. Each piece of the data in that array can be accessed by referencing its numerical order in the list it’s in. For example if we had the following in our array; var cars = [ “Ferrari”, “McLaren”, “Aston Martin”, “Porsche”, “Maserati” ]; If we wanted to access the data in this list we could reference the index number of that item in the list. The first one in the list which is “Ferrari” would be [0] and “McLaren would be [1] , “Aston Martin” [2] and so on. in programming the first piece of data always starts at zero. An object is more of an unordered list of things and instead of being stored inside [ ] square brackets it uses curly ones like these{ }. an object can contain a bunch of data just like an array but it can have things like a property and then a value of that property as well, for example. Var dog = { Name: “Tidus Shadowfang” Colour: “green” Age: 980, }; You could then access certain parts of the dog object such that are in the list above.

Explain what functions are and why they are useful.

Functions are extremely useful as this allows things to function (as long as the rest of our code supports the desired function). a Function basically stores a set of instructions, so that if the function is called later then it will execute the instructions we made. So if we made a function that instructed Donald Trump to run naked out of the Whitehouse and into the streets until he was arrested, then when we call that function in our code it would actually happen! You can bascially do anything, within reason…