Advertisement Jump to content
blesseddisciple

Java Sick of Javascript bugs, going back to Java

Recommended Posts

So I have a decent amount of JavaScript experience now and decided I was gonna lower my head and start cranking out some 2d games, partly to learn, partly to have fun. Afterall, HTML5 canvas is such an easy and enticing medium. I love the JavaScript implementation of it. But after literally struggling for a week to get basic game functionality working I have had enough of the little stupid bugs that pop up with JavaScript. Don't get me wrong, I still love the language for scripting. I'm just not going to spend 20 mins coding and 5 hours debugging just because the language is crap.

I've decided to return to my previous endeavor, Java. I like Java a lot and the only reason I haven't pursued more in the way of game development is just for the fact that Java is limited to mobile or PC apps that may never see the light of day unless it's hosted on some obscure Java game hosting website that is populated with 2,000 half developed games that no one will ever care about. BUT, still, I enjoy hand coding and I know C# but don't feel like using Visual studio and I really don't wanna hand code C# on the .Net or whatever. I use Visual Studio for business apps (ASP.NET) but I don't wanna build a game with it.

So, does anyone have any points to share about why moving to Java for game development is not smart? Besides the whole, "Java is slow" thing. I mean things that might make it harder in JAva to make games vs. in other languages. Please share your thoughts. 

Share this post


Link to post
Share on other sites
Advertisement

The following is mostly my opinion, so I hope no one will react too strongly to it.

I think your appraisal of JS may be a little harsh. It seems fairly clear that it's a viable language for game development, given the number of games that are implemented with it. Also, if you've found yourself spending hours on debugging, I'm wondering if maybe you're not using the best tools or not taking full advantage of the tools you have available.

Developing with JS can indeed be tricky compared to e.g. Java due to JS's dynamic nature. However, static analysis tools such as linters can be used to ameliorate those difficulties, and with the debugging tools available in popular browsers, tracking down the source of errors is generally straightforward.

In any case, I think if you were to post some of the problems you've run into here or on a similar forum, someone could likely help resolve whatever the issues are. Speaking for myself, I'm generally happy to download and try out JS apps myself as long as they're self-contained (this is one of the nice things about JS development). If you're really stuck on something, I bet I or someone else could help isolate the problem.

As for Java, I wouldn't worry about its being too slow unless you're doing something unusually demanding.

I'm not entirely up to speed on the state of Java support on various platforms, but it might be worth looking into that before pursuing Java further. In particular, you might look into support on Apple platforms (if you want to target those platforms) and whether Java apps are supported on the various Apple stores. I know LibGDX is popular, and it both uses Java and supports Apple platforms, so it would seem there's a way forward there, but I'm not sure of the details.

Obviously Java is supported on Android (being an officially supported language, along with Kotlin), so no issues there.

You might also check out this forum:

http://www.java-gaming.org/

I get the impression activity there has decreased significantly, but it looks like there's still discussion going on, and there's a wealth of archived information as well. If you're specifically interested in pursuing game development with Java, you might find some useful info there.

Share this post


Link to post
Share on other sites

JavaScript is a beautiful language. It was written to fulfill a particular need and IMO it does that in spades.  I learned Scheme before JavaScript, and even though you constantly see people claim "JavaScript isn't Scheme" ...... well ..... it kind of is, and therefor can even be considered a dialect of Lisp (although a lot Common Lisp guys will give you hell for saying that).  If you understand Scheme you will understand JavaScript really well.

Whether Java or JavaScript or some other language is more suitable for your needs, I can't say.  However part of your issue might be you need a more fundamental understanding of the language.

Edited by Gnollrunner

Share this post


Link to post
Share on other sites

I'm going to have to suggest your bugs are user error and not the actual language itself. I use Javascript on a lot of commercial work and never experience issues beyond user error. I've fixed a lot of broken code my clients were dealing with from poor programmers, but that's not the fault of the language itself.

Unless you can show some examples, I'm inclined to suggest you might need to re-evaluate your understanding of the language and how to effectively use it for your given task.

Share this post


Link to post
Share on other sites
11 hours ago, Gnollrunner said:

JavaScript is a beautiful language. It was written to fulfill a particular need and IMO it does that in spades.  I learned Scheme before JavaScript, and even though you constantly see people claim "JavaScript isn't Scheme" ...... well ..... it kind of is, and therefor can even be considered a dialect of Lisp (although a lot Common Lisp guys will give you hell for saying that).  If you understand Scheme you will understand JavaScript really well.

Whether Java or JavaScript or some other language is more suitable for your needs, I can't say.  However part of your issue might be you need a more fundamental understanding of the language.

I'm not disagreeing with the fact that Javascriot is a beautiful language, for web scripting. I use it regularly for web apps, it just seems like it really suffers on the object/Class structuring conpared to other languages ive used. I have been programming since QBASIC, and literally never had issues with C#, Java, VB, QB64, Python. But for some reason everytime i turn around while developing a jscript game something doesnt work the way it should in every other language. I'm not bashing javascript, just merely saying im done making games with it. Personally, I love node.js

11 hours ago, Rutin said:

I'm going to have to suggest your bugs are user error and not the actual language itself. I use Javascript on a lot of commercial work and never experience issues beyond user error. I've fixed a lot of broken code my clients were dealing with from poor programmers, but that's not the fault of the language itself.

Unless you can show some examples, I'm inclined to suggest you might need to re-evaluate your understanding of the language and how to effectively use it for your given task.

