Jump to content

javascript/typescript questions


jahmaican
 Share

Recommended Posts

Hello!

 

Excuse me if this is not the first topic addressing this matter (and I bet it isn't). I will soon have some more free time and I wanted to learn something new, so I think - why not HTML5 games? I come from Java (which is my job) and Ruby (kind of a hobby) and I'm not completely new to gamedev (e.g. see my unfinished Ruby raycaster). I did a bit of research and Phaser looks very promising.

 

I know JS can be kind of object-oriented, but it treats functions as classes or something like this and it is quite confusing. Typescript should be more "normal" for me then? As mentioned, I love "the Ruby way" of coding, and I heard there's this thing called Coffeescript that is inspired by Ruby, are Typescript and Coffeescript similar? Can I use Coffeescript with Phaser? Or even some kind of Ruby to JS parser (Opal, RubyJS...)?

 

I never did a lot of JS-related stuff and I don't feel like blindly trying every option, so I'd love to hear your opinion.

Link to comment
Share on other sites

Yes, Typescript adds a more familiar object orriented veneer over JavaScript.  The most important part is it adds static typing to a duck typed language.  You will certainly be more comfortable with TypeScript than JavaScript as a language.  Additionally TypeScript ( and CoffeeScript ) solve some of the worst idiocies of JavaScript.  At the end of the day though, TypeScript is a superset of JavaScript, meaning 100% of JavaScript runs within TypeScript.  Coffeescript on the other hand is a different language that compiles down to JavaScript.

 

 

Here's the kicker though... they both ultimately become JavaScript, and if you dont know JavaScript, when you run into a problem, you run into it hard.

 

 

So basically what I am saying is, learn JavaScript first, then look at learning TypeScript or CoffeeScript.

Link to comment
Share on other sites

Typescript user here :D

Go for it! I enjoy programming TypeScript applications but not JavaScript applications!

With a Java background, you will feel at home.  Much more at home,, than sitting with a book and trying to wrap your head around how to make a bloody class (feels like hacking js to death). 

Many will disagree and maybe I will too one day, but the bottom line is that TS made HTML5 accessible to me.  Without it, I would not have any interest in this field! Also I am forced to make Definitions for small JS libraries, but this is still a small price to pay compared to raw JS applications.

 

Link to comment
Share on other sites

I personally prefer JavaScript, but it's only tolerable when coming from OO languages to not think of it as OO, or try to overly depend on OO methodologies. I never refer to 'classes' in JavaScript, because there's no such things - there are objects and copies of those objects. Once you gain a better understanding of JavaScript's workings it actually becomes rather refreshing to work with - I can't think of a language more suited to rapid prototyping for instance; you can get something working alongside some excellent debugging tool pretty much anywhere in minutes due to the need for only a browser and a text editor.

 

For the record my background is in ActionScript 3 which is essentially JavaScript with Java's OO model. It's actually a very nice, very clean language and it's a shame it's disappearing now along with Flash.

Link to comment
Share on other sites

I think that was my issue with it. 

 

I had spent too many years reading too many books about Actionscript 3 just to feel like I had to hack the language to death.  The terminology of TypeScript makes sense to me,  Prototype chains and all that jazz is something I have not seen since AS1 with my Flash Math Creativity book!

Cool to know you came from AS3 background though :D 

Link to comment
Share on other sites

  • 2 weeks later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...