News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

NetTuts.com:
Refactoring Legacy Code Part 8 - Inverting Dependencies for a Clean Architecture
July 10, 2014 @ 11:04:13

NetTuts.com has posted part eight in their series looking at refactoring legacy code - Inverting Dependencies for a Clean Architecture. In this latest post they move away from just refactoring the code and start to look more at fixing the architecture of the application.

Old code. Ugly code. Complicated code. Spaghetti code. Gibberish nonsense. In two words, Legacy Code. This is a series that will help you work and deal with it. It's now time to talk about architecture and how we organize our newly found layers of code. It's time to take our application and try to map it to theoretical architectural design.

They look at the current structure of the code (well, of their refactored version) and how to apply the Dependency Inversion Principle (part of the SOLID methodology) via interfaces. The code is included for the refactor as well as tests to add to their "Golden Master" test suite to ensure continued correct functionality.

0 comments voice your opinion now!
refactor legacy code series part8 inverting dependencies

Link: http://code.tutsplus.com/tutorials/refactoring-legacy-code-part-8-inverting-dependencies-for-a-clean-architecture--cms-21659

Master Zend Framework:
Howto Handle External Form Element Dependencies with FormElementManager
April 22, 2014 @ 11:58:07

The Master Zend Framework site has posted a tutorial wanting to help you understand external form element dependencies with help from FormElementManager.

Zend Framework 2, like all great PHP frameworks, provides thorough infrastructure for creating forms in your application. Whether that's form objects, form elements, fieldsets, validation groups or that they interact with so many other components in the Zend Framework 2 default libraries. But how do you handle external dependencies? [...] So what if you need a custom form element in your application, one which will render a list of articles from a database table? [...] In today's post, we're going to look at how to create such a custom element, extending the existing select element.

He walks you through the steps you'll need to make the custom element and hook it into the FormElementManager for correct use:

  • Create a New Form Element
  • Implement the getFormElementConfig Method
  • Create a New Form Object
  • Instantiate the Form Via the FormElementManager

Code is included for each step of the way so you can ensure you end up with a working example.

0 comments voice your opinion now!
external form manager element dependencies external tutorial

Link: http://www.masterzendframework.com/zend-form/handle-external-form-element-dependencies-with-formelementmanager

Inviqa techPortal:
Manage Project Dependencies with Bower and Composer
January 30, 2014 @ 12:20:40

On the Inviqa techPortal there's a new tutorial showing you how to manage your dependencies with the help of both Composer and Bower (a Javascript package manager).

As developers, most of us rely on third-party libraries as part of our web applications. PHP developers manage their dependencies with Composer, but how can you manage your client-side dependencies? Most projects start with one core JavaScript library (e.g. jQuery) and one or two plugins, but over time the application grows, and the list of JavaScript libraries grows as well. In this situation, Bower can help you, and in this article you will see how to integrate it into your own project.

You'll need Node installed to use Bower, but the installation process is simple - just one call to load it via npm. They help you get the configuration set up and how to specify its dependencies. Anyone familiar with how Composer works should feel right at home using a similar JSON structure. With that in place, you can move on to the next step, integrating it with Composer. In the Composer configuration, there's a setting for "scripts" that can be run before the install command is executed and some after the install is complete. This is where they call "bower install" to have it install the needed Javascript-based dependencies.

0 comments voice your opinion now!
project dependencies bower composer integrate introduction

Link: http://techportal.inviqa.com/2014/01/29/manage-project-dependencies-with-bower-and-composer/

Anthony Ferrara:
Beyond Clean Code
November 26, 2013 @ 13:12:41

Anthony Ferrara has posted the latest in his "Beyond" series today with this new post - "Beyond Clean Code". In it he looks at the idea of "clean code" and proposed a different way to think about its creation.

This is the fourth post in my "Beyond" series. The previous three posts focused on re-imagining OOP and questioning some of the core beliefs that we have come to take for granted. This one is going to be slightly different, in that I want to talk about another angle of writing code: the process itself. We always talk about how code should be clean, but how do you write clean code?

He starts with an overview of what it means for code to be "clean" with some of the common criteria including clear code flow, short routines and using libraries for complex tasks. He proposes that a change in perspective is needed away from "pretty code" and more towards code that contributes to the business value of the product. Following through on this pattern of thought, he proposes a more effective method than focusing on just clean code - DIRTI (Develop, Isolate, Refactor, Test and Integrate).

The real beauty of this approach is that it assumes that you don't know your abstractions before you start. This will help you understand the problem (and the solution) as you write it. [...] Initially, when you don't fully understand the solution, you will develop, isolate and refactor over and over until you fully understand the solution that you're building. Once that understanding solidifies, you're going to tend to spend more time in the later parts (Refactor Test and Integrate).
0 comments voice your opinion now!
clean code dirti structure dependencies perspective

Link: http://blog.ircmaxell.com/2013/11/beyond-clean-code.html

Igor Wiedler:
How heavy is Silex?
September 03, 2013 @ 13:17:35

Igor Wiedler has shared some of his thoughts on his site today about the "heaviness" of things that call themselves "microframeworks" and why it may not be about the amount of code involved at all.

Quite often silex has been described as heavy or bloated. It's time to put this myth to rest. [...] Micro-framework What an excellent buzzword! Let's face it, this is an overloaded and mostly nebulous term. I don't think it's possible to clearly define what it means. [...] But the real answer lies in what silex doesn't do.

He suggests that the "micro" in "microframework" is more about it providing a limited amount of features (bare-bones) versus a more full-featured, possibly full stack framework. He talks about the dependencies that Silex currently has and provides some statistics about it and these packages it depends on. He also briefly mentions the minimal interface the framework provides, citing the few components you'll probably touch in your work with it.

