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

Mikkel Høgh:
Drupal is still a gated community
May 25, 2015 @ 10:16:42

In a recent post to his site Mikkel Høgh makes the suggestion that Drupal is still a gated community, mostly as it relates to the process around the "Project Applications" process.

One of the things the Drupal community prides itself on, is how open the community is. And that is generally true, but there's one exception. And that is the Kafkaesque horror-show we subject any newcomers that would like to publish their code on Drupal.org to. It goes by the name of "Project Applications". I know several people who've hit this wall when trying to contribute code. It's not uncommon to wait several months to get someone to review your code. And when it does happen, people are often rejected for tiny code style issues, like not ending their comments with a period or similar.

He talks about other factors involving reviews and delays that can also cause authors to abandon their work and feel "unwelcome and unappreciated". He mentions the "review bonus" system and how it's used to encourage participation (or "more hoops" as he puts it) from other authors. He notes that this situation mostly relates to those new to the tool and community and suggests that it just doesn't work (and really is unnecessary). He ends the post with a call to "end the madness" and move to a standardized role that would allow developers to publish without pushing people away and making them feel unwelcome.

0 comments voice your opinion now!
opinion drupal walledgarden project applications review delay contribution

Link: http://mikkel.hoegh.org/2015/05/14/drupal-is-still-a-gated-community/

Nate Krantz:
How I'm Writing Unit / Functional Tests
May 22, 2015 @ 10:50:42

In a recent post Nate Krantz has shared some of his own methods around writing functional and unit tests.

So...testing. That thing that everyone says is so important but you don't really learn about it in school. I've had some trials and tribulations with testing so I'm going to just dump out some thoughts here.

He starts with a bit of background on his own experiences in development and how he finally decided that testing would "solve everything". He started with unit tests (for a CodeIgniter application) and how he got them up and running. He talks about issues he found around dependencies (and static methods) and how he made use of mocks to reduce some of the issues with dynamic loading, at least how CodeIgniter does it. Unfortunately, this didn't work out as planned so he fell back to a test database and create more effective and simpler functional tests. Code examples are sprinkled through out the post to show how he was trying to solve the problem at different points in the process.

0 comments voice your opinion now!
unittest functionaltest opinion experience codeigniter

Link: http://www.natekrantz.com/why-test-driven-development-rocks-sucks/

BeMyCTO.com:
Why Doctrine ORM is not suited for PHP
May 20, 2015 @ 12:09:42

The ByMyCTO.com blog has a recent post that makes the suggestion that the Doctrine ORM isn't suited for PHP...or to put it another way why they think it's not a good option for database integration.

I know, this title sounds like a troll. But it's not, it's a fact. I'm not saying Doctrine is a bad technology or shouldn't be used. I'm just saying it's not suited for PHP and this can lead to critical problems if misused.

He covers a few different topics including:

  • Differences between Java and PHP (and the fact that Doctrine's inspiration was Hibernate)
  • The "session problem" (entity serialization)
  • Identity Map, useless in a stateless environment
  • UnitOfWork, far too complex
  • EntityManager, too magical

Despite all of these points, he does remind the reader that Doctrine isn't useless or inherently bad, it's just that he sees it as reinforcing bad behaviors and suggests using something else.

0 comments voice your opinion now!
doctrine orm avoid critical problem opinion

Link: http://blog.bemycto.com/software-architecture/2015-05-17/doctrine-orm-not-suited-php/

Ross Tuck:
How I Use Traits
May 18, 2015 @ 12:56:47

Ross Tuck has posted a new article to his site today talking about how he uses traits in his applications and where he sees them having the most value.

Recently, a few folks asked about a trait in a new project I wrote. Right around the same time, Rafael Dohms showed me his new talk about complex cognitive processes we don't notice. Because my brain is a big mushy sack, the two blended together. The result was this post, which tries to capture how I use traits but also how I decide to use them in the first place.

He starts off with a bit of talk about leverage versus abstraction and how the concepts relate to code. He includes a brief example of each and points out that, while each is good, abstraction tends to be more useful. He then applies this back to the world of traits, how they compare to the use of normal static methods and how they have an advantage of encapsulation without oversharing. He suggests that assertions are more fit as static methods and that traits are a better fit in cases where multiple inheritance is needed. He also touches in interfaces in traits and his opinion on when is the best time to use them.

0 comments voice your opinion now!
using traits opinion leverage abstraction static interface inheritance

Link: http://rosstuck.com/how-i-use-traits/

Peter Petermann:
A few thoughts about composer and how people use it
May 18, 2015 @ 10:17:43

In the latest post to Peter Petermann's site he shares a few thoughts about Composer and how people use it in the more modern PHP ecosystem.

Composer has changed the PHP ecosystem like now other tool introduced - almost everyone is using it today. Now, I have written about Composer before, and have always been a big proponent of using it. However, as i have spend some time with looking more closely on a few things, there is a few problems (some with Composer, some with how people (ab)use Composer) that I would like to write about.

He's broken the list up into six different point, each with a bit of explanation:

  • Composer gets slow and resource hungry
  • People are using composer as an installer
  • People use their own paths
  • People don't adhere semver
  • People don't tag their releases / don't release
  • People release packages with dependencies to unstable versions

He ends the post by looking at each of these points and offering a brief one-liner way to help solve the issue (or at least minimize the problem).

0 comments voice your opinion now!
composer opinion problem usage ecosystem package

Link: https://devedge.wordpress.com/2015/05/16/a-few-thoughts-about-composer-and-how-people-use-it/

Sahand Saba:
9 Anti-Patterns Every Programmer Should Be Aware Of
May 13, 2015 @ 11:29:50

In a recent post to his site Sahand Saba has posted a list of nine anti-patterns every programmer should avoid. This list isn't language specific and ranges in types of advice from general programming practices down to more specific "code smells" to avoid. The code examples are in Python but you can interpolate them into the world of PHP pretty easily.

A healthy dose of self-criticism is fundamental to professional and personal growth. When it comes to programming, this sense of self-criticism requires the ability to detect unproductive or counter-productive patterns in designs, code, processes, and behaviour. This is why a knowledge of anti-patterns is very useful for any programmer. This article is a discussion of anti-patterns that I have found to be recurring, ordered roughly based on how often I have come across them, and how long it took to undo the damage they caused.

The list of nine includes things like:

  • Premature Optimization
  • God Class
  • Inner-platform Effect
  • Management by Numbers

Each item on the list includes a few subheadings talking about what it is, why it's bad, how to avoid it and some code examples (where appropriate) to find it in your code.

0 comments voice your opinion now!
antipatterns nine list programmer avoid opinion

Link: http://sahandsaba.com/nine-anti-patterns-every-programmer-should-be-aware-of-with-examples.html

Reddit.com:
What great advantages does Python have over PHP?
May 08, 2015 @ 09:49:06

There's an interesting post in the /r/php subreddit asking the PHP developers out there a serious (non-trolling) question: What great advantages does Python have over PHP?.

All over I see people saying that Python is better than PHP, but as a programmer that has tried Python I don't see its great advantages. Can you guys please help me here.

There's already over 50 comments on the post with a wide range of answers including:

  • that Python is "more mainstream" in the world of *nix tools
  • the culture of Python's community for installing extensions
  • features Python includes like a "consistent API, sane error handling, keyword args..."

There's also an interesting "sub-discussion" happening around the sanity of Python's OOP system. Check out the full post for more or to voice your own opinion.

0 comments voice your opinion now!
python language advantage opinion feature

Link: http://www.reddit.com/r/PHP/comments/357zlx/what_great_advantages_does_python_have_over_php/

Reddit.com:
I feel like events are an anti-pattern
May 06, 2015 @ 10:55:00

On the /r/php subreddit frm Reddit.com, phpdevster proposes an interesting opinion - that an event system, set up with a listener and defined events, has become more of an anti-pattern in its most common implementation.

If events are only meant to be additional functionality that ALWAYS ALWAY ALWAYS should happen after a primary action is taken, how often is code really that absolute? Why are events not implemented in more flexible ways by frameworks? - that is implementing some inversion of control which would allow callers to determine which listeners would be relevant to the given context.

He illustrates his point with an example user registration system that fires a "user-was-registered" event that, in turn, fires off a series of events via a listener. He points out a pretty large flaw, though. While the functionality involved in the event is decoupled (the event itself), the behaviors defined by that event are not. Comments on the post offer some different options and solutions to the same problem including:

  • Further decoupling of the eventing process
  • Using objects with settable properties rather than just event name strings
  • The idea of using an "event store" to handle decoupling rather than more immediate code-based solutions

Have some thoughts of your own on events and decoupling? Go over and share them too.

0 comments voice your opinion now!
event antipattern designpattern reddit opinion comments

Link: http://www.reddit.com/r/PHP/comments/34zp6j/i_feel_like_events_are_an_antipattern/

Marc Morera:
Behat and Data-test
April 27, 2015 @ 09:55:08

In a new post Marc Morera makes a suggestion for a testing practice to add to the use of the popular BDD PHP testing framework Behat - a "data-test" option to help with decoupling the tests from implementation.

Tests should be as robust as possible. I think you will agree with me with that phrase. If your tests are too coupled with your implementation, a simple modification of your code will need the modification of your tests, and that's so annoying, right? [...] My question is… should the frontend of your website be aware of the how your Behat tests are built? In my opinion, nope. Your tests should live in a simple layout on top of your application, emulating some cases and ensuring that your users will be able to do what they should be able to.

He points out the main problem with the current testing methods, mainly that the real issue is in the hard-wiring of the test functionality to the name/id/type of the interface elements. He also brings up the aspect of translations and ensuring that your tests take into account that the text may not always be in English. He also mentions Symfony forms and how they define their own structure and naming, not necessarily what you manually generate. He instead proposes a "data-test" property that could be added to elements both indicating that they're used by the testing process and can help in locating the elements during the testing process.

0 comments voice your opinion now!
behat bdd datatest property markup testing method opinion

Link: http://mmoreram.com/blog/2015/04/25/behat-and-data-test/

David Lundgren:
When does Dependency Injection become an anti-pattern?
April 23, 2015 @ 12:11:53

In a new post to his site David Lundgren wonders when dependency injection becomes an anti-pattern when used in PHP applications. The idea of dependency injection is to provide objects with instances of other objects representing things they'll need to get the job done (goes along with separation of concerns). Unfortunately, if used incorrectly, DICs - dependency injection containers - can become less useful and more of a hinderance than a positive part of the application.

During my tenure as a seasoned, and tenderized, PHP developer I have used many design patterns: adapters, factories, data mappers, facades, etc. The most recent one that I have been working with is Dependency Injection. Inversion of Control is not a new idea, at least not in the programming world, but in the PHP world it seems to have taken us by storm in recent years. Every framework will often have a Dependency Injector built in, or offer it as a component for use. It is the hip thing to do in PHP, but I believe we need to take a step back and evaluate it for what we are really trying to achieve. That is reducing the tight coupling that our objects may have. I view it as removing the new-able's from our objects code, and handing the object creation over to something else to deal with.

He talks about how dependency injection containers and service locators relate to each other. He also suggests that, at the heart of every dependency injection container, there's a service locator. He gives an example of a project where a large number of dependencies are being injected and how, despite the assumption of flexibility, his dependencies don't change that often, making the DIC and its functionality a bit less important.

0 comments voice your opinion now!
dependencyinjection dic servicelocator antipattern designpattern opinion

Link: http://davidscode.com/blog/2015/04/17/when-does-dependency-injection-become-an-anti-pattern/


Community Events

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


laravel part2 performance community podcast framework series api symfony2 release introduction composer example configure application php7 library opinion interview conference

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