How do computers fit into the modern world?

How do computers fit into the modern world?

Written in

by

This is a model of a mountain below, with some Model trees, model roads, and model clouds. To a human, it is obvious what sort of real -world objects each one of these represents.

A computer doesn’t have a predetermined idea of what a mountain or a tree is. It doesn’t understand what they are used for. Your laptop or phone will not have a favorite brand of clouds, nor will it know what star
rating the mountain range is.So how will we use computers to produce a mountain range reservation app?, The solution is in the fact that programmers create an entirely different type of model, specifically for computers.Developers help to make these models using data.It isn’t as unusual or as frightening as it sounds since the data is all that the computer requires to be able to comply with the instructions you allow it to execute.

mountain-web

OBJECTS & PROPERTIES

In the event, you couldn’t see the image of the mountain and trees, the data in the information boxes alone would still clarify a great deal relating to this landscape.

 

OBJECTS (THINGS)

In computer programming, every physical part of the modern world could be represented being an object. You will find two of several types of objects here: a mountain and a tree.
Developers might state that there’s one type of the mountain object, and two instances of the tree object.
Each and every object might have its own:
• Properties
• Events
• Methods
Collectively they produce a functional model of that object.

PROPERTIES (CHARACTERISTICS)

Each of the tree’s shares common qualities. In reality, all tree’s possess a type, a color, and size. You can even figure out their current average lifespan. Developers call these traits the properties of an object.Every property includes a name and value, and all of these name/value sets lets you know a little something about every individual type of object.The most apparent property of the mountain is its name.The value of that property is mount ABC as an example.

 

MOUNTAIN OBJECT

The mountain object utilizes property names as well as values to let you know about this particular mountain, including the mountain’s name, it’s rating, the height of the mountain, and what distances can people climb. A person may also tell whether or not this mountain range has particular facilities.

 

TREE OBJECT

The tree objects might equally share the same properties, but they all have different values for individuals properties.They will tell you the type of tree, what size, what color it is, and its average life expectancy.

EVENTS

In real life, individuals interact with objects. These interactions can quickly change the actual values of the properties of these objects.

WHAT IS AN EVENT?

You will find typical ways in which individuals interact with every type of object. For example, in a vehicle a driver will use a minimum of two pedals. The car has been built to respond in a different way when the driver interacts with each of the different pedals:

• The accelerator helps make the car go quicker
• The brake decreases the speed of the car

Likewise, programs are created to do various things whenever users communicate with the computer in different ways. For instance, merely clicking a contact link on a website may raise up a contact form, as well as entering text right into a search box might immediately trigger the search functionality.An event will be the computer’s method of keeping up its hand to state, “Hey, this just happened!”

 

WHAT DOES AN EVENT DO?

Developers determine which events they will respond to. Each time a specific event occurs, that event could be accustomed to trigger a particular portion of the code. Scripts frequently use various events to trigger diverse types of functionality. So a script may state which events the developer wants to react to, and what area of the script needs to be executed when simultaneously events occur.

MOUNTAIN OBJECT

A mountain range may frequently have bookings for tours. Every time a tour is earmarked, an event called book can be employed to trigger code that will boost the value with the bookings property. Similarly, a terminated event can easily trigger code that lessens the value associated with the bookings property.

TREE OBJECT

The leafs of a tree will accelerate back and forth. An accelerate event can trigger code to be able to raise the value of the currentSpeed property as well as a brake event may trigger code to reduce it. You will discover concerning the code that reacts to the events and shifts these properties further down the post.

METHODS

Methods signify things individuals need to be related to objects. They can obtain or revise the values of the object’s properties.

WHAT IS A METHOD?

Methods signify exactly how individuals (or other things) communicate with an object in real life.
They are such as questions and instructions that:

• Tell you something about this object (using information stored in its properties)
• Alter the value of some that object’s properties

WHAT DOES A METHOD DO?

The code for any method may include plenty of instructions that with each other signify one task.By using a method, you don’t always need to know how it accomplishes its task; you need to understand simply how to ask the question and the way to interpret any answers it offers.

MOUNTAIN OBJECT

Mountain ranges may generally be asked if any tour instructors are free.To answer this question, a method could be composed that subtracts the number of bookings from the total number of tour guides. Methods may also be used to raise and reduce the value of the bookings property when tours are booked or canceled.

TREE OBJECT

The value of the currentSpeed property needs to increase and decrease as the Leafs accelerates and slows down. The code to raise or lower the value of the currentSpeed property might be written in a method, and that method could be called changeSpeed ().

PUTTING IT ALL TOGETHER

MOUNTAIN OBJECT

1. Whenever a booking is made, the book event fires.
2 . The book event activates the makeBooki ng () method, which usually increases the value of the actual bookings property.
3. The value of the bookings property is actually changed to mirror how many tours the mountain has accessible.

CAR OBJECTS

1. As the leafs speeds up, the accelerate event fires.

2 . The accelerate event calls the changeSpeed () method. Which often raises the value of the currentSpeed property.
3. The value associated with the currentSpeed property displays how fast the Leafs is moving.

Summary

  • Computers produce models concerning the entire world making use of data.
  • The models utilize objects to symbolize physical elements.Objects may possess: properties that tell us concerning the object, methods that carry out tasks making use of the properties of that object, events that tend to be triggered whenever a user interacts with the computer.
  • Developers can compose code to state ” Whenever this particular event occurs, run that code.”
  • Web browsers utilize HTML markup to produce a model of the web page; Every element provides its own node (which often is a kind of object.)
  • In order to make web pages interactive, an individual compose code that utilizes the web browsers model associated with the web page.

You can read the intro to the whole series here.

 

Original Image Source:

https://www.reddit.com/r/pics/comments/38sxca/mountain_road/

Tags

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.