Fog Creek Software
Discussion Board




Java vs. Perl/PHP

I have to make a decision between whether to take a class in Perl and one in PHP w/Apache taught as well, or a class in Advanced java.

The java teacher is really smart and a good teacher (Indie lady w/no accent).

I look at the job ads and see 1)M$ followed by 2)Java.  Perl and PHP are almost completely off the map - less than 5% ads mention it.

Does anyone know why Perl and PHP are not asked for much. I have my own suspicions, like versatility and the fact that most co.'s are only interested in high-end, high scalability apps.

CGI may be slow, but for personal systems it should be quicker to develop w/for the web.

I don't have much confidence in the ads (lot's more right now BTW, in general [Jan must be hiring season]).

Brian R.
Friday, January 17, 2003

It's more that companies feel safer buying into environments from big companies they know (Microsoft, Sun) which is legitimate, IMO. So, if you'd like to use the class as support for looking at corporate-type jobs, then go with Java. If you will be looking at smaller outfits or doing your own development, consider perl/php.

pb
Friday, January 17, 2003

Take a class in design or architecture. Syntax can be learned in a month. But if you had to choose take the java class. Perl's OOP is messy IMO and php doesn't have enough respect among companies that pay well.

john galt
Friday, January 17, 2003

Wow, you guys are great, thanks a lot. 

I was starting to think that security might be a "hole" in open source programming or some such "fatal flaw", but I think you guys are right that it just doesn't get the same level of respect by big co.'s.

I was thinking more of the small co. route, but I am rather capable at understanding OOP concepts, so perhaps the Java route for now, based on your reactions.

Mostly I am interested in which language is "superior" in terms of real-world productivity, and getting a job right now wouldn't exactly hurt either :); self-employment potential was the "secret goal".

Brian R.
Friday, January 17, 2003

Perl would be your choice for productivity, check out all the free modules on http://search.cpan.org

I have used PHP a lot and Perl beats it hands down in productivity. Couldn't say for Java though.

Matthew Lock
Friday, January 17, 2003

Thanks Matt.  I think file processing is so important, yet I don't see it as a "prominent" part of java.

pb says, "It's more that companies feel safer buying into environments from big companies they know (Microsoft, Sun) which is legitimate, IMO."

Would those concerns go something like it is easier to commoditize an M$ or Java programmer.  My mental image of corporations is in wanting someone who can be easily laid off, and still have easily maintainable code for the next guy.  M$ is the most advertised for job positions, and the easiest to learn tools, IMO.  And in return, more people will learn the M$ way, ensuring more people competing for the same job, IMHO.

I know everyone wants to make a career and afford a house, car, etc. as a programmer.  I would just be happy w/ a programming job, where I am more likely to have some real, less dispensable value.

Thanks for the replies.  It's an important topic, to me at least.

Brian R.
Friday, January 17, 2003

A lot of companies use Perl/PHP/Python/you-name-it - they just don't hire people specifically to do it. They let their Java/C++/C programmers work in the other languages too.

As one of my previous employers stated "it's a lot easier to find a C++ programmer that can do Perl then a Perl programmer that can do C++."

jeff
Friday, January 17, 2003

> I have used PHP a lot and Perl beats it hands down in productivity. Couldn't say for Java though.

Yeah, this is my experience. PHP is brilliant for producing simple dynamic pages quickly (parse request, query database, insert results into template). But it's very much a toy language: it lacks almost all of the features that halfway-decent languages provide (decent OO model, closures, iterators, scoping, templates, etc.).

I'm not sure what you'd learn in a PHP class, aside from the simple mechanics of how to write a simple dynamic webpage. Concepts, i.e. building a franework of understanding into which the vast majority of procedural languages will fit, are much more useful in the medium to long term. My gut feeling is that you'll learn these concepts in the Java class but not in the PHP one, and so would recommend Java.

Tom Payne
Friday, January 17, 2003

" "it's a lot easier to find a C++ programmer that can do Perl then a Perl programmer that can do C++." "

That's a comforting thought. I've done only Visual Basic professionally, but I've been seriously studying C++ for two years now in an effort to increase my value as a programmer. Someone I respect said recently I was probably wasting my time studying C++. So your comment is comforting, I hope it’s true.

My studies so far have led me to this conclusion: VB is mostly using other peoples objects and C++ is mostly making your own objects. Of course this is probably related to the kinds of VB programming projects I have been involved in- actually mostly VBA MS Office integration type projects. There are probably millions of VB class authors out there who will now flame me for saying that, but it’s been my experience.

WNC
Saturday, January 18, 2003

