Author Topic: Which language and library to use  (Read 30733 times)

Numeron

  • Rogueliker
  • ***
  • Posts: 88
  • Karma: +0/-0
    • View Profile
    • Numeron Reactor
Re: Which language and library to use
« Reply #45 on: July 07, 2014, 07:11:20 AM »
*I don't follow what you're saying about type heirarchy.

Multiple inheritance is not a thing in Java.

A class can only fully inherit/extend from one other class, so in order to have polymorphism through other vectors, a class must instead implement interfaces. These interfaces are like empty classes so the only thing that can be inherited from them is the type and the requirement to implement the methods they say you must.

This can be a massive pain sometimes, but I think leads to better designed programs overall.

Bear

  • Rogueliker
  • ***
  • Posts: 308
  • Karma: +0/-0
    • View Profile
Re: Which language and library to use
« Reply #46 on: July 07, 2014, 03:31:42 PM »
In fact I'm fine with a language that has interfaces as the *ONLY* inheritance mechanism. 

I think that taking the "reuse the implementation" approach off the table does lead to better designed programs.

But then, I was never the biggest fan of OO methods in the first place; It fits too well into a lazy programming mindset that tends to ignore or subclass rather than understand and fix basic design problems.

Cfyz

  • Rogueliker
  • ***
  • Posts: 194
  • Karma: +0/-0
    • View Profile
    • Email
Re: Which language and library to use
« Reply #47 on: July 07, 2014, 04:51:31 PM »
Well, overuse of inheritance is a fairly common mistake:
Stack Overflow: Prefer composition over inheritance?
MSDN blogs: Seven deadly sins of programming - Sin #2
Herb Sutter: Uses and Abuses of Inheritance, Part 1

That said, the inheritance (multiple or not) is not an evil by itself, yet adds more flexibility. This way, for example, C++ had its own "default methods" long before those were deemed necessary and introduced in Java 8 (i find ironic the fact modern Java does have kind of multiple inheritance now).

Kevin Granade

  • Rogueliker
  • ***
  • Posts: 83
  • Karma: +0/-0
    • View Profile
Re: Which language and library to use
« Reply #48 on: July 08, 2014, 03:56:09 AM »
*I don't follow what you're saying about type heirarchy.

Multiple inheritance is not a thing in Java.

A class can only fully inherit/extend from one other class, so in order to have polymorphism through other vectors, a class must instead implement interfaces. These interfaces are like empty classes so the only thing that can be inherited from them is the type and the requirement to implement the methods they say you must.

This can be a massive pain sometimes, but I think leads to better designed programs overall.
Aah yes that, actually I think multiple inheritance is generally a terrible idea, interfaces or some similar limited model like composition is generally the way to go.  So that one falls into the same category of not disagreeing with the feature set, but disliking the implementation.

Eben

  • Rogueliker
  • ***
  • Posts: 339
  • Karma: +0/-0
  • Controversializer
    • View Profile
    • SquidPony!
Re: Which language and library to use
« Reply #49 on: July 17, 2014, 10:59:02 AM »
There is no such thing as a perfect language, which is why we not only have so many languages already, new ones crop up constantly.

Java is about my 20th language or so (counting different flavors of BASIC and Pascal as different languages) and it's been my go-to for the past several years. The only time I've run into something that it couldn't handle easily was direct serial port connection to a specific legacy video camera.

On the subject of Java Enum, they are flipping brilliant and all languages need them. Having full fledged singleton objects as a language feature means having the appropriate level of control for meaning of enum objects while still allowing Pascal style records and utility functions. And anyone reading the code will know immediately how they're meant to be used. I see them as the same kind of leap as having GOSUB instead of just GOTO

Back to the OP, pretty much every language is equally good for roguelikes, especially if you're intending to do a text only approach. If you're going to do a graphics approach then the library is the important choice and the language is more of an add-on.

joeclark77

  • Rogueliker
  • ***
  • Posts: 90
  • Karma: +0/-0
    • View Profile
Re: Which language and library to use
« Reply #50 on: July 18, 2014, 06:28:59 AM »
I'm glad that this thread didn't devolve into the typical my-language/your-language argument in which nothing is learned, but instead, we were all able to come together as a community around our shared disgust with Java.  It warms my heart.

By the way, I'd like to hear opinions about C# versus C++ and other languages.  I'm mainly a Python programmer so I think either one would be a big change of pace for me, but I'm interested in both languages as possible new tools.  C# and the whole microsoft stack (visual studio, SQL Server, .NET, ASP, etc.) are used a lot at my work, so I might go for that one.  Is it a better tool for producing packaged software with good performance than Python?  How does the language and its performance compare to C++.  As for C++, I'm thinking it might help me become a better programmer by forcing me to learn more computer-sciency stuff like dealing with memory, threads, data structures, and so forth, but I'm worried about learning a lot of powerful features just to forget them again for lack of need to use them.  How useful is C++ really?

reaver

  • Rogueliker
  • ***
  • Posts: 207
  • Karma: +0/-0
    • View Profile
Re: Which language and library to use
« Reply #51 on: July 18, 2014, 07:27:53 AM »
As for C++, I'm thinking it might help me become a better programmer by forcing me to learn more computer-sciency stuff like dealing with memory, threads, data structures, and so forth, but I'm worried about learning a lot of powerful features just to forget them again for lack of need to use them.  How useful is C++ really?

C++ is still *the* language for video games and applications where performance is critical, but you have to put the effort to make your program fast, it's not magic. C++11 is massively nicer than the last standard, so if you start, start from that. Wrt forgetting powerful features, if you really want to learn them, apply them by starting with tetris, then make more simple games, etc etc - if you start with a big one from the get-go you're doomed.

Paul Jeffries

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 257
  • Karma: +1/-0
    • View Profile
    • Vitruality.com
Re: Which language and library to use
« Reply #52 on: July 19, 2014, 10:46:43 AM »
Either C# or C++ will generally be a lot faster than Python.  Of the two, it will generally be possible to get C++ to run faster, but it all depends on what and how you're writing it.

As a production language I prefer C#, because it's generally faster to get something up and running in it, but as a learning experience C++ is great - I found that after learning and using C++ for a bit it made me a much better programmer in other languages because I had a better understanding of what those languages were doing 'behind the scenes'.  So, the language I would suggest depends on what you're looking to get out of it.

Also, I wouldn't pay too much attention to the Java haters.  It's not my favourite language and I can see why its 'my way or the highway' approach to some things can alienate people used to different languages, but its a perfectly good choice that's very similar to C#.