A
A
allaga2019-08-03 13:01:41
IT education
allaga, 2019-08-03 13:01:41

Is it worth using real life examples when learning programming?

To simplify the study, I tried to use examples from real life, for example:

  1. bicycle blueprint -> class
  2. creating a bicycle from a blueprint -> class object
  3. blue bicycle color -> class property
  4. bike rides -> class method
  5. puddle -> variable
  6. lake -> constant

How accurate are all these comparisons? And is it worth making such comparisons to simplify?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
HemulGM, 2019-08-03
@allaga

bike drawing -> class
create bike from drawing -> class object
blue bike color ->
bike class property rides ->
puddle class method -> lake variable
-> constant

correction:
drawing a bicycle -> class
creating a bicycle from a drawing -> creating an object of the type "Bicycle" - the constructor is
blue for the bicycle -> property of the
bicycle class rides ->
puddle state -> also a
lake class -> also an
OOP class very similar to the real world.
Any object (not concrete) is a class. It doesn't matter what it is, water or sky or light.
For example, there is such a thing in the world as a "bicycle" - in this case, "bicycle" is a class.
A concrete object is already a variable created on the basis of some class.
There is my "bicycle" - in this case, we are talking about the created bike, about a specific object.
Properties also exist in the real world, which is why they are called so in OOP. (Color, thickness, depth, dimensions, volume, etc.)
Constants and variables are more difficult to fit into the real world, because they are just a memory cell with a value.

S
sim3x, 2019-08-03
@sim3x

No you shouldn't
Start with functions, then the functional programming paradigm, then OOP based on the FP paradigm

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question