The first programming language I learned was PHP, however now that I know C and Java I am having trouble coding in PHP. I've noticed, when coding PHP, that is has the following major problems: ------------------------------------------------------- 1. It's Typing system is Sloppy it's typing system (weak) is very, very sloppy. when I am writing a function I want to make sure that an argument passed is a certain object, but it could be a string or integer. Also it's hard to keep up with what variables are with weak typing. The typing system -- and yes, most other weak typed language's typing systems -- comes out as simple and sloppy. When you add the string "1" to "2", you should get "12", not "3", in my opinion. 2. No Real Overloading I LOVE method overloading. Sometimes functions should just be able to handle different parameter lists in different ways. Take this Java example I wrote on the spot. class Main { public String name; public static void main(String[] args) { new Main(); } public Main() { storeName("Joe Blow"); storeName("Joe", "Blow"); } public void storeName(String name) { this.name = name; } public void storeName(String first, String last) { storeName(first + " " + last); } } Code (markup): What I basically did there was I created a function to store someone's name in a variable. You can supply the name or you can supply the first / last names. The overloaded function, in this case, just calls the other version of it. PHP can't do this, but Java and C can, for example. 3. Hard to Code OOP It's really hard for me to code OOP in PHP because of the dynamic typing. Maybe it's just me, but if you can't specify the type of variable which is being passed to a function (say, if it's a custom object) has to be. 4. Sloppy packaging The PHP functions are packages horribly. There are no imports, so all of the functions are already defined in a messy jumble. Secondly, they are very poorly named. some are in camelCase, some use underscores, and some use glue (like htmlentities. The words are just glued together, no camelCasing or underscores) 5. Very Little OOP I love OOP, but I just don't get the OOP feeling. When I'm coding PHP is feels like it's just pretending to be object oriented. There are so many thing sin PHP that could be done with OOP but weren't, which is probably because OOP was only released until a fairly late version. ----------------------------------------- anyway, beside my grievances with PHP, I'm wondering if there's a web-based language that y'all recommend that is a little bit less... messy? It works, but PHP just gives me the feeling that it's mainly designed to throw together a bunch of temporary code to do something quickly but not all that well. I'm not trying to bash PHP, which is a language that has a whole lot of good applications written for it, but I want a more formal language which works on the web and you can actually find a host for. I looked into setting up my own server, but my darn ISP doesn't allow it.
One option of cause is ASP.Net, you could use J# given your Java knowledge but you'd be better off learning C#. .Net is an OOP and meets all 5 of your requirements Assuming you have Windows running on your PC you can download and use Visual Web Developer Studio from Microsoft for free - it does 95% of what Visual Studio does for web projects and 4% of the remainder can be covered by third party free applications
I'v heard good things about C# as a language. I definitely should look into that a bit. I'm sort of repulsed by the Visual Basic style languages because I'm mainly used to C-style syntax, rather than the human-readable syntax of Ruby and ASP. I guess I could train myself to do that sort of thing if enough people think it's worth it though.
It depends what you consider "worth it". C# & .Net have the advantage of being used on both online and desktop applications (though full support for desktop is limited to Windows) and is certainly where most corporates are going - JSP was originally used by financial services but they tend to be migrating across to .Net these days. A lot will depend on what you want to be doing with it. .Net has a lot less free examples/ scripts than PHP but at the same time tends to be much quicker to programme.
Meh, I'm serious enough that I'd be willing to buy a book or two about C# if I wanted to. I don't know that examples are too much of a problem there. I already know C# pretty much though because I know Java. I could probably take the C# Hello World example, put it in a java compiler, and change a class name or two and it'd work. Do C# web hosts exist, you think?
The problem with .NET stuff is you are coding to Microsoft and not standards. .NET stuff only runs in Windows and, in some cases, hides how things work and, on a whim, Microsoft can change things around and screw you up. Take it from one who knows and had that happen to him six years ago. There are plenty of languages around that can do anything .NET can do and better in a standard way that will live forever.
Which languages are these? (Besides PHP, of course. PHP is a good language but I don't think it's for me).
There are millions of ASP.Net hosts. You compile the code and therefore what language you use locally doesn't matter (C#, VB, J# etc). Like PHP there are free hosts all the way up to dedicated server clusters. Traditionally you used to pay a little more for a Windows server than a Linux one but to be honest, the difference is minimal if it exists at all now a days. The one thing to be careful with webhosting .Net on shared hosting is what security permission level is set at on the server. Many shared hosts set it to Medium Trust level which means that some components/ scripts won't work because Reflection requires High or Full Trust. The comment that ASP.Net will only run on Windows PCs is also a load of rubbish, as usual. Yes, your better off using a MS Server for the hosting but people using the site can use any OS and any browser etc, in fact .Net can easily be configured to identify the users hardware/ software configuration and automatically adapt its dynamic output to maximise compatibility.
Didn't say that. I said .NET only runs on Windows (ignoring Mono which everyone on *nix does). The advantage of .NET is that it takes advantage of Windows but the 'net has nothing to do with Windows except when you want to interact with the desktop but then you can use other technologies that don't tie you down to Microsoft and are free to use.
Its still inline code like Classic ASP/ PHP so not ideally meeting your requirements, plus the number of budget hosts is limited. It did used to be used fairly heavily in the corporate market but many are moving across to .Net these days.
I don't have a problem with inline code so long as there's an effective way of referencing external classes, which JSP does have. PHP can have external classes, but the problem is I find it's OOP very distasteful (reasons cited in first post). I'll definately be looking into .NET and JSP. What's the difference between C# and J#? C# seems to be particularly java-like already. P.S. Also, research tells me that there are very few .NET hosts that allow anything other than VBscript. Is that a problem / true?
Lol! How do you add strings? Like this $string = $str1 + $str2; PHP: or like this $string = $str1 . $str2; PHP:
C# is roughly Microsofts take on C++ and J# is its take on Java. They are therefore fairly similar anyway given Java was original intended by Sun to replace C++. A host will never support VBScript as this is for ASP not ASP.Net. All will support C# and VB if your not compiling the code locally. If you are compiling it locally it doesn't matter which of the 20 or so supported languages you use as what you upload to the host will be in MSIL
The concantination operator only exists in PHP. Its existence only serves to hog an operator which is normally used for member access. PHP, in my opinion, would be a better language if it was exactly the same except was strongly typed. This would allow them to: 1. Allow (true) function overloading. 2. Make OOP seem more real 3. Allow IDEs to check for type mismatch errors that cause PHP runtime errors. That way you wouldn't even have to open your browser to debug. 4. The concantenation operator would no longer be needed, thus allowing the . to be used as the member access operator. All in all, most of PHP's problems (at least the ones I recognise) root from its weak type system. I wish Java replaced C++. It's just a better language, if you ask me. Of course, though, people still use it because it's an industry standard. I see. The two are so easy to mix-up.