Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×

Comment Re:Does calling a method really count as 2 lines? (Score 1) 216

To find an example where PHP beats Java significantly in code compactness will be very very difficult.

Let's start with Hello World shall we? Here's the whole PHP program.

<?='Hello World'?>

18 CHARACTERS. PHP was a template engine long before anyone grafted 1,001 other crazy uses to it. In the job it was designed for - fulfilling HTML requests from webservers - few things can touch it for simplicity or development speed.

In fairness to Java, it scales better to large applications than PHP. PHP does little to discourage its largely newbie programmer base from making bad to outright catastrophic design choices. Java has its uses and it's place. It isn't a panacea though, not by a long shot.

So drop the Java fanboi act - it makes you look foolish. There are tasks which it is not the best tool for the job, or even close to the best tool.

Comment Re:Does calling a method really count as 2 lines? (Score 1) 216

When you make a statement like: "travelling salesman in 4 lines of code", it generally means the entire problem in 4 lines of code, not a function call to some built in function and a couple of array initializers.

Where does the line get drawn? Hell, an echo statement must look up the character code for each letter in the string and send that along to the graphics driver for further processing before even one letter is shown on the screen to the user.

The article demonstrated the language itself being able to present a solution to the traveling salesman in 2 lines of code. I personally find arguments about how many underlying function calls the language had to go to while it turned it's instructions into something the computer can understand to be useless asinine pendantry. It doesn't matter to the end user working in this language what goes on any more than it really matters to a video game programmer what exactly goes on in the GPU when a graphics call is made, or to a windows programmer exactly what the GUI must do to place the letters on the screen.

My first impression of this language and library is its a powerful new tool at a level of abstraction even further removed than current high level scripting languages like Javascript. In the field of data gathering and presentation - to which it seems to be aimed - it probably will find a lot of jobs to do. That doesn't mean other languages won't still have their place.

For example: people use PHP often because it can do in a couple lines what might take several pages of code to do in Java - and there are tasks that PHP needs several pages of code to do that Python can deal with in a few lines as well. That's the nature of programming languages. This is another tool to put in the tool case, and that's a good thing. I will admit that the article tries to write this up as a universal panacea, but I have my severe doubts on that. There's likely going to be certain tasks to which this language will prove to be poorly suited and need very long scripts to do that current languages can do fairly quickly.

Comment Re:Not so sure about the language... (Score 3, Interesting) 216

Hi. I'm a 15 year old script kiddie. I just love those thousands of hideous functions because deep inside a significant fraction of them lies an exploit so obvious that three of my friends figured a half dozen of them out in a two hour Redbull and Cheetos hacking session (which consisted mostly of Googling pictures of naked 16 year olds and occasionally looking for PHP vulnerabilities).

That hardly debunks my point. Rather, it reinforces it - people choose languages on the basis of work getting done quickly - all other concerns go out the window pretty quickly.

Comment Re:Not so sure about the language... (Score 4, Insightful) 216

As much as I would like to be impressed, what I see is quite underwhelming: a functional application language with some interface to "facts" and "databases" with a pattern matching engine might make some analysis easier but ... the principles of the language are mostly what you come to expect if you have seen lisp once or any modern functional language,e.g. haskell.

I can see it as being useful, but as another commenter pointed out, "FindShortestTour" is a library function (which might be handy), but definitely not an example of how concise the language might be; the same could be said about "EdgeDetect" or the like. The power of the language can be measured in how easily it can be extended or non trivial algorithms can be implemented ... not in how many functions are offered (even if this could be more convenient none-the-less).

Hello. My name is PHP. I'm the most ugly hideous language known to man, but man do I have thousands of functions to get work done. And that's why I rule the server side processing world :D

Function libraries and ability to get stuff done quickly counts for a lot.

Comment Re:Does calling a method really count as 2 lines? (Score 3, Insightful) 216

All I see there is calling some method to do something complicated. It's not 2 lines of code of the actual meat is hidden somewhere.

