C++ launched its community survey, too

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Feb 28 23:08:45 UTC 2018


On Wed, Feb 28, 2018 at 09:46:49PM +0000, TheFlyingFiddle via Digitalmars-d wrote:
> On Wednesday, 28 February 2018 at 20:01:34 UTC, H. S. Teoh wrote:
> 
> Just to give some background. At work I spend most of my time
> maintaining legacy systems adding some small features or replacing
> subcomponents. So most of what I do is reading code and making some
> minor changes (unless it's buggy code then you get to rewrite :))

In spite of my job title being SW engineer, this actually almost exactly
describes what I do. :-D  Well, OK, sometimes a larger feature is asked
for and I get to write fresh code, but 90% of my daily duties is reading
other people's code, fixing bugs, and making relatively minor changes.


[...]
> Perl is a maintenance nightmare. It just takes so much time to figure
> out what the code actually does. Particularity if it has been changed
> by multiple people over the years.

That applies to almost any code changed by a large number of people over
the years. :-D  Especially when it's code written in a commercial
environment where there's a high turnover and people are forced to
implement last-minute hacks due to customer demands and impractically
tight deadlines. Over time, the hacks accumulate on top of each other
into a brittle tower of cards that pretty much is guaranteed to break at
the slightest change, mostly in apparently unrelated places where you
won't notice until something blows up later.

Sometimes I just have to shake my head and walk away, and admit defeat
that I *don't* understand what the code does, and neither do I want to,
because I might need therapy afterwards.  :-D


> That's the main reason Perl is at the top of my most disliked
> languages.

In my case, that also applies to badly-maintained C/C++ code!


[...]
> > And the whole thing about == vs === is just one huge WAT.  It "makes
> > sense" if you understand why it's necessary, but it just begs the
> > question, why, oh why, wasn't the language designed properly in the
> > first place so that such monstrosities aren't necessary?!
> 
> Another personal favorite.
> function foo($myArray) {
>    return $myArray['test'];
> }
> 
> $myString = "hello, world";
> $test = foo($myString);
> 
> echo $test; // $test = 'h'; Because you know 'test' auto converts to 0.

Hahaha... yeah. This is one of the things that make me hate dynamically
typed languages so much.  Your types can change from under you at any
time without any warning, usually with disastrous consequences, but
should you be so unlucky as to have said consequences masked by more
"convenient" auto type conversions, you quickly find yourself wishing
for a real type system.  Like when you mistype the name of an optional
field in a data structure, and the receiving code simply ignores the
mistyped field.  No warnings or indications whatsoever of what went
wrong.


[...]
> > > Compared to them, programming in C++ or Java for that matter is
> > > like a dream.
> > 
> > C++ is hardly any better, actually:
> > 
> > 	https://bartoszmilewski.com/2013/09/19/edward-chands/
> 
> Yeah... C++ is interesting in that way. Mostly what I have seen is
> that for any given project they have a strict policy of how to do
> memory management and error handling.

Yes, essentially the only way to work with C++ in a sane way is to
restrict yourself, either by convention or by policy, to a strict subset
of C++.  Google, for example, places heavy restrictions on what parts of
C++ are allowed in their codebase.  Full C++ contains just too many
pathological things that code that's actually free-for-all in that way
quickly becomes completely unmaintainable.

Reminds me of a C++ project I had to work with once, where useful work
was done in dtors via side-effects.  Good luck figuring out what the
code does from glancing at it!  (It begins with a mystified "why does
this function only contain some variable declarations and nothing
else?", and goes downhill from there.)


> Also it's not really a pleasure reading C++ templates :D.

C++ template syntax makes me cringe every time I see it.  Reminds me of
all those battle scars I accumulated in the 2 decades or so I was
actively using C++.


[...]
> The awful and nice part of Java is that since your forced to do things
> a certain way then things will actually be done in that way. In this
> case OOP and all of that. It's nice when you read the code, awful when
> you actually have to code in it.

I dunno, I've seen Java code written in a way that's anything but OO,
with 10-page long functions that contain essentially the entire program,
and other clear symptoms of spaghetti code and general cloudiness in the
author's mind.  All "nicely" wrapped up, of course, in a class, complete
with a bow-tie, in lip service to OO.

As somebody once said, A true programmer can write assembly code in any
language. :-D


> > > Only thing missing is the ability to do arbitrary system calls
> > > during compilation :D
> > 
> > AKA
> > compile-my-source-code-and-get-a-trojan-installed-on-your-system.
> > :-D  If this (mis)feature ever gets merged into DMD, give me a call
> > right away -- I have a lot of source code to sell you. For free. :-D
> 
> Why must you ruin my perfect plan of getting a free botnet! :D

'cos I want one of my own. :-D


T

-- 
"The number you have dialed is imaginary. Please rotate your phone 90 degrees and try again."


More information about the Digitalmars-d mailing list