I was C++ programmer with more than 10 years of experience, when I encountered Perl. I took me about a year to learn it to understand all the details, but it was worth it. I'd say it was one of the biggest addition to my skill set. Just for comparison, it took me 2 weeks to learn Java to understand very well (better than Perl in 1 year). However, Java didn't change the way I program. As someone (Paul Graham or Richard Gabriel?) said, if a language doesn't change the way you think, it's not worth learning.

So, my advice - learn Perl. It's a super-language.

raindog
Saturday, January 18, 2003

The truth of the matter is that all of these are great languages. All have strong points and weak areas.  Too make a comment that any one of these languages is a "toy" language shows a lack of maturity and experience.

BDKR

BDKR
Saturday, January 18, 2003

My advice is learn both Perl and Java. If you know them you will already know PHP.
Even if the application you are developing is in Java, knowing Perl is a great help. For example, you can generate some of the code automatically with Perl. Any scripting that helps in any way can be done with Perl. Perl can make anyone's life easier, even if you are not developing mod_perl applications.
I personally like PHP for certain web applications, and would often choose it over mod_perl. I would not use CGI for anything except maybe a little application I was only going to use myself.

PC
Saturday, January 18, 2003


Read some of the insightful Dijskstra rants about languages. You can learn one thing or two.

Leonardo Herrera
Saturday, January 18, 2003

BDKR wrote:

> Too make a comment that any one of these languages is a "toy" language shows a lack of maturity and experience.

I called PHP a toy language in this thread and feel the need to defend my maturity and experience!

I've used PHP to create a fair number of dynamic websites. I think it's fair to compare PHP to Python, Ruby and PERL as they're often used for similar tasks. PHP's great strengths are:

1. It's ubiquitous.

2. It comes with loads of powerful libraries.

3. It's really easy to do simple stuff.

But PHP _the language_ is dire. The object model is farcial -- no decent inheritance, no decent scoping, no data hiding. There is no module functionality, no operator overloading, no iterators, no closures, no templates, no namespaces. In fact there isn't much of anything at all! This becomes a real problem if you're trying to build a medium-sized project or larger.

Ruby, PERL, etc., by contrast, provide all the features of PHP _and_ a whole load more. Writing large projects becomes feasible in these languages.

Therefore, I repeat my assertion that PHP is a toy language.

Tom Payne
Saturday, January 18, 2003

I would recommend to both take classes. PHP, Perl and Java all excel in their own specific area and are great tools for any programmer. The saying: "if all you have is a hammer everything looks like a nail" is just too true in software development.

One thing I would stay away from is the religious time wasting wars about X rules or Y sucks. It's sad to see so many programmers limiting themselves for religious reasons. The fact that you name Microsoft M$ might be an indication that you are heading towards that trap.

Jan Derk
Saturday, January 18, 2003

Someone tell me this isn't the best place for programmers on the internet.  You guys are great.

I took the Perl and PHP/Apache (w/a book on Apache).  I am also taking Linux (again, in a way). 

I can already do VB, VBA, ASP (still learning), so I am adding open source.  I would really like to learn all of the Linux servers.

Java is the most awesome in scope of all of these, and I realized that would be the best for developing my theoretical understanding.  But I really want to be an ace scripter and have a lot of competence at cranking out a lot of code before getting abstract and just opening my mind by learning java. 

I am interested in just getting down server-side programming and the web.  Java is either for applications, or back-end where servers talk to other servers in an enterprise setting.  Server-side scripting will dodge this bullet for now.

I have taken one course in Java.  This was actually an advanced Java course.  I guess I felt "overchallenged" when the teacher said that these java books are trade manuals and not text books.  She mentioned inner classes, and that was one thing I had not heard the term of before, because I did not take java at this college (like most everyone else did). 

She said that only ten people stayed through her last class, which sounds like a real challenge, but I didn't want to bite off more than I could chew at the sake of everything else.  Perhaps another semester, and if it's not offered, I will teach it to myself.

Thanks for all of your advice.  Definitely have a better perspective on what real programmers and hiring mgrs. think about all of this, than I had before.

Brian R.
Saturday, January 18, 2003

"
Mostly I am interested in which language is "superior" in terms of real-world productivity, and getting a job right now wouldn't exactly hurt either :); self-employment potential was the "secret goal".
"
Learn plsql and datawarehousing techniques. Boring as hell but you make alot of $$$.


"
Thanks for all of your advice.  Definitely have a better perspective on what real programmers and hiring mgrs. think about all of this, than I had before.
"
Real programmers and hiring mgrs are at the opposite sides of the spectrum.

john galt
Saturday, January 18, 2003

<p>short version: you want a better chance at a job: do Java.. you want to really learn something about programming that is outside your existing skills: try Perl