0 comments voice your opinion now!
silex heavy myth microframework bloated linesofcode dependencies minimal

Link: https://igor.io/2013/09/02/how-heavy-is-silex.html

Andrew Podner:
Make it Testable-No Matter how Painful it is
April 04, 2013 @ 09:39:27

In a new post Andrew Podner recommends that, as you're doing your day to day development, you try your hardest to create testable code, no matter how painful it is.

I look at the situation we have gotten into by having this problem [of replacing a large legacy application], and frankly, it is like the tech version of 'Scared Straight'. The paranoia of such a far reaching application within the enterprise that absolutely has to deploy successfully and also be very flexible to meet the needs of the future have driven me to the point of near madness in trying to make sure this thing is bulletproof, enter Test Driven Development.

He includes an example situation he recently was faced with in his code...and opted for the "easy" way out (difficult to test). He talks some about the issues, dependencies and coupled code this has created. He does, however, show a solution to the issue - passing in the dependencies as they're needed, not defining them in the method.

For me, writing custom apps in an enterprise environment is not about rapid deployment and looking like a hero. It is about deploying software with a design life of 7-10 years, because the change management involved in deployment is not something you want be be doing over and over again. Testable code with 100% coverage of unit tests, well developed integration testing, and prolific use of tools like PHPUnit & Selenium are part of the development culture because while speed is important, durability is even more critical to business.
0 comments voice your opinion now!
testable code unittest tdd testdriven refactor dependencies

Link: http://unassumingphp.com/make-it-testable-no-matter-how-painful-it-is/

Vance Lucas:
Valitron The Simple Validation Library That Doesn't Suck
March 05, 2013 @ 11:43:24

Vance Lucas has created a "validation library that dosen't suck" and posted about it to his site - his Valitron library.

Valitron is a simple, minimal and elegant stand-alone PHP validation library with NO dependencies. Valitron uses simple, straightforward validation methods with a focus on readable and concise syntax.

He created the library because of frustration with other tools that had (sometimes major) dependencies on other packages. All he wanted was something lightweight and easy to use that was flexible about how it handled its validation rules. Valitron lets you apply a validation (like "required") against multiple fields in the provided data and includes checks for things like length, valid IP, active URL, alpha-numeric, date format and regular expression match. You can also add custom validation rules via a callback/closure.

0 comments voice your opinion now!
validation library valitron simple dependencies


Paul Jones:
Aura More Decoupled Than Symfony 2 and Zend Framework 2
December 12, 2012 @ 12:58:58

In response to the number of questions (and popularity) of his previous information about the Aura framework and how it compares to Zend Framework 2 (and Symfony2), Paul Jones has posted more about its decoupled nature and how the frameworks compare.

Being able to use Symfony2 components or ZF2 modules is not quite the distinction I am making. The distinction is that all Aura packages (with the exception of the Framework package) are completely independent, and have no cross-package dependencies, whereas at least some of the components from Symfony2 and ZF2 have dependency requirements.

He illustrates the point with a common task across all of the frameworks - input validation and filtering. He starts with a look at how to handle it in Zend Framework 2 (with Zend/InputFilter) with the list of packages also pulled in by the Composer install. He does the same with the Symfony2 "Validator" package and mentions the other packages needed to execute its tests. Finally, he looks at Aura's "Aura.Filter" component and it's lack of dependencies (and that its tests can be executed immediately).

0 comments voice your opinion now!
framework aura decoupled zendframework2 symfony2 dependencies unittest


Fortrabbit.com:
Handle your dependencies with PHP composer
September 04, 2012 @ 12:02:31

If you've been developing any PHP at all recently, you've probably heard about the Composer package management tool that's caught on like wildfire in the community. If you're not currently using it, you might wonder what it's all about. Well, in this recent post on the Fortrabbit blog, Ulrich Kautz explains the tool and how to get started using it.

Composer describes itself as "a tool for dependency management in PHP". It uses a large repository of packages which is continuously extended and maintained by the community. It is now out there for about a year or so. This article goes out to everybody who is not already using it: we want you to give it a try it and here is why.

He talks about what Composer is (really a "dependency manager" more than a "package manager") and why its a good thing for projects to use. He gives the quick install instructions and an example of setting up a "composer.json" file to pull in the Twig templating and Doctrine ORM libraries. There's also a quick mention of including the Composer autoloader so it can find the resources correctly.

0 comments voice your opinion now!
composer handle dependencies tutorial introduction


PHPMaster.com:
Managing Class Dependencies Dependency Injection, Service Locators & Factories, Pt 2
June 28, 2012 @ 10:58:15

PHPMaster.com has posted the second part of Alejandro Gervasio's series looking at dependency injection, service locators and factories. In this new part of the series, he picks back up with his look at these patterns and how they can reduce your dependencies on things like "new" even more.

While it's fair to admit that factories do have a neat niche in a number of special use cases, I'm not so merciless as to condemn Service Locators and plain Dependency Injection to an unfair exile. In this final part we'll take a closer look at the implementation of these popular patterns so that you can pick up the one that best suits the need at hand.

He talks some about "class collaborators" as used in service locators and using it in his FileStorage example to find and use pre-created objects. He compares this method with a more simple dependency injection approach, noting that not only is it simpler to maintain but also can cause less overhead required for the DIC.

0 comments voice your opinion now!
class dependencies series dependencyinjection servicelocator



Community Events





Don't see your event here?
Let us know!


laravel interview package update library opinion zendserver symfony deployment tips podcast unittest release install api framework language introduction community series

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework