Beating Spaghetti With Abstraction

How do some people seem to effortlessly write such usable, clean code? This is a question that I’ve tortured myself with over this past year after having the good fortune to work alongside some incredible engineers. While trying to get to the bottom of what separates bad, good, and great one concept kept surfacing: _abstraction. _A good handle on this can work wonders for your codebase.

What is abstract code, why should you care, and how will it make you a better programmer? Abstraction is tricky to discuss because it’s, well, abstract. But I do like how John Ousterhout put it in the book A Philosophy of Software Design

The term abstraction is closely related to the idea of modular design. An abstraction is a simplified view of an entity, which omits unimportant details. Abstractions are useful because they make it easier for us to think about and manipulate complex things.

Or Steve McConnell explained inCode Complete: A Practical Handbook of Software Construction

Abstraction is the ability to engage with a concept while safely ignoring some of its details — handling different details at different levels. Any time you work with an aggregate, you’re working with an abstraction. If you refer to an object as a “house” rather than a combination of glass, wood, and nails, you’re making an abstraction. If you refer to a collection of houses as a “town”, you’re making another abstraction.

It’s the act of removing some/all concrete details so you can generalize more areas of your code for reuse. Abstraction is the weapon you can wield to fight off spaghetti code. Let’s jump right in with an example.

Here’s an ultra-simple piece of Ruby code (don’t worry if you don’t know Ruby, we’re just defining, and then calling, a function). We’re writing some code that turns our bedroom light on and off. Run it to see it’s magic at work.

Perfectly innocent-looking code, right? It does exactly what we want it to do. The light turns on and off so why is there still so much of this article left?

Almost nothing about this code is abstract. When I call the function, what light is going to turn on? Why the bedroom light, of course! It says it right there in the code. This code is _concrete _and non-flexible as it is completely _coupled _to only work with the bedroom light.

Problems arise when we need to change and reuse our code and, trust me, you always end up needing to change and reuse your code.

What if we suddenly have a kitchen that also needs lights? Our example code is unusable as it stands so we’d need to change it, duplicate it, or come up with a new solution. An easy fix would be something like this.

#software-development #computer-science #software-engineering #learning #learn-to-code #deep learning

What is GEEK

Buddha Community

Beating Spaghetti With Abstraction

Abstract class & Abstract method in C# | OOP in C# Part-24

https://youtu.be/vonwoaUl0Hw

#oop #abstract #abstract method #abstract class #what is abstract

Samanta  Moore

Samanta Moore

1623406631

Why You Must Know Abstraction?

One of the fundamental concepts in Oop that you must know.

Through this article, I will be discussing the concept of **_Abstraction _**and how we can achieve it partially or completely in java programming. I have already covered other important pillars of OOPs that are InheritancePolymorphismEncapsulation, and Compositions. After reading this article you would be in a position to answer this question in your next interview.

What Is Abstraction?

It is one of the pillars of OOP like InheritanceEncapsulation, and Polymorphism.The basic English meaning of Abstraction is the quality of dealing with ideas rather than events. Did you get it? I know it’s hard to grasp.Let me put its definition in another way **basically it deals with hiding the internal details and showing the essential things to the end-user.**A real-life example of abstraction can be using an electric circuit board. We use the buttons to turn on and off the electrical devices through the circuit board. We know a lot of things happen inside the board. Here we are using the functionality provided and we aren’t interested in the actual working of the circuit board.Now let’s relate this example with classes and interface. The surface of the electric board is an Interface and the actual implementation of the electric circuit board is a class.

#java-programming #software-engineering #abstraction #software-development #java #why you must know abstraction?

Beating Spaghetti With Abstraction

How do some people seem to effortlessly write such usable, clean code? This is a question that I’ve tortured myself with over this past year after having the good fortune to work alongside some incredible engineers. While trying to get to the bottom of what separates bad, good, and great one concept kept surfacing: _abstraction. _A good handle on this can work wonders for your codebase.

What is abstract code, why should you care, and how will it make you a better programmer? Abstraction is tricky to discuss because it’s, well, abstract. But I do like how John Ousterhout put it in the book A Philosophy of Software Design

The term abstraction is closely related to the idea of modular design. An abstraction is a simplified view of an entity, which omits unimportant details. Abstractions are useful because they make it easier for us to think about and manipulate complex things.

Or Steve McConnell explained inCode Complete: A Practical Handbook of Software Construction

Abstraction is the ability to engage with a concept while safely ignoring some of its details — handling different details at different levels. Any time you work with an aggregate, you’re working with an abstraction. If you refer to an object as a “house” rather than a combination of glass, wood, and nails, you’re making an abstraction. If you refer to a collection of houses as a “town”, you’re making another abstraction.

It’s the act of removing some/all concrete details so you can generalize more areas of your code for reuse. Abstraction is the weapon you can wield to fight off spaghetti code. Let’s jump right in with an example.

Here’s an ultra-simple piece of Ruby code (don’t worry if you don’t know Ruby, we’re just defining, and then calling, a function). We’re writing some code that turns our bedroom light on and off. Run it to see it’s magic at work.

Perfectly innocent-looking code, right? It does exactly what we want it to do. The light turns on and off so why is there still so much of this article left?

Almost nothing about this code is abstract. When I call the function, what light is going to turn on? Why the bedroom light, of course! It says it right there in the code. This code is _concrete _and non-flexible as it is completely _coupled _to only work with the bedroom light.

Problems arise when we need to change and reuse our code and, trust me, you always end up needing to change and reuse your code.

What if we suddenly have a kitchen that also needs lights? Our example code is unusable as it stands so we’d need to change it, duplicate it, or come up with a new solution. An easy fix would be something like this.

#software-development #computer-science #software-engineering #learning #learn-to-code #deep learning

Abstract class & Abstract method in C# | OOP in C# Part-24 | C# OOP Bangla Tutorial

https://youtu.be/vonwoaUl0Hw

#oop in c# #object oriented programming #object oriented concept in c# #learn oop concept #abstract class & abstract method in c#

Linda nano

Linda nano

1624064400

XRP Ripple Could SURGE Very Soon, XRP beats Bitcoin on all metrics! ( HOT NEWS!!! )

RIpple xrp price on a tear and flirting with $1. Here I explain a few ideas about why I think this could be happening, as well as speak on the energy efficiency and scalability of XRP. Thank you for watching and if you have an alt coin you’d like a deep dive just comment it below.
📺 The video in this post was made by Crypto 2103
The origin of the article: https://www.youtube.com/watch?v=kongn5FgCgk
🔺 DISCLAIMER: The article is for information sharing. The content of this video is solely the opinions of the speaker who is not a licensed financial advisor or registered investment advisor. Not investment advice or legal advice.
Cryptocurrency trading is VERY risky. Make sure you understand these risks and that you are responsible for what you do with your money
🔥 If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free ‘GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#bitcoin #blockchain #xrp #xrp ripple #xrp ripple could surge very soon, xrp beats bitcoin on all metrics! #xrp beats bitcoin