DConf 2013 keynote

H. S. Teoh hsteoh at quickfur.ath.cx
Fri May 10 18:59:23 PDT 2013


On Sat, May 11, 2013 at 02:41:59AM +0200, Flamaros wrote:
[...]
> More I work with D, less I want to work with C++.

Yup. I think that applies to a lot of us here. :)


> Using D is just as funny as I found Java, but with a greater
> potential and global control of what we do. A lot of things are just
> as simple as they need and can be.

I don't know about you, but I find that Java can be very straitjacketed
and verbose sometimes. I mean...

	// Java
	class MyLameProgram {
		public static void main(String[] args) throws IOException
		{ ... }
	}

Really?!  In D, we just write:

	// D
	void main(string[] args) { ... }

And then:

	// Java
	BufferedReader reader = new BufferedReader(new FileReader(args[0]));
	System.out.println("Hello world!");

Seriously?  In D we just write:

	// D
	auto lines = stdin.byLine();
	writeln("Hello world!");

Talk about signal-to-noise ratio.

And don't get me started on all those BlahBlahBlahClassWrapper's and
BlahBlahBlahClassWrapperFactoryWrapper's. Ugh. And Integer vs. int, and
other such atrocities. What, built-in atomic types are defective so we
need to wrap them in classes now? Flawed language design, anybody?

I find D superior to Java in just about every possible way. Except
perhaps for the GC. *That* one needs a bit of work to get us up to
standard. :-P


> Sometimes C++ give me hives, it's so error prone and an
> under-productive language for the actual industry needs, that
> certainly why Google created the Go.

Surprisingly enough, before I found D, I actually considered ditching
C++ for C. I only stayed with C++ because it has certain niceties, like
exceptions, (and no need to keep typing 'struct' everywhere on a type
that's blatantly obviously a struct) that in C is a royal pain in the
neck. C++ is just over-complex, and its complexity in different areas
interact badly with each other, making it an utter nightmare to work
with beyond trivial textbook examples. OO programming in C++ is so
nasty, it's laughable -- if I wanted OO, Java would be far superior. I
found that C++ is only tolerable when I use it as "C with classes". Its
OO features suck.

At my day job, we actually migrated from C++ back to C, because the
person (people?) who wrote the original C++ framework overengineered the
whole thing, to the point that making a single function call involves up
to 6 layers of abstraction (in one case involving fread and fwrite of
function parameters, and *then* serialization/deserialization across an
RPC link). Eventually 80% of that elaborate framework was never used,
because the guy who wrote it left the project, and nobody else
understood it. Everyone just hacked their way around it, resulting an a
gigantic mess that had who knows how many bugs just lurking beneath the
surface, waiting to be exposed by a completely unrelated change
elsewhere in the code. (There were some *dtors* that were doing useful
work and had side-effects... talk about OO gone wrong.)

We were so traumatized by the experience that the team lead put his foot
down and said, "no more C++, we're going back to C". My then-supervisor
had perhaps one of the happiest days of his employment here
mass-deleting all the subdirectories containing the C++ code, after the
new C-based infrastructure was ready for use. (My only regret was that
there are still modules written in C++ lying around.  They still suffer
from the same issues, albeit to a smaller scale. At least the pain is
below the tolerable threshold now.)

Of course, C has own its share of nasty gotchas and pain, but, believe
it or not, it's actually better than our experience of C++, in spite of
C++ being supposedly the successor to C. If I only had a say in these
things, I would switch to D in an instant, no questions asked. Sigh. D
may still have its wrinkles to be worked out, but it's far, far superior
in comparison.


> We border probably unconscious when we use the C + + for certain
> uses. I am curious to know which languages Google uses for their car
> without a driver.

If the automated car is running on C++ code, I'd be very, very careful
*not* to own one. Or, if I had to, I'd willingly shell out a fortune for
my life insurance. :-P (Hey, I might even consider becoming an insurance
agent, it'd be good money!) ;-)


T

-- 
Everybody talks about it, but nobody does anything about it!  -- Mark Twain


More information about the Digitalmars-d mailing list