What Is Programming?
It’s all about writing code. Programming is a process
in which we organize data and use logic to do something with those data. The
data are everything a computer can store; they can range from numbers to zombie
characters in a video game.
You do this by writing text into files called source code. Source code written into text files replaces punch cards used by the computing machines half a century ago.
When data are combined with logic and then written into a single file, they’re called a class. Classes are also data, and as such can be managed with more logic.
You do this by writing text into files called source code. Source code written into text files replaces punch cards used by the computing machines half a century ago.
When data are combined with logic and then written into a single file, they’re called a class. Classes are also data, and as such can be managed with more logic.
Classes are used to
create objects in the computer’s memory and can be duplicated to have a life of
their own. Classes are used to build objects. Each piece of data within the
class becomes a part of that object. Different chunks of data inside of a class
are called class members.
Class members can also be chunks of logic called functions or methods.
Class members can also be chunks of logic called functions or methods.
For Example, in a game
with a horde of zombies, each zombie is duplicated or instanced from a zombie
class. Each zombie has unique values for each attribute or data element in the
class.
This means hit points,
and locations are unique for each duplicate zombie object. Objects created from
a class are called instances. Similar to families, objects can inherit
properties from one another.
The
child sometimes called a subclass inherits attributes from its parent. For
instance, the child created from a zombie may inherit the parent’s hunger for
brains.
To be useful, the child zombie can also add new objects and change the objects it inherited from its parent class. As a result, now the child zombie might have tentacles that the parent didn’t have. Objects talk to each other through events and messages.
To be useful, the child zombie can also add new objects and change the objects it inherited from its parent class. As a result, now the child zombie might have tentacles that the parent didn’t have. Objects talk to each other through events and messages.
Comments
Post a Comment