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:
Advanced CodeIgniter Techniques and Tricks
June 07, 2012 @ 13:04:01

On the NetTuts.com blog today there's a new handy post for the CodeIgniter users out there - some more advanced tips and tricks that you can use in your CI-based apps.

CodeIgniter is a widely used PHP framework that aims to help developers write better structured code and remove boilerplate tasks from the workflow. In this article, I'm going to explain some incredibly useful techniques to use when developing applications using CodeIgniter.

They cover things like setting up easier configuration parameters, optional config settings, creating HTML emails, application versions and separate response formats.

0 comments voice your opinion now!
codeigniter technique trick advanced tutorial


BinaryTides.com:
40+ Techniques to enhance your php code (3 Part Series)
April 11, 2012 @ 09:52:57

On the BinaryTides blog there's a series of posts that share some tips and suggestions aimed at helping you and your code be the best they can be - things to enhance your application (including suggestions not just about code but also about environment and development practices).

The three posts in the series include tips like:

  • Maintain debugging environment in your application
  • Collect all output at one place , and output at one shot to the browser
  • Set the correct character encoding for a mysql connection
  • Do not gzip output in your application , make apache do that
  • Don't check submit button value to check form submission
  • Process arrays quickly with array_map
  • Avoid direct SQL query , abstract it
  • Never set error_reporting to 0
  • Make a portable function for executing shell commands

Obviously, not all of these will apply in all situations, but they're an interesting list. Most will come with good explanations and code samples when appropriate.

0 comments voice your opinion now!
technique enhance list suggestion bestpractice


Pim Elshoff's Blog:
Dependency management
February 14, 2012 @ 12:04:18

Pim Elshoff has a recent post to his blog about dependency injection in PHP applications and some of the good and bad things about implementing it. He includes examples of a few different types of "injection" ranging from using globals to an actual dependency injection container.

This article describes common pains and symptoms of bad dependency management and common techniques for dealing with project-wide dependencies. [...] For the purpose of this article I am talking about classes using other classes. To manage your softwares dependencies then becomes designing your software architecture such that the depencies are good. The following sections will talk about what's bad, with good being the absense of bad.

In his "problems" section he includes things like "it's easy to do wrong", "it's hard to get rid of", the "low rate of reuse in bad DI" and how bad DI can make for "untestable software". He points to a few packages (including PHP_Depend) that can be used to determine your dependency levels. His methods for "injection" include using the global scope (so bad), using injection in a constructor/setter, making a service locator (registry) and using a full-blown dependency injection container.

All techniques, tricks and gimmicks aside, managing dependencies is more about actual design than abstract design patterns. You yourself are responsible for keeping the number of dependencies as low as possible and designing your system such that access to dependencies is provided in a sane, understandable manner.
0 comments voice your opinion now!
dependency management injection bad technique architecture


Gonzalo Ayuso's Blog:
Populating datagrid techniques with PHP
July 19, 2011 @ 09:25:46

In a new post to his blog Gonzalo Ayuso looks at the code required to populate a jQuery data grid with the records as pulled from a (MySQL) database.

Today I want to speak about populating datagrid techniques with PHP. At least in my daily work datagrids and tabular data are very common, because of that I want to show two different techniques when populating datagrids with data from our database. Maybe it's obvious, but I want to show the differences.

He uses "old school spaghetti code" rather than a framework to keep things simple and pulls the data from the database with a PDO connection. This information is then manually pushed into an HTML table and the data grid functionality is applied to it. The other method involves a little bit of JSON magic that the data grid library pulls in and populates for you, still appending rows to a table.

He notes that the second method seems faster to the user since the page and table are rendered first, but it also comes at the cost of more than one HTTP request.

0 comments voice your opinion now!
datagrid jquery technique preload ajax json


Eran Galperin's Blog:
Database Optimization Techniques You Can Actually Use
March 28, 2011 @ 13:15:57

Eran Galperin has posted a few helpful tips (ones you can "actually use") for optimizing your database and how your application uses it.

I understand the need for simplicity because of the wide audience of Smashing Magazine, but I'd wish they'd give something more than the absolute basics you could find in almost any other site out there [in their recent tutorial]. I also didn't like some of the methods mentioned there for profiling (or the code itself), so I here is my starter guide to optimizing database performance.

