News for hackers. Stuff that matters.

rramadass

Sure, go ahead and use my comment for your homepage, share it, extend it etc. See also my other comment with some more explanations - https://news.ycombinator.com/item?id=50326359

The stages in the above methodology should be expanded, which as i suggested, you can have AI do it for you. Note that you must be the "human-in-the-loop" and give the explicit go ahead after every stage i.e. checkpoint.

As part of your "Architectural Constraints", always list your specific libraries/frameworks/design patterns/code techniques that you are familiar with and want to be used while excluding everything else. For example you could say something like; "Do not use any design patterns outside of the GoF book", "Use <name> async framework only" etc. Guardrails are everything with AI.

The idea is that you should be able to read the generated code without too much difficulty.

Note that we are using DbC as one level of Formal Verification at runtime during development only. For verifying it statically we can have it mapped onto Lean4 (using tools) or to a SMT solver via SMT-LIB; see my comment here - https://news.ycombinator.com/item?id=50108112

See also; Combining Tests and Proofs with Contracts for Better Software Verification by Bertrand Meyer et al. - https://dl.acm.org/doi/10.1145/3793869

> The whole things kinda read as an idealistic and very wrong view of software engineering.

You have not correctly understood what i wrote.

The above is a battle-tested methodology based on experience/studies/trial-and-error and now being adapted to AI with extra tweaks. Labour which was the main bottleneck earlier is now cheap and hence we can afford to be "idealistic" since the tool is immensely powerful.

You need to expand and iterate each stage above (both individually and as a group with previous stages) in stepwise-refinement to get to what you want.

The rest of your comment is just generic platitudes and some common red herrings which i often see on HN, viz.

> main thing that drives it is the set of requirements...By analyzing the requirements,..But often requirements are evolving concepts.

Everybody just keeps parroting this without understanding. Requirements change but always in a staged manner and not willy-nilly. Hence there is always a window of time when your "Requirements Document" is frozen and you can implement a PoC/Prototype against it. The is the "naive" MVP i mention above. Later when requirements change you reiterate and regenerate your prototype and continue.

Note that the gp already had his UML design and only wanted a way to convert it to code. Hence i did not discuss requirements gathering and analysis here. Nonetheless, i had discussed this earlier in some previous comments - https://news.ycombinator.com/item?id=48274873 https://news.ycombinator.com/item?id=48264680

> Platform...libraries...frameworks...design patterns...

These are all covered under (1.c) above where you explicitly list out what to use and what not to use. These are all part of the "architectural constraints".

> So what's left then is the assembly...So you don't want your structure (architecture) to be that rigid. You can't really know the direction of evolution, so you try to predict it in some way and add flexibility in a few places. This is more an art, but there are general techniques that works well enough.

This is covered under (1) above where i enforce rigid adherence to "modularity" and "separation of concerns" by making each module's public interface narrow and extensible (eg. ioctl like) and its parameters future-proof by using versioned struct/class inheritance (eg. sockaddr). These are all well-known code patterns used in OS implementations/libraries.

> The assembly itself is a matter of data and process. How each module is initialized, its lifecycle, which data it consumes, which data it produces.

This is taken care of by having modules follow the LKM model with ioctl interface as explained above.

> Programming concepts like type checking, memory safety, paradigms (oop, functional, relational,...), formal verification,... are all about data. Code always come in second place. So think hard about your data and its transformation.

DbC methodology is the quintessential "data-driven" programming since the pre/post/inv are predicates to establish sets of data values on which the subsequent code can operate safely i.e. DbC establishes the data path for the code.

Your problem is that you have not established "guardrails" for the AI and so it goes off and tries to do everything it can to help you (its default persona is "people pleaser").

AI understands "negative constraints" very well and so you should explicitly tell it "what not to do" at every stage as much as possible.

Use Top-Down and Stepwise-Refinement methodology to first generate the "Interface" and then the "Implementation" like so;

1) Ask it to produce only the "Skeleton App with well-defined Interfaces" directly 1:1 from the UML with stubs/mocks. It maybe better to use UML in text form which will allow you to annotate it easily with hints/notes for AI. The "Skeleton App" should include a) System Modules with narrow public interfaces like LKM/ioctl b) Directory structure with one module per subdirectory as a DAG with no cycles c) Explicit list of third-party libraries/frameworks to be used d) Classes/Abstract/Interfaces e) Free Functions and Class Methods with full type signatures etc.

2) Check the above and iterate until you have the UML and generated code synced up at the sufficient level of detail of Interfaces you are comfortable with. This should be compilable and is your absolute baseline which cannot be changed until you get a functional MVP.

