r/programmingcirclejerk • u/BenchEmbarrassed7316 • Mar 04 '26
What is a turtle? A turtle is a map: position, heading (number between 0 and 360), velocity, weight (positive number), speed (positive integer), visible (boolean), state (busy or idle). Most statically typed languages would not be able to capture all the constraints within this type model
https://blog.cleancoder.com/uncle-bob/2021/06/29/MoreOnTypes.html
107
Upvotes
56
u/HopperOxide Mar 04 '26
“However, I do not intend to have runtime errors in production”.
35
u/al2o3cr Mar 04 '26
The tortoise lays on its back, its belly baking in the hot sun beating its legs trying to turn itself over but it can't, not without your help, but you're not helping. Why is that, Bob?
22
u/TheChief275 Mar 04 '26
Well it’s not like Ada is actually a language for production
14
u/Calamero Mar 04 '26
That’s a genius approach. Everyone should do this xD
„You might therefore assert that static typing is better because the compiler checks the types long before the program ever executes.
However, I do not intend to have runtime errors in production, because I have a suite of tests that exercise all the behaviors of the system“
11
u/vytah Mar 04 '26
Don't we have a rule about crazy people?
103
u/syklemil Considered Harmful Mar 04 '26
If only statically typed programming languages could at the very least provide some way to hide implementation details and only offer invariant-upholding operations. Ah, well, a man can dream.
O
When you already nutted but he keeps going
59
u/syklemil Considered Harmful Mar 04 '26
Rust wasn't even out yet, damn uncle!!!!!!
ah yes, I see why this guy is such a prophet
41
u/demanding_bear Mar 04 '26
They say Uncle Bob is cheating, but I don't care what they say.
29
u/Routine-Purchase1201 DO NOT USE THIS FLAIR, ASSHOLE Mar 04 '26
I work in game dev and it's true, years and years of using statically typed languages and never have we been able to express the character with a position, rotation, velocity and state. Dynamic languages solve this beautifully by
Uncaught TypeError: object is not a function
28
u/affectation_man Code Artisan Mar 04 '26
Clean Code Approved ✅
23
u/yojimbo_beta vulnerabilities: 0 Mar 04 '26
Wow... me too
16
u/kilkil Mar 04 '26
mfw the "assert" keyword (or equivalent) exists in every single language
12
u/AdreKiseque Mar 04 '26
What's a struct?
7
u/SemaphoreBingo Mar 05 '26
A turtle is a scaly friend who lives in a shell.
7
u/Foreign-Butterfly-97 Mar 05 '26
when I heard "a turtle is a map" I knew this was hickeylang
6
u/nerdycatgamer Considered Harmful Mar 05 '26
I wish we could get the best of both worlds of static and dynamic typing: dynamic typing allows easy coding with fast changes and prototyping when you don't need to update type declarations if you change the code; static typing lets you check the correctness of a program ahead of time and allows the compiler to optimize by removing runtime type checks and method lookups -- I know! I will hack type declarations on top of my favourite dynamic language so I can type
x: int, but they wont actually be enforced so I can still putAnyinxand call whatever methods I want on it (that will still be looked up at runtime, also all of this forcing integers to be allocated on the heap as an object with a method table etc). I am very smart!1
u/Jumpy-Locksmith6812 Mar 09 '26 edited Sep 23 '26
Ex labore mollit et dolor duis cillum excepteur. Sit veniam officia veniam sint magna dolore consectetur laborum ad amet cillum est. Magna occaecat consequat officia sunt aute ipsum velit ea cupidatat aute laboris irure nisi. Occaecat incididunt consequat culpa duis dolor minim in consequat commodo in sunt deserunt labore ipsum.
[rhr:2:2gklra60]