Why Abstraction?
PythonProgramming

Why Abstraction?

June 12, 2025
Why Abstraction?
June 12, 2025

Have you ever contemplated the ability to manipulate something exceedingly intricate with merely a single touch? You pull your phone from your pocket, tap a small green icon, and instantly you’re talking to a friend miles away. You haven’t built a phone, and you don’t need to understand the radio waves or amount of transistors inside it. You just use it.

This magic of hiding the complicated parts so that we can easily use the simple ones has a name: Abstraction. You use one of the world's most powerful ideas all the time.

It’s the same principle at work when you sit in front of a television and pick up the remote. With the press of a button, you can journey from a local news channel to a football match on another continent. The remote doesn’t ask you to understand its infrared signals or the TV’s internal tuner; it just presents you with simple buttons for “channel up” and “volume down.” It has abstracted away all the hard work.

This idea goes beyond just electronics. When you get in a car or on an okada, you don’t need to be a mechanic who understands how the engine’s explosions turn the wheels. You just need to know how to use the steering, the throttle, and the brakes. The machine’s complexity is tucked away, allowing you to focus only on the task of getting where you need to go.

Now, if this idea is so useful for making our daily lives easier, imagine how essential it is for the people who build the technology we use. For a computer programmer, abstraction is everything.

No one could build an application like WhatsApp or Facebook if they had to think about every single detail from scratch. It would be an impossible task. Instead, they use abstraction to build in pieces. They create a small piece of code that handles one job perfectly, like sending a photo, and then they hide all the complex instructions for that job inside a simple, reusable block.

This means they don’t have to reinvent the wheel every time. They can take this “photo-sending” block and use it again and again. It also makes their work easier to manage and fix. If there’s a problem with how photos are sent, they only need to fix that one block; the rest of the application remains untouched, just like a mechanic can fix a car’s engine without changing its steering wheel.

How It Looks in Code

Let’s peek behind the curtain with a tiny taste of code. Don’t worry, the goal is just to see the idea in action, using a process many of us know well: sending mobile money.

Imagine the steps a programmer at Orange Money might take. They need to create a secure block of code that handles the entire transaction. It might look something like this in Python:

# Here, we create a block that hides all the secret work
def send_orange_money(amount, number, pin):
  print("Request received. Connecting to server...")
  
  # --- THE HIDDEN, COMPLEX PART STARTS HERE ---
  # 1. It secretly checks if your PIN is correct.
  #    (Let's pretend the correct PIN is '1234' for this example)
  if pin == '1234':
    # 2. It secretly checks if you have enough balance.
    print("PIN accepted! Checking your balance...")
    
    # 3. It performs the secure transaction.
    print(f"Success! {amount} has been sent to {number}.")
  else:
    # This part runs if the PIN is wrong.
    print("Sorry, the PIN you entered is incorrect. Transaction failed.")
  # --- THE HIDDEN, COMPLEX PART ENDS HERE ---


# Now, using it is as simple as using the service itself.
# We just provide the details.

receiver_number = '077-123-456'
amount_to_send = '50,000 Leones'
my_pin_code = '1234'

# We call the function, and it does all the work for us!
send_orange_money(amount_to_send, receiver_number, my_pin_code)

See how that works? All the difficult and secret steps connecting to the server, checking your secret PIN, confirming your balance, and securely sending the money are hidden away inside that single send_orange_money block.

When we use it, we don't have to think about any of that. We just do what we always do: provide the amount, the number, and our PIN. We are using an abstraction, and it makes a very complex process feel incredibly simple.

Conclusion

So, think about the very action you just took. When you clicked the link to read this article, that single click called a function, a block of code designed to fetch this content. That function sent an HTTP request, a tiny message that traveled across the internet to a powerful computer called a server, where this website is stored. The server found this exact article, packaged it up, and sent it all the way back to your device. Your browser then took that package of code and data and drew it neatly on your screen as the text you see right now.

Were you required to consider any of that? The servers, the data packages, or the requests? No. One simple click abstracted away all of that incredible complexity. That is the true power of abstraction. It's not just a term for coders; it's the invisible magic that makes our digital world work, proving one last time that you don't need to know how everything works to make things work for you.

PythonProgramming