Live data from Hacker News

The Design of Software is a Thing Apart

pathsensitive.com

91–100 of 124 posts

Re: The Design of Software is a Thing Apart

#91
post #29
post #2

the information of a program’s design is largely not present in its code And that's the problem. We need ways to make those higher level designs (~architecture) code.

See my recent comment: > We need model based editing environments that will allow us to have a much richer set of software building blocks. https://news.ycombinator.com/item?id=16117668

I've had similar thoughts, notably as a way to side-stepping the composability limits of current parsing theory. But these limitation are increasingly worked around...

And looking at rust, I can start to imagine a future where macros are powerful enough to support a lot of declarative coding.

When coding javascript today I write code like:

    // can be imported, and api.router() mounted in express
    let api = new API(...);
    module.exports = api;    

    api.declare({
      method: 'get',
      route: '/hello-world',
      description: `bla bla bla...`,
      scopes: {AnyOf: ['some-permission-string']},
      // (more properties)
    }, (req, res) => {...});
Effectively making large parts of the app declarative. It's still far from powerful enough. But I'm not sure giving up text is the way to get more powerful building blocks.

Declaring JSON + function is super powerful in JS. In rust macros might allow us to make constructs similar to my "API" creator, but with static typing. And who knows maybe macros can expose meta-information to the IDE...

Re: The Design of Software is a Thing Apart

#92
We’ve increased our productivity by quite a lot over a five year period by ditching most testing on smaller applications.

Basically our philosophy is this: a small system like a booking system which gets designed with service-design, and developed by one guy won’t really need to be altered much before it’s end of life.

We document how it interfaces with our other systems, and the as-is + to-be parts of the business that it changes, but beyond that we basically build it to become obsolete.

The reason behind this was actually IoT. We’ve installed sensors in things like trash cans to tell us when they are full. Roads to tell us when they are freezing. Pressure wells to tell us where we have a leak (saves us millions each year btw). And stuff like that.

When we were doing this, our approach was “how do we maintain these things?”. But the truth is, a municipal trash can has a shorter lifespan than the IoT censor, so we simply don’t maintain them.

This got us thinking about our small scale software, which is typically web-apps, because we can’t rightly install/manage 350 different programs on 7000 user PCs. Anyway, when we look at the lifespan of these, they don’t last more than a few years before their tech and often their entire purpose is obsolete. They very often only serve a single or maybe two or three purposes, so if they fail it’s blatantly obvious what went wrong.

So we’ve stopped worrying about things like automatic testing. It certainly makes sense on systems where “big” and “longevity” are things but it’s also time consuming.

Re: The Design of Software is a Thing Apart

#93
post #85
post #62

Earlier quoted context omitted.

Do you think this still holds true if you name all your tests in the format test1, test2 ... testN? If not, then you're in the realm of documentation, not tests, and the descriptive names (which is a form of metadata, just as comments are) of the tests are what is communicating these special cases, and not the test content itself. Combining the two is good, but let's not act like the tests themselves immediately solv…

My opinion is that test names, function names, variable names, constant names, high level languages, literate programming, and well written commit messages, all help code to be understandable; I'm fully in favor of all using all these in source code and also in commit messages. My experience is that documentation is generally a shorthand word that means non-runnable files that do not automatically get compared to the…

That wasn't the parent's case though. The parent's case was an odd implementation that provided correct enough approximations of the answer in a much more performance way. Neither are incorrect, but the "simplified" version would be a step backwards.

As noted, the comments are for the why, which tests don't tell you without some additional information.

Re: The Design of Software is a Thing Apart

#94
post #52

Earlier quoted context omitted.

> return x >= 'A'; already and only means ascii A. See, here's where you are wrong. ASCII_A = "A" alphas = ["Α", "А", "Ꭺ", "ᗅ", "ꓮ", "A", "𐊠", "A", "𝐀", "𝖠", "𝙰", "𝚨", "𝝖"] for c in alphas: print c == ASCII_A Output? False False False False False False False True False False False False False Several of the numerous possible utf-8 alphas. Those are not A in different fonts -- they are different unicode characte…

I deliberately used the character literal ‘A’ and not any of your UTF8 strings. I think you are mistaken to confuse a character with your strings. Is this wrong?

You can have a unicode character literal -- and depending on the language there's no distinction between character and string (at the type level), a character is just a string of length 1.

