We spend roughly 10x as much time reading code as we do writing it. A tool or technique that makes you twice as "productive" at writing code *at best* makes you 5% more productive over all. Making your code easier to understand will have 10x the impact. But that doesn't sell tools or put developers out of work, so you won't be reading about it in Forbes.
"But Jason, we can get ChatGPT to explain the code to us". Oh really?
@jasongorman Obviously ChatGPT is a master of stating the bleedin’ obvious.
@thirstybear That's the thing: if it doesn't have the information, it can't generate an explanation. It excels at explaining code that's easy to understand. The real selling point is brownie points for comments. Like at university.
@jasongorman Yes, but I have worked with (senior) developers who commented their code just like that 😁
@thirstybear Readability Theatre

@jasongorman @thirstybear Well, I have worked with "developers" that needed the comments because they somehow were such great developers that they have issues reading simple statements.

But yes, perhaps we should not try to orientate us by the worst cases of commercial software engineering that we've seen. That can cause depression.

@jasongorman @thirstybear
This thought example about the Thai national library (as training data, without books with non-Thai text or images) illustrates it perfectly:

https://medium.com/@emilymenonbender/thought-experiment-in-the-national-library-of-thailand-f2bf761a8a83

Basically no chance that you'll learn Thai, the language, the meaning from the dead books, even the massive corpus will not help.

You might learn how a reasonable Thai text look.

@jasongorman @thirstybear

So if somebody submits some Thai text to you (say a question, but you wouldn't know, obviously, you know how Thai looks, but you have no idea what it means), you might be able to continue it.

But not understand if you just answered, “sure, one big fries coming up with your burger, sir” or “sure I did murder that family, I confess”.

So the idea that a LLM is capable of explaining your code to you, anthropomorphizing at its worst.

No it's not your coding buddy.

@jasongorman classy comments there 😉

@julian It's actually one of the refuctorings in my Waterfall 2006 presentation: "Stating The Bleeding Obvious"

https://www.waterfall2006.com/gorman.html

Waterfall 2006 - International Conference on Sequential Development

@jasongorman clearly far ahead of your time - the amount that has been invested to make a machine be that bad!!
@julian It's a $multi-billion intern
@jasongorman this is a perfect example of how not to write comments. Brilliant. 🤩
ChatGPT explains exactly zilch...as expected.
@mforester TBF, if the information is there, it can explain the code. Basically, it can explain code that's easy to understand.
@jasongorman I'll give it that, but it really depends on what you define as *explaining* the code.
I saw that technically all observations were correct, but none of them are helpful. If I'd ask real intelligence (a.k.a. a person), they'd (hopefully) explain the function in more broad strokes and go deeper and deeper until I understand what I need. 🙂

@jasongorman
Ok, repeat slowly after me:

LLM DO NOT UNDERSTAND ANYTHING.

LLM predict (based on their training data) what's the most likely next token, that would also happen in the training data.
(Yes you can express what ChatGPT does in formal Statistics formula, but then somehow about 98% of humanity runs crying for help when you show them.)

GPT-4: The Emperor Has No Mind

YouTube
@jasongorman that it doesn’t sell tools I’m not so sure. A tool that would help me ensure readable code, however that would work, I would find a very interesting proposition
@flq We might be waiting a while for that 🙂

@jasongorman @flq I do not think we have to. We have a pretty good research into this the past like... 4 or 5 decades? In the ML community in particular but not only.

Ofc the problem is that bringing that to mass use needs a lot more "UX" work that we definitely do not fund.

But stuff like Rust definitely makes the C stuff more readable. Swift also made things more readable compared to ObjC

@flq @jasongorman There are attempts. Rubocop thinks it does that, for instance.

I haven't found them to be very useful, but my opinion is far from universal.

@flq @jasongorman coders writing and marking up / documenting good code from the start? :P
@flq @jasongorman That's a large part of why #python is our preferred development language. I've given salespeople snippets of code to explain behavior in the past, and they understand it.
@jasongorman I hate to say it (because I very much dislike the LLM/AI hype), but ... they're surprisingly good at answering questions about code one shows them too. Not perfect, but they can provide inspiration and places to start looking.
(If one knows how to ask a question, obvs.)
@larsmb I'm not so sure about that ;-)
@jasongorman That's not what I meant. But you can feed, say, ChatGPT a code snippet and ask it to explain at an abstract level what the function does, or, say, why it fails if n == 0 or some such.
It is quite mind-blowing that this does often result in somewhat useful feedback.
I don't think it will replace programmers at all, but it is becoming a tool in the box.
(I dislike code generation via LLMs because I have severe ethical concerns.)
@jasongorman was having this discussion with someone yesterday because they had a tonne of nested functions. Would be more understandable if they broke it out into several steps… “but it works as it is” 🤷🏼‍♂️

@jasongorman

What concerns me is that by producing 10x as much code, the 5% savings will be completely overwhelmed by increasing your *maintenance* workload by 900%.

@jasongorman It just occurred to me when a programmer takes the clear ideas in their head and creates code with bad variable names and function names that a lossy transformation is taking place. It is not possible for a person or an LLM to subsequently offset that loss by processing the code. The information has been lost.
@_KevinTrainor @jasongorman
The real question is: If the programmer didn't express themselves properly in their code, were the ideas really "clear" or was the programmer just delusional?
@jasongorman It does sell new “paradigms” and languages of course, and they in turn sell tools. But it's been a while since the last hype…

@jasongorman

do you have a citation to the 10x reading code thingie? that would be cool to share with colleagues

@jasongorman i personally spend 95% of my time shouting and shaking my fist at code
@jasongorman Amdahl's law applied to programming
@jasongorman I may have been writing about this stuff a bit lately... https://hachyderm.io/@Di4na/110431524694102577
Thomas Depierre (@[email protected])

I keep having to explain to people that building powerful developer tooling (from programming languages to ide plugins) is mainly hampered by the broken economics of the field. So I wrote down a summary of these economics from my pov, hoping it helps inform the discussion and spurn some actions. Let me know how wrong I am ;) This is not exactly about #opensource, but it is adjacent to it. https://www.softwaremaxims.com/blog/economics-developer-tools

