Modularization - the moment the brain begins to control the complex world

Methods and classes are the core of modularizing and understanding the world in the brain's way. A method is a process that binds behavior, and a class is a framework for looking at objects.

밤치 107

— Methods and classes are not just simple grammar, but the way the brain assembles the world.

We live in an incredibly complex world every day. However, the brain understands this complex world by grouping it into a few units (modules).

  • Humans learn to speak with the module called words

  • Express thoughts with the module called sentences

  • Classify the world with the module called concepts

The core of learning, as Dr. Park Mun-ho says, is simple.

"The brain understands the world only when it creates modules and assembles them."

And in coding,

these modules are methods and classes.

The moment you understand this,

code no longer looks like simple instructions,

but begins to look like a miniature version of the world we live in.


1. Method: "The brain's technique of compressing thoughts into a single function"

A method is the process of grouping complex behaviors into a single unit by the brain.

Let's take an example.

  • Drink coffee

  • Walk

  • Wave hands

These are independent behavior modules.

People combine these modules to create their day.

Coding works the same way.

A method is a chunk of code that bundles "one action".


Changes in the brain when learning a method

  • Thinking becomes divided

  • Execution units become adjustable

  • Ability to handle parts rather than the whole is acquired

  • Ability to break down and solve complex problems is developed

This is not simple grammar.

It is the moment when the structure of the brain changes.


Method Example: Creating your own action

def greet
  puts "Hello! Let's make it happen today too!"
end

greet
greet

What happened?

  • The code between def greet ... end defines the action of "greeting"

  • Calling greet executes that action

  • In other words, define once and call as many times as you want

This is the first step of modularization,

the moment the brain bundles actions into a module.


Park Mun-ho's Frame Interpretation

  • Frame formation: "Actions can be grouped into a single unit"

  • Dimensionality: The brain perceives blocks of code in three dimensions

  • Retrieval reinforcement: Freely call actions by calling greet multiple times

  • Modularization: Enables breaking down larger programs into smaller functional units


Practice 1: Creating 3 of your own actions

Make each into a method:

  1. encourage – Output a sentence encouraging yourself

  2. goal_today – Output today's goal in one line

  3. praise – Output a sentence praising yourself

Then try combining them in any order:

encourage
goal_today
encourage
praise

You have just learned

how to create and assemble action modules in your brain.


2. Class: "The second brain that views the world in object units"

If methods are behaviors,

classes are entities (objects).

What constitutes the world

are individual entities (objects).

  • Person

  • Dog

  • Car

  • Book

  • Blog post

  • User

  • Shopping cart

All of these are "objects," and

coding classes are the templates that design the essence of these objects.


Why classes are important

The moment you understand classes,

the brain says this.

"Ah, I can divide the world into 'objects'

and give each object 'behavior'."

And at that moment,

the complex world suddenly gains a clear structure.

This is what

Park Mun-ho calls structural and three-dimensional information structuring.


Class Example: Creating the existence of a person

class Person
  def initialize(name)
    @name = name
  end

  def greet
    puts "Hello, #{@name}! Let's have a great day today!"
  end
end

me = Person.new("NightCoding")
me.greet

Evolution of the brain in this code

1) class Person

→ Frame that says "Defines the existence of a Person"

2) initialize

Constructor that is executed when an object is born

3) @name

Attribute uniquely stored for each object

(in other words, the "feature" module in the brain)

4) greet

→ The "behavior module" this object possesses

5) me = Person.new("NightCoding")

→ Actual creation of an instance

(the moment 'a me' is born in the real world)


Park Mun-ho's Frame Interpretation

  • Divide the world into objects → "Person," "Car," "Post," "Comment"

  • Objects have characteristics@name, @age, @title

  • Objects actgreet, drive, publish

  • Objects interact with each other

  • This is when the world starts to appear structurally and three-dimensionally

This is not just a simple coding concept.

It is the process of expanding the model of the brain's world.


Practice 2: Creating your own object

Topic: MyGoal Object

Try creating one that meets the following conditions.

Class Name

MyGoal

Attributes

  • Goal name

  • Deadline date

Behaviors

  1. info

    → Output "Goal: OOO, Deadline: OOO"

  2. encourage

    → Output "You can definitely achieve this goal!"

Example Execution Flow

g = MyGoal.new("Learn Rails", "2025-01-31")
g.info
g.encourage

The moment you create it,

'your goal' is stored in the brain

not as an abstract sentence,

but as an object.

This is the essence of learning.


3. Real Changes Brought by Modularization

— Now you can see an "assemble-able world"

Method → Modularization of behaviors

Class → Modularization of existences

When these two meet,

you are no longer just someone listing code.

You become

someone who divides the world into objects,

gives behaviors to objects,

and assembles objects to create a system
.

At that moment, your heart races.

Because from being

"someone who only participated in a world created by others"

you have transformed into

"someone creating your own world."

Comments

Add a Comment

Sign in to comment