Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Human brain is two separate organs, Stanford Medicine-led research finds(stanford.edu ↗)
    8comments
  2. San Francisco Onion Futures Company(onionfutures.com ↗)
    47comments
  3. Android 17 is the first since 3.x to add new APIs without releasing to the AOSP(grapheneos.social ↗)
    361comments
  4. Typesafe-computer-use drives a Mac toward a goal for 1/50th of a cent per step(github.com/awlevin ↗)
    13comments
  5. SDCC – Small Device C Compiler(sourceforge.net ↗)
    14comments
  6. Science Is Open Software(jepedersen.dk ↗)
    25comments
  7. If math is more than proof, we need to better celebrate the rest of it(terrytao.wordpress.com ↗)
    discuss
  8. Cloudflare Quick Tunnels(cloudflare.com ↗)
    272comments
  9. Why building a Rust LSP is hard(rust-glancer.github.io ↗)
    20comments
  10. Saving another 100TB of RAM(cloudflare.com ↗)
    61comments
  11. How OpenAI Used Its Own LLMs to Design Its Jalapeño Chip(ieee.org ↗)
    76comments
  12. NASA-IBM Lunar Foundation open-Source Geospatial AI Model(usra.edu ↗)
    1comments
  13. How to Write with an LLM(sockpuppet.org ↗)
    312comments
  14. Ctenophores: Wonders of Biology(quantamagazine.org ↗)
    4comments
  15. You can run Git on object storage if you re-make packfiles(tigrisdata.com ↗)
    4comments
  16. Goroutine Leak Profiles(go.dev ↗)
    2comments
  17. The first new cat species discovered in 100 years(nationalgeographic.com ↗)
    90comments
  18. Show HN: Cactus Needle 3: 8-29MB automation models can match DeepSeek V4 Flash(cactuscompute.com ↗)
    85comments
  19. OpenJev(openjev.com ↗)
    257comments
  20. Photon-Emission-Guided Laser Fault Injection Enables RP2350 Secure Debug(ledger.com ↗)
    65comments
  21. The Farnese letter(simonklee.dk ↗)
    6comments
  22. Cache-to-Cache: Direct Semantic Communication Between LLMs (2025)(arxiv.org ↗)
    12comments
  23. Xcode 27.1 Beta Release Notes(developer.apple.com ↗)
    95comments
  24. Minimal Phone 2(minimalcompany.com ↗)
    208comments
  25. Cyclomatic Complexity in C#(ndepend.com ↗)
    17comments
  26. Inside ZCode: Silently uploading your Git history to the cloud(ferstar.org ↗)
    97comments
  27. Claude Code now reads AGENTS.md if there is no Claude.md(claude.com ↗)
    219comments
  28. Warez: The Infrastructure and Aesthetics of Piracy (2021)(archive.org ↗)
    46comments
  29. LispBM is a concurrent Lisp for microcontrollers with message passing(lispbm.com ↗)
    3comments
  30. Alibaba open-sources AI model that can detect cancer and nearly 150 conditions(scmp.com ↗)
    11comments

Paranoid Programming – Techniques for Constructing Robust Software [ps]

99 pointsby 9y agoftp.stratus.com
26 comments
9y agoHN ↗