Do you count the code that drives the compiler or interpreter as part of your program? What about the code that drives your database?? If it's abstracted away into the language then it's not "actual meat" as far as the programmer doing the work is concerned. It is two lines. And unless you're writing all your code in machine language you have no right to claim otherwise.

Comment Re:Knowledge (Score 1) 141

There is only ONE book you need. The Holy Bible. King James translation.

The original 1611 printing, or the 1820's printing currently in most wide use?

As for the fallacy of such divisive faith - in 1611 there was one Anglican protestant church. Now there's well over 1,000 denominations due to squabbling over interpretations of the text and the sinful pride of "ministers" who will not submit to any authority at all. In that same time frame there still is only one Roman Catholic Church.

The difference? The true church does not subscribe to the heretical teaching of Martin Luther known as sola scriptura. Our faith is in God himself, not the idolatry of a book.

Comment Re:CGI? 1994 called... (Score 1) 284

CGI stands for "Common Gateway Interface." It's not a programming language. Many web services are or at least can be run using this interface, such as PHP. While its true native webserver modules offer better performance, if you have a reason to write a webpage using C the like you'll most likely need to use CGI to do it.

In the future, when you go for the "funneh", try to know what you are talking about.

Comment Re:(YouTube) footage? (Score 2) 223

From what I understand of the link: Segura made multiple minor league baserunning mistakes in this play. Segura was leading off second base and could have attempted to steal third base regardless if the pitcher threw the ball home or not, he just made his first baserunning mistake and went too early for third and saw that the pitcher could have easily thrown him out at third, so then Segura ran back to second before the pitcher could attempt to pick him off at second. Braun made it to second base, and in that situation Braun is automatically called out because two baserunners cannot occupy the same base at the same time.

Braun should not be called out. Once you advance, the base is yours. The runner who was previously on the base (Segura) must advance to the next base before being tagged out. You are right about two runners not being allowed on the same base, however it is the lead runner who is to be called out when it happens. This is baseball 101, the sort of call little league umps like myself see all the time. I could give the major league umps some slack since pro players don't make such a rookie mistake hardly ever, but it still doesn't excuse the fact this is very basic rules knowledge in the game.

Incidently, once Braun takes second, Segura can be forced out by tagging the ball at third - no need to chase him down.

I'm amazed the major league umps missed this.

Comment The reason the software can't score it. (Score 1) 223

The umps are wrong. Each runner has an entitled base. They are only safe at that base, and no others... If the runner behind you takes your base, you must advance to the next to be safe, you aren't safe anywhere else..

The correct call, Seguro, not the runner from 1st, was out at second. The moment that runner touched 2nd base it was his, seguro's base became 3rd and he's out if tagged anywhere else on the field.

This is very, very clearly spelled out in the rules of baseball. You can't run backwards, it's against the rules, and whoever supervises the umpires needs to pull that entire team in for review and suspension for blowing a series of calls that severely.

Comment Re:Always a letdown. (Score 1) 209

It "only" says that if you manage to do that you can violate causality and create paradoxes.

How? I've read the descriptions - they all hinge on the principle that for something to exist it has to be observed. To me that's as stupid as a man claiming the sun doesn't exist when he can't see it in the sky.

Comment Re:Always a letdown. (Score 0) 209

First point - If we as a species perceived everything by sound I'm quite certain the same statements would be made by us regarding breaking the sound barrier. And yet, we have

Second point - Who was it that said that when an esteemed scientist tells you something is impossible, he is most likely wrong?

Final point - The arrogance of modern physicists never ceases to astound me. Compare what we know about the universe to what can be known, and I'm fairly certain you'll find that it would compare unfavorably to what the cavemen understood about the universe as compared to modern man.

Why is it so hard to say, "I don't know, let's find out?"

Slashdot Top Deals

Work without a vision is slavery, Vision without work is a pipe dream, But vision with work is the hope of the world.

Working...