r/AskComputerScience • • 6d ago

Does computer science rely heavily on abstract reasoning?

Today I stumbled on the phrase "abstract reasoning," which means the capacity to think in abstract terms without first having to learn the specific details underneath.

For example: "throwing a rock at a window would break the window" is more abstract than "throwing a hard, dense object such as a rock at a structurally fragile object such as a window would cause the fragile object to shatter and fall apart afterward," which is more literal in a way.

I noticed that when learning programming, most languages are abstract, and even lower-level ones like C or C++ abstract away a lot of things in their libraries.

I'd say I can't really think in abstract terms. Whenever I learn something, I want a clear working example that I can tie to real-life things in my own experience, and only then can I even begin to absorb what it means. Even learning about headers and the use cases of virtual functions in C++ took me two days to reach some conclusion. It seems I've always been bad at abstract reasoning.

What do you think? Does computer science, and software engineering specifically, reward abstract reasoning? Can I improve this ability?

7 Upvotes

25 comments sorted by

19

u/Beregolas 6d ago

Yes, computer science is mainly abstract reasoning. Most universities rely heavily on transfer tasks, and not on pure knowledge checks. You will learn a concept, and be expected to be able to apply it to a novel problem.

For example: A common task in DSA is to perform a sorting algorithm by hand, step by step, and also to analyze it's armortized runtime cost (O(n²) time, P(n) space for example), and to prove it's correctness. You will have done this during class and assignments for 3-4 different algorithms, maybe bubblesort, mergesort, quicksort and bucketsort. In the exam you might be expected to perform both tasks on Insertionsort. This means you actually need to understand the material, and not only know by heart how the proof or execution works for the sorting algorithms you already know.

The O notation in itself is pretty abstract, come to think about it. We are only interested in the growth characteristics of the runtime cost, and not the specific value it will have for any given n. any constant factor, even if it's 10000, will just be dropped.

We also make heavy use of abstraction in programming, which is probably more what you are thinking about. Every programming pattern exists, so we don't have to think about specific implementation details all the time. We don't reason about lines of code, we reason about what happens if we insert an element into a stack. We have (or someone else has) already verified that the stack works exactly as we learned in uni, so there is no need to dive any deeper than that. It would be a waste of time, and we wouldn't get anything done.

We also just accept that lower level elements needed to code just work. No one thinks about transistors, electrons, logic gates etc. while coding. There has been an enornmous amount of work done for all of these, so that we don't have to think about them every time we write a line of code.

This question was already asked 10 months ago (which I only remember because I answeres then too), you might find some relevant answers there as well: https://www.reddit.com/r/AskComputerScience/comments/1qusgly/is_computer_science_heavily_based_in_abstract/

4

u/GiveMe30Dollars 6d ago

I was about to add on something, but then i noticed how oddly suspicious that other than punctuation, the contents of both posts are identical.

OP may or may not be a bot.