3) Using the above skeleton, with strictly no change to any interfaces, ask it to fill in only the implementations the simplest possible way (i.e. "naive" linear, brute force etc.) with no optimizations whatsoever. Here you explicitly ask it to add runtime assertions for preconditions/postconditions/invariants. Make explicit that assertions should not have any side-effects whatsoever. This should now compile to give you the "naive" MVP.

4) Generate comprehensive test suites and test the above.

5) Now have it optimize everything, without changing the interfaces and assertions, but honouring them strictly. Compile and test against the above test suites. This should give you the "optimized" MVP.

6) Once the above passes, if performance is critical, have it comment out all assertions except "preconditions"; leave this in always. This is the minimal "sanity check".

7) Finally, for every "usecase" (i.e. feature) in the UML, have it generate the control flow graph annotated with preconditions/postconditions/invariants (which form the specification) individually one per usecase. This is your "whitebox" verification documentation to make sure the implementation call graph satisfies the usecase i.e. feature specification.

Note that the above process gives you two implementations viz. the "naive" one and the "optimized" one. It is very helpful to always keep it that way as you modify/add features going forward so you can check one against the other.

You could use the same process using a textual Requirements Document etc. instead of UML. Also, if needed you can have AI generate the UML from the requirements, so you have a graphical specification of the system too.

This is the "Correctness-by-Construction" (CbC) approach using "Design-by-Contract" (DbC) methodology.

Additionally, If you generate for a strongly-typed language you can ask AI to explicitly exploit the type system fully with an eye to proving the code correct by suitable use of dependent types etc. to establish constraints for code correctness in step-1 itself as part of the interface. This is "Type-Driven Design". However, this is somewhat advanced and hence only do this if you have a good grasp of the implementation language since AI will try to be too clever and implement "typing hijinks" which can make the code incomprehensible.

Think of it as how you used wizards in older IDEs (Visual Studio MFC etc.) to first generate default skeleton app code with stubs/mocks, got it to compile and then started adding your code to it with testing and verifying at every stage. You want AI to behave in such a deterministic manner.

PS: To get started, feed my comment to AI and have it generate the necessary prompts for your AI interface ;-)

Very Interesting!

Do you have a detailed paper/article written on this?

> I think the royal combo is Lean 4/TLA+/etc. plus AI plus a deterministic generator. For large systems formal method assertions need to be compressed down to a human comprehensible size. This can happen when the assertions are confirming the accuracy of a model and its attached code generators. The generator can generate proofs of the generated code and a human only needs to ensure that the generator provably generates the correct mass scale assertions.

This is not completely clear; would you mind elaborating on that in more detail?

Re:I DO Understand Relativity on Saturday October 31, 2026 @12:14PM (#50317471)
Both of you are right in slightly different senses.

There is no "global time clock" and hence in a philosophical sense there is no "common now".

However, the speed of light is constant in the universe and so you can calculate time based on distance traveled by light to you provided you are not moving at speeds comparable to speed of light. This means you can suppose a "common lightyear clock" for measurement.

But when the speeds are comparable to that of light, you have time dilation and length contraction and so even the "common lightyear clock" is invalid. This is the principle of "Relativity of Simultaneity".

The way to think about it is, Events happen in a Space-Time fabric and so in order to measure the interval between two events you have to consider both Space and Time w.r.t. object speed vs. speed of light. The universal invariant here is the "Space-Time Interval" between two events which will be the same for everybody whatever be their mass or speed.

Mandatory Background:

1) Understanding Formal Methods by Jean-Francois Monin - This is the absolute best for getting a grip on the breadth, concepts and sample tools for Formal Mathematics/Specification/Verification. Fire-hose of information (not a step-by-step textbook) so use this as a map for everything "Formal". The S/N ratio is very high (~250 pages only!) so use AI/Textbooks to help explain concepts you find difficult to understand.

Practical:

1) Software Abstractions: Logic, Language, and Analysis by Daniel Jackson - Uses "Alloy" language to teach Structural (i.e. Data) Modeling.

2) Specifying Systems: The TLA+ Language and Tools for Hardware and Software Engineers by Leslie Lamport - Uses "TLA+" language to teach Behavioural (i.e. State Machine) modeling.

The above two are for "System Modeling" i.e. everything needed to formally build complete systems.

3) Finally, You should also look at the bunch of free books on the Lean4 website which can be studied parallely for "code-level" proofs and verification.

