 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
DZone.com: Trying out PHP Refactoring Browser
by Chris Cornutt April 22, 2013 @ 10:03:35
On DZone.com Giorgio Sironi has written up a post about some testing he's done with the ""PHP Refactoring Browser" (more on that here) on some basic code examples.
IDE proponents love, in fact, an Integrated Development Environment that provides all the functionalities you need while writing and editing code; the followers of the Unix way typically write code in Vim while augmenting it via plugins where feasible and leveraging external tools that do one thing, and do it well. [...] Automated refactorings in PHP were out of the league of Vim and Unix users; thanks to Qafoo, however, a new open source tool is able to edit code with predefined refactoring recipes: PHP Refactoring Browser.
He goes through some of the basic features and functionality of the browser, setting expectations a bit. He shows how to get it installed (via Composer) and the results of some of his testing. Rather than including them all in the post, he opted to make actual commits on github of the changes.
voice your opinion now!
refactoring browser trial commits github example
QaFoo.com: PHP Refactoring Browser Alpha Release
by Chris Cornutt April 08, 2013 @ 09:49:33
On the QaFoo blog today the company is introducing a new tool to help PHP developers write better, more optimized code - the PHP Refactoring
Browser (written in PHP too).
Without continuous refactoring, code maintainability and extensibility will start to decrease fast, even if it has tests. Until now, only IDEs contained functionality to perform automated refactorings. And then even only PHPStorm contains the most important refactorings such as "extract method". Today we release the PHP Refactoring Browser, a refactoring tool written completely in PHP. It is based on several outstanding open-source libraries.
The browser currently supports multiple refactoring methods including the extract method, renaming of local variables and converting a local variable to an instance. They include some example code and the result from the execution of the tool. The output shows where refactoring would work best with some color coding and formatting.
You can find more about this new tool over on its github repository.
voice your opinion now!
refactoring browser tool alpha release components
Brandon Savage: Effective Refactoring Strategies
by Chris Cornutt December 24, 2012 @ 11:24:57
In a recent post to his site, Brandon Savage has a few helpful hints to keep in mind when you're refactoring your applications to make them easier to maintain (and possibly perform better) in the future.
The downtime [of this week] provides a perfect opportunity for the aspiring software developer to do the one thing they are always told there's no time to do: make the code better for better's sake. With few deadlines and plenty of free time, most developers can get a few hours of refactoring in to their code towards the end of the year. They can rearchitect sections that were implemented with haste in September; they can write tests for sections that were untested in April. Put another way, the "lost week" can be redeemed.
He has a few recommendations, each including their own brief summary:
- Test Everything First
- One Method, One Job (Also One Class, One Job)
- Don't Be Afraid Of More Objects And Classes
- Remove Dead, Unused, Unnecessary or Old Code
- Document Your Code
Check out the full post for the summaries and links to other useful resources.
voice your opinion now!
refactoring tips test single responsibility oop documentation
Marco Tabini's Blog: The easiest way to add unit test to your application
by Chris Cornutt September 09, 2011 @ 09:17:32
In a new post to his blog Marco Tabini offers some suggestions on unit testing - not really a tutorial on how to it, more of an "easy way in" to introducing it to your development process.
Stopping development for weeks while you figure out how to add unit tests to cover your entire codebase is simply something that cannot be done (at least, not if you want to keep your job), no matter what future benefits it might bring. The good news is, adding unit testing to your existing project only takes five minutes - which is pretty much how long it takes to get a unit testing framework installed. That's it. Move on.
He puts the emphasis on unit testing to manage change in a code base, not so much to ensure that the current application runs as it should (not initially at least). He's found them most useful in bugfixing, refactoring and when adding new functionality. Current tests (and even tests written in TDD) can help with all of these. He includes reminders that if the tests aren't written well, they're useless and that once you've started testing, it needs to be continuous, even if they're not perfect.
voice your opinion now!
unittest opinion application bugfix improvement refactoring
Devis Lucato's Blog: Anonymous objects in PHP - Composition, Mocks, Refactoring
by Chris Cornutt November 23, 2010 @ 13:17:53
In a new post to his blog Devis Lucato points out something he noticed when working with objects and anonymous functions/closures - they're not all as they seem.
Both solutions allow to instantiate an anonymous object with properties. They are used as value objects and have no other purpose than storing values, so no logic can be included and they don't come with methods. They can be used as function parameters instead of arrays, for instance. PHP 5.3.0 introduced anonymous functions and closures, so it is now possible to attach functions to these VOs (*). [...] The first thing to notice is that these properties are not methods but callable functions:
In his example, an anonymous function dynamically appended to an object doesn't have access to a property set on the object just one line before. There's a way around it with call_user_func, but it's not practical. His proposed solution is to create a type of Anonymous class that uses the __call method to catch the methods and translate them into calls to call_user_func_array automatically.
voice your opinion now!
anonymous objects composition mocking refactoring
Jani Hartikainen's Blog: Refactoring explained to an absolute beginner
by Chris Cornutt June 28, 2010 @ 09:57:52
When developers start graduating from just hacking together scripts and want to start looking toward the future, one thing they start thinking about is making their code the best it could be. One way to achieve this is refactoring, but where to start? Well, this new post has an introductory guide to help developers understand this powerful technique.
Recently while on a drive with a non-programmer friend, I talked with him about code complexity and manageability, how very complicated code is detrimental to productivity and stuff like that. Later on, I decided to explain it to him with actual code examples, although the most he has ever done was some HTML back in elementary school.
He starts with a basic PHP+HTML+MySQL script that mixes the three and shows how to break it apart in steps - moving the PHP away from the HTML, creating functions and making a "template" for the database fetch results to display in.
voice your opinion now!
refactoring beginner tutorial mysql
PHPImpact Blog: Code Refactoring Guidelines
by Chris Cornutt September 16, 2008 @ 12:16:00
Federico has posted a list of suggestions on things to look out for and to consider when you're refactoring your code.
Refactoring neither fixes bugs nor adds new functionality, though it might precede either activity. Rather it improves the understandability of the code and changes its internal structure and design, and removes dead code, to make it easier to comprehend, more maintainable and amenable to change. Refactoring is usually motivated by the difficulty of adding new functionality to a program or fixing a bug in it.
He's broken it out into a few topics with the suggestions underneath - things like looking at the "Big Picture", avoiding "Extreme Abstraction" and ensuring that your "Error Handling" is up to where it should be.
voice your opinion now!
refactoring guideline suggestion list
Soledad Penades' Blog: Signs your PHP needs refactoring
by Chris Cornutt June 05, 2007 @ 16:26:00
As mentioned by Ed Finkler, there's a list of signs your PHP needs refactoring from Soledad Penades.
I have had to go through a php application recently which has given me more than one headache and has required me to use all my possible patience. While working with it, I thought This is good material for an article, so that nobody else does the same in the future, and nobody else will need to experience the same displeasure as I have had to.
So here are the signs your PHP application needs a serious refactoring, right now
Included in the list are things like:
- Uses global variables
- Everything's an array
- The neverending switch
- Interface inconsistency
It hits on one of the thing that bugs me too, the problem of "Brackets galore" - so many subarrays that you have to resort to three or more sets of bracketed keys to get to the value you want. It's bad enough trying to follow someone else's code without having to "trace down" an array to figure out which of the values they're talking about.
voice your opinion now!
refactoring global bracket duplicate switch interface inconsistent refactoring global bracket duplicate switch interface inconsistent
|
Community Events
Don't see your event here? Let us know!
|