SolarPHP 1.0 Released
HvitRavn writes "SolarPHP 1.0 stable was released by Paul M. Jones today. SolarPHP is an application framework and library, and is a serious contender alongside Zend Framework, Symphony, and similar frameworks. SolarPHP has in the recent years been the cause of heated debate in the PHP community due to provocative benchmark results posted on Paul M. Jones' blog."
It's called Symfony, FYI
if his blog is running on this framework it's as slow as molasses
That's a joke... I say, that's a joke, son!
(just a little something I picked up in Sarcasm 101)
Perfect timing. I was just about to write a rather complex web application. How does this (or PHP in general) compare to, say, PERL in the execution speed, memory usage, and code manageability aspects? I'm sure I can get some quality, unbiased opinions here on the topic.
Thanks in Advance!
cache:http://paul-m-jones.com/?cat=27 into Google search (the original link). With any luck, the old content being referred-to might be there.
If the community wants to improve PHP they could start with making the function, class and method names case sensitive. For some unknown reason the powers behind PHP have chosen not fix this.
... it's still PHP.
Lipstick on a pig and all that.
I think the 18 second load time the homepage is experiencing now should help discredit the benchmark results
Jason-Palmer.com
Yet another PHP framework. Won't this ever stop? Won't the development efforts ever be directed to only a handful of frameworks, to get the best we can instead of a gazillion half-(or un-) documented, over-(or under-) engineered frameworks?
Stupidity is an equal opportunity striker.
Fellow slashdotter Bill Dog
Phpulses benchmarks still put it at 5 times faster than Solar without any caching.
http://www.phpulse.com/benchmarks/?area=86
This is my sig. There are many like it but this one is mine.
Yet another PHP framework. Won't this ever stop?
No. It won't. There's probably always going to be new ideas about abstractions with the potential to save developers effort once they're implemented. I should hope so, anyway.
Won't the development efforts ever be directed to only a handful of frameworks?
The lion's share of attention is certainly directed towards a handful: Cake, Symfony, Zend (not actually a framework), and CodeIgniter probably topping the list, others like Akelos or Zoop or TinyMVC probably farther down but still striking the fancy of developers here or there.
But it pretty much comes down to developer itches, and the fact that thoroughly understanding a system is usually a task roughly equivalent to writing it.
Tweet, tweet.
Yeah, because Rails is being used everywhere.
Potato chips are a by-yourself food.
They are by definition antisocial, expect everything to revolve around them and don’t want you to use just pieces of them.
Give us just a nice set of libraries. That’s it.
Let us choose what parts to use, what parts to get from other libraries, and what not to use at all.
Frameworks are like having to buy a bundle offer at the supermarket, when all you need is one part of it, and then at home also noticing that the parts are not playing nice with everything else.
But I hope the craze will be over soon, just like the Flash intro craze, the Java Applet craze, etc.
Any sufficiently advanced intelligence is indistinguishable from stupidity.
If we used what was everywhere everyone would be developing websites in .NET to deploy on their Windows intranet. But it's a lot easier to be sarcastic than have a point other than "lol nobody uses Rails" (as if that were even close to true).
So instead of a web framework in PHP, you're suggesting they use... a web framework in Ruby.
Masterfully observed
Give us just a nice set of libraries. That's it.
Pretty much Zend Framework in a Nutshell. Totally misnamed -- there is no Framework. It's a set of disparate libraries organized into a sort of class hierarchy that happens to have amongst it a Controller class.
Tweet, tweet.
You may have a valid point, but I can't get over the trollish way you souped up those code examples to prove your point. You made the PHP example over-commented, bulky and redundant on purpose. A more accurate counterpart would more likely look like this:
public function actionIndex()
{
$this->list = $this->_model->blogs->fetchAll(array(
'where' => array('blogs.status = ?' => 'public'),
'order' => 'blogs.created DESC'
));
}
Without knowing the actual library used for the PHP example, there might be saner and less ugly variants.
Curious, I searched for solarphp debate and the first 12 results are a verbatim cut-n-paste of the same summary that was copy-pasted into the Slashdot article.
The subsequent results don't even touch on any kind of performance testing with solarphp. So, um... why is this on the front page again?
You could also abbreviate every. posts == p, Post to P, and status to s. and public to p, and created to c. Then it would be.
@p = P.where(:s => 'p').order('created DESC')
Even less typing. cause typing is so tedious and IDE's have autocomplete and copy paste.
But then in PHP I could use something like http://framework.maintainable.com/mvc/3_model.php
Or
http://www.doctrine-project.org/
http://xyster.devweblog.org/
http://propel.phpdb.org/trac/
And they may not be as AWESOME, but they're alright.
In the end it depends what you want to do, how long you have to do it, what your stuck working with, and how fast it needs to run.
I admit, I code a lot of PHP. And I have never felt the need to take a serious look at using any frameworks. Isn't the entire point of PHP that it makes a great rapid development platform?
I scream. You scream. I assume that means we're both acquainted with the problem. We proceed.
Another framework. Big whoop. I'm more interested in things like HIPHOP that allow you to compile PHP to code for fast performance.
http://developers.facebook.com/news.php?story=358&blog=1
Anyone who's used both have an opinion of how it compares to CodeIgniter? I've done one project in CI and I've been pretty happy with it, thinking of using it to do some larger projects soon. It forces you to have neat, short code. Disadvantage is it's spread out a little more between files, but with an application like TextPad I can move back and forth between those files pretty easily.
Looking at Solar, it does look like it has a crapload of classes that do useful things without having to reinvent the wheel. CI looks relatively smaller in comparison.
The thing I like about CI is you just load the libraries or classes that you need for that particular app, so it remains very lightweight.
Pauls blog is indeed running Wordpress, but that's all it is - a personal blog. The framework site itself runs on Solar.
This "performance debate" that people keep mentioning started back in 2006 when Paul benchmarked a select few frameworks (http://paul-m-jones.com/?p=236). Now even the creator of Symfony uses this method to compare performance. And Solar is still faster.
It's not a new framework on the block. It has been in development for years and can behave as a full-stack framework, a collection of libraries, or something in the middle. Even Zend has borrowed ideas from Solar (http://paul-m-jones.com/?p=1113).
I like to think of it as a framework for people who already know PHP. Having worked with CakePHP, CodeIgniter and a few others, there are far too many people in those communities who think that by using a framework they don't need to learn how to program. I'm pretty confident these people won't understand Solar. Hooray!
Things to love about Solar: http://www.solarphp.com/trac/core/browser/trunk/info/description
(Score:0, Offtopic)
While the smugness of the parent post could be interpreted at a stretch as flamebait or trolling, it's in no way offtopic. Comparing code density/expressiveness between frameworks is topical.
Tweet, tweet.
Um, why stop there? Forgive my lack of indent, I can't be bothered to figure it out.
That function can be identically written as:
public function actionIndex() {
$this->list = $this->_model->blogs->fetchAll(array('where' => array('blogs.status = ?' => 'public'),'order' => 'blogs.created DESC'));
}
Also, I have the feeling that 'blogs' was just thrown in to make it longer. This calls a function on a 'blogs' object, which is presumably linked to the blogs table somehow, and will presumably use 'blogs' by default. You can just use 'status' and 'created' as the Ruby example does. So:
public function actionIndex() {
$this->list = $this->_model->blogs->fetchAll(array('where' => array('status = ?' => 'public'),'order' => 'created DESC'));
}
Also, I don't know in what universe you commonly pass a single array to functions instead of, you know, actual function parameters. While I'm sure in some universe there's some framework that lets you do that, in reality you'd have a fetchAll($where,$order=NULL) function that you could use here, with array passing used for really options stuff, and an array passed in for $where. And, also, inexplicably, your function name has doubled in PHP.
So it would more likely be something like:
public function index() {
$this->list = $this->_model->blogs->fetchAll(array('status = ?' => 'public'), 'created DESC');
}
Vs:
def index
@posts = Post.where(:status => 'public').order('created DESC')
end
Yeah, that's massively shorter. Why, in PHP, you have to...um...explicitly use $this to access your own class and use array() to make an array. The horrors, the horrors!
Why on earth you're writing a public function for this is beyond me, though. I think you just did that because PHP takes longer to define a public function.
A sane programmer would just, instead of defining a class to have actionIndex() on, and then making such an object, and then calling $random_obect->actionIndex(); and then $records = $random_obect->list(); would just do this:
$records = $this->_model->blogs->fetchAll(array('status = ?' => 'public'), 'created DESC');
If corporations are people, aren't stockholders guilty of slavery?
I realized after I posted that I said 'you' a lot, and I was really talking about the grandparent, not you, thasmudyan.
If corporations are people, aren't stockholders guilty of slavery?
Actually I pulled the sample straight from the documentation for the project in the OP.
You seem to think I made up that example, when in fact I got it from the SolarPHP documentation: http://solarphp.com/manual/blog-demo.app.index#blog-demo.app.index.action
You also assume a lot about what the Ruby code is doing; this is where my Rails example is from: http://m.onkey.org/2010/1/22/active-record-query-interface
Look I'm sorry if I offended you, I didn't mean to cause so much outrage just by comparing code excerpts directly from the SolarPHP documentation ,with an example adapted from upcoming Rails 3.1 documentation.
You sound like someone with a fair share of experience with informed opinions about the tools you like to use. Well, me too. I think your last remark is dead-on, but I had a different point I was trying to make. I never said "Rails is awesome, everyone should use it all the time!"
I have to say though, your counterpoint is a bit forced. It's not about reducing keystrokes at all costs, it's about providing the programmer with useful abstractions and reducing the need for him to repeat him or herself. Let's be real here and just admit that PHP doesn't make this easy for frameworks.
Why is every framework example about demonstrating how to create a blog?
Well.. maybe. Or Maybe not. But Definitely not sort of.
A simple 'grep' told me that this framework has 820 PHP files. I know the Solar site holds lots of documentation, but to know and understand a framework, I want to see what the code looks like. Just to get an idea of its quality and security. With 820 files, there is no way I'm every even going to give it a try. In my opinion, it should take less time to understand a framework than it takes time to build your own simple framework. This framework, with its many files and 'complex' structure and object extending, definitly failed on that one. Another one for my ignore list.
It doesn't have to be like this. All we need to do is make sure we keep talking.
To paraphrase MadTV's Snoop Dogg video parody, "it's all about the blogz, baby, it's all about the blogz." I am ironic of course, but let's face it - the media paints this picture of Internet that is full of blogs.
"Real" developers love to hate PHP because it goes against their rules, meanwhile the little language that could is the largest web language around. More site are run on PHP then anything else.
Why? Because it can. All the devs who want standards and a standard framework are the kinda dev's that take six months to produce the first draft of the first requirement pre-meeting agenda action point item. Sure, that is great if you work for the state or the fortune 500, but the new stuff happens with tiny companies started in someone's garage where the code has to be working yesterday.
As soon as other languages become capable of "just producing a site now", then PHP will start to becomes less dominant.
And yeah, this practice does result in thousand of badly written site in urgent need of being cleaned up. That is not a bad thing, if it was left to the ruby crowd, those sites would never have seen the light of day.
For people who understand business, having to rebuild your shop because it has become to small after a year is NOT a sign that you chose the wrong shop. It is a sign you did well. Only developers totally removed from the realities of daily life don't get this.
Oh and if you need conventions in your programming, aren't you really saying someone needs to hold your hand? For me the only quality measurement that works for software in the end is "does it allow the owner to make money". It can be the most horrible spaghetti code you ever saw, but if it allows the company to flourish and grow, then it is good code. I have seen to many "proper" development on very large projects that followed all the conventions and produced steaming piles of crap that were unusable. Look to every single government IT project for examples.
MMO Quests are like orgasms:
You may solo them, I prefer them in a group.
The "problem" is what do you do if you do not have your own library of functions written? Or the company doesn't?
Then you can use a framework to get the basics down. Like for instance database abstration. What you say? That is already part of PHP...
Actually, I get your point entirely. It is the same with smarty... why on earth should you use a template language, in a template language?
I think all of this is partly because people expect it.
PHP is a scripting language, closer to perl then C or Java and people are not really used to such languages. They have always been considered to be to primitive.
And so the "proper" developers have always had a thing against PHP that allowed just anybody to start producing code and working web sites. You can see in a lot of frameworks the attempt to force PHP to become another language.
Do you need a framework? No, unless you come from a background where just raw coding is not how you do things. There is a difference between scripting and "programming". Please don't hang me up on those terms, but you probably get my meaning if I say the average Java developer would choke on Perl and the average Perl developer considers Java to be hopelessly over engineered.
One of my favorite discussions was with a Java developer about PHP's lack of proper garbage collection... he spend several hours trying to explain how important garbage collection is, in a script that runs for a few miliseconds and then is cleared completly from memory. It is like claiming that you absolutely need a parachute, on a kamikaze plane.
MMO Quests are like orgasms:
You may solo them, I prefer them in a group.
Actually I pulled the sample straight from the documentation for the project in the OP.
I didn't realize this, sorry. But nevertheless, it seemed like an unfair and artificial comparison to me. Most people would agree that Rails is a nice, mature MVC framework and I doubt the same can be said about SolarPHP (which I personally don't know anything about). My perception was that your examples were chosen to present Ruby in a more concise and more elegant light, by force.
Again, which is not to say that there isn't a good point to be made here. Ruby code tends to be a little more concise and, as a PHP-heavy programmer myself, I have to concede that PHP's syntax is anything but elegant. It's one step away from the surreal ASCII art that is Perl ;-)
Filler texts contained hearin contain no meaning even though they fit a certain grammar.
Ipsum Lorem.
In 90s we had to build a complete interactive web-page in Perl or C, with html tags and JavaScript, and then print it out to a browser. And we were grateful.
Nowadays, having PHP, which is so easy to use, people want to make it even easier. I don't get it.
I mean, there *are* prebuilt blog software packages. Where does the real difference lie between a CRM and a web framework?
Wordpress vs Zend? The wordpress example is even easier: getposts(); Thus proving its the best framework ever!!!!!
Maybe I'm too harsh, but its like expecting a hello world program to be representative of the a programming languages ability. Sometimes it seems like there are all optimized towards creating a blog. Which makes as much sense to be as optimizing a language for hello world.
Well.. maybe. Or Maybe not. But Definitely not sort of.
Disclaimer: I'm not a PHP or Ruby programmer. I come from the land of Java and Python.
@posts = Post.where(:status => 'public').order('created DESC')
$records = $this->_model->blogs->fetchAll(array('status = ?' => 'public'), 'created DESC');
Assuming these would be returned from a framework library, or I can't readily access the source and this is just part of documentation.
The first example is fairly readable, concise and sensible. Knowing a little about how Ruby handles things as objects, I "get it" and am comfortable with what @posts would probably contain. I'm fairly certain @posts is a plural set/object of more Post objects, which represents a row in a database, where status is public, then ordered descending. I can probably iterate through it. As an outsider, I could read this, lookup the column names for the row and almost immediately start using it.
Knowing some of the problems with PHP and its community, I can make no assumptions about what $records will really be unless I know the author's style or am already familiar with the codebase. Ignoring your writeup justification for shortening, I can't guess what _model is, I don't know what blogs really represents, and I'm uncertain why fetchAll needs an array object passed as a parameter, I have to mentally replace the question mark with "public", then assume the second parameter is an order-by parameter since I see the DESC. Before I would be ready and comfortable to use $records in a meaningful way, I'd have to dump it to the screen or use a debugger, plus lookup the syntax for fetchAll, and I'd really want to know what _model and blog actually represented since you're now magically assuming the blog object links to a table somehow. I do not know if blog is iterable or if it's rows it has grabbed are even accessible. $records may be the result of some manipulation it performs on the query result. I just don't know, and that makes me uncomfortable.
So while you've reduced character quantity to near comparable levels, you've not matched readability or understanding. You've merely condensed complex code into short complex code. Honestly, I think it's a philosophy difference between PHP and Ruby. Ruby the language strives for the principle of least surprises, and if the programmers utilizing it adhere to that, I can grasp their code pretty quickly. PHP is a grab-bag; you can make no assumptions, which is both a strength and a weakness.
Granted, PHP can still be used successfully to start and run a business, but as a programmer with no professional experience in either language, I'm gravitated towards the Ruby example.
Um, perhaps you need to think about what you're saying.
You might not be familiar with PHP, and thus unfamiliar with how it how it handles objects, but it's pretty easy to guess how a framework would return all records from a query if you know anything about PHP. It would return an array of arrays. Perhaps the repeated array is an associative array, perhaps it is column indexed and there's another command to get the associative ones.
You know, like the actual commands the language itself has, which I know because, heh, I'm a PHP programmer and know the language.
I'm uncertain why fetchAll needs an array object passed as a parameter, I have to mentally replace the question mark with "public", then assume the second parameter is an order-by parameter since I see the DESC.
fetchAll would need an array object passed as a parameter because you might want to use multiple WHERE clauses, which I, OTOH, have no idea how to do in the Ruby example. Likewise, I have no idea how to do a LIKE instead of an =, whereas I can see how to do that in the PHP command. Don't bitch because the PHP framework command is more powerful than the Ruby one.
Likewise, while you don't know the format of the fetchAll() function, um, you're unlikely to magically know the format of the Post object, either.
I can't guess what _model is, I don't know what blogs really represents
Presumably $this->_model is how you look up the database framework, in the framework. But your confusion is because these two pieces of code aren't identical. The Ruby appears to be inside some sort of object that is already linked to the blog table (You'll notice it doesn't reference what table it's using at all.), whereas the PHP code to to call a function on that object. (Which is why, as I said, it was insanely stupid to write a function to do that, instead of just calling the existing function.)
If the PHP was actually on the object, it would be calling the fetchAll function like $this->fetchAll(array('status = ?' => 'public'), 'created DESC');
I'd give an example of what the PHP is doing in Ruby, but I have no idea how to access objects like that.
I'm fairly certain @posts is a plural set/object of more Post objects, which represents a row in a database, where status is public, then ordered descending. I can probably iterate through it. As an outsider, I could read this, lookup the column names for the row and almost immediately start using it.
And I, as a PHP programmer, have NO IDEA what a 'Post object' is or does. You somehow know it represents 'rows in a database'. Well, good for you, but that's not actually very intuitive at all. That's language knowledge you have. If you asked random people what a Post object would do to a database, most would guess 'insert and/or update a record'.
In fact, looking at it, I think you're wrong, and Posts represents the table itself, which means that @posts almost certainly is not an array of them. (Which means, instead of being inside a table object like I said above, we're in a database object or possible Post is some global object, although that seems like a very stupid name. Also, why is it capitalized if it's a table name? I have no idea.)
I do not know if blog is iterable or if it's rows it has grabbed are even accessible. $records may be the result of some manipulation it performs on the query result. I just don't know, and that makes me uncomfortable.
Yes, not knowing the exact syntax of a language does result in several questions. Just like, you know, any language.
And I urge you to actually read the paragraphs above, and compare your words:
'I'm fairly certain @posts is a plural set/object of more Post objects' vs 'if it's rows it has grabbed are even accessible'
'I can probably iterate through it.' vs. 'I do not know if blog is iterable'
'fairly certain...status is public, then ordered descending' vs. 'may be the result of so
If corporations are people, aren't stockholders guilty of slavery?
*checks it out*
Yes, if you use fetchAll(), you have to pass in an array to do the select. Oooh, scary.
Whereas, with Ruby, you apparently just keep appending functions to the object.
Which then results in an interesting question: How the heck do you optionally add parameters to a select using the Ruby framework?
In SolarPHP, you add, or don't add, a record to an array. In Ruby on Rails you...what?
Apologizes as I don't actually know Ruby coding, but it would look something like this:
Post.where($whereclausearray).join($joinarray).order($order).groupby($sortby).having($having)
With all the ones you aren't using as NULL, just in case you want to use one? Hrm.
Likewise, SolarPHP requires 'status = ?', whereas Ruby on Rails just has the field name, which is more 'concise'...as long as you don't need to make it 'status LIKE ?', which you can do in PHP, but not in the that Ruby syntax.
Now, I'm sure you can actually do that query somehow, and my 'optional clauses' comment is silly but that's my point. You're nitpicking over rather microscopic language differences. Actually, not even that. You're nitpicking over framework differences, and pretending that a slightly more verbose language is somehow a lot worse.
Any programmer with the slightest bit of knowledge knows that, while being more verbose doesn't make a language better (See: COBOL.), it also doesn't really make it any worse. Likewise, you haven't show that PHP actually is more verbose, just that a single function inside a framework (Which adds verbosity) is. Meanwhile, as I pointed out, the PHP function you're comparing to the Ruby function can, in fact, actually do more, so actually it's a case of 'comparing a command with more functionality to a simpler command with less'.
As for the missing $this-> stuff in Ruby, apparently, Ruby is using global variables or something, or alternately those two commands aren't actually that comparable, the Ruby one being inside an object that knows what 'Post' is, and PHP one being somewhere else that doesn't know what 'blog' is. If the PHP one was inside the same object, it would be using $this->fetchall() instead of referencing some complicated chain to find it.
If corporations are people, aren't stockholders guilty of slavery?
Erm, I don't think I said anything about what the Ruby was doing at all.
If corporations are people, aren't stockholders guilty of slavery?
My bad then, I thought your PHP examples were supposed to be functionally equivalent to my Rails example.
So you don't actually know Ruby or Rails, but you know that my example is less functional. You're kind of all over the place in the rest of your post, and the "ooh scary" remarks don't really help your case (which, as far as I can tell is "I am annoyed that you would compare PHP with Ruby unfavorably")
It's your PHP example.
I just rewrote it to be less expanded out, as you were bitching that PHP was too much typing or some other such nonsense.
Your example idiotically had the php tags, it had braces on lines by themselves, it created an array and stored it in a variable instead of just using the array, etc.
The PHP and the Ruby were both functionally one line, with two surrounding lines to define the function. The PHP line was about 50% longer than the Ruby one.
Which would be a fine thing to point out, but pretending it was 11 lines is just, well, lying.
I don't care if you got it out of an actual example from the framework site. Examples are often expanded to make them easier to understand.
The actual fact of the matter is that SolarPHP and Ruby on Rails can both make a query, and assign it to an array on the current object, using a single command, no matter what sort of silliness you're trying to use to make it otherwise.
It appears this specific command is slightly longer in PHP, and it also appears that it's slightly hard to access the framework, although that's almost certainly not true.
As I've pointed out, your 'Post' there is either a) an idiotically-name global object (Ugh), or b) the Ruby is on the object with that function, and if that was true of where the PHP was, or the PHP could just use $this->fetchAll(), not $this->_model->blogs->fetchAll().
If corporations are people, aren't stockholders guilty of slavery?
No, I'm annoyed you take an expanded example and compare it to the most concise way of doing something in Ruby, and pretend that demonstrates something.
The two examples are essentially identical.
They pass parameters different ways, but they are both functions, on a 'database table object' that return an array of result.
That's it. That's how you do that in the framework. It's a single function on a specific object. You get an array of arrays back.
You just decided to find an example with a bunch of padding around to pretend that PHP was absurdly more work to use, that people would 'rather type' the other.
If corporations are people, aren't stockholders guilty of slavery?
They're not identical at all, you just don't know that because you've spent all your time going apoplectic here instead of reading the links I posted.