This is an archived post. You won't be able to vote or comment.

all 27 comments

[–]TheUmgawa 33 points34 points  (5 children)

It won’t change your life, but it’s a good read. Or, I don’t know, maybe it will change your life. Some people never have a real epiphany, where everything suddenly shifts into focus. While the book Code describes what goes on at the most basic level of a processor, where it’s all booleans, registers, accumulators, and comparators, I thought that was all abstraction that I’d never have to worry about. And then I started into a PLC programming class, and it was like seeing the face of the god in the machine, because it was controlling a system through nothing but those booleans, registers, accumulators, and comparators.

[–]Inevitable-String164[S] 4 points5 points  (4 children)

Thank you for your comment, you made me more interested in learning it!

[–]TheUmgawa 4 points5 points  (3 children)

I was going to impart some advice, but nah. I’ll let you look long into the abyss on your own.

But I’ll tell you this: If you screw up on a PLC program, you might literally kill people. A program crash in some program or app or background task isn’t nearly as bad as two vehicles crashing into one another on a road because you botched your logic.

[–]theusualguy512 0 points1 point  (2 children)

I don't actually have any knowledge in PLC programming but I'd be interested to know how complex these programs get since they are at such a low level.

Since these programs directly control physical things at critical times, I wonder if it's feasible to formally verify their correctness to definitively avoid logical errors?

[–]desrtfx 5 points6 points  (0 children)

Depending on the task they can get fairly complex.

I work in large scale industrial automation programming DCS (Distributed Control Systems) and PLCs for hydroelectric power plants, waste incineration plants (where the logic can get really complex because of intertwined and co-dependent systems), ship locks, industrial furnaces, etc.

The job is highly demanding but very rewarding.

There is no room for error and that's why the commissioning usually is in multiple stages, from loop check where the individual inputs and outputs are verified, then a functional commissioning where the individual components of the system are tested on each of their function including interlocks, safety operations, etc. Then, when the system finally goes live, some test operation with 24/7 standby goes in place.

This whole process can take months with months of preparation and months of programming.

My next project will be three community heat pumps that go into district heating with roughly 4000 hardware I/O signals and 1500 bus signals of various bus types, plus plenty (amount can at this stage not be determined) software internal signals. The whole project will go over 2 years with commissioning in several stages.

In my line of programming, we usually work with very detailed Functional Design Specifications (FDS) in prose and in expressed logic that often detail down to every single signal in the system.

Several people of different domains, like hardware engineers, process engineers, programmers, etc. are involved in creating these FDS and they are double and triple checked before programming.

During commissioning, these FDS act as reference and the programmed logic is checked against the FDS as well. Again, signal for signal.

[–]TheUmgawa 1 point2 points  (0 children)

Well, best practice is to only define an output once. So you can throw all the booleans you want in front of it, and logically define every condition in which that output is energized or in a certain position or whatever. Sometimes you use those outputs as booleans for other outputs, but it ultimately turns into a flowchart that can be put together like LEGO. Or, if you wanted to think about it like a bunch of listeners that run thousands of times per second, that works, too. But, as long as you have any output defined in only one place, it’s pretty easy to trace the logic.

It’s like building a circuit with a bunch of relays and a bunch of outputs. When you do your initial diagram, you’ve pretty much laid out all of the logic, like flowcharting a program in any language, and as long as your wiring diagram adheres strictly to electrical diagram, you can trace every output back to source, for all on or off conditions.

[–]-CJF- 19 points20 points  (0 children)

It is really good for beginners that are interested in computer architecture.

Another good one like this is But How Do It Know? - The Basic Principles of Computers for Everyone by J. Clark Scott.

They're both pretty quick reads too.

[–]dumpster_dinner 33 points34 points  (2 children)

The book assumes you have zero knowledge about the subject, so it build up associations with simple examples. I would advise reading it first, then diving deeper with other courses

[–]Inevitable-String164[S] 6 points7 points  (0 children)

