Thoughts after Symfony Live Berlin 2012

Lately XSolve team had a great opportunity to attend to Symfony Live conference in Berlin. That was our second chance to meet Symfony community after successful edition in London this year.

Germans are perfectly organized and they showed this to attendees this time. They’ve choosen very exciting venue, located in former church, with organs above main scene. Everything was right – place, seassions, food and party after last talk.

The most valuable part of this conference were talks. My favourite was “Symfony2 Form Tricks” by Bernhard Schussek, but also “What’s new in Doctrine2″ and “Practical REST”, were very interesting. What was very important – there weren’t any poor talk, which speaks for itself, if it comes to sessions quality.

To sum things up: Sensio Labs DE (the organizators) did they job very well and it was worth to have a such a good time in Berlin.

You can also find out ashort summary on XSolve’s profile and view some photos on Flickr

Read more

Is Symfony2 a MVC framework?

Is Symfony2 a MVC framework? This question in tricky and you can’t see answer at the first moment when you visit symfony.com website. Even more – MVC pattern isn’t mentioned in elevator pitches in “What is Symfony” section. Most of PHP developers will tell you promptly, that this is Model View Controller implementation without a doubt.

The question is: where is Model layer in Symfony2? My answer is: there’s ain’t one and it’s good..

Symfony2 isn’t hardly bounded with Model layer, as it could have been seen in first version. We can see many Active Record model implementations in modern web frameworks such as Ruby on Rails, Django and symfony 1. I’m not saying those solutions are bad. The main problem was, that big systems maintained by plenty of developers changing over time tends to have a messy codebase. The common place to locate business logic were Model layer. The result of that approach were huge model classes, randomly structured Table/Peer classes full of static method and general feeling that system is hardly impossible to maintain anymore.

The problem: complex systems

Nowadays Internet and business needs agile team working on sophisticated and higly complicated systems. Simple problems were solved years ago. If one wants to make a success with his web application, he needs to solve tough problems. Those systems are impossible to be produced with old fashioned Watterfall software development process. Something better fitting should taken into the consideration to adapt to current conditions. Most of development process can be covered by agile tools such a Scrum or Kanban.

All those cases, from architectural point of view, could be solved by Domain Driven Design

The solution: Domain Driven Design

It’s a approach and way of thinking about complex systems. It supports best known design patterns, good separation of concerns, agility and good communication layer between technical and business people, for example by using ubiquitous language.

So if you ask, where should I look for a Model in Symfony2 projects, I’ll tell you: look for it around the domain. Symfony2 has plenty of capabilities that could be used for developing system with DDD approach, I’ll name just a few of them.

Read more

Symfony Live London 2012 recap on xlab.pl

On xlab.pl blog I’ve posted summary and my feelings after Symfony Live London conference. Click here, to read it.

Read more

Export colored Behat scenarios to PDF

Everyone falls in love with Behat. It’s powerfull tool for testing business requirements in PHP. Behat scenarios, written in cross-platform Gherkin language, are readable for developers, easy to understand and verify for business people and executable by machine, which goes through an application to prove that it works as expected.

Behat scenarios are one of the best ways to describe system. UML Use Cases or tons of pages in SRS documents are fine, but hard to understand from the begining, and even harder to maintain in the future. Behat eases this process and also gives opportunity to automate requirements verification.

To write Behat scenarios you need a text editor. I’ve picked my favourite – Vim, which highlights *.feature files syntax. But business people mostly don’t use Vim, so I need to figure a way, to expose scenarios in easy and pleasant way. There are few steps to get it done:

  1. Merge all features in one file
  2. Open it in Vim
  3. Make hardcopy
  4. Convert hardcopy output (PostScript) to PDF
  5. Send it to customer :-)

Here’s how we do it from technical point of view:

1. Find all feature files and cat them to one file (assuming your .feature files are located somewhere in src/ directory)

find src/ -name *.feature | xargs cat >> system_requirements.feature

2. Open Vim and configure some printing options

:set printfont=courier:h8
:set printencoding=latin2
:colorscheme default

Some remarks:

  • font is platform dependant, you should adjust it by yourself
  • printencoding set to latin2 is required for polish encoding (even if features were written in UTF8)
  • colorscheme is also a matter of taste, default one looks good in PDF

3. Now we are ready to create hardcopy, which is simple print to the PostScript file:

:hardcopy > system_requirements.ps

4. In terminal convert *.ps file to PDF (or whatever else format you like):

$ ps2pdf system_requirements.ps

5. Et voilà, your PDF is ready to send to the customer, example can be seen below

Behat scenarios in PDF

 

Read more

Let’s meet at PHPCon 2012

During upcoming edition of PHPCon 2012 in Kielce I’ll give a talk “Symfony2 w chmurze” (Symfony2 in the cloud). I’ll describe advantages of cloud infrastructure purposed for web applications, some use cases of cloud deployments and things which developers need to keep in mind, to get Symfony2 application work properly in such environment.

More informations are available in PHPCon agenda:http://phpcon.pl/2012/pl/agenda

See you there :-)

Read more

Deploying Symfony2 applications with Ant

When you have plenty of Symfony2 applications and you need to deploy them from time to time, you are probably sick of thinking about every activity you need to do for every deploy. Often people use some build scripts, which are hard to maintain and tends to be unreadable. I wanted to automate it as much as it possible and I’ve choosen Ant, to help me out.

Actually Ant is choice, due to other fact – it can be easily used with Continous Integration server like Jenkins, while ssh scripts often generates some problems. With this aproach all you need to have Ant binary on server and build.xml config in root folder. You can have different targets defined in config and chain them using depend attribute. So in this case you can have target for building project on production server (usefull for continous delivery) and setup for Jenkins.

Read more

The most useful features of PHP 5.4

As you probably have noticed, PHP 5.4 is around the corner. As far, there’s Release Candidate 6 available and final release is a matter of weeks. Let’s have a look at new features, that will make PHPers live easier.

Read more

Always use most latest versions for benchmarks

In my previous post Modern framework comparison I presented performance tests, which compared Ruby On Rails, Django and Symfony2. After recieving a feedback in comments I decided to run this benchmark one more time on my own laptop (instead of on my hosting). The reason was simple: enviroment was outdated. I installed mod_python and configured it easily and struggled about one day with phussion passenger (AKA mod_rails) with ruby 1.9, but finally everything works. The results is compared in table below.

Read more

Modern frameworks comparison

How many times were you curious which one of, modern web frameworks is the best? For developers who have their favourite, answer is simple. But there are plenty of questions from begginers or devs who want to learn new technology, wondering which one should take, to stay on the edge.

Read more

Why Mockery is better than PHPUnit Mock Builder and how to integrate it with Symfony2

Recently I did a lot of Test Driven Development on my Symfony2 bundle. I used PHPUnit’s built-in mocks and stubs for many projects, so I took it again. But while I was working on mocking Symfony2 core objects I found those mocks very uncomfortable in use. I tried Mockery and it saved my day. Let’s see how to get it working with Symfony2 and how it kicks ass!

Read more
older
Back to top