Exploring the philosophy of objects
forkit
forkit at gmail.com
Mon Jun 27 01:35:59 UTC 2022
On Sunday, 26 June 2022 at 07:37:01 UTC, Ola Fosheim Grøstad
wrote:
>
> D is trying to position itself as a language where you start
> with a prototype and evolve it into a product.
D, by design, defaults to 'flexibilty' (as Andrei Alexandrescu
says in his book - The D Programming Language.
I don't think it's unreasonable, for me to assert, that
flexibiltiy does not exactly encourage 'structured design'.
But for a language where you want to 'just write code' (which
seems what most D users just want to do), then D's default makes
complete sense.
2 examples:
If @safe were default, it would make it harder for people to
'just write code'.
If private were private to the class, instead of private to the
module, it would make it harder for people to 'just write code'.
I'm not against the defaults, necessariy. Valid arguments can be
made from different perspectives.
I much prefer to focus on advocating for choice, rather than
focusing on advocating for defaults.
But in the year 2022, these defaults don't make sense any more -
unless as stated, your aim is 'to just write code'.
I think this is what D is grappling with at the moment.
To do structured design in D, you have to make the conscious
'effort', to not accept the defaults.
btw. Here's a great talk on 'A philosophy of software design', by
John Ousterhout, Professor of Computer Science at Stanford
University.
The talk is more or less based on the question he asks the
audience at the start of this talk.
Having not studied computer science (I did psychology), I was
surprised when he mentioned 'we just don't teach this' :-(
https://www.youtube.com/watch?v=bmSAYlu0NcY
More information about the Digitalmars-d
mailing list