Tips included in his post center around a different set of questions:

  • When should you optimize the database?
  • Think about profiling first, optimizing last
  • How EXPLAIN can find the big problems
  • When caching should be used

Some code is included, but only briefly since his point is more about the server than the client (script) side of things.

0 comments voice your opinion now!
database optimize technique explain cache profile


Rafael Dohms' Blog:
Problem Solving technique #1 Taking a mental break
February 07, 2011 @ 12:08:44

Rafael Dohms has posted a new tip for developers (and really anyone else that has to concentrate on mentally challenging tasks all day) that could sometime help you break through that wall you've hit in your code - take a mental break.

Developers are modern day artists whose masterpieces are not hung on walls but stretched out thin on web servers all over the world, yes that is very poetic, but I really try to look at developers as artists and puzzle solvers. [...] A different activity, to most its the simple act of going to get coffee or water, taking a stroll outside in the fresh air, some like sports, some like games.. everyone has their escape valve.

He gives an example of a friend (Chester) who, when he hit a mark he just couldn't pass, turned to a set of lego blocks to help clear his mind. The subconscious mind kicks in as you preoccupy the conscious and a lot of times the answer floats up to he top with little or no effort.

0 comments voice your opinion now!
problem solving technique mental break developer


Simas Toleikis' Blog:
PHP data caching techniques
December 13, 2010 @ 08:45:10

Simas Toleikis has posted some caching techniques he's come up with to handle a few different situations including simple file-level caching and working with memcached.

Caching intermediate data is the most primitive and yet the most rewarding optimization technique where you don't need to fiddle with any complex algorithms or premature optimizations. If you are into PHP you should be aware of all the best practices and the right tools for this job to make your websites fly.

He covers a few different, though common, situations you may come across in your application where caching could be very helpful:

  • Static scope variables
  • APC shared memory functions
  • Memcached for large distributed caches
  • In-memory database tables
  • Simple file-level caches
0 comments voice your opinion now!
caching technique situation apc memcache file memory


PHPClasses.org:
Lately in PHP Ep. 6 - Unusual Site Speedup Techniques, Named params & Annotations
November 01, 2010 @ 08:29:46

On the PHPClasses.org site today they've posted the latest episode in their "Lately in PHP" podcast series - "Unusual Site Speedup Techniques debate, Named parameters and Annotations".

In this episode, Manuel Lemos and Ernani Joppert discuss several unusual site speedup techniques presented in recent articles of the PHPClasses site blog. They also discuss the (non-)inclusion of new PHP features discussed by PHP core developers like having named parameters in function calls and the support of Java-like annotations in PHP code.

To listen you can either use the in-page player, grab it from iTunes or just download the mp3. Complete show notes and transcript are also included in the post.

0 comments voice your opinion now!
podcast latelyinphp speedup technique named parameter annotation


Sebastian Bergmann's Blog:
Testing Code That Uses Singletons
February 12, 2010 @ 11:28:45

Sebastian Bergmann has written up a post for his blog recently that looks at unit testing singletons, something that's been rumored as being some of the hardest to test.

I frequently quote Miško Hevery with "It is hard to test code that uses singletons." And then my audience asks me... Why is it hard to test code that uses singletons? Lets have a look at the default implementation of the Singleton design pattern in PHP.

He defines a singleton first, showing how it's used to create single instances of objects and, because of this, cannot be tested easily because there's no way to know you're getting a clean instance every time. Dependency injection can help with the problem by allowing you to pass in a "mock" instance of the singleton class each time. He also mentions some variations on singletons that could make it easier to test in the future.

0 comments voice your opinion now!
singleton unittest technique dependency injection


Brandon Savage's Blog:
Why Coding Tests Are A Bad Interview Technique
November 02, 2009 @ 19:59:47

Brandon Savage has a suggestion for those interviewing developers for positions at their company - forget the coding test.

One thing I've noticed in hunting for a job recently is the number of companies that insist that you write them a code sample to spec. Not just any code sample, but a fully functional, complete application. This is absurd, for several reasons.

He suggests that, while submitting example code or taking a test as a part of the interview process can be a "first line" to be sure the person knows the language, they shouldn't be considered useful much beyond that. He likens it to people in other trades (like a plumber or electrician) to do their job before they can do their job...for you. Brandon suggests that the real key to a developer - how well they can learn - just can't be measured by a test like this.

0 comments voice your opinion now!
coding test interview technique opinion



Community Events





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


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

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