Hachyderm.io
@jasongorman and then there’s comprehension: stop writing code, stop being able to _write_ good code, start getting a lot worse at picking up or repairing bad code either.

@jasongorman "We spend roughly 10x as much time reading code as we do writing it."

Interesting! Is that based on empirical data? I had not looked at it this way.

@guusdk @jasongorman I was going to ask the same thing. I'm really not sure this is true, it certainly doesn't "feel" true, unless you count reading the code you are actively writing. Certainly this depends on the kind of project.
@aesthetikx @guusdk Record yourself "coding" for a day on a production system
@jasongorman there's some maths missing here. If I double my writing rate then I double the amount I have to read, so I become 90% worse overall not 5% better.
@leeg Bingo!
@jasongorman @leeg Yeah. Our job is not to write code. Code in itself is not an asset. Code is a liability we take on in order to solve business problems.
@leeg @jasongorman Kind of logic and revelation which reminds me of the various explainations about why you should avoid writing clever code, for example:
>Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
— Brian W. Kernighan and P. J. Plauger in The Elements of Programming Style.
ExplainDev | Code explainer that answers your questions in context

ExplainDev helps you to be more confident and independent with others' code. Get code explanations and direct answers to your questions via Chrome and VS Code extensions powered by AI.

@jasongorman Maintainability was item 1C in the Steelman language requirements¹, out of which the Ada language came: “The language should promote ease of program maintenance. It should emphasize program readability. The language should encourage user documentation of programs.”

This is an excerpt from the first Ada Language Reference Manual.

__
¹ https://dwheeler.com/steelman/steelman.htm#1C

Steelman

Steelman, the requirements document for Ada