I am developing TYPO3 projects since 2006 now, and projects are getting bigger and more complex. Setting up a simple CMS site with a contact form and news listing is all routine.
Right now, we finished a bigger project: A platform for an international company with countless extensions:
Login & registration, news, listing database records, dynamic contact forms, surveys & statistics, intranet functions: document upload & download, several backend "tweaks" per TCA modifications, etc. .
The project managers got upset at us developers, because sometimes, after we finished on function X and later committed function Y to the dev server, function X was broken. This was related to typoscript settings, extension interdependencies, versioning errors or sometimes simple programming mistakes and typos.
I know how to take care of the latter, but in general:
From your experience:
How can we develop an error-proof system in TYPO3, where everything works in hand and extensions don't get in their way? In other words:
How can we secure and isolate functionalities (extensions) - and avoid those interdepency issues?
We are working in a DEV team with two developers, and we already use:
Subversion Repository
Local DEV server for development & testing
External typoscript configuration files, split into single files for each extension
Edit for Bountyhunters:
What I am looking for is a best-practice-summary that might include these topics:
General workflow habits
General coding habits
Reliability of our subversion commits (or Git)
Unit testing (PHPUnit, Selenium?)
Deployment (I haven't yet figured out how automated deployment can
help us)
Typoscript best practices
Problems we could find in large TYPO3 projects are not to much different from any development project.
General practices :
configure continuous integration platform with continuous deployment tools;
Test Driven Development with automated testing;
robust architecture (dB, URL routing, ...);
performance tests during development;
use versionning with formatted comments;
use powerful IDE as PHPStorm, Eclipse, Netbeans;
Common TYPO3 practices :
use official API;
follow TYPO3 API code guideline;
use TYPO3 hooks where You can if You need to modify the logic of Core or 3rd party extensions;
use TypoScript constants to separate data from logic in Your configuration;
Additional references :
TYPO3 Best Practice Workshop
TYPO3 Best Practices (de)
TDD & Best Practices mit TYPO3 (de)
Extensions could help to manage complex TYPO3 installation :
caretaker
additional reports
Use modern project management methodologies & tools
Scrum, Kanban, lean developement principles
Bugtrackers as Redmine, Trac
Books :
php|architect's Guide to Enterprise PHP Development
I absolutely recommmend start using PHPUnit for unit testing, but remember unit testing is really about how you create the code in the first place, not usually something you add later. But of course, better late than never.
You should consider setting up a build server like jenkins/hudson or atlassian bamboo. The latter is quite nice and integrates with zend studio which in my opinion is the better choice when developing in PHP. In general the atlassian products are widely used for software projects. (Jira + confluence + greenhopper in particular)
I would also recommend setting up phpunit on jenkins - see http://jenkins-php.org/ as a template, although I've read good feedback about Teamcity. Then, depending on the code you write you setup unit tests (for raw php code, maybe a bit with of mocks), integration tests (API and module connectivity) and system tests (selenium).
Once you have it running after each build you can be sure that at least covered functionality is working. The problem however is that you will spend more time on writing tests and their support as well as thinking about testable code. Also keep in mind that you cannot cover everything - thats not the point. You must have critical paths covered.
Related
I am setting my own software development company and I have to choose how to organize our work. We will have to develop website and web applications in general in the near future and I would like t organize the workflow in the way we don't loose more time then needed on development process.
My concern regarding the above, is to take one of the tons of PHP existing CMS out there and use it as a base for all the coming projects or take a Laravel CMS such as OctoberCMS, or similar and use it as a base project. The former gives me more choice, because there are many CMSs with a lot of modules and templates ready to use, the latter would be a great base either for small websites and also for more complex web applications, being Laraval a MVC framework it is ready for developing more complex web applications, but offers less functionality and modules (for example OctoberCMS provides a not very easy CMS tool for editing pages, which would be not suitable for my customers).
I would like to hear your suggestions and thoughts.
Thank you
I kinda had the same trouble months ago, and I ended up choosing the framework option.
After months developing and using Wordpress-based solutions for my clients I noticed that the start up of every single project was very fast (easy to install, lots of materials available for free or cheap) and enough satisfactory, but the hell arrived every time there were some more-than-little modifications (logics and design).
Using a framework with a pattern like MVC (I use Yii) may be more difficult at the beginning, but write, debug, and organize your code is far more fluid and satisfactory, on the long run. Even a module (cms) can be easily extended or rewrite with lesser effort than packed CMS solutions like Wordpress.
So, summing up: upvote for framework option.
I made the decision to switch from WordPress being my defacto platform for new projects when Laravel Framework v4 was released, much for the same reasons mentioned by #SomethingWicked. I also have a fundamental issue with Matt M. and WordPress Core development team, that WordPress is an Application Platform. It is not, it is a Content Management Platform. Purely because it takes too many liberties in making assumptions (biased to blogging and content management) for the user.
I am also a firm believer in the 12-Factor App (http://12factor.net), which WordPress makes very difficult, neigh impossible, to adhere to.
I am not sure if this is a stupid question or not.
I have been working with Mongodb and found myself writing the same logic in different applications for simple stuff like selecting collections and drop them etc.
If I made some classes based on the datamapper pattern using all the Mongodb functions would this be a basic SDK ?
If I am totally wrong could someone help me out in defining a SDK ?
I think you're creating a reusable library or if you are getting a bit more ambitious an application framework.
My understanding of an SDK is that it would have the tools (eg. compilers, WSDL pre-processors) necessary to develop applications, whereas the Runtime Environment would just have what you need to run the developed application. Contrast a Java JRE (VM, standard libraries) and JDK (compiler etc.) When we develop for specialised platforms (eg. smart phones) we often have in the SDK an emulation of the target platform to allow us to test our code on our workstation.
I don't think you should be concerned as to whether or not you are building a framework or an SDK, rather be concerned about if it will be useful to other developers. If you say to them: "download your standard Java JDK, + standard mongodb + my excellent framework) you may well help them a lot. I would view something such as Spring as having started like that, and look what happened to that.
Once you start packaging other stuff with your framework, with the objective of making the developers initial download simpler you buy into a world of maintenance issues, when will you release a new version of your package? What happens when fixes are needed for packages you include.
Software Development Kit
A software development kit (SDK or "devkit") is typically a set of development tools that allows for the creation of applications for a certain software package, software framework, hardware platform, computer system, video game console, operating system, or similar platform
Currently, I am looking to switch from a home grown eCommerce website to a custom site using a framework. I need something that can upscale (handle hundreds to thousands of transactions), is easily maintained, and simple to customize.
I was recommended the symfony framework by an outside source, but I have not previously heard of it. My understanding is that using something like symfony would still require integrating magento (or its ilk) for commerce on the back end.
Is there a better solution? Is there another platform that would fulfill all of my needs?
It's hard to say what platforms would suit your needs without knowing what they are :) Do you have specific requirements that are unusual in the ecommerce world? Having said that, a decent ecommerce framework will allow you to adapt the core functionality to suit your needs in a robust manner.
As #usoban suggests, Magento doesn't require Symfony, but it is built using the Zend Framework. So if you're familiar with the Zend patterns, then you will adapt to Magento much quicker.
Magento has a broad range of features "out of the box" and is certainly capable of scaling to large volumes of transactions and visitors.
It does require serious hardware and resource optimization in that high-end configuration, but there is a body of knowledge on how to achieve that both on the Magento site and elsewhere on the web. The Enterprise Edition is also designed for performance (includes Full Page Caching) along with features/functionality that are important for administration of serious ecommerce (content merging and staging, granular permissions, etc).
You will hear a lot of complaints about Magento's learning curve, and they are mostly justified, particularly if you are coming from a traditional PHP coder background. However, if you take the time to work through the tutorials, and recognize that the complexity is due to the power and flexibility of the system, you are likely to find it worthwhile. Also, us StackOverflow peeps reckon that you'll get much better support here than on the Magento forums :) There tends to be some questionable advice there, at least here you can see what the peers think of the answers :)
Hope all this helps!
JD
There are bundles now was developped for this purpose. Some of them can give you a lot of functions like Cart management, products by categoris,...
This is a bundle that can help you sylius
Also, you can base your developpement on vespolina which is in production now.
Drupal 8, now uses some componenets of SF2, and in the future it will be developped entirely on the top of symfony. So you can start using Drupal 8 but it's in developpement stage also.
Using symfony2 will give you the possibility to use also ezPublish 5 and PHPBB4.
As you can see, most of PHP CMS and business projects are moving to SF2. And the reason is very simple, SF2 has implemented the JSR Specifications but not in JAVA language, in PHP5.3
I advice you to try it first for a small project first to learn the best practices implemented by sf2, specially the IoC (Inversion of Control) also called Dependency Injection.
I have worked with symfony in several projects (one of them is a custom e-commerce site built from scratch), and I'm very happy with this framework.
If you plan to use Magento as a backend and symfony for the frontend, I'd suggest you to use Drupal Commerce http://drupal.org/project/ecommerce because Magento is a heavy piece of software. You can even forget about symfony and extend drupal to fulfill your needs.
An alternative to Symfony could be Zend Framework http://framework.zend.com
ZenMagick is an on-going project that uses a lot of Symfony2 compoenents. It is currently at version 0.9.11. The homepage describes it as
Originally based on Zen Cart, it has evolved into a flexible and robust system of its own, that allows you to get the shopping cart you want.
I'm looking for inputs into how I can manage the upgrade process itself of a homegrown php/mysql application. Meaning, if we have a 'stable' version of our php/mysql application working on our production server, and we now want to upgrade it to the next version that we've worked on - how do we go about doing that elegantly? What practices should I be implementing?
What I was planning to do was just to
Ask the developers to stop
checking in code after all stability
/ functionality tests are done
Take the application offline*** (Q: how should I prevent ppl for logging in / accessing public pages? Best practices for that?) but allow access to developers through a secret login page / url
Log onto the production server and check out the latest version
locally***
Have the developers/testers test their code through the secret access page / url***
After that is done, we restore access to all by removing this secret access page / url, removing the site-under-maintenance page and restoring access to all.
***NOTE: A simple way of doing this would be to rename /myapp/ to /myapp.old/ and put the new application version into /myapp.new/ Developers would access /myapp.new/, test to their satisfaction and then after we're done, we would rename this back to /myapp/ (this is just the basic idea)
This is a huge question, and in many ways it will depend on your specific project. But here are some practices to think about:
Put lots of comments in your code. Things that seem perfectly logical now will be confusing when you go back to make changes in a year or two.
Maintain a development version of the site with its own database. You can test changes to the site before publishing to your production site.
Use a PHP framework (such as CakePHP, CodeIgniter, etc). If you are far along on your project, this may be difficult to do. But it will help you write code in a way that is easy to update, and will include a lot of stable, mature functions that you won't have to write from scratch. Using one of these frameworks (and following its best practices) is probably the best way for a beginner to learn to think about writing modular code that's easy to update. This will also encourage you to develop your database in a way that is consistent with the structure of your site.
Write tests (the framework should help you with this) to programatically check your code for errors.
Use a version control system such as Subversion or Git. This allows you to track changes to the site, and easily roll back changes if/when you realize they are buggy.
Comprehensive unit test coverage would be very helpful, as would small, highly cohesive, low-coupled classes. In addition to the unit tests, good coverage from an integration level would be valuable.
What would be a good tool-for-the-job to do automated deployments of LAMP-based applications(MySQL, PHP, Zend Framework) to integration and staging environments?
I am looking specifically for tools that handle deployes to remote hosts. I assume building tools such as phing and ant I assume could be used for that, but I was wondering if there is something better for this case.
For integration, especially for continuous integration, I like phpUnderControl (which is a tool for PHP projects, but is itself based on CruiseControl, which is quite know in the JAVA World) : it deals with :
fetching the last revision from SVN
launching the automated tests (PHPUnit)
php_CodeSniffer
Generation of the PHP Documentation (phpDocumentor)
and provides a nice interface for users to see the results of each build.
And, to begin, here's an article that explains how to set phpUnderControl up : Getting started with phpUnderControl
(Each time I, or some colleagues, have installed phpuc, we did almost as explained in that article, from what I remember)
For staging, I generally go with a couple of phing tasks to build a tar.gz archive, that I deploy to the staging server once in a while, using another phing task to un-tar the archive, and create the required symlinks (or stuff like that).
The idea being that Continuous Integration happens all the time, and has to be fully automatic, while deploying to staging is done only one in a while (once per week, for instance), and can be done semi-automatically.
Configure a build server, something like CruiseControl is excellent for this and roll your own custom Nant scripts if needed or use Exec tasks to take care of the deployment.
For these things like specific deployments each with their configuration issues and intricacies, there is hardly ever something out-of-the-box.
Look at it this way, rolling your own scripts and batch files definitely means you know all about the steps and can configure and modify it anyway you like, rather than some magic fairy dust going on, and when things break - having no idea where to fix it.