views:

57

answers:

1

I learned some java first, and now I'm learning PHP. I am not comfortable with how "free" it is, with things like loose typing. I really liked the way java forces you into good practice. Are there any open source web programming languages that are more restrictive than PHP, in the same way java is?

+3  A: 

How about... Java? :D
If normal Java-driven frameworks are (for some reason) unacceptable, then how about Google Web Toolkit - you write code in Java (with all the benefits of the language), but the application is compiled to JavaScript, which can be run on any modern browser. Additionally, it performs some optimization, etc - really worth looking into if you are familiar with Java and want to use that language to write "light" web applications.


If I didn't make it clear before: you write code in Java (you can use all the design patterns, object-oriented features, strict typing, etc., the compiler warns you if there are compilation-time errors, there's very mature Eclipse integration and so on), but the application is compiled to JavaScript - no need for Java plugin in the browser (no Java applets whatsoever). The compilation part additionally optimizes and obfuscates the output JS code so you'll get faster and smaller code, then if you wrote it by hand. The server side is up to you - while it is easiest to use Java there (especially with all the cool stuff coming in GWT 2.1), you easily use PHP, RoR or Django (via JSON or XML).

Igor Klimer
I read in various sources that Java applets are dead. Was I lied to?
lala
@lala there is a difference between Java Applets that run in the browser (which indeed didn't take off the way it was envisioned), and Java as the server-side programming language (which is not dead at all)
Pekka
Oh I see. I'm a noob and didn't know the difference. Thanks.
lala
@lala: added a clarification - hope that makes the whole thing clearer :)
Igor Klimer
@lala you're welcome. However, I'm not sure to what extent using GWT enables you to build full web applications. Server-side Java programming ([JSP](http://en.wikipedia.org/wiki/JavaServer_Pages) and the likes) is what you should be looking into IMO
Pekka