8 ms·
“Code” 2nd Edition
- yardie 4y agoI bought Code and Code Complete around the same time. And started reading Code before switching to Complete. And now I'm reminded I have the 1st Edition still sitting on my bookcase read about 1/3 the way through.
- systemvoltage 4y agoWe need more people like Petzold in this world. The layers of abstraction are stacked so high that we need to provide a generalist view of what's going on. Some of these Jenga bricks need realignment and people to maintain them, sometimes to re-engineer those bricks to be stronger. We can't just all sit at the top of the tower and wonder why is it behaving irratically! Please support by purchasing the book.
- dmitryminkovsky 4y agoWow this is awesome. Code was an eye-opening book for me as a child. I have a 2 year old, and have been wondering whether he could possibly appreciate camera film ISO codes (an early example of "a code" in the book), given that he'll likely never see a roll of film, or other things like that. An updated edition is great news.
- jgwil2 4y agoHaha I like how the cover shifted to dark mode...
- JonD23 4y agoI read the 1st edition while I was in high school. I knew I wanted to get into tech after reading that book. Many years later, I worked with Charles at Xamarin. For weeks after I joined, I thought of ways to get him to sign my book. One day I heard he was doing a book signing at an event, and I volunteered to go. He signed my book, "from bits to mobile", and now it lives on the top of my bookshelf.
- scrollaway 4y agoAny suggestions on where to preorder this from Europe (Belgium)?
- beezlebroxxxxxx 4y ago> If you’d like to pre-order the book from the publisher, don’t try to find the book on the Pearson website. Instead, order the book from InformIT.com or MicrosoftPressStore.com or your favorite online retailer. So I imagine any online retailers where you might be able to preorder technical books. If you are not adverse to doing so, it can probably be pre-ordered in the coming months on Amazon, as well.
- rafaelhaseyes 4y agoIn Europe you could for instance order at Blackwells[1], they are an independent bookseller and fairly cheap for english language books. Even better would be to use a local independent bookseller in your own country of course [1] blackwells.co.uk
- bmitc 4y agoI still need to get to the first edition copy I have, but now I think I'll wait to read it with the expanded bits on CPU architecture.
- mtoddsmith 4y agoI love the antiquated ordering process. Wish I could just click buy from my iPhone or send crypto.
- layer8 4y agoFrom the TOC it reminds me of The Cartoon Guide to Computer Science, which I would still recommend: https://archive.org/details/TheCartoonGuideToComputerScience https://archive.org/details/TheCartoonGuideToComputerScience
- cyanf 4y agoI’m currently using the first edition to teach my young brother about computers. We would read the book create a “clean room” implementation of a computer with Minecraft redstone. It’s great fun! He was overjoyed when we got our first 1-bit memory cell.
- tetek 4y agoOne of my fav books about Computer Science, I always recommand it for begginers!
- srvmshr 4y agoCharles Petzold's other book, The Annotated Turing is also a great read.
- 0xFF69B4 4y agoThe Annotated Turing is probably my favorite technical and historical book, there's nothing else like it. But I'll never forgive the utterly strange typo in it: "In a famous 1907 paper on relativity, Hilbert's friend Hermann Minkowski would coin the word Zaumreit or spacetime." Zaumreit literally translates to "bridle riding" and is probably a play on words, Raumzeit means spacetime. This has puzzled me for over a decade now. How does this even happen?
- mrunkel 4y agoYou find it surprising that an American author and book editor don't read or speak German? I'm guessing the author remembered the word incorrectly and wrote it down that way. It's not hard to transpose two letters when you don't know the language.
- 0xFF69B4 4y agoThe book is really well researched, it includes 5 pages of selected bibliography. I doubt the author wrote about a scientist coining a word and then recalled said word from memory. There's no misspelling of the word "Entscheidungsproblem" which occurs like 80 times. It just stuck out to me, maybe the source material was already wrong, maybe he was trying to be funny or nerd snipe someone, it's a mystery.
- toma_caliente 4y agoI have this book and have never read it. I may just wait for the second edition to release at this point
- Minor49er 4y agoThis is great news. This book has been highly regarded for being able to explain the magic behind what makes a computer actually work. The new edition has about 70 pages of additional material. There is also a companion website that is under construction that already has a delightful amount of interactivity, showing how binary switches, relays, and gates work: https://www.codehiddenlanguage.com/ https://www.codehiddenlanguage.com/
- MarkSweep 4y agoLooking at that source code for the website is fun it is own right. There is a whole JavaScript framework for simulating and displaying circuits. Each circuit is represented by a JSON file.
- nightski 4y agoBought it! I own the first one and it's just a fantastic book. I've shared it with family members to help them understand how computers work (more tech savvy ones at least). But yeah love this one.
- kris-s 4y agoOne of my all-time favorite works of non-fiction. Essential reading for software engineers.
- stevoski 4y agoThis book (1st edition, at least) is astonishing. Perhaps the best book for coders that I’ve ever read. I recommend it to all the HN crowd. Reading it, I felt like I actually understood how computers worked, right down to the “electricity going through wires” level and lower, and how that builds up to if-then statements, etc, in a high-level language.
- begueradj 4y agoThe content is something we learn in universities, even deeper. I think it's good for self taught programmers
- gonehome 4y agoMaybe where you went, but that definitely wasn’t the case in my CS degree. Code is really great and he’s a better teacher than most of the professors I had.
- coldpie 4y agoThis ~$40 book was way, way, way more valuable education material than the many thousands of dollars I wasted on a university program.
- ThrowawayR2 4y agoDon't oversell it. Speaking as someone who has done VLSI layout of a 32-bit processor in my student days, Petzold's book is a solid popularization but it doesn't cover a tenth of what a computer engineering degree does.
- peterkelly 4y agoOne of the best computing books I've ever read. Looking forward to checking out the new edition.
- deleted 4y ago[deleted]
- bluedino 4y agoMy favorite Petzold book is 'Programming Windows 95'
- bena 4y agoI got the Fifth Edition. A book that's served me well. Learning the Win32 API, holding open doors, improvised weapon, it does it all.
- Dwedit 4y agoIt is a very large book indeed.
- qbasic_forever 4y agoAs doors got heavier it became necessary to add Petzold's windows programming with MFC book to the stack too, another massive (and great at the time) tome.
- formerly_proven 4y agoMy sample has a gigantic splat on its back because I threw it at some insect many years ago and it was positively crushed by The Petzold's impact force. Never cleaned that off because it added to the aesthetic of raggedness.
- matwood 4y agoDefinitely a classic from back when books were sold by weight.
- JJMcJ 4y agoIt's a large book but has very little fluff or padding in it. Covers a huge amount of ground. I learned a lot from it back when I did some Windows work back around 2000 to 2005. Also MFC.
- matwood 4y agoIt was an awesome book, and was basically required for win32 programming in the late 90s.
- ultrasounder 4y agoGreat. There goes my summer.:-) Essentially read this book with my 14 old Aspie and help him understand and appreciate Software and the hardware it runs on it. Thanks for posting this here.
- scop 4y agoThis book was absolutely essential when I was first sinking my teeth into software programming. Things that seemed either arbitrary or completely mysterious suddenly made sense now that I had a contextual understanding of how computers worked. Without having that knowledge, I think my career would have been vastly more difficult and frustrating. While I understand many “get started programming” books/tutorials put an emphasis on getting coding asap, I really had to stop and learn about computers before I could start coding in a well rounded way (and that’s coming from a WebDev, who doesn’t even have to deal with low-level stuff too often!). Thank you Mr. Petzold!!!
- coldpie 4y agoWish I had something to say other than "me, too." I read it sometime in high school, well after I'd learned C, and it really made me understand what was actually happening to the code I wrote. Very helpful later in my career and hobbies too, when I have to do reverse-engineering.
- SkyMarshal 4y agoSame. I think some of us learn best by having a map of the territory and an understanding of how everything all fits together first. Having that better helps us deep-dive into and master specific areas. This one single book provides that map.
- _jal 4y agoAbsolutely. I tend to be mystified and lost without some way to place what I'm doing in some larger context, even if that context is super-vague or wrong in technical ways. Had several teachers who utterly refused to provide that, repeating "it'll all make sense eventually." Well, it did, after I got better teachers.
- scop 4y agoThat's a great observation about teachers. I was fully convinced in late middle school that I was an idiot who had no hope to achieve good grades or a grasp of subjects. Then suddenly I found myself getting As in high school without a real change in effort/routines. I attribute that in large part to learning the "why" behind various subjects via new teachers.
- ctur 4y agoThe 1st edition of this book was very influential for a generation (or more) of engineers. I can't wait to see how it's evolved and what I learn reading a new edition through again.
- antiverse 4y agoLooking back it's really strange that nowhere in our CS/Soft Eng. curriculum is it covered exactly what is meant by the term "abstraction" when it comes to how a computer works. That it's all, after all, shuffling of electrons (underlying MOSFET chemistry notwithstanding) and signals is the missing link. There's other books out there, and Ben Eater's website, that indepth show how to construct processor, gates, store "memory", and so on.
- qbasic_forever 4y agoWhen I was in school 'computer engineering' was the degree you wanted for that level of understanding. It was a blend of 50/50 computer science and electrical engineering. You'd learn enough analog EE to understand transistors and enough digital EE to understand logic and computer architecture (this is really where you learn the gory details of how a CPU works internally). Then you'd focus on enough CS to flesh out low level OS, systems programming, etc. to make it all work. Basically learn enough to go from nothing but a circuit diagram to a computer booting up a display with a login prompt for an OS you designed and built, on hardware you designed and built.
- skavi 4y agoStill is as you describe. Just graduated from a CompE program.
- skeeter2020 4y agoYou're describing what was the CompSci option for an egineering degree when I went to Uni the first time. If you look at another great book for learning the "full picture", Nand to Tetris, Comp Sci is the second half of the book while Engineering seems to fill the space between physics and low-level software.
- 2snakes 4y agoRight. Imagine a car. Now consider how it is abstracted to you. The wheel, the controls, the pedals. That's an abstraction of the complex system that is a car.
- deleted 4y ago
- xt00 4y agoGreat book -- read it when I was a teenager -- but one thing that I think makes the book a bit harder to explain to smaller kids these days is the use of relays for explaining lots of things. Its a great concept to explain things but it does tend to cause a bit of confusing for younger kids who may not have played with electromagnets as much as kids from 20-30 years ago. Not sure what to replace relays with but maybe having kids watch a super easy to understand video about how relays work would help make the book easier to understand for say like an 8 year old reading the book.
- ultrasounder 4y agovery easily substitute using FETs. Essentially the same as relays and BJTs but much easier to control logic FETs than BJTs.
- squarefoot 4y agoBut that would introduce more complexity (polarity, biasing, etc) that would distract from the initial purpose. With a relay they should only learn how connecting a battery to pins 1 and 2 closes the contacts on 3 and 4. Using relays with more throws they can also learn the basics of logic gates, flip flops, etc. I believe that relays still have a place for educational purposes.
- ultrasounder 4y agoYup! Agree 100%
- rrauenza 4y agoMy kids played a lot with "relays" in Minecraft using Redstone. Not quite the same, though!
- xt00 4y agoHa that's a great idea.. sounds like a good idea for a coding book.. hey so you know minecraft.. use that knowledge to learn how computers work..
- mypastself 4y agoGreat book. It might be time to replace my first edition hardcover. Looking forward to the follow-up blog post with the more detailed info on the updated content.
- RcouF1uZ4gsC 4y ago>The iconic graphic still displays the letters CODE in Braille, Morse code, and ASCII. All you have to do is add a '0' to the front of each ASCII sequence to make them 8 bits instead of 7 bits, and then they will be UTF-8 encoded.
- kerv 4y agoI took a course like 10 years from Charles. He was amazing and I'm sure this book is just as amazing.
- localhost 4y agoCode is my favorite technical book of all time [1]. Charles does an amazing job of building a computer up from basic principles "two young boys who want to communicate after their parents tell them to go to bed at night" all the way to modern (for 1999) computers. He layers abstraction on top of abstraction all the way to a working computer. My only (slight) disappointment in the book is that he tries to cover operating systems -> object oriented programming in a couple of chapters at the end. That could have been a multi-volume series in its own right. It goes really well with Elements of Computing Systems (2nd ed) [2] which I kind of think of as a "lab manual" where you get to build a computer from first principles. [1] https://www.amazon.com/Code-Language-Computer-Hardware-Software/dp/0735611319 https://www.amazon.com/Code-Language-Computer-Hardware-Softw... [2] https://www.amazon.com/Elements-Computing-Systems-second-Principles/dp/0262539802 https://www.amazon.com/Elements-Computing-Systems-second-Pri...
- danielvaughn 4y agoI picked it up years ago, got through the first few chapters, but then never finished it. I loved the early buildup and still want to go back and keep reading.
- unethical_ban 4y agoSame! Still one of my favorite books ever read, but other than the floating point chapter it started getting over my head.
- greymalik 4y agoWhen the book “builds” a computer, I’m assuming that’s a virtual computer? If so, what language does it use?
- Closi 4y agoIt’s more a book that actually shows you how a computer really works, from first principles. It’s not a book about implementing a particular computer - it’s more about giving you the rough thought process about how it actually works at the level of electricity and wires, and how this gets built up into something that actually calculates stuff. It’s the first book that took me from “computers are mystical magic” to “computers are understandable magic”.
- animesh 4y agoI majored in electronics (more than a decade ago) but always worked in software development. Does it still make sense to purchase it? I am eager to buy it, just need the push. :)
- gjstein 4y agoI have a similar background in Electrical Engineering and, while I enjoyed the book, it did not change my perspective. I think the book does a good job of opening up what many programmers (and, of course, others) may see as a "black box" that they interact with on a daily basis. I recommend it to those who do not already have a fairly comprehensive of how a computer works, but if you think you pretty much already understand how transistors become ALUs and have touched Assembly, you may find it a bit boring (as I did).
- animesh 4y agoThanks for this solid comment. Assembly is the one that I am most removed from at the moment. It is 15 years or more. So it seems like I will enjoy it at the very least.
- systemvoltage 4y agoI second this. I found it to be a little elementary for me since I already know these concepts. But it is useful for a lot of people who don't know how a computer really works.
- fodmap 4y agoYes, it does. Here's a little push for you. I think you'll find fascinating how all the pieces of the 'puzzle' fit together beautifully.
- animesh 4y agoThank you, I decided on it.
- commandlinefan 4y ago
- wly_cdgr 4y agoHell yeah. An absolute classic
- jljljl 4y agoLove this book. Recommend pairing it with Nand2Tetris to get a good understanding of how Computers work: https://www.nand2tetris.org/ https://www.nand2tetris.org/
- drivers99 4y agoNand2Tetris is great and I'd like to add "The Pattern on the Stone" by Danny Hillis to the list. (I just noticed it was revised in 2015.)
- kristopolous 4y agoGreat to see petzold still at it
- user3939382 4y agoThis is a very respected book. Famous. I’ve had my copy for several years. Never did read it.
- morninglight 4y ago"Programming Windows" exposed the simplicity behind the Windows architecture. If you had even a smattering of C experience, Petzold could get you writing Windows applications the same day you opened his book. He triggered an explosion of software development. There are excellent books for novice Linux programmers, but unfortunately, nothing compared to Petzold's clear and direct presentation. .
- pacaro 4y agoAbsolutely! My first software job back in 94, on my first day I was given a battered copy of Petzold and told to read and do the exercises up to chapter 7. It was an extremely effective boot camp for a novice windows programmer
- Narishma 4y agoI don't remember there being exercises in those books.
- pacaro 4y agoYou may well be correct, the instructions might just have been to code along with the book, I know that part of the exercise was definitely to ensure that I could use the tools. It was 28 years ago, I'm fuzzy on the details :)
- shadowfox 4y ago> There are excellent books for novice Linux programmers Do you have any suggestions in this regard?
- crispyalmond 4y agoUnsure of novice, but I have this book[0] which is pretty great. [0] https://man7.org/tlpi/ https://man7.org/tlpi/
- Stratoscope 4y ago
- muh_gradle 4y agoI am beyond excited. I have my worn out copy of the first edition perched near me. Petzold's Code is by far my favorite computer science and programming related book.
- planckscnst 4y agoI recommend this to anyone learning about programming or computers. That's usually kids. Last year, I went back to ready it again and it started with a story about trying to communicate with your friend next door. I thought "oh, this story isn't really relatable to kids today - they all have phones". So I'm really glad there is a second edition and I'm wondering if there is a new story.
- eterm 4y agoThis is by far the best book I've read that really made computers click for me. I think it's especially good for people like me who work in software development but don't have a computer science degree or background. Going from scratch and the very foundations of telegraphy all the way through to what opcodes really are and how code actually works in memory was an eye opener for better understanding what coding really is.
- no-dr-onboard 4y agoMy wife bought me this book when I was in college and I never found time to read it. The comments here make me want to crack it open and give it another swing. Thank you all.
- jmconfuzeus 4y agoThis is the book I used to teach myself basic CS back in 2010.
- WalterBright 4y agoI suppose I came to understanding programming in an unusual way. I first knew a bit of BASIC and could write simple programs in it, how the computer actually worked was a baffling mystery. My first semester in college, I took a class in semiconductor physics. That started with the PN junction, to diodes, to transistors, to gates, to flip-flops, to clocking, to registers, adders, etc. Later on, this made learning microprocessors straightforward, then assembler, then C, etc. I suppose it would have been faster to go straight to programming, but I am happier knowing how it works all the way down.
- ratww 4y agoI also learned electronics first, but in a much more amateurish way. As a kid I loved electronics magazines and building projects from them. My dream was a Z-80 kit, but even much simpler kits were too expensive for me. I ended up making a make-believe computer with a few logic gates, decade counters and flip flops. That was my "computer", which taught me digital logic. Not a lot of power, but for a 10-11 old it could compute the stuff I wanted, and I eventually learned digital logic. I never got the Z-80 kit but I eventually got a computer with DOS, which had QBasic, where I learned to code by modding GORILLA.BAS and NIBBLES.BAS. What a weird language, there was AND and OR, but not NOR, XOR, NAND and others...
- nurettin 4y agoI learned it the hard way as well. I think my book was "computer architecture" by Morris & Mano you start from PN to logic gates to truth tables to carnough diagrams to writing your own adder to D transistors to memory to bus to clock to cpu to write your own assembly to perform machine instructions.
- endofreach 4y agoI have no idea how i ended up buying this book last year (haven‘t heard of it from anyone)… the best book i have read in recent years. Definitely the best tech book i have or will ever read (haven‘t even finished „code“ fully yet, lol). Also: i found a book i always was too scared of starting to read (because i didn‘t want to feel like the biggest idiot trying to read it): „The Annotated Turing“. When i looked at it again after having read „Code“, i saw it was also written by Petzold. The way he wrote „code“ i know, that this will be great. I am very excited to read it when i have a few hours to fully block for it.
- halotrope 4y agoI got the first edition and it was transformative. Finally the connection between electricity, computers and modern communication was made. This all while being a fun-easy read. If it was not for this book I would never have started going down the rabbit hole of dabbling with ICs, Arduinos and (basic) electric circuitry. As Alan Kay famously said "People who are really serious about software should make their own hardware". No need to develop a whole computer, just getting your hands dirty with more basic electronics than consumer hardware will make you a much more complete technician.
- uwagar 4y agothe book that showed me what a pointer is. there is a hair rising line in that book in italics! almost like in a horror book like exorcist or dracula. 'turn the book on its side. can you see it?, its counting' hair raising stuff. thanks mr petzold.
- bloppe 4y agoLol "the hidden language of computer hardware and software" imagine calling Chinese a "hidden language" on an intro text book just because it's not immediately obvious how to speak it.
- SteveDR 4y agoI mean, if we somehow used Chinese every day without realizing it, then yeah that would be a fair analogy. Code is literally hidden from users.
- yumaikas 4y agoThe first edition of this book was my introduction into how computers worked at a lower level. It gave me enough of a grounding in various concepts that I was able to understand much of a Digital Systems class. It also partly inspired my first efforts at building a scientific calculator (which would never be quite finished). I definitely recommend it for folks who want to build context on the lower levels of computers, as a start into understanding CPUs, binary/hex, and other parts of how we tricked sand into thinking with lighting.
- benjaminclauss 4y agowould love a similar book for Networking up to the modern Internet
- user3939382 4y agoComputer Networks by Tanenbaum. Boring name but this is like the bible for computer networking.
- sarchertech 4y agoI’m working in it https://www.networksfromscratch.com/ https://www.networksfromscratch.com/ It’s nowhere near done, but I’m steadily working on it.
- benjaminclauss 4y agoThis looks great! I'll check it out. Subscribed.
- Shorn 4y agoCharles Petzold has a blog? With an actual RSS feed? I swear this is the first new blog I've added to my RSS feed reader in over a year.
- thombat 4y agoSeconded - it's fabulous to find that not only is he writing, but writing posts with titles like: http://www.charlespetzold.com/blog/2021/08/Screw-You-Microsoft-Edge.html http://www.charlespetzold.com/blog/2021/08/Screw-You-Microso... no M$-lapdog, he. I learnt my Win16 from the first edition of "Programming Windows" and would have learnt my modern UI from the newest edition if MS hadn't been so busy throwing the bathwater out with the Windows Phone baby that I lost heart.
- animesh 4y agoThanks for pointing this out. I would have missed it otherwise.
- ryanar 4y agoDangit I just got the first edition
- bombcar 4y agohttps://www.codehiddenlanguage.com/Chapter06/ https://www.codehiddenlanguage.com/Chapter06/ is pretty cool - interactive diagrams including a kitten selector.
- fire 4y agoIs the microsoft press site actually decent? Is there anywhere else y'all would recommend picking this up from? Seems like Amazon doesn't offer a combination ebook+physical the way the microsoft site does.
- n4jm4 4y ago
- netr0ute 4y agoAny way to get this on the Internet as a web page? It's ironic how this book covers some of the most advanced technologies in our age, yet gatekeeps it all behind plain old printed pages or a "watermarked ebook."
- destructuredObj 4y agoHappy to see a new edition! Great book, really helped remove a lot of the "well it's just dark magic" parts of how a computer works for me. Really can't recommend this enough to anyone who wants to truly understand how computer hardware and software works from bottom to top.
- elnatro 4y agoIs this book useful for a 10-year-old-experience software engineer (I also studied Computer Science)? I usually see this book named as “worth it” but I don’t know if it is an introduction to computer science or it is really interesting for an experienced developer.
- mrelectric 4y agoIt's interesting because you'll learn how to explain things better to the newbies. Pick up a pdf on libgen, check it out. If you like it buy it, if not you're still square even.
- mixmastamyk 4y agoIt’s an introduction on computer architecture, meaning how to build one. Not much theory except explaining binary/boolean math, etc
- donohoe 4y agoIf you'd like to support local independent book stores then you can pre-order it here: https://bookshop.org/books/code-the-hidden-language-of-computer-hardware-and-software-9780137909100/9780137909100 https://bookshop.org/books/code-the-hidden-language-of-compu... Its definitely a bit more more expensive (~$37 vs $32) than ordering it via links in post.
- AH4oFVbPT4f8 4y agoThank you for the link, I will be ordering it from here instead of Amazon
- ParetoOptimal 4y agoI will as well. I've also added this to my "alternatives to Amazon" list.
- runevault 4y agoI never did read this book, one of the bigger holes in my technology reading. I should use this as an excuse to finally pick it up and dive in, once the new edition arrives.
- the_watcher 4y agoI’m definitely going to buy the new edition and excitedly re-read it, but it would have been deeply enjoyable if the second edition _only_ updated itself to dark mode. Could have been one of the rare actually funny April Fools Day announcements.
- rramadass 4y agoHaving read (and own) Charles Petzold's Programming Windows, Code and The Annotated Turing books, i can unequivocally state that he is a Master of Technical Writing. No fluff, precise but detailed and straight to the point. Modern authors can learn more than a lesson or two from his style of writing. He needs to write more books, that is his Gift and Calling. PS: Andrew Tanenbaum's Structured Computer Organization makes a very good followup to Code.