<p>I've spent a long long time learning Perl, I dont program internals but I've done almost everything else in it (by long time, I mean 3-4 years.. what can I say, I'm a slow learner).. Once you know Perl well, learning PHP is not that difficult..

<p>For most of what I do at work, I officially need Java, but I think I am much much more productive because when the other guys are doing some things manually or in Java (report parsing, file manipulations, quick web stuff), I do them in Perl in considerably less than half the time.. in short, Perl is a great Swiss army knife (its been called that by many people), but it may not have many hiring opportunities because its not from one of the big corps (jobs.perl.org might give you a glimpse of openings for Perl programmers but try ANY job site for Java)

another perl fan
Monday, January 20, 2003

I go with Tom on this one. IMHO PHP is great for whipping up a few quick pages, but I shudder at the thought of using it for a big app. The two serious webapp environments for the moment seem to be Java and ASP.NET.

Just me (Sir to you)
Monday, January 20, 2003

I did what I would call a "medium size" project in PHP because it was all I knew at the time. Now it's an unmaintainable, unscalable mess.

Now that I've been doing Java for a year or so, I just shudder at the thought of doing anything substantial in PHP.

PHP is great for its little domain though. My personal homepage runs like a champ on PHP. My massive server side applications run like a champ under Java, and are flexible, extensible, and easily understood.

Whee
Monday, January 20, 2003

Well, I was a little harsh eariler. I apologize for that.

Anyways, it's a little interesting that a language is considered toy like based on the extent that it panders to particular paradigm.  And besides, to use the same reasoning, one must conclude that C is a toy language as well.  Entire OS's must be toys due to the fact that they are based on a toy language. I've never considered Unix a toy.  The best real time 3d engines (Q1, Q2, and i'm pretty sure, Q3) are written in C.

Cheers,
BDKR

BDKR
Tuesday, January 21, 2003

BDKR wrote:

> Anyways, it's a little interesting that a language is considered toy like based on the extent that it panders to particular paradigm.

The paradigm is not the issue here. If you're going to write a large program then you need ways of avoiding naming collisions, and ideally data hiding. C++/Java (imperative,compiled), Python/Perl/Ruby (imperative, interpreted), ML/Haskell/Lisp/Scheme (functional with imperative features, compiled and interpreted) all provide this (as some combination of namespaces, classes, modules, etc.). PHP has a single global namespace. This means that any function you define a function could clash with every single other function in your entire application and every single library. Even C has a static keyword which stops function names leaking outside the current sourcefile, so at least you've got some control.

Of course, it is _possible_ to survive in a single global namespace, but it's not _easy_.

> And besides, to use the same reasoning, one must conclude that C is a toy language as well.  Entire OS's must be toys due to the fact that they are based on a toy language. I've never considered Unix a toy.  The best real time 3d engines (Q1, Q2, and i'm pretty sure, Q3) are written in C.

Your argument here is flawed because your initial premise is flawed. From it you set up a straw man, which unsurprisingly you tear down.

Do you have a vested interest in PHP? i.e. why are you defending it so vociferously?

Tom Payne
Tuesday, January 21, 2003

> Do you have a vested interest in PHP? i.e. why are you defending it so vociferously?

A quick google for 'BDKR + PHP' reveals that you're active on various PHP email lists and websites. A veritable zealot, Terrence Cox!

Tom Payne
Tuesday, January 21, 2003

"Of course, it is _possible_ to survive in a single global namespace, but it's not _easy_."

Things get realy interesting when you add case sensitive, dynamically typed variables that are implicitly declared.

Just me (Sir to you)
Tuesday, January 21, 2003

To suggest that PHP is a "toy" language or for simple applications is absoultely ridiculous.  I have worked in JAVA, ASP, and PHP and have to say that overall - hands down, PHP wins.  I have worked on several large scale and VERY complex web apps that were developed in PHP which perform great.  PHP was much more flexible with less code to get the job done than the JAVA apps.  I've watched programmers code their brains out in JAVA to get very little done.

If you are concerned about app performance or scalability, examine your  hardware infrastructure.  If you are concerned about future app maintainability, spend as much time upfront on the app architecture design.  I think this is the biggest area where apps go wrong - not enough time spent upfront in the overall design.

I'm not bias towards any language but I support any language that allows me to focus on my goal: develop a maintainable speedy app that doesn't crash and gets the job done and PHP right now does that - the rest is for philosophers.

Mark Remy
Monday, February 23, 2004

> PHP was much more flexible with less code to get the job done than the JAVA apps.  I've watched programmers code their brains out in JAVA to get very little done.

I do not believe you. Could you please provide a real example of a thing which can be easily done with PHP and takes alot of time with Java?

I'm not talking about some specific language constructs - I'm talking about _real life_ problems.

Dmitry Andrianov
Wednesday, February 25, 2004

Probably he can not :-)

S.K
Monday, June 07, 2004

What about one line ftp upload in Java?

Viki
Monday, August 30, 2004

*  Recent Topics

*  Fog Creek Home