This sounds interesting. Alas, I cannot read it right now, since my iPhone lacks native support for viewing PostScript files (something which macOS has.) If only there was a PDF or HTML version, or if my iPhone could display .ps (there probably is some app, I haven't looked.)

UPDATE: found a free web based service to convert it to PDF for me, docspal.com

9y agoHN ↗

It is quite interesting to look how some of those recommendations change in the industry over time (to a degree you can make such general statements). For example in Clean Code, Robert Martin argues against the idea of encoding type information into names (e.g., Hungarian notation suggested here) given that this can readily provided by IDE instead and enforced by strongly and static type system. Though, he _does_ recommend encoding information about arguments into function names.

It seems that this recommendation to a large degree is a reflection of tools used. Nowadays it wouldn't be completely unusual for an IDE to show formal parameter name along with actual argument values passed, thus obviating the need to encode this information into the function name in the first place.

Idea of robust data structures is very interesting. While storing additional information to detect potential misuse of API, like concurrent modification or iterator invalidation is common in other context, the idea of using it to correct the data structure is not the first thing that comes to mind.

9y agoHN ↗

And at the same time everyone in the JavaScript world is comfortable with using some hungarian-ish notation. $ is for jquery objects, Capitals are for classes, lowercase for instances, camelCase for methods and properties, UPPERCASE for constants, underscore_case for API values, snake-case for CSS classes. To name a few common conventions.

None of this is enforced at the tools level.

9y agoHN ↗

Hungarian notation IIRC is specifically a 1-char-prefix of an argument names indicating type, ie. `goToWork (bTrth, sTxt, iCnt)` -- ie to reinforce type expectations -- rather than such casing conventions..

http://foldoc.org/hungarian%20notation

9y agoHN ↗

Yes, that's more-or-less correct.

The prefix wouldn't necessarily be only a single character. For example, using a "p" prefix for pointer values was a common convention in Microsoft ecosystem projects where Hungarian notation was probably most popular. Thus a pointer-to-char (char*) parameter might be prefixed with "pc".

But yes, the fundamental idea was to convey information about the type of the variable as part of its name. That convention has mostly died out today, probably due to a combination of IDEs being used routinely in the ecosystem where the notation was most popular, and more recently due to modern languages having better type systems that enforce the rules objectively instead of relying on a convention.

Ironically, with the popularity of dynamically typed languages today, we sometimes seem to have regressed to a point where interfaces to functions aren't always clear, and lots of avoidable bugs creep in due to passing incorrect types of data around. The emphasis on rapid evolution and ad-hoc/organic design we see with a lot of "agile" development processes isn't always helpful either. Put those together, and you almost have the complete opposite of the systematic design and robust processes advocated in the slides here.

9y agoHN ↗

But yes, the fundamental idea was to convey information about the type of the variable as part of its name.

No.

There are two types of Hungarian Notation.

The original one ("apps hungarian"), which made sense and sometimes still makes sense. Here you would assign a meaning to a prefix. For example, if you're writing MS Word a variable named "sWidth" might be the width of something in pixels on the screen (s), while "pWidth" might be the same width, but in logical units (say pt) on the page. Then you could have a function ptos, and it's easy to see whether variables were used correctly in computations - you can't mix screen-space and page-space coordinates without conversion.

This made a lot of sense, because either variable would likely just be an "int".

Similarly in a Python Webapp one might write "us_name" where us means UnSanitized. So before passing that anywhere else you know you need to sanitize it. See a "us_" variable somewhere that isn't a call to a sanitizer? Probably a bug!

Then there's that other one, "system hungarian", which is the stupid thing everyone knows with stuff like lpcstrWindowName.

9y agoHN ↗

Actually it would be something like cxPixels and cxPoints with c meaning "count", x meaning "horizontal" and Pixels/Point being the actual unit. You can see several Windows structs having this naming convention (the simplest one being SIZE which simply contains cx and cy).

EDIT: people often see these as prefixes, but they are not really prefixes, the original paper was about the whole name.

9y agoHN ↗

All of your examples are still type information. They are more specific than the types provided by a basic C-style type system, but that's the point.

9y agoHN ↗

We can easily distinguish between the two by calling them units.

9y agoHN ↗

I knew that what you referred to as underscore_case was called snake_case so I had to find out what your "snake-case" (with dashes) is called. It's kebab case, or if the words are capitalized, train case.

sh-i-sh-k-eb-ab-----

I can see it!

Choo-Choo-Train

I can see it!

So, carry on...

9y agoHN ↗

Apple do this with their frameworks now with Swift 3, for these very reasons (strong typing + advanced IDE). There's no need to encode parameter names into the function definitions anymore, unless they're core data types.

So now you have stuff like:

view.convert(point, to: otherView)

Which in Swift 2 was:

view.convertPoint(point, toView: otherView)

9y agoHN ↗

It is quite interesting to look how some of those recommendations change in the industry over time [...]. For example in Clean Code, Robert Martin argues against the idea of [...]

Martin claimed in the very same book several ridiculous things (like not documenting short functions, which makes autogenerated documentation look awful; apparently Martin haven't ever used documentation generators before writing the book).

It's hard to take Martin's recommendations as coming from "the industry".

9y agoHN ↗

There's plenty one could reasonably criticise about Clean Code and some of Martin's other work, particularly in the context of building robust systems, but he is not wrong that Hungarian notation is mostly obsolete given modern programming languages and tool chains.

9y agoHN ↗

I agree. I found the "ideal" argument length of 0 (or I think 1) to be a bit ridiculous, though I was in the love affair period you have when you first start learning functional programming.

I read (see below) that the idea of Hungarian notation was bastardised. The idea wasn't to encode type information as such, not in the primitives type sense. It was more to encode meaning succinctly.

To use the example given, Position(x, y) is perfectly fine in Hungarian notation, because the variables tell us exactly what they are: the x and y coordinates as part of a point. The Hungarian notation we rip on would have us write Position(ix, iy).

With the tools and type systems today, yeah, it's obsolete in the truest sense. Interesting piece of history none the less. I guess the real usefulness is the idea of encoding verbose information that our current tools and language do not support. That sounds better than encoding a primitive.

https://blogs.msdn.microsoft.com/rick_schaut/2004/02/14/hung...

9y agoHN ↗

This is a fascinating set of slides, particularly when you think it was produced almost 20 years ago. A few of the ideas are slightly dated now as we've developed better tools and techniques to achieve the same ends, but most of the material is fundamentally sound and has stood the test of time.

For anyone who's only ever worked on projects where the emphasis is more on shipping something fast than shipping something correct, like most of the startups and web apps we discuss here on HN, these slides give a decent overview of the "alternate reality" when you're working on projects where reliability really matters and more of an engineering mindset is needed.

If nothing else, it's worth reading for the Ariane 501 case study on slides 19-22 that demonstrates just how expensive a simple programming error can be if you don't design your system defensively enough and do proper housekeeping on your code.

9y agoHN ↗

At page 7, in the table "Causes of outages", the numbers for "Fault tolerant systems" only add up to 90%, not 100% - don't know if the source “Dependable Computing: Concepts, Limits, Challenges,” by J. C. Laprie, FTCS-25. has the same error.

9y agoHN ↗

It's funny to see how well this has stood the test of time; these concepts are still perfectly valid today (although wuch is right that Hungarian has fallen out of favour.)

9y agoHN ↗

More than valid: much of it is implemented in both NonStop and Stratus servers with amazing levels of uptime. Been waiting forever for FOSS OS's to copy some of these techniques with a limited config of HW redundancy. Now you can even get inexpensive, PowerPC boards that support lockstep with 1+GHz processors. That's for embedded use.

9y agoHN ↗

Embedded and FLOSS appear to be rather different worlds, I'm afraid. There's a gcc toolchain running through both, but...

9y agoHN ↗

Well, yeah, but people do a lot with old computers, Rasp Pi's, etc. I guess I was thinking those crowds. Esp if it was a monitoring, backup, or authentication solution where uptime meant more than throughput.

9y agoHN ↗

There's also a research paradigm about mathematically derived programs.