(That being said, yeah agreed! I feel like this question is sort of redundant in a sense, because when you really think about it if ... {...} else {...} in any form of programming language ever is already abstract reasoning, and anyone who comprehends causality can understand that pretty trivially.

It's the interconnected protocols of complex systems and swtiching between abstraction layers that we can struggle to understand or do at times, especially when your starting point is the surface of the abstraction itself eg. "HTTPS serves websites!". Has the same pulling-the-rug-underneath-you feeling that starting out in mathematics can have.)

13

u/MegaromStingscream 6d ago

I think there are conflicting ways to think about what is and isn't abstract.

All of coding is abstract in the sense that the concrete is electrons dancing around in circuits.

Then again I can explain you a generic, but very useful concept like a specific sorting algorith as a story which is more abstract than pseudocode which is more abstract than implementation is a specific language. For understanding the algorithm and why it is slower or faster the level of dancing electrons is pretty useless.

I certainly think abstract reasoning and even moving between levels of abstraction is important. I'm sure it can be practiced. But I don't really know what kind of things you would actually struggle with.

3

u/farsightxr20 6d ago

Yes but your example is at least partly inverted, you just used more words while making the statement less specific (rock is more specific than "hard dense object" and window is more specific than "structurally fragile object").

2

u/dmazzoni 6d ago

A big part of the job of software engineering - writing larger programs - is coming up with abstractions.

The human brain is limited. We can’t comprehend programs that are thousands and even millions of lines of code in our head at once.

The only way to make it feasible is to build abstractions. We take a chunk of code and give it a name. The name is so clear that we can forget HOW it works, just think about its job and what it’s supposed to do.

A file is an abstraction. There’s no such thing as a file on your SSD or memory card. It’s just 1s and 0s arranged in things like blocks and sectors.

But the concept of a file has been around for so long that it’s a really good one. Unless you’re an operating system engineer you don’t need to think about how files work, you just need to know how to use them.

Programs with millions of lines of code invent hundreds or thousands of abstractions. They allow you to modify the program without understanding how every piece works.

1

u/dariusbiggs 6d ago

The further you get away from low level languages the more abstractions you tend to get.

The more complex the problem the more abstractions you tend to get.

Your train your ability to turn complexity and abstractions into smaller chunks of code and logic that are easier to reason about. How to use the basic building blocks to implement the complexity into small discreet blocks.

You see these levels of abstractions develop as you get more into software development methodologies, problems, algorithms, and techniques. Things like the repository pattern, the factory pattern, distributed processes, saga patterns, two phase commits, graph theory, paxos and raft, etc.

The good thing about computer science is that it everywhere, and there is always more to learn. Never stop learning.

1

u/DragonfruitGrand5683 6d ago

Computers abstract away how things work. So if you program you are for the majority of tasks abstracted away from the hardware.

A chef doesn't need to know how an oven actually works but he does need to know a logical order in order to cook.

When something goes wrong in cooking he needs to be able to trace the steps.

If you have the drive to understand how the computer works you will be able for it, but if its just a chore you will give up.

1

u/dashingThroughSnow12 6d ago edited 6d ago

Back in my university days, one of the sayings was that computer science is the science of abstraction.

Wrt your comments about yourself, the field needs different people to succeed as a field. Plenty of people are like you. Plenty of people are like me where we get a working understanding then flesh out that understanding over time.

There are advantages to both approaches. And both are on a spectrum and you'll be on different spots for certain topics.

1

u/TedsGloriousPants 6d ago

The answer to your actual question is yes: you need to do a lot of abstract reasoning to do programming. It's not "most" languages that are abstract, they all are. If you do it for work, complicated software systems are abstractions on abstractions all the way down, and you have to be able to keep enough of that conceptually in your head.

The answer you're not looking for is that everything is an abstraction, not just computers, and at some point you have to stop and realize that you cannot know every detail of everything.

1

u/Leverkaas2516 6d ago

Yes, ypu find at the granular level that certain types of abstract reasoning are everywhere. Like data types and arrays that are containers for classes of objects, or in a regular expression certain symbols represent classes of data while other symbols are operators. Or with a finite state automaton, symbols represent states and states are drawn as nodes on a diagram but really represent program state.

That is to say, just like in mathematics there are endless substitutions and representations. Letters and lines and arrows and boxes and symbols that represent other things and depict complex underlying behaviors and relationships.

If you extend computer science to what you might call real-world applied computer science or software engineering, you then find that you've learned hundreds of ideas (the aforementioned arrays and finite state automata) but normal people in the real world don't know either those ideas or those names, and they state their problems and requirements in very different terms. It's your task to map their problem descriptions to extremely complex combinations of the basic ideas, and sometimes do things like invent novel ideas, or at least recognize that your lexicon is inadequate and go lookiing through the literature.

1

u/LitespeedClassic 6d ago edited 6d ago

Computer science is really the study of problem solving. Not solving some particular instance of a problem, but how to solve all instances of a problem at once. (For example, Not “how do you calculate the derivative of f(x)=3x2 +2?” That’s an instance of a derivative problem, but how do you design a procedure that given any polynomial f(x) it computes its derivative.) 

Problem solving like this is accomplished broadly by several things: abstraction (remove irrelevant details to create a pure form of your problem that only has the relations necessary to its solution), decomposition (breaking a complex problem into manageable parts), composition (putting solutions to decomposed parts together to form a solution for a whole), pattern recognition, and algorithms (step by step procedures for transforming any problem instance into its solution). 

This is the core of all computer science. 

1

u/DubiousLogik 6d ago

I think u got a bad def. To do abstract reasoning well u need to know the building blocks else it's not abstract, it's make believe. U don't need all the layers, eg I don't know L3 ntwk stack to write app code, but I know my own layer - oo, di, apis, etc.

I use diagrams a lot for issues like the one u described. It's ok that your learning style is different if u do eventually get there

1

u/jwezorek 6d ago

Formalized abstract reasoning is just "mathematics". Computer science is a branch of mathematics. Software engineering is branch of engineering that leverages the results of computer science among other things. So, yes, both depend on abstract reasoning.

1

u/0jdd1 6d ago edited 6d ago

I’d go one step further. Research and practice in computer science are largely about creating new abstractions. Abstractions do an extraordinary amount of the heavy lifting.

Once you get your Master Of Complexity™ merit badge, you need to shift to abstraction to get things understandable again.

1

u/mc_pm 6d ago

The entire job of computing science is to manage different levels of abstraction.

1

u/PhilNEvo 6d ago

I think you're underestimating yourself, and maybe not fully grasping what abstraction is?

If I told you, build x program, or optimize x algorithm, are you telling me your first step is to start drawing the logical gates or pull out the physics equations, before you can reason about abstract steps to solve your problem?

Quite to the contrary, I bet you start from the top abstract level, and say "Oh, x program needs x,y,z features-- To implement x feature, I first need to..." and then you slowly piece by piece reason through a flow of abstract steps in more and more detail till you get to the implementation level.

And yes, CS does reward abstract reasoning, that's why so many problems are tied up to tools like graph theory, linear algebra, data structures and so on, because you learn to think about problems in a way where more efficient solutions come more naturally.

1

u/BranchLatter4294 6d ago

Yes, you have to be able to use abstract reasoning.

1

u/Due-Consequence9579 6d ago

I would say a “good” developer is able to comfortably move up and down levels of abstraction. They should be able to conceive of how a user would interact with the system. Abstract those interactions into interfaces. Abstract the data models that are needed to support those interfaces. Be able to consider an individual interface implementation. Understand how the different implementation approaches could affect performance. Understand different failure modes and how to compensate or if compensation is even needed. All while being able to go to incredibly precise detail on any one of these topics.

It’s literally all abstraction.

1

u/SnugglyCoderGuy 5d ago

It relies on many layers of abstract reasoning. Sometimes you will have to dive deep into the layers, sometimes saying "the orogram will do x" is all you need

1

u/Electronic-Yam-69 5d ago

The word "abstract" has a lot of meanings and I think you're confusing 2 or more of them in this question.

"abstract reasoning" has very little to do with "abstracting away" the details" of a programming library.

1

u/AverageHot2647 5d ago edited 5d ago

Foreword: I have been a programmer for over 20 years and have read a lot of experience reading academic papers and technical specifications for abstract systems, but I have never studied computer science at university, and my knowledge/experience are skewed towards applied, rather than theoretical, computer science.

In most cases you can use a concrete example to help you develop an understanding of an abstract concept.

In some cases that’s not possible, and you need to develop an understanding of the abstract concepts before you can apply them to anything concrete.

There’s three forms of this.

Firstly, and most trivially, when something is taught or documented by someone who has an excellent understanding of the subject, they often prefer to teach / document it in abstract terms. It’s a bit unfortunate, and not the best way to introduce someone to a topic in most situations.

Secondly, you may find that you have to develop a certain amount of abstract knowledge on a topic before you can understand how it applies concretely. In these situations, I find people often refuse to progress past the first thing they can’t understand in concrete terms, because the feeling of not being able to tie knowledge to something concrete is deeply uncomfortable to them. The key, I think, is just to force yourself to continue, and really engage with the material, despite this uncomfortable feeling. I.e. just pretend the feeling isn’t there and trust that this is going somewhere.

The third, and by far least common, is when something is genuinely so abstract that you can’t tie it to anything concrete.

Up until now, we’ve only talked about learning. There’s also the flip side to this, which is when you are the producer (not the consumer) of knowledge. In this case, you will need to be able to think abstractly about things, and in a lot of cases you do need to start abstract.

One example is in software engineering. If you’re designing a protocol, and you start with a simple concrete use case, you will make assumptions which don’t apply to other use cases. So you need to think abstractly about what you want this protocol to be able to do, and design it to meet your abstract specification.

To make this concrete, imagine you started from a concrete use case: sending a list of temperature measurements between two machines. You might make the decision to send a length and then send each of the measurements, so the receiving machine can allocate enough space to receive the data upfront. This protocol is now only suitable for sending a fixed length set of fixed length items, and will break down if you later decide you want to stream variable length items.

To be clear, this isn’t always bad. If you know you have one specific use case, and this use case will either not change, or your able and willing to replace the protocol of it does, then designing to your concrete use case is fine.

Hope this helps 🤜🤛

1

u/No_Profession_3125 5d ago

Not anymore, it's been automated.

1

u/Fidodo 4d ago

I disagree with your definition of abstract here. What is a rock? What is a window? I would say abstracting that would be doing away with those words entirely and thinking in generalized terms like hard materials vs brittle materials. And yes, that kind of reasoning is helpful. In computer science you need to abstract everything to data structures and that means taking tangible things and figuring out how to represent them in data. That requires abstract reasoning.

0

u/franjozilic 6d ago

I think the part where you have to use both the creative and rational portions of your brain at the same time is worse.

1

u/BoomGoomba 5d ago

Pseudoscience