DEV Community

Cover image for Why Every Software Engineer Should Learn Computer Architecture.
Voider
Voider

Posted on

Why Every Software Engineer Should Learn Computer Architecture.

Introduction

I believe that success greatly correlates to two things, how you see the world and how much you truly understand it. We can say the same about software engineering; where computer architecture is the very essence of software engineering, if you understand it well enough, software engineering will be a piece of cake.

What is Computer Architecture?

According to Wikipedia:

Computer architecture is a set of rules and methods that describe the functionality, organization, and implementation of computer systems.
Some definitions of architecture define it as describing the capabilities and programming model of a computer but not a particular implementation.

In a nutshell, CA is basically the set of rules that control how hardware and software interact together.

Why Study Computer Architecture?

Computer Architecture can help you more than you think.
For example, most F1 drivers know a lot about their car's engine, to the point they can determine any problem with their engine, even before their engineers can!

They also know about Physics and Aerodynamics, hence this helps them give precise instructions to their mechanics in the Pitstop, like adjusting the nose or the wheels leading them to win more races.

Well, what does all this have to do with CA? It’s the same concept! When you understand and know more about the cornerstone of Software Engineering, you know how to handle problems and achieve what you need, more efficiently.

Why you should learn Computer Architecture:

  • You will likely use it for the rest of your life.
  • Computer Architecture is one of the most fundamental subjects in Computer Science. As without computers, the field of Computer Science would not exist.
  • You need to understand how the instructions and operations actually work and interact together, to make your software better; because whatever you do, no matter what, it is on top of CA.
  • Computer Architecture will help you design, develop, and implement applications that are better, faster, cheaper, more efficient, and easier to use because you will be able to make informed decisions instead of guessing estimating and assuming.

Example On How Computer Architecture Can Affect The Way You Code:

Branch Prediction: Let's say you are on a train, your job is to observe the way and you are at a railway junction:

Railway

You have to choose a side and you don't know which side to go on; so you either choose the right path or the wrong path, if you do choose the right path you will keep going, if you choose the wrong path however, you will go back and choose the other path. So if you keep choosing the right path you won't have to go back again and if you choose the wrong path you will keep having to go back and forth,
makes sense?

Consider an if-statement: At the processor level, it is a branch instruction:
code

Now you are a processor and you see a branch, you have no idea which path to go, so you will have to enter.

  • If you guess right the execution will never have to stop.
  • If you guess wrong, you spend more time going back and restarting the execution.

So how do we make the better choice each time?
We observe. If the process, usually takes left then we guess left. If it takes right most of the time, we guess right. If it alternates, then we alternate our choice as well

This is, more or less, how Branch Prediction works.

Conclusion

Learn Computer Architecture, become a better software engineer.


Special thanks to the reviewer, Rawan Attia.

Oldest comments (40)

Collapse
 
rawanattia profile image
rawanattia

Great article!! Keep it up!

Collapse
 
voider profile image
Voider

Thank you so much.

Collapse
 
rezahussain profile image
Syed Ali Reza Hussain

My semester exams are going on and I'll be writing my Computer Architecture exam in the coming 10 hours. I've hated every moment of preparing for this subject. But after reading this article, I guess I'll give it a try. Thanks man

Collapse
 
voider profile image
Voider

I am happy to hear that man, and good luck with your exam I hope you do great!

Collapse
 
voider profile image
Voider

I agree

Collapse
 
incrementis profile image
Akin C.

Hello Voider,

thanks for your article.
I agree with your conclusion that learning computer architecture will help you become a better software engineer :)!
And a question comes to my mind, "How do you train to become a Computer Architect?".

Collapse
 
adelfelf profile image
adelf-elf

I wish we could not assume questions like this, i see it everywhere, not exact question but such computer questions, definately its a "newbe" asking but if they took time to read ur article, please answer them to ur best.....you dont know how much you do to that person

Thank u

Collapse
 
voider profile image
Voider

Hello Akin,
I recommend reading computer organization and design by David A. Patterson and John L., that's where I knew about CA during my last semester, but I also recommend learning the basics of assembly so that you can 'link' the concepts you will know about from the book from a closer level of abstraction.

Collapse
 
abanoub7asaad profile image
Abanoub Asaad

Good Job, Badawy
Keep going 💪

Collapse
 
voider profile image
Voider

Thanks Abanoub!

Collapse
 
amine1996 profile image
amine1996 • Edited

I agree that knowing CA is useful. However, the optimization you make on a if statement will only really be useful in high performance context. Adding lot of checks like this in an environment where performance is not the highest requirement will only make your code harder to read.

Collapse
 
voider profile image
Voider

I agree with you, the range of knowledge you need to know will vary depends on what you need to do.
I will be covering the levels of abstractions for most of the software requirements hopefully.

Collapse
 
sopulumax profile image
Sopulu-max

For those who read this. You've probably heard of the 80/20 rule. You're looking at one. Learning computer architecture is the 20% of the work that'll get you 80% of the result.
Great post and Great advice

Collapse
 
jeffabailey profile image
Jeff Bailey • Edited

That kind of dogmatic behavior is what is wrong with the tech industry and humanity as a whole.

Seriously, try expanding your mindset.

Collapse
 
leob profile image
leob • Edited

Spot on, yes this is a fine example of some narrow minded elitist thinking, probably with the idea to keep "outsiders" out of "our" industry, and to protect the privileges of the 'incumbents' lol. Yes let's raise the barriers by subjecting all newcomers to some arbitrary and useless algorithm tests, artificial gatekeeping with a nice hidden agenda if you ask me, terrible idea if I ever heard one.

 
jeffabailey profile image
Jeff Bailey

You just described most of humanity. Do you think that taking a hardline point of view will change everyone?

Collapse
 
zyabxwcd profile image
Akash

I would love to read some more example translating into real scenarios when you program. The branch prediction one translated into if condition was really interesting.

Collapse
 
voider profile image
Voider

check out caching, it will help you really well on how to use your data structures better, you can also check how function calls really work, also instruction-level parallelism and out of order instruction scheduling

Collapse
 
srchip15 profile image
SriNath

Liked reading your article. IMHO book recommendations or links to other types of resources would enhance your piece. I do see that as part of the discussions section however embedding the same in the article itself would be better.

Collapse
 
leob profile image
leob

Lol you want to put up artificial barriers (keep salaries high?), and what does it have to do with Ruby and Python? Weird thought, but fortunately it ain't gonna happen.

 
leob profile image
leob

Total nonsense, you're trying to provide a solution in search of a problem. Does your idea guarantee that the industry will attract the best and most talented people? i don't think so, it just reeks of artificial gatekeeping. Fortunately the principles of free market economy won't ever let this happen.

 
leob profile image
leob

Exactly, this is not the government's responsibility, and forcing "every" developer (regardless of what he/she actually does) to take an standard exam sounds like the worst idea ever. So who all would be included, also the person in the accounting office writing Excel macros? He/she is also undeniably a "coder".

Collapse
 
leob profile image
leob • Edited

"Every developer", how do we even define that? An accountant writing Excel macros is also writing code, hence is a coder or 'developer'! This idea is only feasible and remotely realistic if you apply it to specific well-defined segments of the industry, like SCADA programmers building mission critical stuff, industrial control applications, and that's an example where it would have added value.

P.S. "putting a stake in the heart of Ruby and Python", that's just toxic, and painful/denigrating for people who love these tools and get stuff done with it ... I'd say spare us your negativity and your elitist mindset, and don't pollute dev.to with it!