PDA

View Full Version : Do you use a framework?


tsick
23-04-2010, 10:47 AM
Just interested to see what people are using..

If you use a framework, which one and why?

If you don't.. why not?

--

I use the symfony framework. Started using it a few years ago because it wasn't feasible to dev without a framework.

I chose symfony over Cake etc because of the superior community and documentation.

tuna
23-04-2010, 10:52 AM
please clarify are you talking

Front end dev
Back end dev

or something else really weird. ;)

tsick
23-04-2010, 11:05 AM
I'm talking about any application.

I use symfony for both frontend and backend applications

kay
23-04-2010, 11:18 AM
lol, tsick you're talking about server side as in php code. Tuna was asking if you mean a php/asp/cf/jsp framework or a javascript or css framework (i.e. client side).

I inherited one site that used symfony, but found someone else to take over. To me it seemed very much overcomplicated. But I'm not a PHP coder, I'm a CF coder, and yes I use a framework for that. For our PHP stuff we have our own framework inhouse, based on MVC but customised to the kinds of work we usually do.

tsick
23-04-2010, 11:36 AM
haha ok, thought that question was strange. We are in the PHP/MYSQL section though :)

I can see your point about it being complicated, it took me 2 months to fully conquer.

I used to have my own PHP framework aswell, however maintaining it (security, depracted functions in PHP5, legacy versions on 30+ sites etc) became a real problem and also it didn't scale out as well as I would've hoped when I started doing larger projects.

Mr C
23-04-2010, 11:37 AM
I've used it in the past (previous employment), and I have to say, I'm not a fan of it.

Most of the time I code OO php in an MVC style, and have a built up a library of classes to simplify the frequent common tasks.

I started with mojavi before symfony existed, (the core mvc stuff in symfony came from mojavi), and still like it for its simplicity and ease of use, but rarely use it.

I have been wanting to check out Zend framework for a while now.

tsick
23-04-2010, 11:49 AM
I guess it depends what you use it for. Would'nt make sense to use it for a standard website, but if your building a web app or enterprise grade site using a framework like symfony has significant advantages.

Vee
23-04-2010, 12:11 PM
I've been working with CodeIgniter in the last couple of weeks, can't complain

If there are any gurus here, PM me your deets as I may have a large project coming up that I would like to have developed on CI but don't want to be turning all (any) of the screws myself.

Botman
23-04-2010, 04:19 PM
I use CakePHP.

Why? It does a good amount of work for you while keeping out of your way. Though that's probably true for everyone and their preferred frameworks. :)

I am always open to something better but yeah, I've found CakePHP to be consistently good enough.

Biggest weakness is that out-of-the-box, I find the view mark-up gets pretty messy because you end up with:

if (!empty($product['Product']['name'])) {
echo $product['Product']['name'];
}

Otherwise you risk an Undefined Index warning if the variable was not set.

Give me Smarty syntax any day: {$product.Product.name}

Vee
23-04-2010, 05:34 PM
Surely there is a template engine available for CakePHP?

nebbian
23-04-2010, 08:22 PM
I had my doubts about using a framework, but now I'm using CakePHP I wouldn't consider any other way of coding.

Want an admin interface for a new table, with subtables? I can get that up and running in around a minute. Seriously, 60 seconds. With hyperlinks to the related tables and everything.

Before Cake I used smarty and normal PHP, so when I started using cake I got smarty working with it... but quickly found that the smarty way is much slower and harder to use. For a start you can't bake a smarty view straight out of the box, and when you're doing funky stuff with arrays it just turns into a big old mess. I found myself changing my output to suit smarty, which just isn't right.

You get used to the tag soup after a while.

As for the frontend, I've mucked around with Yui for a bit, but then turned to ExtJs and had good success with it. CakePHP and Extjs now run our CMS and the job tracking system we sell.

nebbian
23-04-2010, 08:31 PM
I use CakePHP.

Biggest weakness is that out-of-the-box, I find the view mark-up gets pretty messy because you end up with:

if (!empty($product['Product']['name'])) {
echo $product['Product']['name'];
}

Otherwise you risk an Undefined Index warning if the variable was not set.



Or you can just set debug to 0 before you finish the controller function:

Configure::write('debug', 0);
}

I've never had to do those sort of checks though... normally $product contains all of that row of output, which always includes 'name'.

Shane SF
25-04-2010, 09:01 PM
Or you can just set debug to 0 before you finish the controller function:

Configure::write('debug', 0);
}

I've never had to do those sort of checks though... normally $product contains all of that row of output, which always includes 'name'.

I wouldn't recommend turning debug off instead of fixing warnings. Do the right thing ;)