I cant blame you for assuming it's my poor coding skills. In fact, it is, but only to the point that things that are easy in other languages act buggy in js unless you know all the little tricks to make it work right. Classes for example, trainwreck in js. Not my fault.

Share this post


Link to post
Share on other sites

Never shy away from something because it's difficult. That, in and of itself isn't the best reason for not embracing a technology. Now, Javascript does have it's own esoteric way of handling OOP, prototypes, function objects, ect. But arguably knowing how these structures work, and how they are best leveraged isn't just relevant to GameDevelopment, but as you mentioned, web-app development as well.

In fact, it sounds like Javascript is one of your primary languages that you work with in your day job. That gives it's own inherent benefit to better understanding how the more advanced features of the language are leveraged. Did you use a debugger? Did you know you could use a debugger? Set breakpoints, step into methods, view variable tables, set watches, ect? I think even Firefoxs debugger provides this, but It's ok if you didn't know.  Many "experienced" developers inherently assume that debugging scripting languages has to involve placing 

print("Did i make it here???");

wherever they think the instruction pointer ends up. If that's what you're doing and you're not on an embedded platform that forces the above debugging methodology, you're approaching this from the wrong angle. Just imagine building a game on android without tools like an interactive debugger, you'd find that Java is just as frustrating, if not more so. Especially when you find how easy the Write-Once-Run-Anywhere principle of Java can completely fall apart between different mobile devices. I have horror stories of the simple math.sqrt() method not giving idempotent results for the same input between different hardware 

In that context, +1 to zakwayda, tools can make all the difference. 

All that being said, if Javascript is out, than Java is a fine choice for GameDev. 

Edited by markypooch

Share this post


Link to post
Share on other sites
22 hours ago, blesseddisciple said:

it just seems like it really suffers on the object/Class structuring conpared to other languages ive used.

 

22 hours ago, blesseddisciple said:

Classes for example, trainwreck in js. Not my fault.

That's because you aren't supposed to use classes in JavaScript. You're supposed to be using prototype-based OO. ;)

Share this post


Link to post
Share on other sites

Keep in mind the OO stuff in JavaScript is simply made to mimic other languages. It's not really an OO language. You can program without it. In Lisp you basically use lists for most everything. You "cons" stuff together for you data structures and you can write whole programs like that. You can do the same in JavaScript.  If you would rather use Java then fine, however I still think a large part of your problem may be the lack of a deep understanding of the language.

Share this post


Link to post
Share on other sites

I always hesitate to disagree with people on the forums, as I don't want to alienate anyone. But with respect, and in the interest of open discourse, I'll offer a couple thoughts here.

Quote

Classes for example, trainwreck in js.

I think you're mistaken about this.

To the extent classes exist at all in JS, it's only as a supervenience on the underlying object-prototype model. It's a different paradigm than that of e.g. Java and C++, which may be what's throwing you off.

That said, JS's approach is (arguably at least) perfectly functional and in no way a trainwreck. You can conceptualize things in terms of classes if you want, and ES6 even offers a formalized way of doing so. Creating classes in ES6 is straightforward - perhaps even less effortful, I would argue, than in Java or C++.

Lots of people use JS for game development. I've used it a lot for prototyping, and have never had any problems with classes or objects or anything like that. I'm really quite sure that whatever obstacles you've encountered could be easily overcome :)

Quote

Not my fault.

Perhaps not, but I don't think it's JS's fault either. Maybe it just wasn't a good fit.

I know you've already decided to go a different direction. But given that other people might read this thread looking for information on these languages, I just wanted to provide an alternate view (as others have).

Share this post


Link to post
Share on other sites
1 hour ago, Zakwayda said:

I always hesitate to disagree with people on the forums, as I don't want to alienate anyone. But with respect, and in the interest of open discourse, I'll offer a couple thoughts here.

I think you're mistaken about this.

To the extent classes exist at all in JS, it's only as a supervenience on the underlying object-prototype model. It's a different paradigm than that of e.g. Java and C++, which may be what's throwing you off.

That said, JS's approach is (arguably at least) perfectly functional and in no way a trainwreck. You can conceptualize things in terms of classes if you want, and ES6 even offers a formalized way of doing so. Creating classes in ES6 is straightforward - perhaps even less effortful, I would argue, than in Java or C++.

Lots of people use JS for game development. I've used it a lot for prototyping, and have never had any problems with classes or objects or anything like that. I'm really quite sure that whatever obstacles you've encountered could be easily overcome :)

Perhaps not, but I don't think it's JS's fault either. Maybe it just wasn't a good fit.

I know you've already decided to go a different direction. But given that other people might read this thread looking for information on these languages, I just wanted to provide an alternate view (as others have).

To flesh out our arguments, let's say I present a programming obstacle, nothing too time consuming. You program it JS and again in Java, (or I can in Java but then we introduce different programming styles/approaches), and then we compare which one looks/functions more efficiently and with less trouble. Does that sound fair?

1 hour ago, Gnollrunner said:

Keep in mind the OO stuff in JavaScript is simply made to mimic other languages. It's not really an OO language. You can program without it. In Lisp you basically use lists for most everything. You "cons" stuff together for you data structures and you can write whole programs like that. You can do the same in JavaScript.  If you would rather use Java then fine, however I still think a large part of your problem may be the lack of a deep understanding of the language.

You literally just admitted that they threw together some stuff to make it act like something it's not. You may not see that as a bad thing, but you can't blame others for not agreeing with you on that point. 

Edited by blesseddisciple

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!