Off-Topic: Java and Framework Alternatives - 'Friendly' Discussion.

C/C++, I used the CodeBlocks IDE at first, but I hated that IDE, so I was going back to Eclipse (they have a C/C++ IDE also), so once that problem was solved I started to code a platformer with SDL/OpenGL, I can’t say that I don’t like it, but the compiler flags, and importing libraries really pissed me off in the beginning (didn’t understand it). After that it was quite fun, its a little bit less flexible, because memory management is something you don’t have to worry about in Java, but C++ is another language… (Take 2D arrays, and giving them as a parameter to a function for example).

Further Java/C++ are really similar, made a network application, it is really the same as Java-networking. But I ended up with a silly UDP-problem which was no problem local, but over internet (really only over internet, not local) it was behaving really weird (client received first msg from server, nothing more, had nothing to do with firewall/ports, it is really the code/C++).

So I headed back to THE platform-independent, which I really appreciate now, as I had to do it all in C++ myself (my networking was working on Linux/Windows).

One word: Scala

I’ve done many years of C# and Java programming. Scala is a big leap from both. A few Reasons?

  • Properties. Java has this horrible convention of writing getters and setters everywhere. C# has this half fix of “properties” which are redundant with regular fields or variables. Scala implements this the right way. I won’t explain the full thing here, but it really is far more elegant than either Java or C#.

  • Generics. Scala arrays use standard generics syntax and casting rules without any performance hit. C++/C#/Java all have this legacy with completely different syntaxes and completely different casting rules for no reason other than legacy. Additionally, C#/Java are prone to array casting runtime bugs that Scala catches at compile time. In hindsight, C#/Java made a mistake by making arrays covariant, but they can’t change due to legacy.

  • if/for statements can return a value. No need for special ternary operator when you can use an if expression.

  • Partial functions. C++/C#/Java have this “switch”/“case” construct that imitates a mathematical partial function. Scala has native partial functions.

  • Native support for tuples and currying.

  • LINQ: Notice how Scala can do everything C#'s LINQ can do with the core Scala language without pulling a C# move and bolting a completely separate disjoint language syntax on top of the core language.

  • Type inference: Java has almost zero type inference, C# has much more limited type inference, while Scala supports type inference on function return types for example.

  • Deprecated null. null just exists for Java compatability. Scala uses Option, which is a collection for 0-1 items and makes code much more concise.

  • Pattern matching. Hugely powerful language construct that applies in many domains.

  • Parser combinator library. This is one useful showcase for the elegance and flexibility of much of Scala.

  • SBT. It’s like a hyper concise, better version of Maven. It also has an extremely useful REPL or console where you can have all your classes loaded and manually call functions.

Other competitive languages are Haskell, Rust, and maybe Lisp and ML derivatives. F# is Ocaml for the .NET platform and I’ve heard that’s worth checking out.

If you’ve taken the time to learn the features I just mentioned, you wouldn’t consider using Java or C# and would only use C++ if you had to for the runtime flexibility.

Except any time I see Scala, I think, “MY EYES!!”. :frowning: I haven’t given it a proper shot, that’s just my naive impression.

yes, very naive :stuck_out_tongue:

Why “MY EYES?” ?
It looks a little cleaner

I have mixed feelings about the way they define functions, but a lot of things I think look pretty good/cleaner

To the Scala Dude
What happens if a function doesn’t fit on one line, and you move part of it to 2nd line.
without the ; how does it know when it ends?

There are of course a bit more details to it, but the 3 big rules for this from the scala spec:

A newline is interpreted the same way as a “;” if ->

  • The token immediately preceding the newline can terminate a statement.
  • The token immediately following the newline can begin a statement.
  • The token appears in a region where newlines are enabled.

foo.      //. can not end a statement
  bar()

foo      
  .bar() //. can not start a statement

foo.bar(
             //newlines doesn't matter here
)

Accidentally hit appreciate.

I did about a year ago. It looked pretty good but the installation was a nightmare. The installation file messed with strange files on my computer. I ended up having to uninstall the software by using the terminal and deleting and restoring files.

I’ll just leave this here: Rust

Nice language. A bit buggy though, and incomplete (impossible to make a doubly-linked-list without unsafe code), but that’s to be expected as it is still under development.

Also, it’s AOT compiled, and can run on most common platforms, but the standard libraries only work on Win/Mac/Linux.

Once this is complete I would consider using it as well as, or instead of Java.

Haha, that reminds me of something Riven said some time ago about adding a confirmation dialog to the appreciate button :slight_smile:

[quote=""]
That being said. Unluckily there isn’t any magic bullet when it comes to other frameworks. Advanced applets are going to die quite soon though (if they didn’t already some time ago) so I think that the best thing to do is to do AOT compiling or at least bundling the jar (and possibly jre) into executables with for example Launch4J.

Mike

I started off programming in Javascript making simple things,
using JQuery for animation. I cant stand looking back on code I’ve written.
Also used Unity(JS), I liked it alot and got pretty good with it.
Its lame having to do models, textures, art, and other stuff when you just want to
code. Thats why i moved to 2d.

I mentioned Rust. The language design looks extremely similar to Scala. Almost every Scala pro I mentioned applies identically to Rust.

  • Similar variable and function declaration syntax. Optional types on the right after a colon. Defaults to type inference
  • Avoids null. Both Scala and Rust use identically named “Option”
  • Rust has an identical pattern matching mechanism to Scala.
  • code blocks return values. if expressions make the ternary operator unnecessary.
  • void type is called Unit.
  • Both have native tuples.

The big difference is Rust is designed to work in a native, C-centric world, while Scala is designed to work in the JVM managed code world.

For some apps, such as a Firefox type web browser, the JVM is not an option. I imagine that is what the Rust team at Mozilla have in mind. That needs to work at a lower level. For a video game targeting Mac/Win/Linux, JVM seems ideal. The downside of JVM for games, is there is that the entire community is C based and JVM has terrible runtime options for consoles and iOS and even with Android, Dalvik is a high performance runtime like desktop Java.

I think the integration with the C world is much more important than AOT compilation. There are AOT compillation options with Java, they aren’t polished, but even if they were, I think that’s less important that C world integration.

Other Rust v Scala differences:

  • Rust has more direct control over low level memory issues, which I imagine has both pros and cons depending on the scenario. Rust has more support for stack allocation, exposes pointers, optional, more manual garbage collection.
  • Rust arrays use a disjoint syntax from other generics classes. IMO, this is a mistake.
  • I’ve never used Rust but it’s clearly a rare more obscure language, so it will not have the fleshed out community and tools and library ecosystem that Scala has.