News for hackers. Stuff that matters.
Re:Think in Math, Write in Code by braythwayt on Thursday July 18, 2019 @06:25AM (#20468396)
Writing a lot of code you later discard because it isn’t part of the final solution is like throwing clay on the table and then carving away the bits that don’t fit.

Nobody criticizes the sculptor for the clay that ends up on the floor, and clay is heavy. We carve away bits, they have no mass and don’t need to be swept up, all we have to do is cut them away, revealing the final program.

Re:Think in Math, Write in Code by sidlls on Thursday July 18, 2019 @08:48AM (#20469182)
On the other hand the sculptor has considered the type of clay, the quantity, the tools she'd need to use to carve away those bits, and understands enough about what she wants to create to know what bits to carve away first.

Programming may not be (all) math, but it's not art, either.

Re:Think in Math, Write in Code by hutzlibu on Thursday July 18, 2019 @10:11AM (#20469938)
"Programming may not be (all) math, but it's not art, either."

Huh? Maybe the kind of common 8-5 office programming around buisness logic is not, but to design any bigger project is definitely art.

Re:Think in Math, Write in Code by seanmcdirmid on Thursday July 18, 2019 @12:13PM (#20471299)
Math can be considered an art, though not a fine art. Programming by either extension is an art (though again, not a fine art).

https://en.m.wikipedia.org/wiki/Mathematics_and_art

Re:Think in Math, Write in Code by j88439h84 on Thursday July 18, 2019 @01:18PM (#20471949)
I don't see why it couldn't be a fine art.
Re:Think in Math, Write in Code by seanmcdirmid on Thursday July 18, 2019 @01:40PM (#20472170)
Perhaps it could be practiced as part of a fine art, but like carpentry, programming itself isn’t.
Re:Think in Math, Write in Code by thaumasiotes on Thursday July 18, 2019 @02:58PM (#20472915)
> Writing a lot of code you later discard because it isn’t part of the final solution is like throwing clay on the table and then carving away the bits that don’t fit.

How do you make a statue of an elephant?

Re:Think in Math, Write in Code by Gravityloss on Thursday July 18, 2019 @06:50AM (#20468503)
Planning for realistic levels of waste. Throwing away prototypes. Gradually making changes. Keeping backwards compatibility. Testing. Accommodating users with large collective investment in learning.
Re:Think in Math, Write in Code by mannykannot on Thursday July 18, 2019 @08:38AM (#20469109)
This is not a useful analogy; it is more of an excuse for not trying to think things through. Would this be a reasonable analogy for building a bridge?

If you don't have a reasonably detailed idea of what you want and how to achieve it, you are unlikely to get it.

https://dilbert.com/strip/1991-9-6

Re:Think in Math, Write in Code by zbentley on Thursday July 18, 2019 @09:30AM (#20469552)
> Would this be a reasonable analogy for building a bridge?

That is also a useless analogy. Do bridge builders get to test and re-test their bridges in the real, non-simulated world? Can they instantly make a copy of their bridge with a few critical differences and see how the two behave? Can they re-build their bridge in minutes?

Metaphors aside, I think history is ample evidence that "coding your way around a problem" rather than conceptualizing a solution first is a perfectly valid way to approach professional programming. It's not the only way, and it has drawbacks which others have pointed out here. So does the conceptualize-first approach: you might solve the wrong problem, make something inelastic in the face of changing requirements, or fall into the psychological trap of being attached to your mental model even when it turns out that you really didn't think of everything and have to make changes on the fly.

I'm really tired of people being dogmatic about either approach ("move fast and break things/pivot; anyone else isn't really interested in getting stuff done!", "you're just a messy code monkey unless you can hold the solution in your head before you start!"). It's almost always veiled arrogance rather than honest improvement-seeking, in my experience.

Re:Think in Math, Write in Code by mannykannot on Thursday July 18, 2019 @09:56AM (#20469790)
Well, yes, it is a useless analogy... Oh, you meant to say that comparing bridge-building to software development would be a useless analogy? It's not an analogy I made - the point is that just because you can make a cute analogy, it doesn't mean it offers any insight.

> I'm really tired of people being dogmatic about either approach

Exactly - and the implication that I am being dogmatic is a straw man. I am simply opposed to arguments that depend on poor analogies.

Furthermore, all of the bad things that you say can happen if you try to think ahead are as least as likely to happen if you don't, and especially if you have gone in the wrong direction for some time (I know the latter is a manifestation of the sunk-cost fallacy, but it happens a lot on real projects.)

Re:Think in Math, Write in Code by rowanG077 on Thursday July 18, 2019 @09:26AM (#20469500)
Building software is not even remotely the same thing as building a bridge. It would be more akin to the architect creating the drawings twice for the bridge. Once as an exploratory version and the second one the production version.

Oh wait that is actually how architects work. In fact at my work we have multiple CAD designers(not architects though) and it's not uncommon for them to completely throw away a design and start over. I think code should be mostly the same.

Re:Think in Math, Write in Code by 0x445442 on Thursday July 18, 2019 @09:56AM (#20469793)
I'll bet the engineering process of the software written for the Apollo 11 lunar lander was much closer to the bridge building process than you might think. I'll also bet there's a whole host of software projects which use similar processes today. It's just that most of us writing DB skins for "The Enterprise" are rarely, if ever exposed to real engineering for the simple fact that quality software is expensive and typically, our organically grown solutions are good enough.
Re:Think in Math, Write in Code by nwallin on Thursday July 18, 2019 @01:35PM (#20472131)
> I'll bet the engineering process of the software written for the Apollo 11 lunar lander was much closer to the bridge building process than you might think.

Of course, but the Apollo 11 lunar lander was created without the aid of ubiquitous desktop computers. I imagine the SpaceX guidance/control software was written in a way that less resembles bridge-building/Apollo 11 lunar landers and more like the organic processes we see elsewhere in the software industry.

If Neo were to build a bridge in the Matrix, chances are his processes would bear little resemblance to those of the Army Corp of Engineers.

Re:Think in Math, Write in Code by 0x445442 on Thursday July 18, 2019 @10:59PM (#20475857)
> I imagine the SpaceX guidance/control software was written in a way that less resembles bridge-building/Apollo 11 lunar landers and more like the organic processes we see elsewhere in the software industry.

For the guidance/control systems, I bet you're wrong.

Re:Think in Math, Write in Code by ryandrake on Thursday July 18, 2019 @10:36AM (#20470229)
Maybe if we treated the practice of software development more like bridge building, we would have better reliability, fewer outages, fewer zero-day exploits, fewer patches and bugfixes--software that actually works the first time, and every time for years.
Re:Think in Math, Write in Code by Jtsummers on Thursday July 18, 2019 @10:41AM (#20470294)
I work in aviation/defense. They try to treat it just like building bridges, and it's a disaster. Please don't.

Software is a design practice/process. Not a building process. Any analogy should be to the design phase of other engineering disciplines.

Re:Think in Math, Write in Code by mannykannot on Thursday July 18, 2019 @10:00AM (#20469833)
Your designers are working with abstract models. They are thinking about problems at a conceptual model, they are not putting up structures and seeing if they work.
Re:Think in Math, Write in Code by rowanG077 on Thursday July 18, 2019 @10:08AM (#20469903)
code is also an abstract model.

The CAD designers absolutely test if things work. Why do you think almost every engineering bureau has 3D printers.

Re:Think in Math, Write in Code by mannykannot on Thursday July 18, 2019 @10:18AM (#20470010)
> Code is also an abstract model.

Sure, but it is not the only one. You are allowed to think at other levels, and it can be quite useful, especially on larger systems.

Re:Think in Math, Write in Code by drdeca on Thursday July 18, 2019 @09:26AM (#20469504)
In the analogy with the clay, I believe they are both adding and removing clay