News for hackers. Stuff that matters.
Re:Throw away code by vietjtnguyen on Saturday September 26, 2020 @12:10AM (#24596355)
If you haven't, you should explore domain-driven design (DDD). It's an explicit idea in that framework that a problem needs a "ubiquitous language" and an identified "bounded context" where the said language is valid.

Like you, when approaching a new problem I like to nail down the terms we are discussing, literally scaffolding classes and types (in C++) as the problem is being discussed. It drives the adoption of unambiguous terms. Then as solutions are discussed the "ubiquitous language" helps clearly identify the interactions between types.

Re:Throw away code by brundolf on Saturday September 26, 2020 @03:13PM (#24601358)
One advantage of using a very open-ended type system like TypeScript's is that you don't have to know as much up-front.

I could declare some type Foo, and that type might end up being:

- A class

- A record type

- A union type

- An intersection type

- A constant

or whatever else. But I can go ahead and start referring to that type in terms of function signatures, etc. Particularly for this kind of sketch-coding, it's really nice to be able to declare a concept and start talking about it before you even know what it is.

Re:Throw away code by fendy3002 on Saturday September 26, 2020 @07:59AM (#24598132)
Can you explain more? For me, DDD is hard if you don't know or inexperienced on the business field.