Skip to main content
What are Properties?

Properties in coding are like the characteristics or traits that describe something, such as the color or size of a toy.

Jon Mattingly avatar
Written by Jon Mattingly
Updated over a week ago

NOTE: Learners are introduced to the concept of properties in the new app from Kodable, Bug World!

Definition: A characteristic of an object.

Example: Properties are the characteristics of an object. In the Car class, there are certain properties, or features, that all cars have, like steering wheels, brakes, and color, but the values of each property can differ between each individual object.

For example, let's say you have black car. Remember, your car is an individual object that can be modified independently from other objects in the same class. You can choose to modify a characteristic of your car, like its color, by painting it red! Your car is still an object in the Car class; you've simply altered a property value of your car that affects how it looks.

If we were creating a program with these two cars in it, these objects would both have a color property as defined by the Car class, but the color property for your car is now "red"; while the property before painting was "black".

Application: Properties are special types of variables that are associated with an object. Properties are assigned to a class when the class is defined, and their values can be modified on individual objects. Modifying properties of an object will make the object different from the main class and any other objects. You can add or delete properties, but all objects will automatically inherit the properties of the main class when they are created.

In the new Bug World app, each BlueBlaster has default properties from the class it was created from. Learners unlock the ability to modify objects and change these property values, like strength and speed. In the example below, you can see this player had the option to modify a BlueBlaster by editing the strength property to increase damage or speed.

When a learner increases the strength property for one BlueBlaster, this change does not affect ALL towers in the BlueBlaster class; editing the property values on an object only changes that one object. 

Why We Use Properties: Properties allow you to change a single object and it will have an isolated effect on your program, independent of other objects. Properties are what make objects different from each other. 


Did this answer your question?