5 ms·
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 (~architectur
by mpweiher 9y ago
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.
- jandrese 9y agoIt seems kind of magical to be able to encode the intent of a program outside of its actual function. Theoretically this is what comments are for, but obviously those have zero enforcement value at the compiler level.
- hacker_9 9y agoThats because the 'why' is more powerful; from it you can infer the 'what' and 'how'.
- Jtsummers 9y agoThis is the problem that I've run into trying to use formal methods. I love them, I can express some things very concisely and even clearly. But there's no direct connection to the code and so keeping things synchronized (like keeping comments synchronized with code) is nigh impossible. We need the details of these higher level models encoded in the language in a way that forces us to keep them synced. Type driven development seems like one possible route for this, and another is integrating the proof languages as is done with tools like Spark (for Ada). This will reduce the speed of development, in some ways, but hopefully the improvement in reliability and the greater ability to communicate purpose of code along with the code will also improve maintainability and offset the initial lost time. And by keeping it optional (or parts of it optional) you can choose (has to be a concious choice) to take on the technical debt of not including the proofs or details in your code (like people who choose to leave out various testing methodologies today).
- hinkley 9y agoGilad Bracha wandered off to work on progressively typed languages after he’d had enough of trying to fix Java’s type system. I think if it took something like JSdoc and have it more teeth you could do something like this in just about any of the dynamically typed languages.
- mpweiher 9y agoWell, he also "wandered in" from doing optionally statically typed languages...see Strongtalk and Newspeak. :-)
- carlmr 9y agoEspecially in the functional space there are some good ways to do DDD, although I don't see why we limit this to functional languages. https://fsharpforfunandprofit.com/series/designing-with-types.html https://fsharpforfunandprofit.com/series/designing-with-type...
- mpweiher 9y ago>use formal methods. My admittedly very brief experience with formal methods was that they were actually less close to the "design" of the software than the code. So not sure that's a direction that will get us anywhere we need to go. >in a way that forces us to keep them synced. Why "synced"? Wouldn't it be better if those higher level designs were actually coded up and simply part of the implementation, but at a level of abstraction that is appropriate to the design. We used to increase our level of abstraction, but now we appear to have been stuck for the last 30-40 years or so. At least I don't see anything that's as much of a difference to, let's say Smalltalk as Smalltalk is to assembly language.
- borplk 9y agoSee 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 https://news.ycombinator.com/item?id=16117668
- jopsen 9y agoI'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...
- mpweiher 9y agoNice. But also a workaround, right? Because it's not actually declarative, it's APIs that are made to look declarative-ish. So there's several layers of mismatch, for example most of the active ingredients being strings, meaning you're coding mostly in the string-language embedded into JS. We do that a lot. Probably time to start looking at our workarounds (and Macros are another workaround) and figure out what we are actually trying to do.
- jopsen 9y ago> But also a workaround, right? Because it's not actually declarative, it's APIs that are made to look declarative-ish. I'm not entirely sure what you mean... In an ideal world "API" would be a keyword, similar to how "class" is a keyword for declaring/defining classes. Example: API MyApi { constructor(defaultName) { this.defaultName = defaultName; } /** some description */ method: get route: /hello-world scopes: some-permission-string || other-permission-string { let name = request.query.name; if (!name) { name = this.defaultName; } response.send('hello ' + name); } } module.exports = MyApi; // similar to how you would export a class in JS I think something _like_ this will be doable using rust macros in the future (if not already on nightly). Whilst my JS code, where I create an API object and call API.declare(...) for each route isn't as neat as having an "API" keyword and code-generation for said keyword, it's pretty close. I just write the API.declare(...) as something that collects arguments, and then those can be instantiated multiple times... Similar to how a class can be instantiated multiple times. I do similar things for loading components that depend on each other: declare dependencies, define function for loading using said dependencies -- then have some library code construct a function that loads any desired component with maximum concurrency (by analysing the DAG).
- js8 9y agoI don't think it's possible (at least with today's technology). The high-level design/specification is intentionally vague; if it wasn't vague, we wouldn't need the low-level code, we could have a compiler generate it from the high-level specification. As far as we can tell, the technology that can create a piece of exact code from a vague specification is called strong AI. Heck, we don't even have a language to describe vague specifications without loss of fidelity. We don't know if such a language can exist.
- mpweiher 9y agoI think there is at least one and probably several layers between "code as is written now" and "vague intents". Of course I could be wrong.
- fallous 9y agoI'm not sure that's possible in any truly meaningful way. Design is a very high level of abstraction that expresses a world, a particular view of that world with regards to a general set of problem domains, and a set of principles and theories about acting within that world. Code is a means (and not the only means) of achieving those actions. This is not unlike the domains of philosophy, morality, ethics, and law. Attempting to express or enforce philosophy and morality via legalism is an exercise in futility, and even ethics which appears to be on the same level as law actually isn't since the presumption of ethics is behavior even in the absence of a law.
- crdoconnor 9y agoExecutable user stories?
- maxerickson 9y agoI guess that is at least sort of what they are working on at VPRI. http://www.vpri.org/ http://www.vpri.org/
- mpweiher 9y agoAbsolutely, they're probably very much at the top of people trying to solve this.