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

QaFoo Blog:
When to Abstract?
May 18, 2016 @ 15:12:18

On the QaFoo blog they've posted an article that shares some of their thoughts on "when to abstract" in your code - essentially finding that point where abstracting out functionality makes sense.

One of the most difficult challenges in a developers life is finding the "right" abstraction, or at least the best one given the current circumstances. The core problem is that abstraction is a bet on the future development of the software and we know that future is volatile. The circumstances will change, so will the view on the best abstraction change.

But there is another dimension which influences this decision: What kind of software are you developing?

They start off by defining three different types of projects (internal, library and adaptable) and move into how this type changes when/how you abstract things in your code. They give a brief summary for each type and when it usually makes sense, including steps to take (concrete first, then abstract).

tagged: abstract code library internal adaptable type opinion concrete

Link: https://qafoo.com/blog/084_when_to_abstract.html

DevShed:
Abstract Classes in PHP - Setting Up a Concrete Example
Feb 01, 2006 @ 13:54:08

DevShed has posted part two of their "Abstract Classes in PHP" series today, this time focusing on the creation of an example class structure.

Welcome to part two of the series "Abstract classes in PHP." In three tutorials, this series introduces the key concepts of abstract classes in PHP 4-PHP 5, and explores their application and use in different object-oriented development environments. Whether you're an experienced PHP developer wanting to fill in some gaps related to abstract classes, or only a beginner starting to taste the power of object-based programming in PHP, hopefully you'll find this series enjoyable and instructive.

They take a moment and look at how their example will be structured before jumping into the code. After that, they creat subclasses of the parent, defining the resultProcessor and fileProcessor classes. At the end, they combine them, creating a class that can parse data pushed into it (such as parsing out an XML file).

tagged: abstract class set up concrete example subclass process data abstract class set up concrete example subclass process data

Link:

DevShed:
Abstract Classes in PHP - Setting Up a Concrete Example
Feb 01, 2006 @ 13:54:08

DevShed has posted part two of their "Abstract Classes in PHP" series today, this time focusing on the creation of an example class structure.

Welcome to part two of the series "Abstract classes in PHP." In three tutorials, this series introduces the key concepts of abstract classes in PHP 4-PHP 5, and explores their application and use in different object-oriented development environments. Whether you're an experienced PHP developer wanting to fill in some gaps related to abstract classes, or only a beginner starting to taste the power of object-based programming in PHP, hopefully you'll find this series enjoyable and instructive.

They take a moment and look at how their example will be structured before jumping into the code. After that, they creat subclasses of the parent, defining the resultProcessor and fileProcessor classes. At the end, they combine them, creating a class that can parse data pushed into it (such as parsing out an XML file).

tagged: abstract class set up concrete example subclass process data abstract class set up concrete example subclass process data

Link:


Trending Topics: