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

Brandon Savage:
When To Write Bad Code
January 29, 2013 @ 11:14:51

Brandon Savage has posted some of his thoughts on when it's okay to write bad code in your development lifecycle:

I've been there myself. I recently needed to prototype something. As I sat down to work on it, I had absolutely no idea how I was going to write the component I was working on. And so, I started working - without a plan, without writing tests, without designing an architecture, and without really knowing how the component was going to end up. You know what? The component came out working, but when I was done it was ugly. Totally ugly. The code was bad. But I had a solution, and a solution that worked.

He points out that sometimes, doing things "the right way" can stifle creativity and experimentation - two things that a developer needs to solve the problems they face day to day. He notes that refactoring is a part of their job and moving from a rough prototype to a finished product often improves this skill and can find issues not discovered before.

This does NOT mean that developers can push bad code into a repository. Nothing lives longer than temporary code; see to it that your finished code is always good.
0 comments voice your opinion now!
bad code opinion prototype experiment creative refactor


Jani Hartikainen:
Parsing and evaluating PHP in Haskell Part 1
January 17, 2013 @ 11:13:23

Jani Hartikainen has posted the first part of a series of articles sharing his experiences with an experiment he's conducting - trying to parse and evaluate PHP in Haskell.

The other day I uploaded a new experimental project on GitHub - A Haskell PHP parser / evaluator. It doesn't understand 100% of all PHP syntax, but it was an interesting experiment nevertheless. Here's some insights and other thoughts from working on the code.

He gets the "why?" question out of the way early, noting that it was mainly a desire to play with Haskell and figured parsing something he already knew well was a good first project. He also mentions the "Parsec" library that seems well suited for the parsing part of the process. There were some issues that he came across, however including dealing with PHP's weak typing and handling all of the possible incarnations of PHP script structure. He includes an example AST showing his different data structures (PHPValue, PHPExpr and PHPStmt). The next part of the series will be more about the evaluation of this structure.

0 comments voice your opinion now!
parsing evaluation source haskell project experiment


Eric Holk:
How Do We Read Code?
December 19, 2012 @ 10:36:28

There's an interesting post on Eric Holk's blog talking about how we read code - a look at the results from a psychology experiment that tracked the viewer's eye movement as they scanned through code (complete with video).

The goal is to figure out some way of measuring what features in programming systems help programmers understand wht they are doing, and how this can be used to make systems that lead to higher quality software. Mike is currently running an experiment where he shows people several short Python programs and asks them to tell the output of the program. The test subject is sitting in front of an eye tracker, so afterwards Mike can see where you were looking at various times during the experiment.

The results are pretty interesting and Eric likens it to a sort of "just-in-time compilation" that the mind is doing as it reads through the code, not a straight forward read through. The timing of the read is interesting too, noting that once something is figured out, it's run through faster the following times.

One aspect he's interested in is how the approach of inexperienced programmers differs from that of experienced programmers. For example, there seems to be some evidence that following variable naming conventions helps experienced programmers understand the code much quicker, while breaking these conventions leads to a severe penalty. On the other hand, inexperienced programmers seem to take about as long regardless of how the variables are named.

This study is still going on and, if you're in the Bloomington, Indiana area and would like to lend your eyes to the cause, send an email over to Mike Hansen (more on the subject on his blog here).

0 comments voice your opinion now!
ericholk mikehansen read code psychology experiment video eye tracking


Stan Lemon:
Aura.Micro - Experimental Replacement for Silex
December 14, 2012 @ 09:29:12

With all of the recent talk about the Aura framework that's been happening lately, Stan Lemon thought it would be interesting to see how a microframework based on the Aura packages would be to create. He's posted about his experiences on his site today.

I was recently working on a small project that used Silex. As I browsed my vendor folder, I realized how much extra "stuff" I had inherited with Silex. There were a bunch of other components required when all I wanted was some quick and easy routing, micro-framework style. When I think about going lean I always find myself coming back to Aura. Micro-frameworks are not a new to idea to Aura, so I wondered if I could take the elegance and ease of Silex by wrapping up Aura.Router and exposing it through a similar API.

The result of his work is Aura.Micro, a simple microframework that really just handles routing (unlike Silex with builds on the Pimple DI as well). He includes an example of it in use, defining several different kinds of actions on the routing like "before", "finish" and a few "get" routes.

0 comments voice your opinion now!
auramicro microframework experiment silex router


Gonzalo Ayuso's Blog:
Runtime Classes. A experiment with PHP and Object Oriented Programming
August 08, 2011 @ 09:17:05

Gonzalo Ayuso has put together an experiment related to the current OOP structure of PHP - a test working with runtime classes, a structure generated entirely when the script is executed and not predefined in the file.

Last week I was thinking about creation of a new type of classes. PHP classes but created dynamically at run time. When this idea was running through my head I read the following article and I wanted to write something similar. Warning: Probably that it is something totally useless, but I wanted to create a working prototype (and it was fun to do it).

His class is pretty basic - a "Human" object that echoes a "hello world" sort of message via a "hello()" method. He creates the classes inside of different test methods to ensure that his assertions are true. The tests check basic output of the "hello()" method, calling undefined methods, testing inheritance and a test creating and evaluating a dynamic function.

For something more complex, he creates a dynamic class that solves the FizzBuzz kat, a popular programming puzzle. You can find the full code for this and his other examples on github.

0 comments voice your opinion now!
runtime class experiment objectoriented oop fizzbuzz



Community Events





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


tips bugfix deployment zendserver interview language conference developer symfony podcast api community opinion release series framework introduction laravel list library

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