PS: There are a few more (eg. Event-B method etc.) but you can get to those if/when you need to.

From https://www.cs.utexas.edu/~EWD/transcriptions/EWD12xx/EWD123...

    Here, the noun "elegance" should be understood in the       sense of the second meaning of "elegant", as given in the Concise Oxford Dictionary (6th Edition, 1976): "ingeniously simple and effective".

    we shall stress that in sophisticated designs, elegance is not a dispensable luxury, but a factor that often decides between success and failure.
Everyone playing around with AI today, needs to read, understand, reflect and assimilate the advice given in EWD619 ;-)

    I also observe a widespread underestimation of what can be achieved by thinking properly, and sometimes an unwillingness to admit that, for certain goals, proper thinking is an indispensable prerequisite, an unwillingness of which a sad waste of effort, and ultimately, undeniable failure are the certain results.

    I regard the obvious consequences of these attitudes and assumptions as regrettable. We have surrounded ourselves by arteifacts of needlessly clumsy designs, which make them cumbersome to develop and to maintain, and dangerous to rely upon; nevertheless they are relied upon, partly because we have the feeling that we have no choice, partly --and that is where I protest-- their imperfections have been raised to the status of a Law of Nature. Secondly we observe --mainly, but not exclusively, under the auspices of that branch of human activity and aspiration called "Artificial Intelligence"-- a great amount of research and development effort spent on trying to reduce the need for (what I am now forced to call) Natural Intelligence; I have reasons to expect these efforts to be in vain. Thirdly, we see our educational systems affected: they are getting geared to "Otto Normalverbraucher" [trans. Average Person] to the extent that it is now regarded as an indecency to require from a university graduate that he expresses himself adequately.
The rise of "Artificial Intelligence" today does not preclude the necessity of training our "Natural Intelligence" to think clearly and simply i.e. elegantly, in our problem-solving endeavours. None of the bazillion tools/techniques/methodologies (eg. crazy agentic loops, humongous prompt chaining, bloated codebases etc.) hoisted upon us to interface with AI is a substitute for thinking. If anything, simplicity, precision, formal methods, managed abstractions, separation of concerns are more vital today in the age of AI.
Re:The Great American Rascal: Tom Sawyer at 150 on Saturday October 31, 2026 @12:57AM (#50313336)
Yep, i have read versions of this story earlier, i think in one of the martial arts tales books by Pascal Fauliot.

PS: My HN handle is based on my real name and not because i am a follower of "Ram Dass" (American) ;-)

Re:The Great American Rascal: Tom Sawyer at 150 on Saturday October 31, 2026 @12:25AM (#50313204)
The frenchman line does not occur in other editions of this essay. This is the only place i have seen it.

The essay itself is highly thought-provoking and an evisceration of Mankind. I especially like his indictment of "Moral Sense";

One is obliged to concede that in true loftiness of character, Man cannot claim to approach even the meanest of the Higher Animals. It is plain that he is constitutionally incapable of approaching that altitude; that he is constitutionally afflicted with a Defect which must make such approach forever impossible, for it is manifest that this defect is permanent in him, indestructible, ineradicable.

I find this Defect to be the Moral Sense. He is the only animal that has it. It is the secret of his degradation. It is the quality which enables him to do wrong. It has no other office. It is incapable of performing any other function. It could never have been intended to perform any other. Without it, man could do no wrong. He would rise at once to the level of the Higher Animals.

Since the Moral Sense has but the one office, the one capacity -- to enable man to do wrong – it is plainly without value to him. It is as valueless to him as is disease. In fact, it manifestly is a disease.

The Moral Sense enables a man to do wrong. It enables him to do wrong in a thousand ways. Rabies is an innocent disease, compared to the Moral Sense. No one, then, can be the better man for having the Moral Sense. What now, do we find the Primal Curse to have been? Plainly what it was in the beginning: the infliction upon man of the Moral Sense; the ability to distinguish good from evil; and with it, necessarily, the ability to do evil; for there can be no evil act without the presence of consciousness of it in the doer of it.

The point is that moral sense enables one to distinguish right from wrong and so when you do wrong to others you are fully conscious of the suffering it causes. And yet mankind does it in a thousand different ways.

The main reason is the insane levels of pollution in Indian urban centers which is literally in your face everywhere. Hence everybody is very much conscious of EV adoption (a necessity) and are transitioning to them as soon as they are available and affordable.

If the Chinese and Indian govts. sort out their differences allowing their EV companies to better share technologies and production, thus bringing prices down drastically, the entire planet's environment will be changed!.

The US/Europe are being absolutely moronic when it comes to EV vehicles.

Their core technology (batteries, inverters, electric motors, drive trains, thermal management, software etc.) are all pretty similar (not too much essential variation) across brands and hence the main differentiator becomes price and cosmetics.

In the developing world cost is king, you don't need too much power, smaller size, maneuverability and comfort are the key parameters. Their EV market is for the taking and China is doing it easily with US/Europe not even in the race.

Re:Simon Tatham: I often find typos cognitively fascinating on Friday October 30, 2026 @08:58AM (#50303240)
An offbeat comment.

But this leads us to consider the Neuroscience/Cognitive effects of Typing by itself which is quite relevant today. More people type (Keyboard/Tablet/Smartphone) than write nowadays.

A Google search brought up a few studies;

1) Functional and cognitive correlates of typing speed in a large U.S. panel study - https://www.nature.com/articles/s41598-026-36500-7

2) Typing expertise in a large student population - https://link.springer.com/article/10.1186/s41235-022-00424-3

