[RFC|Accepted] Symfony 2

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
Post Reply
User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: [RFC] Symfony 2

Post by naderman »

Alright so I'd say that consensus is, that this direction is worth exploring. So I've created a ticket for an initial Symfony 2 structure based on the sandbox http://tracker.phpbb.com/browse/PHPBB4-3 to get us started.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC] Symfony 2

Post by Oleg »

eviL3 wrote:I hope you are not worried about disk space. Besides, Symfony is small. 3MB on disk, 600KB compressed. phpBB3 is 11MB on disk. But unless it takes up hundreds of MB it's a non-issue anyway.
There are two issues with increasing code volume:

1. Bootstrap (the time it takes from the application code taking control to where it is capable of performing useful work) takes longer. For example of a project which struggles keeping bootstrap times down take a look at tickets in Drupal's issue tracker.

2. Memory usage. Even now there are users running into the memory limit as a result of people posting in less common languages that cause UTF8 tables to be loaded.

Besides those there is the general issue of control. What would happen when the framework of your choosing decides to do something differently from what you want? What would you do when your patches are not accepted for whatever reason? Does the framework have a backward compatibility policy? How would you deal with changes in the framework that require your code to be changed in such a way that it would break phpbb modifications? (And I'm not just talking about current mods, any modifications or plugins rely on documented or undocumented APIs and implementation details.)

The bigger the framework, the more work it takes to keep up with its changes. In case of phpbb you will not always be able to hide the differences behind a UI.

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: [RFC] Symfony 2

Post by naderman »

I think most of your concerns can be answered simply by thinking about the alternative. And the alternative is we write everything the framework provides ourselves.
nn- wrote:
eviL3 wrote:I hope you are not worried about disk space. Besides, Symfony is small. 3MB on disk, 600KB compressed. phpBB3 is 11MB on disk. But unless it takes up hundreds of MB it's a non-issue anyway.
There are two issues with increasing code volume:

1. Bootstrap (the time it takes from the application code taking control to where it is capable of performing useful work) takes longer. For example of a project which struggles keeping bootstrap times down take a look at tickets in Drupal's issue tracker.

2. Memory usage. Even now there are users running into the memory limit as a result of people posting in less common languages that cause UTF8 tables to be loaded.
I'd say that is a general problem and not a reason not to use a framework. We have to deal with these problems even if we wrote everything ourselves. And as Igor pointed out the code volume is unlikely to increase significantly if at all. Afterall better code reuse and more concise code is one of the goals of a framework.
nn- wrote:Besides those there is the general issue of control. What would happen when the framework of your choosing decides to do something differently from what you want?
It's open source so as a last resort we can always fork and maintain it ourselves which would not be more work than using our own code instead of a framework. So even in the very worst case it's not worse than building your own framework.
nn- wrote:What would you do when your patches are not accepted for whatever reason?
Well so far Symfony has been very open to suggestions and patches but again as a last resort we could technically just fork it.
nn- wrote:Does the framework have a backward compatibility policy?
Yes they do for their stable releases.
nn- wrote:How would you deal with changes in the framework that require your code to be changed in such a way that it would break phpbb modifications? (And I'm not just talking about current mods, any modifications or plugins rely on documented or undocumented APIs and implementation details.)
That would certainly require a case by case evaluation. In most cases I assume that only few if any MODs will really break - frameworks don't normally break applications built on them in minor releases. And if they rely on undocumented behaviour one can if the impact is not too big still change that behaviour and break the few dependend MODs. However the people working on the framework will not take such decisions lightly either.
nn- wrote:The bigger the framework, the more work it takes to keep up with its changes. In case of phpbb you will not always be able to hide the differences behind a UI.
Can you explain what you mean by that? I didn't quite understand your point about UIs here.

sitedyno
Registered User
Posts: 1
Joined: Thu Aug 26, 2010 8:48 pm

Re: [RFC] Symfony 2

Post by sitedyno »

Please PLEASE develop phpBB on a framework. I'd prefer CakePHP, but Symfony would be ok as well. Unit tested code + extensible (not hackable) code would be a blessing few in the phpBB community know about.

GravityDK
Registered User
Posts: 36
Joined: Sat Aug 28, 2010 10:19 am

Re: [RFC] Symfony 2

Post by GravityDK »

I'm not a PHP developer, but have some experience in software engineering.
I read the RFC on Wiki, and looked into Symfony 2 itself.

I wanted to voice support for Symfony 2; it appears to be a very good decision to use it.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC] Symfony 2

Post by Oleg »

naderman wrote:I think most of your concerns can be answered simply by thinking about the alternative. And the alternative is we write everything the framework provides ourselves.
Realistically you would not need everything that any given framework does. For example, a certain framework doubled in size over a number of years, but while it received much shiny new functionality the old version only needed maybe three significant improvements.

This argument applies a couple more times so I'll just quote them here:
I'd say that is a general problem and not a reason not to use a framework. We have to deal with these problems even if we wrote everything ourselves.
It's open source so as a last resort we can always fork and maintain it ourselves which would not be more work than using our own code instead of a framework. So even in the very worst case it's not worse than building your own framework.
Again, practically speaking phpbb will not need every bit of code in symphony.
And as Igor pointed out the code volume is unlikely to increase significantly if at all. Afterall better code reuse and more concise code is one of the goals of a framework.
I am quite convinced that simply porting phpbb to use a framework, any framework, would increase the amount of code in phpbb. Even assuming you throw out all database drivers, I expect the simple overhead from making procedural code into object-oriented code would be bigger still. Compare for example the number of lines added and removed here: http://github.com/p/phpbb3/compare/deve ... ystem-cron.

Now let's take a look at some size measurements:

Code: Select all

pie@area symfony % wc src/Symfony/**/*php|grep total
   50637  147942 1541585 total
pie@area pb % wc phpBB/**/*php|grep total
  196951  627633 6650830 total
pie@area pb % wc phpBB/includes/utf/data/**/*php|grep total
   46728  126278 1882893 total
pie@area pb % wc phpBB/includes/db/**/*php|grep total
    7541   21429  184807 total
You're looking at a 30% growth in code volume if you exclude utf8 tables. The size of database drivers is 10-12% the size of symphony.
That would certainly require a case by case evaluation. In most cases I assume that only few if any MODs will really break - frameworks don't normally break applications built on them in minor releases.
I cannot speak for php frameworks but some other frameworks change in such a way that every minor version requires at best a few days of picking up the pieces and at worst massive rewrites chasing code churn in the framework.
Can you explain what you mean by that? I didn't quite understand your point about UIs here.
If phpbb is built on a framework, then plugins depend on two things: phpbb and the framework that phpbb is built on. If for example the way plugins are registered with phpbb is implemented by the framework, and that interface changes in an incompatible manner with no way of providing old behavior (let's say the order of arguments to a function got changed), then such framework change necessitates updating every phpbb plugin.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC] Symfony 2

Post by Oleg »

I should point out that I am not necessarily opposed to using some framework for phpbb. I do feel however that the downsides of doing so have been insufficiently covered.

igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Re: [RFC] Symfony 2

Post by igorw »

nn- wrote:Realistically you would not need everything that any given framework does. For example, a certain framework doubled in size over a number of years, but while it received much shiny new functionality the old version only needed maybe three significant improvements.
This is true, we will receive some unnecessary functionality by using any existing framework, and we cannot fully predict how the framework will evolve. But at the same time we may decide to use some of this functionality at a later point. And this functionality is also available for anyone extending (eg. MODs) phpBB.
nn- wrote:I am quite convinced that simply porting phpbb to use a framework, any framework, would increase the amount of code in phpbb. (...) I expect the simple overhead from making procedural code into object-oriented code would be bigger still.
This is irrelevant, because we would make the code object-oriented either way. So assuming we build a custom framework that works similar to the way Symfony2 does (however only including the things we need), we would end up having a similar amount of phpBB code. The difference would only be the size of the framework code.

Actually, additionally to Symfony2 we will also need an ORM, so that will add another ~4MB (size of Doctrine2). If we want to use Twig for templating, that adds another ~0.5MB.

As I said before, in these dimensions the amount of bytes a framework uses does not matter. Your concerns regarding the (API) stability are valid, and perhaps the symfony community can tell us if such incompatible changes were introduced in the history of symfony, if they will be in Symfony2 and how hard upgrade paths for these changes are.

There are some downsides to using a framework, that is true. These do imo not beat the major point for using a framework: not having to write and maintain a large amount of (generic) code.

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: [RFC] Symfony 2

Post by naderman »

I agree that there are going to be some parts of Symfony 2 we do not need. However due to the modular structure of Symfony I think that we can keep that amount relatively low just by excluding the parts entirely unecessary to us. And the upside of not having to write a lot of code far outweighs the downside of currently unecessary extra code that some people might still find useful for MODs.

As for backward compatability Symfony promises that interfaces will not be broken in minor releases. As far as I know that has been the case with symfony 1.x releases as well, so I'd say we are covered from that perspective.

Rotsblok
Registered User
Posts: 325
Joined: Mon Nov 14, 2005 12:21 pm
Location: x= y+1

Re: [RFC] Symfony 2

Post by Rotsblok »

I don't know how these things work so sorry for a nooby question :P

If I have some website application already using Symphony and I am to install phpBB (with symphony), does it installs symphony again, or does it detect that I am already using Symphony and just adds the modules that phpBB needs to my existing Symphony installation? Or does phpBB has to have 2 version; 1 with full symphony package and 1 with just the Symphony modules that phpBB will be using..
ø = 1.618033988749895...
Everything has ø in it

Post Reply