In a social gathering, someone (a music/visual art...
# thinking-together
s
In a social gathering, someone (a music/visual artist) asked me the following:
When you see a working application, can you tell how the code is written and organized?
What do you think?
a
Nope.
Every programmer but me makes weird, inscrutable choices.
šŸ˜„ 5
d
When it behaves exactly as you expect (after coming to understand how it works, if it's not immediately obvious), then the code will in some way be 1:1 with the user mental model (bearing in mind that there may be many ways to express that same model). For example, you'll find code (or a refactoring if the equivalent code) that reads like "Money transfer is: select a source account, a destination account, and an amount, decrease the source account by that amount, increase the destination account by that amount. This must succeed or fail as a single transaction". Only when there is a mismatch between the user mental model and the programmer's mental model, does software do things you don't expect and perhaps cannot understand (talking about designed behavior, not bugs and technical limitations). Ever find yourself having to figure out what the heck the program is thinking, because it's obviously not what you are thinking? For example, pick your favorite WTF moment from almost any document editor.
šŸ‘ 1
a
I think that the ā€œmultiple ways to express that same modelā€ part was the point, though. Like, how code is organized is often an aesthetic choice that doesn’t affect execution. As for how it’s written, maybe you can tell which sort someone is using with enough measurement of proportional and constant factors, but can you tell whether they used jQuery or React to display the results?
d
On that point, no, you cannot tell. BUT if weird behavior is the undertone of everything, you can bet it's organized in terms of the wrong abstractions (i.e. it's not actually/properly modeling the thing it's supposed to model). Otherwise, there might be certain behaviors or visual cues that certain frameworks or libraries are known for. I don't think that applies to jQuery so much, because most of those events like dragging, sliding, etc. can be exactly modeled from scratch. I think Bootstrap has some recognizable UI features ... but you might say the same thing if that, too. It's hard to say with anything that depends on HTML + CSS
a
True, there are definitely hallmarks. Anybody can tell a desktop app written in Java, or a GTK app running in KDE. šŸ˜›
That'd be a fun thread: most egregious implementation details exposed via the UI.
šŸ‘ 1
k
For several years now I've been saying that software is in a pre-literate state: https://www.reddit.com/r/programming/comments/63zg6f/what_unpopular_opinions_do_you_have_about/dfylg58
a
Related via this caveat to your comment in one of the replies? "I think I only have to be familiar with the problem being nsolved in the context it's being solved. Namely I can read someone else code as long as I have a pretty good idea on how to solve the same instance of the same problem."
s
I was thinking about this in terms of how we can do 'Inspect element' on an HTML page and see the underlying source. Why can't we keep doing 'inspect' repeatedly and get closer to the parts of code that generate the element?
šŸ‘ 4
w
If I remember rightly, Racket has a way to examine macro expansion in a stepwise fashion.