nebbian
25-04-2010, 11:13 PM
I wouldn't recommend turning debug off instead of fixing warnings. Do the right thing ;)

Agreed :) Those big yellow boxes mean you've done something wrong.

Setting debug to 0 (in the core.php file) really cranks up the speed though!

Zen
26-04-2010, 06:10 PM
I use CodeIgniter, i've found it to be absolutely great (if you know and use MVC, because it does not force the MVC principals upon you.)

really light, but has some excellent features.

Botman
06-05-2010, 12:31 PM
I've never had to do those sort of checks though... normally $product contains all of that row of output, which always includes 'name'.

That is a good point. Now I am wondering if I just picked a bad example.

Maybe it wasn't the undefined index I was concerned about, but simply wanted to hide fields that were not set (hiding the mark-up around the field too, so writing out an empty value was undesirable).

I researched adding Smarty to CakePHP. The verdict from others who tried was that they did not play well together, however this was over a year ago. A lot has probably changed.

nebbian
06-05-2010, 09:39 PM
Perhaps I should share a little function that lives in my bootstrap.php:

function echoIfSet(&$inputVariable) {

if(isset($inputVariable)){
echo $inputVariable;
}

}

As with most things, there's the right way to do things, and the way that you sometimes have to do things to make it work.

Like this line in the beforeFilter function in my app_controller:

$this->set('app_controller', $this); // F U MVC

;)

madpilot
07-05-2010, 10:01 AM
I'm on Ruby exclusively now, so that means Rails and Sinatra. But before I dropped PHP, I wrote a micro framework, based on the idea behind Sinatra, called Junior: http://github.com/madpilot/junior

