Which language is the least bad?



  • I'd say the least WTF languages are definitely C/C++. At least... for the tasks they're intended for.

    I don't really get why anybody would mind either. Sure, put a newbie on any of the two languages and some monstrous beast will emerge, but a properly written program in either language can be beautiful, especially with C++11/14.
    The only downside I find with C++ is the lack of standardised API's for often used tasks such as networking and GUIs.

    We should somehow turn this topic (or create a new one) to form one perfect TheDailyWTF language... I wonder what we'd end up with.



  • @SpoofedEx said:

    I'd say the least WTF languages are definitely C/C++. At least... for the tasks they're intended for.

    C is ok for the tasks it's intended for.

    C++, however, is "intended" for all types of application development, and thus is wholly unsuited for what it's intended for. It's also ugly and unpleasant to use.

    @SpoofedEx said:

    We should somehow turn this topic (or create a new one) to form one perfect TheDailyWTF language... I wonder what we'd end up with.

    MUMPS.



  • Haskell is great for features and strong typing. What does Ada bring to the table?



  • All programming languages are designed by committee.

    I don't think any language is the least bad, they're all bad in different ways to various extremes and that makes me hate them all equally. Not enough to find another career, though.


  • 🚽 Regular

    @mott555 said:

    Objective-C is the worst language I've used

    Object Pascal is worse. I worked with a hardware tool where the developer had made his own extensions to it and his own compiler.

    Edit: Technically that's that particular implementation but I still didn't like it. C# wins for me


  • BINNED

    Strong typing plus readability at the expense of verbosity that makes Java code seem terse.



  • @antiquarian said:

    Strong typing plus readability at the expense of verbosity that makes Java code seem terse.

    I have dealt with VHDL before, and it is too verbose. Ada and VHDL made the same mistake, and that is confusing tedious syntax with disciplined semantics. Compare to Haskell or ML.


  • BINNED

    I did compare it to Haskell, which is why I'm considering using it for a home project. It has the same type safety as Haskell, but the code is easier to read.



  • Python is good, but the standard library has a few WTF moments. For example, the urllib2 module:

    import urllib2
    
    gh_url = 'https://api.github.com'
    
    req = urllib2.Request(gh_url)
    
    password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
    password_manager.add_password(None, gh_url, 'user', 'pass')
    
    auth_manager = urllib2.HTTPBasicAuthHandler(password_manager)
    opener = urllib2.build_opener(auth_manager)
    
    urllib2.install_opener(opener)
    
    handler = urllib2.urlopen(req)
    
    print handler.getcode()
    print handler.headers.getheader('content-type')
    

    An "auth manager", a "password manager", and an "opener", just to fetch a webpage with HTTP authentication! And the rest of the library is the same: CookieManagers, CookieJars, RedirectHandlers, HTTPErrorProcessors... And don't try to upload files through it if you value your sanity.

    Compare to the third-party requests library:

    import requests
    
    mycookies=dict(mycookie="value")
    r = requests.get('https://api.github.com', auth=('user', 'pass'), cookies=mycookies)
    
    print r.status_code
    print r.headers['content-type']


  • Oh but that's ok because now there's a urllib3

    Haha, I totally forgot about their awesome versioning system involving just adding a number to the end of the library name.


  • ♿ (Parody)

    @blakeyrat said:

    Oh but that's ok because now there's a urllib3

    Shit. I have at least 4 URLs I need to deal with.


  • Discourse touched me in a no-no place

    The CLR has a massive advantage in that MS had an opportunity to see where Java's bundled class library was wacky, and produce a much more orthogonal library, starting with WFC for Java, which was an absolute JOY to use, relatively speaking.



  • @cartman82 said:

    like this.

    Or this.



  • @blakeyrat said:

    ... so the programming language doesn't support a pretty common protocol due to PERSONAL DISLIKE?

    < guzzles> Powered by our patented "Global Interpreter Lock," the Python Foundation is pleased to announce TrollThreads, Python's latest language feature. < guzzles> A collaborative effort between The Python Foundation and PyFLTK, TrollThreads ensures that no two routines in your program will ever run simultaneously or exhibit other threadlike behavior. < guzzles> TrollThreads API should be almost instantly familiar to any developer with experience writing threaded code in other languages, with important added functionality. Namely, that it doesn't actually work. < guzzles> Should you actually want to take advantage of traditional threading, please use the "subprocess" module and a clusterfuck of IPC or inquire in our IRC channel, where many helpful developers will angrily explain that threads are *obviously not what you REALLY wanted*.

    As per topic, I'm a C# junkie - for me, it's the least WTFy of the languages, most of the time it does what's expected, and has a really awesome standard library. Powershell is pretty nice too.

    I kinda-sorta got on good terms with Javascript, I like C for its intended purpose (down-to-the-metal coding), and the rest either I've never tried using, or are a clunky mess to me.

    Honestly though, what really makes a language shine is a good IDE - and Visual Studio is pretty much irreplaceable to me.


    Filed under: <code> blocks parse Markdown, but three apotstrophes don't, wtf?



  • Oh yeah, Python's fake-threading. Ruby has the same thing. Never really came up for my use, since my threads were just waiting on REST API calls to return 99% of the time. Still WTFy though.



  • @antiquarian said:

    [Ada] has the same type safety as Haskell, but the code is easier to read.

    It has higher-kinds, universal quantification and GADTs (with GHC extensions)? Does it have dependent types?

    ...

    ...actually it does have some cool stuff.



  • TRWTF is the notion that threads are the solution to all asynchronous problems. Is there something mortally wrong with an event-loop-driven Reactor or Proactor pattern for async event (read: I/O and UI) driven stuff, and forking a process in the background or yielding to the system every-so-often if you want to do something compute intensive?

    Filed under: You have a problem, so you create a thread to solve it. Now you have 2^n, n>=0 problems.



  • Also everything in the standard library related to time is kind of a clusterfuck. There are about six or so distinct data structures/types/formats for timey-things and no obvious way to go from one to the other.

    That said I'm very happy with Python.



  • @tarunik said:

    TRWTF is the notion that threads are the solution to all asynchronous problems. Is there something mortally wrong with an event-loop-driven Reactor or Proactor pattern for async event (read: I/O and UI) driven stuff, and forking a process in the background or yielding to the system every-so-often if you want to do something compute intensive?

    After months of working mostly in node.js, I watched a video where John Skeet is trying to ensure Singleton is thread-safe. I got chills down my spine at the thought of having to figure all this out on my own in a real-world project.


  • 🚽 Regular

    @cartman82 said:

    After months of working mostly in node.js, I watched a video where John Skeet is trying to ensure Singleton is thread-safe. I got chills down my spine at the thought of having to figure all this out on my own in a real-world project.

    Back when I started with C# I wrote an email to him about extending singletons (I had basically re-invented an idea that already existed) after seeing the nice article on his blog and we had a back and forth over email where he gave me some sample code for my idea.
    Really nice chap, I had no idea who he was until much later so I'm amazed he took the time to respond to me.

    I keep meaning to buy his book, it looks pretty good.



  • @Cursorkeys said:

    Back when I started with C# I wrote an email to him about extending singletons (I had basically re-invented an idea that already existed) after seeing the nice article on his blog and we had a back and forth over email where he gave me some sample code for my idea.Really nice chap, I had no idea who he was until much later so I'm amazed he took the time to respond to me.

    I keep meaning to buy his book, it looks pretty good.

    Yeah, he seems like a really nice guy. Which, being a skeptical jerk, makes me wonder what dark secrets is he hiding. Imagine cops busting down his door and finding kidnapped orphans chained in the basement, answering SO questions 😄


  • 🚽 Regular

    @cartman82 said:

    kidnapped orphans chained in the basement, answering SO questions

    Either that or he's cloned himself, he seems to be everywhere at once. Every time I see his SO stats I think that I really should be doing some more design work instead of playing New Vegas.


  • BINNED

    → closed as off-topic:

    Oops… Wrong site…



  • Vb.net

    But I switched to c# because the world did



  • C# would be my pick. It is just so good it makes programming boring. It is cross platform these days, the compiler is now opensource and the tooling (the Xamarin IDE while it isn't visual studio ... it is pretty good). I done a bit with everything that is popular and I always find myself back using C#. VB.NET isn't that bad either, even though it is much lamented.

    Java is fine (but you spend ages writing boilerplate code) but I dunno why I would use it over C# knowing I can run my code on other platforms with Mono.

    After that I quite like Python, but I honestly haven't done that much with it outside using small frameworks like Flask.


  • Discourse touched me in a no-no place

    @blakeyrat said:

    Python's fake-threading. Ruby has the same thing.

    Python's threads are real threads, alas. They're real threads as implemented by a demented idiotic jerkwad. Where else would you speed up a CPU-bound thread by adding a busy do-nothing loop in parallel?! That's not slightly wrong, that's abysmal, absolutely the reverse of what any sane person would expect. And it's all because the lady loves Milk Tray some fucker thought that doing parallel programming right, with proper locks and memory barriers, was going to slow things down. (Protip: it only slows things down on a pure single core machine. Which nobody has these days.)

    I don't think Ruby's quite as bad as that. It's just s…l…o…w… (and broken in other ways).


  • Discourse touched me in a no-no place

    @tarunik said:

    You have a problem, so you create a thread to solve it. Now you have 2^n, n>=0 problems.

    More accurate would be: You have a problem, so you create another thread to solve it. Now you have protwbloemåááîîî…



  • @loopback0 said:

    stone age middlewarej [ ... ] Clearbasic

    I know the product you're talking about and I have felt your pain. Ancient Java, home-grown web framework and business objects. Fortunately we switched our installation off a couple of years ago. Of course the database persists, as they usually do, full of WTFs of its own, but we are on the long path to freedom.



  • @Zacrath said:

    And tabs cause problems wherever they're used.

    Tabs good. Tabs meaningful. Several spaces in a row not so meaningful.

    Python handles tabs just fine, you just have to use them consistently. I do not recommend mixing whitespace.


  • BINNED

    Perl has real threads. Which are broken as well.

    They were designed to emulate fork on win32 systems, a new interpreter is fired up and assigned to a real thread, then everything is copied over to the new thread ( COW, what's that? ) and if unicode is involved... boom! SIGSEGV! ( invalid use of memory contexts )! and that's considered WONTFIX by p5p ( well "stalled" ≡ WONTFIX after perusing the various tickets/messages [ perl5i, RT#31923, p5p ] ).

    When I want to use threads, real working (mostly) threads, I rewrite and use Groovy/Java.
    Perl, Python, Ruby all have screwed up non-working thread models.

    PS, I usually really like Perl. Just not their threading.



  • My daily language at work is Java. I don't mind, despite all the verbosity and such it's much better than most alternatives. I like compile-time type safety and I'm not smart enough to refactor a large project in a dynamic language. Java is a pragmatic choice, the language is very popular which means a wide range of libraries are available and Spring makes things bearable. We don't do EJBs except for one legacy system we're phasing out, so I've got that going for me.

    My play time is with Scala these days. A bit more magic going on than I really like but overall it's been pretty painless.


  • Discourse touched me in a no-no place

    @M_Adams said:

    Perl has real threads. Which are broken as well.

    They were designed to emulate fork on win32 systems, a new interpreter is fired up and assigned to a real thread, then everything is copied over to the new thread ( COW, what's that? ) and if unicode is involved... boom! SIGSEGV! ( invalid use of memory contexts )! and that's considered WONTFIX by p5p ( well "stalled" ≡ WONTFIX after perusing the various tickets/messages [ perl5i, RT#31923, p5p ] ).

    My preferred scripting language is Tcl, and there threads are generally very strongly partitioned, even more so than in Perl. In particular, nothing is copied over; the other thread starts out with its own basic interpreter context and has to be told what it is doing exactly (by sending messages over).

    The plus side? There's very little in the way of global locks (including in the memory subsystem) so you can take good advantage of multiple CPUs for doing several things at once. You also don't need to use threads for IO; Tcl's had good async IO for donkeys years. (It makes me grind my teeth every time I deal with Java, where the IO system is still awful after all these years…)


  • BINNED

    I do use Tcl/Tk, and yes the threading is nice. But, well, in Perl everything is a "variant" (sic), in Tcl it's much worse. Everything is a string! Blech.


  • BINNED

    Not that I'm saying "variants" are good either.


  • Discourse touched me in a no-no place

    @another_sam said:

    Spring makes things bearable

    It's the one truly useful Java library. It lets you avoid vast amounts of shit with object construction and lifetime management, all the stuff that you used to have to spend lots of effort and software pattern malarkeying on. The trick is to make your classes not talk about Fight Club Spring…



  • @another_sam said:

    My play time is with Scala these days. A bit more magic going on than I really like but overall it's been pretty painless.

    Too much magic for my taste.

    Every times I start a Scala tutorial: "Hmm, this doesn't look too bad, kind of like simplified Java. Let me just skip a few pages ... oh"...


  • Discourse touched me in a no-no place

    @M_Adams said:

    I do use Tcl/Tk, and yes the threading is nice. But, well, in Perl everything is a "variant" (sic), in Tcl it's much worse. Everything is a string! Blech.

    Actually, Tcl's not really been “everything is a string” since 1997 (16 years now). It uses something that's fairly similar to the variants, but with some strong serialization rules; all values in Tcl can be converted to a string and back, even if it's not efficient to be doing so.

    (Getting good floating point conversions isn't trivial. Most C libraries get it nastily wrong, as do most other languages, but it's apparently bastard hard to get right and parsimonious.)


  • BINNED

    @dkf said:

    Tcl's not really been “everything is a string” since 1997 (16 years now)

    Hmm... I'll have to "mea culpa" on that one, I haven't really paid attention "under the hood" in re Tcl, Tcl is an I use it when I have to... language. I may need to rethink that...



  • @dkf said:

    It's the one truly useful Java library. It lets you avoid vast amounts of shit with object construction and lifetime management, all the stuff that you used to have to spend lots of effort and software pattern malarkeying on. The trick is to make your classes not talk about <s>Fight Club</s> Spring…

    I don't know... a good JPA library (like Hibernate) is also useful.

    Too bad I'm not allowed to use either on my main project at work. Because I do SO love manually writing JDBC and JSP/Servlet code* for everything.

    *and all the other classes they rely on, such as the Service layer, the DAO layer, the actual classes that represent database objects...


  • Discourse touched me in a no-no place

    @powerlord said:

    I don't know... a good JPA library (like Hibernate) is also useful.

    Hmm, I'm using a JDO library instead, because I could figure out how to make it do what I really needed. The only tricky bit was taming the PersistenceManagerFactory so that it didn't fuck around with thread local variables (because that sucks in a JEE environment…)

    Are there any benefits of JPA instead of JDO? I could never find a clear enough description; everything assumed I knew way more about what I was doing than I really did at the time, or that I was a complete moron only capable of using canned recipes.



  • Every times I start a Scala tutorial: "Hmm, this doesn't look too bad, kind of like simplified Java. Let me just skip a few pages ... oh"...

    Maybe you shouldn't "skip a few pages..."



  • @powerlord said:

    I don't know... a good JPA library (like Hibernate) is also useful.

    Sorry to be a smug Clojure weenie on you, but JPA gets the single biggest thing wrong it can, and that's putting the query syntax outside the language it's operating in. Then again, that's because Java threw the overloaded operator baby out with the bathwater, I bet...


  • Discourse touched me in a no-no place

    @tarunik said:

    putting the query syntax outside the language it's operating in

    By that, do you mean that the query language isn't Java (given that the “J” of “JPA” stands for that)? It's not entirely an argument I buy; the benefits of a syntax that is tuned to its task are non-trivial. [spoiler](Unless you're a Smug Lisp Clojure Weenie.)[/spoiler] But that's not to denigrate the ability to have some integration with the outside language; it's pretty awesome to have an embedded query language that can refer to variables outside “directly” rather than having to pass them in by position.

    I'm guessing this is another discussion that will run and run. We've got popcorn…



  • @dkf said:

    By that, do you mean that the query language isn't Java (given that the “J” of “JPA” stands for that)? It's not entirely an argument I buy; the benefits of a syntax that is tuned to its task are non-trivial.

    Yes, or more precisely, that they weren't able to basically embed the semantics of SQL (although not the exact syntax, of course) into Java.

    Would you rather deal with collection.execute('SELECT FOO WHERE BAZ = ?', baz) or collection.select(foo).where(collection.baz == baz)? (Consider both examples pseduocode.) Also consider that you can bring your language's type system to bear on the latter...

    P.S.: can Hibernate reflect objects from table structure, or introspect schemas for that matter?


  • Discourse touched me in a no-no place

    @tarunik said:

    Would you rather deal with collection.execute('SELECT FOO WHERE BAZ = ?', baz) or collection.select(foo).where(collection.baz == baz)? (Consider both examples pseduocode.) Also consider that you can bring your language's type system to bear on the latter...

    The former, because then I can write my complex relations that reflect what's really going on and get them executing close to the data, where they belong. Twisting my head around how to express a relation in a language not designed for it just so that some code might be able to hoist it to the DB (or might just decide to do table scans and cross join everything on the client) seems foolish.

    But then I don't mind the query part of SQL at all; I've actually got a background in logic. It's the DML and DDL parts that irritate.

    @tarunik said:

    P.S.: can Hibernate reflect objects from table structure, or introspect schemas for that matter?

    No idea.


  • ♿ (Parody)

    @tarunik said:

    P.S.: can Hibernate reflect objects from table structure, or introspect schemas for that matter?

    I'm not exactly sure what you mean here. There's definitely manual work involved. You can take a bunch of objects, apply annotations and have Hibernate generate the schema for you. To my knowledge, you can't point it at a schema and have it generate classes for you.

    Hibernate has its own query language (HQL) that is SQL-like, but is also object oriented. It's handy for pulling collections from the DB, but isn't as expressive as native SQL. Of course, the handy part is when you don't have to use SQL or HQL at all, because you're just using objects and letting Hibernate worry about the conversion. This doesn't scale well, so I find that I have to use all 3 ways of using Hibernate in different situations.



  • @boomzilla said:

    To my knowledge, you can't point it at a schema and have it generate classes for you.

    There is an eclipse plugin to do this, also a maven plugin. I have tried neither. Other tools may exist.

    @boomzilla said:

    I have to use all 3 ways of using Hibernate in different situations.

    Indeed. As well as the mapped relations, native SQL and HQL, there's also the Criteria API.


  • ♿ (Parody)

    @another_sam said:

    there's also the Criteria API.

    I'd forgotten about that. Intentionally I think. IIRC, it's really stupid.



  • @Captain said:

    Maybe you shouldn't "skip a few pages..."

    I was thinking much the same. Especially with Scala. It has implicit variables which can silently fill in arguments in function calls, implicit functions which can silently do type conversions so you can pretend an object has a different type, optional dot-notation on method calls, optional semicolons, curly braces and parentheses are interchangable in many situations but not all and they have different semantics that may trip you up, the list goes on. You have to pay attention.



  • @boomzilla said:

    I'd forgotten about that. Intentionally I think. IIRC, it's really stupid.

    It's a nice idea but Java doesn't have the language features needed to make it great.


Log in to reply