new DIP47: Outlining member functions of aggregates

jostly johan.f.ostling at gmail.com
Mon Sep 9 09:58:06 PDT 2013


On Monday, 9 September 2013 at 14:22:15 UTC, Joseph Rushton 
Wakeling wrote:
> Question: do you have any access to information about similar 
> short-deadline programming activity using other languages 
> (Java, C# ...) that also forbid the separation of declaration 
> and definition, and how devs using those languages cope with 
> that?  It might offer an alternative solution that no one here 
> has thought of.

As a long-time Java developer, my answer would be that it's dealt 
with via careful code crafting. Keep classes small, follow the 
principle of single responsibility etc. There are tons of good 
advice for writing maintainable, easy-to-understand code. And 
there's certainly nothing stopping us from doing the same in D.

However, if I understood Manu correctly, the issue here is those 
instances where there is not a lot of time, as in 48-hour game 
jams and game industry crunch mode. The cases where it is felt 
that code quality takes second place to getting things out fast.

In those cases, I think Java people would feel the same problem. 
It can be alleviated, in Java, by making sure you write 
interfaces for all public-facing code. The same could be done in 
D, but I am unsure if that would involve a performance hit that 
might actually matter in games programming. So at that point, the 
Java programmer would rely on the IDE to make sense of the 
bigfiles they are producing.

Now, I think an argument could be made that the initial 
productivity loss from performing refactorings to make sure you 
are producing maintainable code will pay off in a short while, 
even in crunchmode, but I realise this is something the games 
industry in general would have to deal with, and it should not be 
a burden put upon the individuals wishing to adopt D for making 
games.

As for the DIP, I would not want to code using that style myself, 
but I wouldn't mind it if the requirement was to keep all parts 
of the same class in the same module. Once we start crossing file 
boundaries, finding out where stuff is is going to be terrible 
unless you have a good IDE support for things like "Go to 
definition".


More information about the Digitalmars-d mailing list