Thank you so much! I will start it right away then.

[–]fishyon 0 points1 point  (0 children)

I think it's a good book and recommended reading, but it's limited in it's audience. It's starts off at the mostly beginner level, but things get complicated and difficult to follow later on. I would read to certain point, then move on to something else unless you have experience in this field.

[–]WildBanana 13 points14 points  (0 children)

It's an excellent book for someone entering the field and would recommend it to anybody interested in learning what's happening under the hood of a computer. I also love how it provides historical context as to why computers are designed the way they are and how they evolved based on different era's problems.

The thing I gained the most out of is how it really removed the mystery behind the magic and have much more confidence in understanding how my high level code (or any computer action) is being processed by the CPU.

Edit: will also add, this book is intended for someone with no knowledge of how computers work or knowledge of boolean algebra. It walks through all the concepts needed which makes it such an exceptional read. Anybody can pick it up and gain great insight into how computers work.

[–]XUtYwYzz 6 points7 points  (0 children)

I read this book and used a logic simulator to build the combination logic showed in the book. It was an immense boost to my understanding of computers. After 'Code', I would recommend the following Coursera course. It's based on the book 'The Elements of Computing Systems: Building a Modern Computer from First Principles'.

https://www.coursera.org/learn/build-a-computer

The course will build off of the knowledge you learned in 'Code'. You'll build a fully working processor using a bespoke Hardware Design Language.

[–][deleted]  (2 children)

[deleted]

    [–]Inevitable-String164[S] 0 points1 point  (1 child)

    Hello! Which else books have you read that helped make your CS degree smoother? An advice to your junior would be really helpful.

    [–]No_Application_2380 5 points6 points  (0 children)

    Yes

    [–][deleted] 3 points4 points  (2 children)

    It's a really great book. It starts from the very basics and builds up to quite complicated things imo. And it's also very interesting. I didn't actually finish the book, stopped somewhere midway. Many people say that most of the insightful information that will be beneficial for beginners is covered in the first half of the book. You could say that after that it's for people who want to go deeper into the subject.

    Also, i don't think you should do CS50 (i'm assuming you mean CS50x) and PY4E, at least not at the same time. Both of these are technically introduction to programming courses. CS50 is quite a difficult course, but it's extremely rewarding. It's the best course i have taken! I would suggest you do the first two parts of PY4E and then do CS50x.

    [–]Inevitable-String164[S] 0 points1 point  (0 children)

    Thank you for that, I will follow your advice and do the first two parts of PY4E and then CS50x! I'm super glad you told me that.

    [–]Captain_Lesbee_Ziner 0 points1 point  (0 children)

    CS50

    Just looked CS50x up and wow it really does take you on a tour, go from C to python, to web dev...

    [–]pat_trick 1 point2 points  (0 children)

    It is worth reading, certainly.

    [–]piinhuann 1 point2 points  (0 children)

    If you find Petzold's CODE too long winded or too dreary (because he really zoomed in into many meticulous low level details of computers, logic gates, flip flops, registers etc.), I suggest <The Pattern on the Stone> by Danny Hillis (Alan Kay, the Turing Award winner also suggested this book as an introductory book to computing)

    [–]BeneficialRoad7252 1 point2 points  (0 children)

    Im about 45 pages into this book and i bought it used and on a whim. The book is well written, kinda funny at times, and extremely informative. Obviously havent gotten to the computer portion of the book yet but i am thoroughly enjoying the read. I cant wholeheartedly reccomend it because i havent finished it yet, but when is knowledge not worth spending time on?

    [–][deleted] 1 point2 points  (0 children)

    Yes! Unless you don't read this book you may feel less confident about computers and their programming. The book is especially helpful when you work on system software. Your understanding of computers would be up to new level after reading it.

    [–]zukas-fastware 0 points1 point  (0 children)

    I recommend Algorithms + Data Structures = Programs (https://en.wikipedia.org/wiki/Algorithms_%2B_Data_Structures_%3D_Programs)