We said this before.
Capture the big picture (Module)
Divide it into specific areas (Class)
Define actual actions within it (Method)
This method is clearly effective.
However, readers may feel like this.
"But... it's still difficult and burdensome."
"I still don't know how to implement the whole thing."
"I don't know how to divide the detailed functions."
It's normal.
Because Module-Class-Method is
"thinking that creates structure,"
Now what is needed is
"thinking that starts actual implementation within that structure."
Two concepts emerge right here.
**psuedo code
**TDD(Test Driven Development)
These two
dramatically reduce the burden when developing.
1) Psuedo Code — Write down your thoughts in words before coding
Psuedo code is literally
"text that looks like code but isn't real code."
Rather than writing actual working code right away,
we write like this first.
For example, if you want to create a "login function":
User enters email and password
Find a user with that email in the database
Compare the password
If correct, create a login success state
If wrong, show an error message
This is not Ruby or Python.
It's just the "flow of thought."
However, each line
soon becomes a Method,
enters a Class,
and goes into the Module structure.
By simply writing down small actions in order without worrying about the big picture, half of the problem is already solved.
This is the power of psuedo code.
The biggest advantage of psuedo code
You can design functionality without knowing code
You can break down complex functions into simple sentences
The anxiety of "where to start" disappears
Mistakes are reduced when writing actual code later
A good programmer
is not someone who writes good code,
but someone who can clearly explain the problem before writing code.
2) TDD(Test Driven Development) — Write tests first, then fill in the code later
TDD starts like this.
"First, define the desired behavior in writing,
and then create the code that passes it later."
It's reversing the order.
For example, to create a "function that adds two numbers,"
first write the test like this.
expect(add(2, 3)).to eq(5)
This one sentence says:
"There should be a function called add"
"When you input 2 and 3"
"The result should be 5"
This test naturally fails at first.
Why? Because there is no add function.
Then, to resolve this failure,
add a minimum amount of code.
def add(a, b)
a + b
end
And the test turns green (success).
This process ingrains
the method of developing by breaking down features into small units
naturally in your brain.
Powerful effects of TDD
You don't have to build a huge feature all at once
You only need to think in small feature units (Method level)
Thinking becomes clearer, dramatically reducing mistakes
Like an automatic driving assist, it checks if you're doing well
The more complex the function, the greater the value
In short, TDD is
the most effective way to assemble large problems into small blocks.
Psuedo Code + TDD = Developing with a mindset of assembling Lego blocks
When you use these two together,
problems become exponentially easier.
1. Write down the overall flow with psuedo code
→ Think of it as creating Lego instructions.
2. Implement them one by one successfully with TDD
→ Think of it as fitting Lego blocks together one by one.
This method is
the most stable workflow for implementing
Module → Class → Method structures.
Coding is not intimidating.
Because every problem
is broken down into small pieces
and when each piece is successfully completed,
the whole thing is naturally created.
Readers gain enlightenment here
"Ah... I was struggling because I was trying to complete it all at once."
"If I describe it first with psuedo code and then succeed one by one with TDD,
even complex functions will eventually be completed.""If it's like assembling Lego blocks...
I can also create big projects!"
Once this enlightenment occurs,
readers no longer start development in fear.
Instead, they develop a mindset of "breaking down and organizing."