Re: The Design of Software is a Thing Apart

#95
post #67

This is a lovely article. Software is a possibly a) errant and b) misinterpreted operational semantics of some other semantic horizons of contractual or implicit expectations. Knuth's Literate Programming was onto something. We inhabit a world of word problems and even faulty realizations of rarer formal specifications. Claims concerning "phenomena in the world" drive maintenance and enhancement regimens.

Worse still, most of us walk around under the delusion that we know what we want while others can see it doesn’t make us happy. How do you get the product you want when you don’t know what you want?

The hard part is reaching a committed niche in the user base, whether paying customer or audience kinds. Software tools generalize from and for niche sponsors with more specific needs. Software growth is then the "consensual delusion" of feature set and paying constituency accretion. Platform heterogeneity "churn" offers both big risks and big opportunities. Never a dull moment in software development.

Re: The Design of Software is a Thing Apart

#96

Earlier quoted context omitted.

Write a property based test, ie generate a bunch of random inputs, then assert that all of them are within some (loose) margin of error.

This doesn't satisfy the time constraint though. return 1.0f / sqrt(x) Passes a property based test but now your game doesn't actually run because it's much too slow of an operation on hardware at that time. You can also test execution time too, but that's finicky and doesn't help explain how to fix it if you break that test (if there's no accompanying documentation).

But at this point all you're saying is "I can't think of a way of testing performance".

Re: The Design of Software is a Thing Apart

#97

The OP doesn't seem to understand TDD: "So you update the code, a test fails, and you think “'Oh. One of the details changed.'" Some of the concerns they raise about writing tests are covered by Uncle Bob here: http://blog.cleancoder.com/uncle-bob/2017/10/03/TestContrava... and here: http://blog.cleancoder.com/uncle-bob/2016/03/19/GivingUpOnTD...

Good design is difficult. That's the easy to understand part. What is difficult for me to understand, why is this skill just ignored. There are lots of skills that are difficult, but people still persist on learning them. Not for software design. It-works-somehow-for-now seems to look good enough for the most. This also results in "OOD is difficult, FP will save us. Oh no, FP does not really save us, FRP for sure will". Sorry guys, you will need to break some eggs for omelette.

Re: The Design of Software is a Thing Apart

#98
post #5

Peter Naur's "Programming as Theory Building" also addresses this topic of a "theory" which is built in tandem with a piece of software, in the minds of the programmers building it, without actually being a part of the software itself. Definitely worth a read: http://pages.cs.wisc.edu/~remzi/Naur.pdf

"Bad programmers worry about the code. Good programmers worry about data structures and their relationships."

-- Linus Torvalds

Re: The Design of Software is a Thing Apart

#99
post #96

Earlier quoted context omitted.

This doesn't satisfy the time constraint though. return 1.0f / sqrt(x) Passes a property based test but now your game doesn't actually run because it's much too slow of an operation on hardware at that time. You can also test execution time too, but that's finicky and doesn't help explain how to fix it if you break that test (if there's no accompanying documentation).

But at this point all you're saying is "I can't think of a way of testing performance".

Performance can be tested in a unit test. You just need to measure the time needed to compute the function on a given set of numbers, then measure the time needed to compute 1.0f / sqrt(x) on the same set of numbers. The test succeed if your function is 10x faster. In future, the test may fail because sqrt has improved and this trick is no more needed.

Re: The Design of Software is a Thing Apart

#100
post #39
post #8

> Those who speak of “self-documenting code” are missing something big: the purpose of documentation is not just to describe how the system works today, but also how it will work in the future and across many versions. And so it’s equally important what’s not documented. Documentation also (can) tell you why the code is a certain way. The code itself can only answer "what" and "how" questions. The simplest case to sh…

> Some might claim unit tests will solve this Yes. Tests will solve this. Your point is perfect for tests. If another experienced coder cannot comprehend from the tests why something is wrong, then improve the tests. Use any mix of literate programming, semantic names, domain driven design, test doubles, custom matchers, dependency injections, and the like. If you can point to a specific example of your statement, i.…

> a complex method that you feel can be explained in documentation yet not in tests, I'm happy to take a crack at writing the tests.

// This implementation is unnatural but it is needed in order to mitigate a hardware bug on TI Sitara AM437x, see http://some.url

(that's an obvious one; but there are plenty of other cases where documentation is easier than a test)

Post reply on HN