Re: OT: Java vs PHP

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: Paul Mooring
Date:  
To: Main PLUG discussion list
Subject: Re: OT: Java vs PHP
I'm a Ruby guy, it's definitely my favorite language and I've seen and used it on lots of production projects. Rails does not scale well. I think a lot of confusion comes into play when newer web developers are working on a big project for the first time and thinking scaling should be the defining factor in every choice they make. Twitter had to dump rails for Scala on the back end for scaling reasons, Facebook had to compile their PHP to C code and compile that and Google has done even more exotic things to scale. These are companies that measure their load in millions of req/minute, you don't need to worry about that kind of scale yet.

Some of the problems Ruby specifically has are in the memory management and multi-tasking departments. Ruby's garbage collection has a sort of "water-mark" side effect, memory is flagged for re-use within the interpreter but not in the OS in general. This means that if a ruby process needs 1 GB of memory for a short period of time, then it will keep around 750 MB of memory forever, even if it's only actively using 10MB. Second there's no concurrency in Ruby, well ok there's threads and fibers but those are shackled with a GIL great for getting around blocking operations like web request or blocking IO but limited to 1 core and not faster for cpu bound problems. These problems can and have been solved in Ruby's mature web eco-system. If you're really interested in a decent sized project I think Ruby is a great choice but know what you're getting into, and maybe checkout JRuby and Puma from the get go if you want to solve the problems I mentioned up front.

One more thing since I mentioned JRuby you can actually run JEE server and mix it in with true Java code for optimization if you run JRuby. That can give you the ease of developing in a more developer friendly language than java (static typing debates aside Java has a lot more boilerplate code to deal with) while allowing you to dip into to something more heavy duty if you hit a performance wall.
--
Paul Mooring
Systems Engineer and Customer Advocate

www.opscode.com

From: Kevin Fries <<mailto:kevin@fries-biro.com>>
Reply-To: Main PLUG discussion list <<mailto:plug-discuss@lists.phxlinux.org>>
Date: Sunday, January 20, 2013 11:36 PM
To: Main PLUG discussion list <<mailto:plug-discuss@lists.phxlinux.org>>
Subject: Re: OT: Java vs PHP


I was the one that mentioned waterfall and must disagree with some of what you said.

I have seen many programs try and use java using agile methodologies, never one that ended up being highly maintainable over the long haul. Java's strict typing and poor to mediocre introspection makes agile programming almost impossible to pull off.

If you want to use an iterative style, you need a language that can support it. Both PHP and Java are very bad in this aspect. Python is good, Ruby is excellent. Both languages allow you to properly inspect your objects and extend them dynamically. Java requires much too much plumbing to pull this off. Python will allow dynamic inspection of your apis and adjust to changing conditions, but only Ruby allows you to extend a class to add functionality without subclassing it. It is these features that make agile, TDD, and BDD programming possible.

I stick to earlier guns. As you said, Java is great at the big commercial project. And your absolutely correct... that is why the big guys use it. They have the staff to maintain it. But looking at the OPs specs, I feel that it will be far too much tool for what he is ready for. Rails and Django are frameworks that will have is project up and running quickly.

There was also someone who said Rails does not scale horizontally.. ummm you know twitter is a rails app right? And Puppet? That comment was silly and very inaccurate.

I have programmed for many years in PHP as well as Java. I use both and recommend them often. The specs given by the OP though causes me to not recommend this. Rails and Django will make this project happen, and be maintainable for the long haul given the environment he describes. I lean to rails because I like and am more comfortable with Ruby. But Django is also a fine tool that should work equally well if you are more Python orientated.

If you have equal discomfort with Ruby and Python, Ruby borrows more heavily from Small talk and Perl (like PHP) than Python does and therefore may be easier for a PHP programmer writing programs in a OO and MVC style.

Kevin

On Jan 20, 2013 11:06 PM, "Bryan O'Neal" <<mailto:Bryan.ONeal@theonealandassociates.com>> wrote:

I am in agreement with Joseph

On Jan 20, 2013 6:32 PM, "Joseph Sinclair" <<mailto:plug-discussion@stcaz.net>> wrote:
A little nervous jumping into the perennial language/platform discussions, but here goes. (and please understand these are opinions, based on my experience, nothing here should be interpreted as an invitation to argue if X is better than Y; it isn't and it's not worth arguing about)

There are more Java programmers than any other language or platform, at least for the past few years. Every college program I know of uses Java as the language of teaching, so new grad programmers almost all can work in Java (perhaps not very well, but they know the language and platform).

If you're working on something quick, go with what you know. It seems that PHP is what you know already, so go with that.

If you're building a larger system, then, if possible, start with something open-source and modify to suit.
If you cannot start from an open base, then (given the options you present) build in Java for a web application and use some of the thousands of open libraries to help (the maven build tool does a great job of managing dependencies). There are many good reasons that Amazon is built almost entirely on Java, as are many (if not most) other large commerce sites and services.

Be aware that, coming from a small-project background, you should expect everything to take 5-10 times longer than you would normally estimate. You'll be building something bigger than what you're used to, and building a large system to be high quality and maintainable requires a lot more time and effort than a small project. Also, if building in Java, get a real expert in the platform (and I don't mean a "Spring expert") to provide technical leadership; like any large platform there are many ways to do things, and some will be far more maintainable down the line than others.

I, personally (with exceptions, of course), tend to lean towards Java for web-based systems (particularly if the domain lends itself best to a REST SOA/ESB type architecture), C++ for locally-installed applications or system-software, Python or Groovy to script things together, Javascript for in-browser interaction, Scala or Erlang for high-throughput event-driven and asynchronous MPI systems (e.g. AMQP services), and a grab-bag of other tools when needed.

==Joseph++

One final note (at the risk of starting a two-front ideology war). I saw someone recommending Waterfall as a development methodology. This is a recipe for failure, as proven over, and over, and over (in academic papers, peer-reviewed scientific studies, and commercial results too numerous to list) during the past 30 years. There are exceptions, but you're not building a life-critical embedded system, you're building a web system. Avoid Waterfall methodologies and start with a well-used agile methodology (e.g. Scrum, Kanban, XP, etc...), try to stick to the methodology as much as possible for the first year of using it.


On 01/20/2013 12:24 PM, keith smith wrote:
>
> Hi,
>
> I am in the process of planning a web project.� I'm thinking possibly using Java.� To this point I have done all my web projects using PHP.� I know there will be a learning curve.
>
> My main question is the availability of Java programmers.� It seems there is a lot of PHP talent available for PHP projects.� I like that there is a lot of availability of PHP programmer because that makes my apps supportable if I move on or am otherwise not available.�
>
> I have not met a lot of Java programmers, so I assume they are not available the same way PHP programmers are.� In other words I think I can visit Gang Plank HQ and find a hand full of PHP programmers that I would fee good about pulling into a project.� I'm not sure I can say the same with Java programmers, however I have not paid much attention when it comes to Java programmers.�
>
> You thoughts are much appreciated!!�
>
> ------------------------
>
> Keith Smith
>



---------------------------------------------------
PLUG-discuss mailing list - <mailto:PLUG-discuss@lists.phxlinux.org>
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss

---------------------------------------------------
PLUG-discuss mailing list - <mailto:PLUG-discuss@lists.phxlinux.org>
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss