Step 12 Program Expansion -- How to Grow Small Apps into Big Ones
Last time, we used functions to create slightly more practical programs like a "fortune-telling app," "calculator," "grade checker," and "quiz app."
This time, let's learn the mindset and intuition of "how to grow small apps into big ones"!
1. Build small and grow big
In programming, if you try to build a perfect, large app from the start or plan a massive idea, you are likely to get discouraged along the way.
It is important to have a sense of "growing" an app by following the flow of
building something small that works → making improvements → adding new features
.
The concept of Agile development
In the world of software development, there is a concept called Agile development. This is a method where you "don't build something big and perfect from the start, but instead build something small that works and improve it little by little."
First, build a "minimal app" that works simply.
Grow it by repeating improvements and adding features.
Check while running → Improve → Add the next feature.
This is a mindset that focuses on delivering results quickly, such as "in today's world where changes are rapid and customer needs fluctuate easily", "advancing development feature by feature while repeating short cycles."
Actually, this is also an important mindset when learning to program. Rather than aiming for perfection at the beginning,
"building something that works first and growing it little by little" is important because it allows you to solidify your foundation and deepen your learning while also gaining a sense of accomplishment.
2. Concrete example: Growing a fortune-telling app
Let's improve the simple fortune-telling app we made last time little by little.
Step 1: Basic fortune-telling
import random
def omikuji():
results = ["大吉", "中吉", "小吉", "凶"]
print("今日の運勢は…", random.choice(results))
omikuji()Step 2: Add messages based on the result
Instead of just making a "list," let's change this to a "dictionary" and pair the result with a message for when you hit that result.
* choice ➤ Fortune (key)
* results[choice] ➤ Message (value)
def omikuji():
results = {
"大吉": "最高の一日になりそう!",
"中吉": "いいことがあります。",
"小吉": "ちょっといい日になるかも。",
"凶": "気をつけて行動しよう。"
}
choice = random.choice(list(results.keys()))
print("今日の運勢は…", choice)
print(results[choice])
omikuji()Step 3: Make it so you can draw as many times as you want
It might be better to be able to try as many times as you want rather than just once. (Hmm? Maybe a 10-pull gacha format would be good...)
Let's use "While True:" and "Input" to make it repeatable until a specific key (other than y) is entered.
def omikuji():
results = {
"大吉": "最高の一日になりそう!",
"中吉": "いいことがあります。",
"小吉": "ちょっといい日になるかも。",
"凶": "気をつけて行動しよう。"
}
while True:
choice = random.choice(list(results.keys()))
print("今日の運勢は…", choice)
print(results[choice])
again = input("もう一度引きますか? (y/n): ")
if again.lower() != "y":
print("終了します。")
break
omikuji()How was that? (*^^*) By adding features little by little like this, it has gradually grown into a "playable app"!
Also, didn't you come up with "other interesting ideas" or think of improvements like "it would be better if I did this..." while you were creating it?
That is exactly the point of "building little by little," and if you were able to feel that way, you can say that you are already starting to develop an "engineer's mindset" (*'▽')
3. Ideas for improvement and expansion
Improve the UI: Make the display easier to read, add emojis or decorations
Increase the data: Add more types of fortunes, create daily results
Add multiple features: Display lucky colors or advice in addition to fortune-telling
Use external files: Save and load results or messages from text files
4. Learning Points
First, build something that works, even if it's not perfect
Add features "one at a time"
Run and check after each improvement → If it works well, move to the next step
By stacking up small successes, your enjoyment of programming and your confidence will grow steadily!
Practice Exercises
* Please try these by referring to the content from the previous session (Step 11).
Try adding a "lucky color" to your fortune-telling app and display it.
Try adding "exponentiation (a to the power of b)" to your calculator.
Add a feature to your grade evaluation program to display the "average score".
Add a feature to your question app to ask multiple questions, such as "favorite color" or "favorite animal".
Try adding one new element to a program you created yourself.
Summary
The trick to programming is to "start small and grow it big"
By making improvements one by one, your learning will naturally deepen
Check the operation every time you make an improvement and enjoy the sense of accomplishment
Next time, to further develop the app we've grown this way, let's take on the challenge of file operations and utilizing external data!
Next article
いいなと思ったら応援しよう!
よろしければ応援お願いします! いただいたチップは引き続きプログラミングや学びについて、皆さんの利益になるようなよい記事を書くことで恩返しをさせていただきます!