Which language is the least bad?


  • ♿ (Parody)

    @masonwheeler said in Which language is the least bad?:

    @boomzilla In Boo, I'd do it like so:

    def GetValues(myList as List of Foo) as List of int:
        return myList.Select({element | element.Value}).ToList()
    

    Does that look any less weird? :P

    The weirdness is delayed and downplayed.


  • Considered Harmful

    @scholrlea said in Which language is the least bad?:

    @pie_flavor Dr. Wirth would like a word with you..

    pie_flavor:whoosh:

    @masonwheeler said in Which language is the least bad?:

    @pie_flavor You could also say List[of int], and it's syntactically required if there's more than one type parameter. I just find it cleaner to leave that off when there's only one.

    And why, may I ask, was this chosen over List[int]?


  • Impossible Mission - B

    @pie_flavor said in Which language is the least bad?:

    And why, may I ask, was this chosen over List[int]?

    I don't know. You'd have to ask Rodrigo. If I had to guess, probably because it would make it more difficult to parse.



  • @pie_flavor Niklaus Wirth was the designer of Pascal, as well as Algol-W (gee, no ego there), Euler, Modula, Modula-2 (but not Modula-3), Oberon, and Oberon-2. He was kind of important back in the day.

    While Pascal didn't have lists as a primitive type, it did have primitive arrays, which were declared thusly:

    var
        myIntArray: array[0..10] of int;
    

    This style was used in his later languages, and many others that copied them, including Ada.

    Though that syntax is probably even older, come to think of it. Presumably this is why it has enough Hipster cred for the Boo designers.

    Filed Under: Like I'm one to talk.


  • Impossible Mission - B

    @scholrlea said in Which language is the least bad?:

    Though that syntax is even older, come to think of it. Presumably this is why it has enough Hipster cred for the Boo designers.

    Alternative possibility: It came from Rodrigo imitating VB.NET.

    The first example given of its generics syntax reads: System.Collections.Generic.Queue(Of String)



  • @gąska They've done some weird stuff with ref lately that C++ fans would probably really like, since you can now, like return ref x; which apparently lets you do really weird operations on complex data structures.

    Most of the time, you don't use ref or out - they essentially just let you pass the same reference to a method, instead of making a copy of it for that method to use (the default). I've never found a good reason to use it, personally, but I'm aware that some people need it for things.



  • @masonwheeler Ah, that would make sense, yes.


  • Considered Harmful

    @magus You don't see the use of out? What about TryParse and friends?



  • @pie_flavor I'm not a fan of them. I'd take a deconstructing ValueTuple return over them any day:

    var (value, success) = int.TryParse("508G");
    if (success)
    {
        ...
    }
    

    Dumb as that is, I like it better. The flow of the code just makes far more sense. It wasn't there at the time, though.


  • Considered Harmful

    @magus It might make more sense in regards to the signature, but not in regards to usage.

    if (int.TryParse("bork", out int i) && IsAcceptableValue(i))
    {
        DoSomethingWith(i);
    }
    else
    {
        ReportFailureState();
    }
    

  • Banned

    @magus said in Which language is the least bad?:

    @gąska They've done some weird stuff with ref lately that C++ fans would probably really like, since you can now, like return ref x; which apparently lets you do really weird operations on complex data structures.

    I'm not C++ fan. Quite the contrary. I hate C++. I despise it with every cell in my body. It's just that I hate everything else even more. Except Rust. Rust is the first - and so far the only - programming language I've ever used that I don't hate. I'd even go as far as say that I like it a little. But not yet. They have to stabilize non-lexical lifetimes first.



  • @pie_flavor Even in terms of usage. Randomly declaring a variable some random place in the middle of the line? Sure, it's an improvement on not being able to declare a variable in the middle of the line, but I will always prefer functions that return values properly, even if you can't write a line that says, "Check a condition, and parse a string, and say if it worked, and that it's good enough."


  • Considered Harmful

    @magus When the return value is intended to be used in a construct, and in a one-liner at that, it does make more sense. For instance, a function taking an out string and returning an IEnumerable<Foo> is significantly better than a function returning a ValueTuple<string, IEnumerable<Foo>>, because the former can be one-lined into a foreach statement and the latter can't. Same way the builder pattern, despite doing a lot of unnecessary returns, cleans up code significantly.



  • @pie_flavor I disagree completely. Sure, it lets you write more terse code, but I prefer moving away from Perl. It's not as if I'm talking about reaching VB levels of horrible either. I don't like methods that return multiple things anyway, and would prefer they're slightly messy-looking, but at least not in a terse, general-language-style-breaking way.


  • kills Dumbledore

    @scholrlea said in Which language is the least bad?:

    GDTs

    Global dairy trades?



  • @jaloopa said in Which language is the least bad?:

    @scholrlea said in Which language is the least bad?:

    GDTs

    Global dairy trades?

    OK, I deserved that one.

    Filed Under: Global Descriptor Tables, for what it's worth.


  • Considered Harmful

    @magus Well, you can go ahead and write your annoying but plain code, and I can write my simple but weird code. The thing about a language containing both ValueTuple and out is that you can choose.


  • Banned

    @pie_flavor @Magus I think you'd both like the Rust way:

    if let Ok(i) = "123".parse() {
        DoSomethingWith(i);
    } else {
        // ...
    }
    

    If you want to handle error:

    match "123".parse() {
        Ok(i) => DoSomethingWith(i), // wrap in code block if different return types
        Err(e) => ReportError(e),
    }
    

    Alternatively:

    "123".parse().and_then(DoSomethingWith).or_else(ReportError);
    

    Or if you're going to return error on error:

    DoSomethingWith("123".parse()?);
    


  • @masonwheeler said in Which language is the least bad?:

    Well, I can't be the only one around here who sees people use the term on a somewhat regular basis... can I? 😕

    FWIW, I don't remember seeing "abstract data type" since those low-level Computer Science classes. That level of thinking doesn't come up much when you're busy, say, writing Windows GUIs using MFC or WinForms; automating a database download and creating a book from the data; or trying to convince your C# code to lay something out the same way as a C library so you can call functions that take complex structs.

    We may have used "ADT" back in college, I don't remember. I figured it out, though.


  • Considered Harmful

    @parody said in Which language is the least bad?:

    trying to convince your C# code to lay something out the same way as a C library so you can call functions that take complex structs

    Does [StructLayout(LayoutKind.Sequential)] with a few MarshalAs attributes not work in all cases?



  • @pie_flavor said in Which language is the least bad?:

    @parody said in Which language is the least bad?:

    trying to convince your C# code to lay something out the same way as a C library so you can call functions that take complex structs

    Does [StructLayout(LayoutKind.Sequential)] with a few MarshalAs attributes not work in all cases?

    Not once you have a few arrays involved. I ended up building a lot of little C# structs (with plenty of attributes) to get it to work and converting back and forth.


  • Considered Harmful

    @parody What's example code for something that wouldn't work?



  • @pie_flavor said in Which language is the least bad?:

    @parody What's example code for something that wouldn't work?

    It was many years ago now, but I think it was as simple as:

    C struct contains: char foo[10][20];
    C# native object has: List<string> foo;

    For these I ended up making nested C# structs and converting back and forth because MarshalAs doesn't give you a way to specify the fixed length for the underlying string.
    This extended to many places where the C structs had nested structs or arrays, whether because the defaults/other things I tried didn't work or because those pieces of data were represented differently in C#.


  • Considered Harmful

    @parody You couldn't just store it as string[]?


  • Notification Spam Recipient

    @scholrlea said in Which language is the least bad?:

    I'm sorry, I thought you would be able to recognize a term you yourself have used before. Are you honestly going to tell me that most programmers won't be able able to resolve 'Abstract Data Type' from that in this context?

    FWIW I didn't up until this point.


  • Notification Spam Recipient

    @masonwheeler said in Which language is the least bad?:

    Out of curiosity, did you take any CS classes in college? This is 100-level material.

    Yes I took classes. Obviously didn't stick, despite programming in various languages being my career so far.


  • Notification Spam Recipient

    @masonwheeler said in Which language is the least bad?:

    @blakeyrat said in Which language is the least bad?:

    I know what an abstract data type is. I did not know what an "ADT" was. If he had typed abstract data type, I would have of course not bother posting that request for clarification. I've never before in my life seen someone type "ADT" to mean "abstract data type".

    Well, I can't be the only one around here who sees people use the term on a somewhat regular basis... can I? 😕

    So far no less than four people have chimed in on ths...


  • Notification Spam Recipient

    @masonwheeler said in Which language is the least bad?:

    @blakeyrat That's... a very odd perspective. I devour stuff like that, because I'm interested in writing software, and writing software is a very technical subject that requires a solid theoretical foundation to do well.

    HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA

    You're funny. Tell another!



  • @pie_flavor said in Which language is the least bad?:

    @parody You couldn't just store it as string[]?

    Not and have it work, as far as I can remember.


  • Considered Harmful

    @parody With something like [MarshalAs(UnmanagedType.ByValArray, ArraySubType=UnmanagedType.LPStr, SizeConst=20)]?



  • I can't believe all the hate for C++, here.
    So you can have value semantics if you want. Guess what, you can also make pointers or references as much as you want. You are given freedom in C++, and it's your choice to use it wisely.
    I expected people here to be decent programmers, allowing those features to be used properly. Sure, you don't want to work on C++ projects of co-workers that suck. I'm there right now; it's a pain. But well written C++ software (which is, admittedly, rare) I will claim is better than software written properly in C# or Java.

    Also, people think that reference semantics are necessary for object oriented programming. It's not. You need it for run-time polymorphism, which is not necessarily needed for object oriented programming. But - thanks to the much hated templates (among other aspects) - you don't actually need it.
    Sure, templates can be a pain in the ass. But when applied properly, they will enhance readability and good coding.

    I can really recommend the talk "Inheritance is The Base Class of Evil" by Sean Parent (https://www.youtube.com/watch?v=bIhUE5uUFOA).
    The described way of object oriented programming has made a project I'm working for extremely more pretty and readable than using inheritance (I designed using both). And guess what? It exploits value semantics, smart pointers and templates.

    Don't be afraid because something can be used incorrectly. A knife can be used to cut off your finger, does that mean you hate the knife?

    Edit: I wrote you need pointers for inheritance, but that's not true, only for run-time polymorphism (which is achieved through inheritance and virtual functions). Fixed that now.



  • @pie_flavor said in Which language is the least bad?:

    @parody With something like [MarshalAs(UnmanagedType.ByValArray, ArraySubType=UnmanagedType.LPStr, SizeConst=20)]?

    You're missing one of the lengths. IIRC, you've just told the marshaler you want an array of 20 null-terminated C-style strings (oops!), but nothing about how large the strings should be. (Also oops!)

    This is the sort of thing that worked:

    [StructLayoutAttribute(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
    public struct Foo_Str
    {
        [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string str;
    }
    
    [StructLayoutAttribute(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
    public struct Foo
    {
        [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 10)]
        public Foo_Str[] fooStrs;
    }
    
    /****************
      Initialization code for the above structures.
      You need to set everything because the
      marshaler hates null references.
    ****************/
    public Foo CreateFoo()
    {
      Foo foo = new Foo();
      foo.fooStrs = new Foo_Str[10];
      for (int i = 0; i < 10; i++)
      {
        foo.fooStrs[i] = new Foo_Str();
        foo.fooStrs[i].str = "";
      }
    
      return foo;
    }
    

    Hopefully I didn't mess up the code; it's super early in the morning and I haven't been able to sleep.


  • Considered Harmful

    @parody Ew, you put Attribute in your attributes?



  • @pie_flavor Apparently I did ~10 years ago, sure.


  • Discourse touched me in a no-no place

    @scholrlea said in Which language is the least bad?:

    Non-Lispers are always astonished by this

    No. Some languages use that sort of magic behind strings. Interfaces and representations are very much not the same thing.


  • Discourse touched me in a no-no place

    @evo said in Which language is the least bad?:

    I can't believe all the hate for C++, here.

    There's a lot of C# weenies round here.

    I have three reasons that I dislike C++:

    1. It's bloatedly complicated. Seriously, the language itself is big and subtle and that makes it both hard to learn and easy to conceal sins with.
    2. It remains thoroughly hostile to stable ABIs. It's not that you can't make your library have a stable ABI when using C++, but it is really difficult to do; the frequently changing core C++ semantics has really made this much harder than it should be, and the habit the language encourages of mixing the API between the ABI level and the symbols that get compiled into inline code in consuming code, well that's just a great way to not have a stable ABI at all. Users of C++ libraries had better have some love for the upgrade treadmill and recompilation.
    3. It's exceptions remain awful and expensive.


  • @evo said in Which language is the least bad?:

    You are given freedom in C++, and it's your choice to use it wisely.

    The instant a second programmer joins the team, this goes from being a benefit to a giant albatross around your neck.

    We all agree that the only sane way to use C++ is to pick a subset of the (myriad) features and use only those. The problem is: every developer picks a different subset, and C++ is far too large for any single developer to completely internalize in the way can they can simpler languages like C# (although C#'s getting large too) or JavaScript or Python.

    I'm not interested in being able to write clever code, I'm interested in being able to write quality software. And C++ is one of the worst languages for achieving that goal. (Worse even than plain C, IMO.)

    @evo said in Which language is the least bad?:

    I expected people here to be decent programmers, allowing those features to be used properly.

    Decent programmers understand their own limitations.

    @evo said in Which language is the least bad?:

    Sure, you don't want to work on C++ projects of co-workers that suck. I'm there right now; it's a pain.

    So, you do understand why C++ is bad, but just... refuse to believe it? Are in denial? I don't get it.

    @evo said in Which language is the least bad?:

    But well written C++ software (which is, admittedly, rare) I will claim is better than software written properly in C# or Java.

    "Better" by what metric? Less buggy? Took less developer hours to create? Has a better UX (which Java's always going to lose, BTW)?

    It's hard to imagine C++ doing better on any of the quality metrics I actually care about than C#.

    @evo said in Which language is the least bad?:

    Don't be afraid because something can be used incorrectly. A knife can be used to cut off your finger, does that mean you hate the knife?

    The problem is the second guy you hired to help you chop vegetables for your restaurant will cut you with the knife. Then your restaurant will go out of business because you were in the ER taking care of it and there weren't enough vegetables.


  • ♿ (Parody)

    @jaloopa said in Which language is the least bad?:

    @scholrlea said in Which language is the least bad?:

    GDTs

    Global dairy trades?

    Godot Departure Time


  • Considered Harmful

    @blakeyrat said in Which language is the least bad?:

    which Java's always going to lose, BTW

    Speak for yourself, I like JavaFX.



  • @pie_flavor Well Java stuff on like phones, which have custom and simpler windowing systems, isn't guaranteed to suck I guess. To be fair to Java. Which sucks.


  • Banned

    @blakeyrat JavaFX is desktop. As a library, it's very similar to Windows Forms - so similar that it's not out of question that they decompiled MS's libraries and automatically translated CLR bytecode to JVM bytecode. As of what it looks like, I can't say for sure because I'm blind.


  • 🚽 Regular

    @masonwheeler said in Which language is the least bad?:

    LOB application

    How dare you use an acronym without defining it? How dare you?



  • @dkf said in Which language is the least bad?:

    @evo said in Which language is the least bad?:

    I can't believe all the hate for C++, here.

    There's a lot of C# weenies round here.

    I have three reasons that I dislike C++:

    1. It's bloatedly complicated. Seriously, the language itself is big and subtle and that makes it both hard to learn and easy to conceal sins with.
    2. It remains thoroughly hostile to stable ABIs. It's not that you can't make your library have a stable ABI when using C++, but it is really difficult to do; the frequently changing core C++ semantics has really made this much harder than it should be, and the habit the language encourages of mixing the API between the ABI level and the symbols that get compiled into inline code in consuming code, well that's just a great way to not have a stable ABI at all. Users of C++ libraries had better have some love for the upgrade treadmill and recompilation.
    3. It's exceptions remain awful and expensive.

    It is hard to learn, but the rewards for being able to code in it properly are huge, in my opinion. Not just because of efficiency, but also because the code is often actually more readable. Or at least, in C++ you can better encapsulate the difficult parts (as is often done by the standard library or boost).
    The ABI I agree with, that is unfortunate.
    About exceptions being awful and expensive - do you have a source for that? I have no idea why you would call them awful (assuming you use RAII). And are there any languages in which exceptions outperform those in C++?

    @blakeyrat said in Which language is the least bad?:

    @evo said in Which language is the least bad?:

    You are given freedom in C++, and it's your choice to use it wisely.

    The instant a second programmer joins the team, this goes from being a benefit to a giant albatross around your neck.

    We all agree that the only sane way to use C++ is to pick a subset of the (myriad) features and use only those. The problem is: every developer picks a different subset, and C++ is far too large for any single developer to completely internalize in the way can they can simpler languages like C# (although C#'s getting large too) or JavaScript or Python.

    I'm not interested in being able to write clever code, I'm interested in being able to write quality software. And C++ is one of the worst languages for achieving that goal. (Worse even than plain C, IMO.)

    No, the instant a second programmer who doesn't know what they're doing, but is given too much responsibility in a code base, the codebase will grow terrible. If somebody doesn't know C++ properly, you shouldn't let them anywhere near the design of the software. This is true in all programming, but more in C++, simply because it gives you more tools and variety to do things properly.
    You should definitely NOT pick a subset of C++ (except in some cases such as performance-critical cases), and I'm not sure why you would suggest this even. I've heard this, but it usually comes from people who only know that particular subset of the language. That is, using the subset is a limitation of the coder, not a feature to make the code better.
    I don't think there are too many features I know, but never used. Recently, I've used virtual inheritance for the first time in my life, because I needed it. This makes that code (~ 60 lines) a bit harder to understand, but allows the writing of code that is easier to understand and maintain. In a way you could never do in C# or Java.

    @evo said in Which language is the least bad?:

    I expected people here to be decent programmers, allowing those features to be used properly.

    Decent programmers understand their own limitations.

    So you're saying you can't learn C++? Learning about those features in a limitation?
    Most people didn't learn it, but can learn it, solving those limitations. I do agree that C++ has a steep learning curve, but as I keep saying, it does give more flexibility, allowing good C++ developers to write better code.

    @evo said in Which language is the least bad?:

    Sure, you don't want to work on C++ projects of co-workers that suck. I'm there right now; it's a pain.

    So, you do understand why C++ is bad, but just... refuse to believe it? Are in denial? I don't get it.

    No, I understand that C++ is difficult, and can go bad if nobody actually knows the language. You need at the very least a leader and designer who knows the language thoroughly, that is capable of delegating tasks, possibly to people less experienced.
    In the case of the projects at work it was that: nobody did know C++ well enough to know which features to use when. And also, because people preferred inheritance over composition everywhere.
    The same holds for any other language: would you want an idiot who can't design code to use inheritance everywhere it could possibly be used?
    C++ is harder, so there are a lot more people who don't know it well enough to design code properly.
    I guess it's about the same as Windows vs Linux; Linux gives you more freedom, but more rope to hang yourself. Linux has a more steep learning curve, and I wouldn't want an idiot touching my Linux servers because they could easily fuck it up.
    Though maybe that's not the best thing to say to you, is it ;-).

    @evo said in Which language is the least bad?:

    But well written C++ software (which is, admittedly, rare) I will claim is better than software written properly in C# or Java.

    "Better" by what metric? Less buggy? Took less developer hours to create? Has a better UX (which Java's always going to lose, BTW)?

    It's hard to imagine C++ doing better on any of the quality metrics I actually care about than C#.

    Most importantly: easier to read and maintain and understand. And, to me less important: more efficient.
    There will be parts that are more difficult to understand, but they are encapsulated and shouldn't be touched by people who don't know what they're doing. Those are only tiny parts, however, and using it is easy. So in the end, it will become easier, even for less experienced C++ developers.

    @evo said in Which language is the least bad?:

    Don't be afraid because something can be used incorrectly. A knife can be used to cut off your finger, does that mean you hate the knife?

    The problem is the second guy you hired to help you chop vegetables for your restaurant will cut you with the knife. Then your restaurant will go out of business because you were in the ER taking care of it and there weren't enough vegetables.

    Yes, and that doesn't happen in a restaurant because you don't give a knife to an idiot who doesn't know not to wave it in your direction. He was taught to use a knife. He is delegated to be in a position that can cause no harm to you. He is delegated to do the cutting tasks he is capable of doing, and not of some complicated fancy shape-cutting that he hasn't yet mastered.
    It's exactly the same, just that cutting is significantly easier than writing good, maintainable code.


  • Considered Harmful

    @evo said in Which language is the least bad?:

    And are there any languages in which exceptions outperform those in C++?

    Dart, probably.



  • @dkf said in Which language is the least bad?:

    It's exceptions remain awful and expensive.

    Awful in what way? The fact that any type can be thrown?

    As for expensive... current implementations definitively optimize for the case where the exception isn't thrown (a.k.a. "zero overhead exceptions"). I actually think that that's the correct choice for the majority of the time.

    Edit:

    It remains thoroughly hostile to stable ABIs.

    That's a trade-off w.r.t. to being able to do zero-cost abstractions, which rely on fairly aggressive inlining.



  • @pie_flavor said in Which language is the least bad?:

    @magus It might make more sense in regards to the signature, but not in regards to usage.

    if (int.TryParse("bork", out int i) && IsAcceptableValue(i))
    {
        DoSomethingWith(i);
    }
    else
    {
        ReportFailureState();
    }
    
    if i, err := strconv.Atoi("bork"); err == null && IsAcceptableValue(i) {
        DoSomethingWith(i)
    } else {
        ReportFailureState()
    }
    

  • Discourse touched me in a no-no place

    @evo said in Which language is the least bad?:

    It is hard to learn, but the rewards for being able to code in it properly are huge, in my opinion. Not just because of efficiency, but also because the code is often actually more readable. Or at least, in C++ you can better encapsulate the difficult parts (as is often done by the standard library or boost).

    The key problems are once you move away from the standard library. The potential for dastardly tricks hidden behind operators whose application is invisible… well, let's just say that good code doesn't do it but there's also the other 99% of all code out there.

    About exceptions being awful and expensive - do you have a source for that? I have no idea why you would call them awful (assuming you use RAII). And are there any languages in which exceptions outperform those in C++?

    The main problem with exceptions in C++ is that they make the assembly level rather more complex, even when the point where the exception is thrown and the point where it is caught are in the same function (after inlining). And there's a need for an extra part of the runtime library to support them too; you do pay for that! Of course, I'm thinking about things from a low-level here; one of the platforms I write code for really doesn't have space for that sort of thing (32kB of code space really requires tight code) and not having exceptions really puts both the standard library and boost off-limits.

    So… exceptions in C++ now get about a 6/10 (they'd get one more if they didn't support throwing arbitrary types). That's much better than they used to be, but since they used to be terrible to the point where some programmers still say that anything is better than exceptions, that's not the highest bar to beat.

    (Performance of exceptions? Performance of an error path? Is that really important?)



  • @evo said in Which language is the least bad?:

    It is hard to learn, but the rewards for being able to code in it properly are huge, in my opinion.

    Hard to learn means too much of my brain contains C++ quirks while programming and not enough of my brain is leftover to track the actual code I'm actually writing. Maybe you're some kind of genius savant, I don't know, but I'm aware of my own limitations.

    @evo said in Which language is the least bad?:

    Or at least, in C++ you can better encapsulate the difficult parts (as is often done by the standard library or boost).

    Better than C#? Example please.

    @evo said in Which language is the least bad?:

    And are there any languages in which exceptions outperform those in C++?

    Exceptions take close to zero time in C#. They are fast enough that many framework methods, like TryParse, use exception captures under-the-hood because they benchmarked it and there was no advantage to rewriting the function to be exception-less.

    That said, I don't know how fast C++ exceptions are. Just saying the ones in C# are real fast.

    @evo said in Which language is the least bad?:

    No, the instant a second programmer who doesn't know what they're doing, but is given too much responsibility in a code base, the codebase will grow terrible.

    Maybe; but there are a lot more programmers out there who haven't internalized C++ than there are that have. Since the goal (again I remind you) is to write quality software, you're better off picking the language that more people have internalized and is easier for new developers to internalize. That language is not C++.

    @evo said in Which language is the least bad?:

    If somebody doesn't know C++ properly, you shouldn't let them anywhere near the design of the software.

    We both agree that C++ is fine if you're an auteur and writing auteur software, but 99% of development shops can not function that way. The software is simply too large for just one person.

    @evo said in Which language is the least bad?:

    You should definitely NOT pick a subset of C++ (except in some cases such as performance-critical cases), and I'm not sure why you would suggest this even.

    Because C++ is too large to wrap your head around in its entirety. Features like operator overloading and templates create tons of scary-action-at-a-distance, with templates having the added bonus of the error reporting being absolutely shit.

    The compilation time is long enough that between hitting "debug" and actually being able to debug the application, you've clicked over to Fark.com and utterly forgotten the fix you were about to test.

    Practically-speaking, there are no performance critical cases. None. They only exist so programmers like you can justify using crummy languages they believe are more "powerful".

    In the rare event that there is:

    1. An actual performance critical case
    2. One that C#, even using the right algorithms and data structures, is measurably worse at than C++ (which is, BTW, not something to take for granted! Memory-managed languages are frequently faster at many workloads.)

    Well then, now you know why C# added pinvoke. Of course, pinvoke is a bitch with C++ because the ABI instability we've already discussed, so you're still better off going with C in that case.

    @evo said in Which language is the least bad?:

    That is, using the subset is a limitation of the coder, not a feature to make the code better.

    Once more: I give no shits about making the code better, my only interest is in making the product better. Using a subset of C++ that's easier to keep in every developer's head while they're writing code is a strategy for making the product better. (Generally speaking, the less "clever" code is, the better the resulting product is.)

    I'm sorry I assumed you agreed with that viewpoint, I should not have made that assumption without asking first.

    @evo said in Which language is the least bad?:

    Recently, I've used virtual inheritance for the first time in my life, because I needed it. This makes that code (~ 60 lines) a bit harder to understand, but allows the writing of code that is easier to understand and maintain. In a way you could never do in C# or Java.

    The designers of C# and Java, BTW, agree with me. Both of those languages are designed to be easy to internalize with consistent behaviors and very little scary-action-at-a-distance.

    Or put another way, the lack of the thing you were using doesn't indicate a flaw in C# or Java, it indicates a different priority in the design of the language.

    (Although, again, C# is growing larger and gaining scary-action-at-a-distance in the form of, for example, attributes. But that aside....)

    @evo said in Which language is the least bad?:

    So you're saying you can't learn C++?

    Correct. I honestly believe that there's no way my brain could internalize C++. I also believe that is the case for the vast majority of developers.

    I had enough trouble writing C# code for tax-exempt savings account accounting rules, keeping both C# in my head at the same time I kept those complex-ass rules in my head. I ended up having to write reams of pages in OneNote to pull that off.

    I don't think I would have been able to do it at all if that company used C++.

    @evo said in Which language is the least bad?:

    Most people didn't learn it, but can learn it, solving those limitations.

    I disagree.

    @evo said in Which language is the least bad?:

    I do agree that C++ has a steep learning curve, but as I keep saying, it does give more flexibility, allowing good C++ developers to write better code.

    Perhaps; but even if that's true, it's irrelevant for creating quality software in 2018. Your super-genius who's writing that super-amazing C++ code could, much more easily, be writing super-amazing C# code. And he'd finish the product a hell of a lot faster, probably with far fewer bugs. (And have proper unicode support, be able to run on 32-bit or 64-bit machines, have sensible date handling libraries, good integration with web servers, database, etc.)

    @evo said in Which language is the least bad?:

    In the case of the projects at work it was that: nobody did know C++ well enough to know which features to use when.

    Why do you think this is specific to your workplace and not to all workplaces that use C++?

    It's fine to say: "if everybody were like me, this product would be great!" But at some point you have to back away and realize:

    1. Not everybody is you
    2. You can't go it alone
    3. The goal (once more) is to produce quality software, not to brag or show off or be "clever"

    If you use C++ and you hire someone who's not so sharp, as you agree, he's going to turn your codebase into a mess. If you use C# or Java and hire someone who's not so sharp, he's far more likely to be able to do ok in that environment.

    @evo said in Which language is the least bad?:

    The same holds for any other language: would you want an idiot who can't design code to use inheritance everywhere it could possibly be used?

    I'd prefer clear code over "using inheritance everywhere it could be used." For example, maybe I have two POCOs (plain old C# objects) that go out as responses to various things, one to a REST (representational state transfer) request, one to be emailed to an admin. Both of these POCOs have a field labeled "success", but other than that they have absolutely nothing in common, and in fact live in different class libraries.

    Based on your sentence there, what I should do is create a third class library, put in it a POCO named something like "ResponseToSomeKindOfRequestThatHasASuccessBool", put my success bool in it, then go to the REST and email libraries, add a reference to it, and subclass it for their two response POCOs. Yay I'm using inheritance!

    Oh but look at how much complexity I added, when I could have just typed public bool Success; twice.

    @evo said in Which language is the least bad?:

    I guess it's about the same as Windows vs Linux; Linux gives you more freedom, but more rope to hang yourself. Linux has a more steep learning curve, and I wouldn't want an idiot touching my Linux servers because they could easily fuck it up.

    Yeah and guess what? As a result, nobody uses it. (And those who do use it only because it's free, or because they have an irrational seething hatred of Microsoft for some reason.)

    Similarly, how many new projects are started in C++? Very few, and those that are are really simple tiny tools, not like the Adobe behemoths of the 90s when C++ was basically the only choice. If Photoshop were being founded today, do you think Adobe would pick C++? (And quick reminder: Adobe had so much trouble with C++ that they eventually started writing their GUI widgets in Flash. Flash!)

    @evo said in Which language is the least bad?:

    Most importantly: easier to read and maintain and understand.

    Will it? That's a hell of a claim.

    @evo said in Which language is the least bad?:

    There will be parts that are more difficult to understand, but they are encapsulated and shouldn't be touched by people who don't know what they're doing.

    C# is just as capable of encapsulation. But in C#, the code you need to encapsulate is complex because the problem it solves is complex, not because the code itself is complex.

    You sound like you're a big fan of the "high priesthood of technology" philosophy. Ugh.

    @evo said in Which language is the least bad?:

    It's exactly the same, just that cutting is significantly easier than writing good, maintainable code.

    Maybe we should endeavor to create a language where writing good, maintainable code is just as easy as chopping vegetables.



  • @blakeyrat said in Which language is the least bad?:

    Maybe we should endeavor to create a language where writing good, maintainable code is just as easy as chopping vegetables.

    Yeah, even that sometimes doesn't work out all that well.

    For example, I'm of the firm opinion that one of my kitchen knives is a secret apostle of Khorne because it demands my blood after each and every time I sharpened it.


  • Banned

    @blakeyrat said in Which language is the least bad?:

    I had enough trouble writing C# code for tax-exempt savings account accounting rules, keeping both C# in my head at the same time I kept those complex-ass rules in my head.

    I always assumed people on this forum have skill above the average in this industry. No I think I've been wrong in at least one case.

    I ended up having to write reams of pages in OneNote to pull that off.

    ...or maybe he just doesn't realize that every programmer has stacks of post-it notes everywhere on their desks because they can't write code efficiently without them.


Log in to reply