DEV Community

Cover image for Let's Get Started with Understanding the Machine
Rose
Rose

Posted on

Let's Get Started with Understanding the Machine

Last week, it finally came in the mail! The 2nd edition of Randall Hyde's book Write Great Code - Understand the Machine. I am excited to study this book and gain more in-depth knowledge of computer organisation. So, let's get started with understanding the machine!

Cover Photo by Umberto on Unsplash

Write Great Code

Writing great code is not as easy as it may sound. There are a lot of aspects to take into account. One of the important elements is understanding how a computer works. If you can utilise the computer's strengths and avoid its weaknesses, I'm confident that your applications will improve.

In order to write great code, you need to know how to write efficient code, and to write efficient code, you must understand how computer systems execute programs and how abstractions in programming languages map to low-level hardware capabilities of the machine. - Randall Hyde

This quote summarises Hyde's view on what it takes to write code. In the past, well over 20 years ago, there was only one way to learn the absolute best of coding techniques: learning the Assembly languages. The reason behind that is not because of the language itself. Instead, it is because you'll learn a ton about machine organisation.

Machine organisation is a subset of computer architecture. It covers topics such as:

  • Low-level data types;
  • Internal CPU organisations;
  • Memory organisation;
  • Peripherals;
  • Computer communication.

Write Great Code - Understand the Machine covers machine organisation quite in detail, which is essential information for me to gain. Not only because it would allow me to write better code, but also because I need this knowledge to write my operating system. Everything I'll learn from this book, I'll share with you.

Pen, paper, book: Let's study Understand the Machine!

Get Started with Understanding the Machine

So, what topics does Hyde cover in this book? It is quite a list, and they can all be related to the subjects of machine organisation. This list gives an outline of what the book covers. That is what I will write about in the many articles to come.

  • Basic Computer Data Representation
    • What do integers, characters, character sets and many more primal data types look like in a computer?
  • Basic Arithmetic & Bit Operations
    • How does the computer perform calculations and operations with bits only?
  • Memory (RAM)
    • How does a computer access memory, and what are the characteristics of memory performance?
  • Complex Computer Data Representation
    • What do composite data types and memory objects (e.g. pointers and arrays) look like in a computer?
  • Boolean Logic & Digital Design
    • How can I optimise the boolean expressions in if and while loops?
  • CPU Architecture
    • How can I write code in a "CPU friendly" manner?
  • CPU Instruction Set Architecture
    • Why do some statements take longer to execute than others?
  • Computer Communication to the Outside World
    • How does the computer communicate with peripherals (e.g. hard drive and sound card)?

When I see this list of things I need to learn, it terrifies me. However, it also excites me. There is still so much out there that I'm eager to learn, but I need to go one step at the time. If you want to follow my journey, keep an eye out for more posts to come! In the meantime, I'll get started with understanding the machine.

Discussion (2)

Collapse
miriamtocino profile image
Miriam Tocino • Edited on

I love this, Rose! Especially, your approach on getting to know about the internals and use what you learn in such a very practical way to get you write better code.

Did you get any ideas so far? Something that you didn’t expect?

PS. Looking forward to reading more about your journey and learnings. Keep them coming!

Collapse
nitinkatkam profile image
Nitin Reddy

Randall Hyde's Art of Assembly Language was popular in the late 1990s - it was, and still is, available as an HTML and a PDF book for reading from his website.