It's handy if you still want (M)VC, but don't want a huge framework. (The M is in parenthesis, because it doen't actually provide you with a ORM).

Ruxton
10-05-2010, 02:06 PM
Surely there is a template engine available for CakePHP?

Why slow things down by putting a template engine (whatever you choose), inside a template engine (PHP)?

I've been responsible for choosing to do this in the past and I wish i'd just stuck with using PHP and taught everyone to properly separate their views from model and controller.

I'm on Ruby exclusively now, so that means Rails and Sinatra. But before I dropped PHP, I wrote a micro framework, based on the idea behind Sinatra, called Junior: http://github.com/madpilot/junior

It's handy if you still want (M)VC, but don't want a huge framework. (The M is in parenthesis, because it doen't actually provide you with a ORM).

You can quite easily provide a good ruby style ORM to it by using http://www.phpactiverecord.com (which requires php 5.3), been playing with this over the last few days.

I remembered you pointing out Junior in your eotw talk, recently i'd had a toy around, done some extending and changes to make it a bit more "MVC" (in my mind anyway) and implemented PHP ActiveRecord. Who knows what i'll use it for (if anything), it was just an adventure in "i wonder how easy that'll be".


And back to the question:
Generally i'm using my own "frameworks", they started out as collection of libraries for common tasks and were built into bigger and better things as time goes on. When you're constantly building the same thing over and over again you'd be stupid to not have core framework to bring the basics of it up quickly.

ekul24
22-05-2010, 11:56 AM
I don't see why people write their own framework when there already plenty of great frameworks out already.
Its an old reinvent the wheel situation.
This then has a flow on effect for when another developer has to work on your custom framework not familiar with the code etc takes longer and also difficult to estimate changes
and how do you handle upgrades with a custom framework?

madpilot
23-05-2010, 06:15 PM
I don't why people write their own framework when there already plenty of great frameworks out already.
Its an old reinvent the wheel situation.
This then has a flow on effect for when another developer has to work on your custom framework not familiar with the code etc takes longer and also difficult to estimate changes
and how do you handle upgrades with a custom framework?

If no one wrote their own frameworks, then there wouldn't be "any great frameworks out there already" would there?

ekul24
23-05-2010, 07:39 PM
Your kind of missing the point.

ashul
23-05-2010, 10:10 PM
Myles' point IMO is simple if you are going to innovate and you are someone that can think out of the ordinary - this means you have the experience and skill (experience in my context is tried, failed , stood up and tried again till you succeeded) you can follow a custom framework that will be different from others and you will be on a winner. Maybe it is something that comes with age?

ekul24
24-05-2010, 10:14 AM
Yeah I get what your saying but for the norm.
Most clients don't want a cms or solution thats been built upon a framework that needs to be tried and failed they want one that "just works" and usingupon an existing framework, especially for open source projects, is what I believe to be good business.

I'm sorry I feel as though I'm rattling a few peoples cages in here :(
I am normally nice I just like to stir the pot a bit :)

Mr C
24-05-2010, 10:52 AM
Frameworks != CMS

ekul24
24-05-2010, 12:26 PM
Frameworks != CMS

No, no its not. My bad switching between the Framework and CMS posts.
*quickly edits post*

ashul
25-05-2010, 11:05 PM
Frameworks != CMS

hmm are you sure? If an application is served up from the repository of a CMS is it running on a framework?

A

ashul
25-05-2010, 11:08 PM
Yeah I get what your saying but for the norm.
Most clients don't want a cms or solution thats been built upon a framework that needs to be tried and failed they want one that "just works" and usingupon an existing framework, especially for open source projects, is what I believe to be good business.


There is a HUGE difference between what clients want and say maintenance in the long run. Look at the bigger picture first, what "just works" today might not be an acceptable solution tomorrow. Don't underestimate the innovation of those that don't just follow the herd because the one in front of the herd must be right..

Mr C
26-05-2010, 03:02 AM
hmm are you sure? If an application is served up from the repository of a CMS is it running on a framework?

A

To me, no, its just an application running ontop of a CMS.

Frameworks, by themselves don't really do anything useful, or at all, until you start building on them, or at least that's where I draw the line in the sand, from a programmers point of view.

Eg, you download a framework, put it on your webserver, and it basically doesn't do anything. Sure it might come bunldled with an example app to get you started, but the rest is up to you to produce whatever you want with it.

Content Management Systems, on the other hand, work after you finish installing them, and are designed to manage content, which really isn't alot of help if your not building a content based website.

I've worked on custom built web-based front ends to systems that have nothing to do with typical advertising websites or e-commerce type sites, to which a framework is the best base to start with, rather than a CMS.

ekul24
28-05-2010, 02:05 PM
There is a HUGE difference between what clients want and say maintenance in the long run. Look at the bigger picture first, what "just works" today might not be an acceptable solution tomorrow. Don't underestimate the innovation of those that don't just follow the herd because the one in front of the herd must be right..


Exactly.
If you use an existing framework or cms you can build upon that and you'll have more time to be innovative since your not writing basic functionality and you'll have more time to focus on the business logic of the solution.

ashul
29-05-2010, 09:19 AM
To me, no, its just an application running ontop of a CMS.

Frameworks, by themselves don't really do anything useful, or at all, until you start building on them, or at least that's where I draw the line in the sand, from a programmers point of view.

Eg, you download a framework, put it on your webserver, and it basically doesn't do anything. Sure it might come bunldled with an example app to get you started, but the rest is up to you to produce whatever you want with it.

Content Management Systems, on the other hand, work after you finish installing them, and are designed to manage content, which really isn't alot of help if your not building a content based website.

I've worked on custom built web-based front ends to systems that have nothing to do with typical advertising websites or e-commerce type sites, to which a framework is the best base to start with, rather than a CMS.

That is what I used to think.

Then Just over 2 years ago, we decided to rebuild our CMS from the ground up, new code base, no reuse of old stuff, everything brand shiny new.

We found that in 90% of the deployments we do clients wanted more custom stuff than the CMS can do out of the box. So you end up having a separate admin area to do extra stuff. So the new CMS needed to be able to take these client enhancements in a hosted solution scenario.

What came out of it was a plug-in architecture. Anything extra you need you create a plugin upload via a web interface, scan them and voila you have a new front end control that does stuff available for insertion.

Whilst we were doing this we realised that non-cms standalone web apps we were building require some common stuff outside of the Visual Studion environment - viz, front-end CSS, JavaScript, Templates - so we separate front-end stuff from app logic, and want to keep a history of template, css etc we use the CMS to roll out apps now as well. Means I can go and change a master page and republish and app will have a new widget or link across the pages it requires.

A

ashul
29-05-2010, 09:20 AM
Exactly.
If you use an existing framework or cms you can build upon that and you'll have more time to be innovative since your not writing basic functionality and you'll have more time to focus on the business logic of the solution.

if you are building on a bowl of spaghetti, just be aware that your inherent foundation will be weak.

Mr C
29-05-2010, 01:35 PM
Yes. Choose your framework or CMS wisely. They are not all created equal, and sometimes the popular choice isn't necessarily the best choice.

Zen
07-06-2010, 07:09 AM
Yes. Choose your framework or CMS wisely. They are not all created equal, and sometimes the popular choice isn't necessarily the best choice.

Very true.

A great deal of the time the product that is packaged the nicest will sell well, but that does not make it the best product to use.

stevanz
07-06-2010, 06:44 PM
framework is a cool tool to speed up the development... for type of framework, i would say codeigniter, the developer of our website is pretty good on that and i don't have any problems on it.