3) The Neuroscience Behind Writing: Handwriting vs. Typing—Who Wins the Battle? - https://pmc.ncbi.nlm.nih.gov/articles/PMC11943480/

4) Using Typing to Decode Language Production - https://www.cmu.edu/dietrich/psychology/news/2019/nozar-typi...

W.r.t. typos, from (4) above;

Interestingly, they found that typing errors were not just a result of clumsy fingers slipping on the keys. No. According to Nozari, the errors were similar to errors in speech production. Mistyping was akin to misspeaking. Instead of saying ‘red bag,’ you say “bed rag,” switching the first sounds of the words. Many typing errors are very similar, switching the ‘r’ and the ‘b,’ which are not next to each other on the keyboard.

Re:The Great American Rascal: Tom Sawyer at 150 on Friday October 30, 2026 @01:58AM (#50300339)
People who are exposed to Mark Twain only through Tom Sawyer/Huck Finn/A Connecticut Yankee/etc. works usually think of him as a "fun" author.

But he had one of the most incisive and intellectual minds of his times, which was biting in its criticisms/satire of American and the larger Human civilization. Everybody (but Americans especially) should read his set of essays titled; On The Damned Human Race for edification.

I often wonder what he would think of current-day American society and so-called democracy. He actually coined the term "Gilded Age" to highlight the covering of everything rotten/corrupt with a superficial sheen so as to sell it to the masses. If that doesn't describe today's society i don't know what does.

Read, The Lowest Animal (aka The Damned Human Race) by Mark Twain - https://www.thoughtco.com/the-lowest-animal-by-mark-twain-16...

And so I find that we have descended and degenerated, from some far ancestor (some microscopic atom wandering at its pleasure between the mighty horizons of a drop of water perchance) insect by insect, animal by animal, reptile by reptile, down the long highway of smirchless innocence, till we have reached the bottom stage of development – nameable as the Human Being. Below us – nothing.

Re:The Great American Rascal: Tom Sawyer at 150 on Friday October 30, 2026 @01:26AM (#50300156)
Ha, Ha!

You will love then Poe's essay on the "theory and practice of scams" titled; Diddling Considered as One of the Exact Sciences - https://www.eapoe.org/works/tales/diddlnga.htm

Re:Tell HN: The Amount of Irrelevant Content on Here Is Insane on Thursday October 29, 2026 @06:56PM (#50297410)
The first rule for anybody on any social network is to decide for themselves how much they want to adhere to the following maxim;

"Better mad with the crowd than sane all alone".

-- Aphorism 133, "The Pocket Oracle and Art of Prudence" by Baltasar Gracian trans. Jeremy Robbins.

Re:What Happened to the Neanderthals? on Thursday October 29, 2026 @06:21PM (#50297027)
Wrong assumptions and reasoning on your part.

My comments are to do with highlighting the different unique narratives (w.r.t. Human/Other beings) in Sanskrit literature which are self-consistent within that corpus. It is just a fact (of History and Geography) that it is only found in Hindu (and Buddhist/etc. derivative) cultures to a very large extent. Cultural Anthropologists/Archaeologists/Geomythologists nowadays do study these independent of its religiosity as "Deep Time" oral traditions/histories to better understand our own evolution and history. Hence it is not a question of accepting them blindly so much as expanding and exploring the range of possibilities of our own histories.

Re:Why Birds Can Fly over Mount Everest on Thursday October 29, 2026 @11:12AM (#50290381)
There are two air sacs viz. Anterior and Posterior with the Lungs in-between. During Inhalation, part of the air goes to lungs (pushing stale air to anterior sacs) and the other part is stored in the posterior sacs. During Exhalation fresh air from posterior sacs is moved to lungs while stale air from anterior sacs is breathed out. This is the efficient unidirectional respiratory flow which allows the lungs to get oxygen continuously during both inhalation and exhalation.

See the explanation and diagram here; How Air Sacs Power Lungs in Birds’ Respiratory System - https://asknature.org/strategy/respiratory-system-facilitate...

Re:Spiders Spin 'Silk Dope' into Nature's Toughest Material on Thursday October 29, 2026 @06:45AM (#50287003)
Also see Veritasium's excellent episode, Is Spider Web really stronger than Steel? - https://www.youtube.com/watch?v=wt4p2oalmRY

It features a company with a cool technique where Spider Silk DNA is inserted into Silkworm's DNA so you can easily farm them.

Re:What Happened to the Neanderthals? on Thursday October 29, 2026 @05:03AM (#50286275)
I meant that your use of the phrase "real old stuff should be found, in some form, in other cultures" is not necessarily true. Much of the commonality is based on linguistic studies only and does not include other cultural aspects.

The more important point is that once the cultures diverged into different geographies, they came into contact with other cultures with their own realities/stories which were incorporated into Sanskrit literature and handed down orally while a similar thing did not happen with the others to the same extent.

Re:What Happened to the Neanderthals? on Thursday October 29, 2026 @01:14AM (#50284814)
> But it's implausible for all kinds of basic reasons...Until you realize that "very long ago" by the standards of hindu myth are wildly different than "very long ago" by the standards of hominid species

No, that is just ignorance.

There is enough specificity and detail in Sanskrit literature to easily refute this. See this comment of mine for details - https://news.ycombinator.com/item?id=50284725

Re:What Happened to the Neanderthals? on Thursday October 29, 2026 @01:10AM (#50284793)
Quite Interesting.

In the documentary "The Journey of Man: A Genetic Odyssey", they say that the Aborigines are the survivors of the very first migration out of Africa. They went through the middle-east, moved through South India and thence to Australia and hence have DNA links to some South Indians/Sri Lankans.

Because they were isolated from the latter migrations, they have preserved much of the "true" Human archaeological history in their oral (and other) narratives. Anthropologists call this "Deep Time" oral histories.

Re:What Happened to the Neanderthals? on Thursday October 29, 2026 @12:56AM (#50284725)
No, you are wrongly conflating the date ascribed to a version of a text (speculation based mostly on linguistic studies) with the events described in the text itself which predate it by aeons.

The Itihasas/Puranas talk about vast time scales populated by different beings with different lifespan lengths in a very specific and detailed manner. It contains both cosmic and civilizational histories all bound together in a single multi-branched narrative. Hence it is a very unique historical corpus from which much can be gleaned and mapped against modern studies.

Some resources:

Hindu units of time - https://en.wikipedia.org/wiki/Hindu_units_of_time

Yuga cycle - https://en.wikipedia.org/wiki/Yuga_cycle

As an example, The events in the Ramayana are dated towards the end of "Treta Yuga" but the text itself mentions a very long list of continuous lineage before coming to Rama. Look up "Treta Yuga" in the above pages and you can see how far back this particular narrative goes; you could calculate it as; "length of dvapara yuga + length of kali yuga to current date" and it comes to >800,000 years into the past!. Now add the lineages mentioned in the text itself and you go even longer into the past.

The interesting thing is that each of those timelines have some sort of Human/other beings in it!

Re:Tell HN: The Amount of Irrelevant Content on Here Is Insane on Thursday October 29, 2026 @12:20AM (#50284528)
Oh, I am sure the HN mods already have some sort of analytics and inferencing going on with some resultant policy implementations also in place. That is their job ;-)

But because of their "business model", they seem to care now only about retaining a critical mass of users (over everything else), nevermind that a large percentage of them are just worthless bots/shills/propagandists/etc. This is the poison pill for all social networks.

Basically, they have given up on their initial slogan of "news for hackers" and have now become a catch-all bucket with a heavy emphasis on everything AI which is rather a shame.

Re:What Happened to the Neanderthals? on Wednesday October 28, 2026 @04:41AM (#50270725)
You are mixing up a lot of timelines (mostly in AD) and hence not a good comparison.

I am talking about records from 5000-7000BC (deducing from Sanskrit literature) by which time they had already been orally transmitted for eons. So they are truly ancient with layers upon layers of grafting of realities/myths/stories over time.

Older »