Posts Tagged ‘OOP’
OOP-NOOB Series – The Publicity Stunt
OOP makes use of access modifiers to control the accessibility of methods and properties. This is what allows you to use the concept of encapsulation, so that you have a public interface that consumers of your code can develop against, as well as a private implementation that needs to be treated as a black box from the outside.
Having all of your methods and properties be public generally defeats the purpose of using OOP in the first place, as most of the benefits depend on the concept of encapsulation in some form or other.
Read MoreUsing A Config To Write Reusable Code – Part 3
In a previous instalment, we identified the Config file as being a promising tool to map data reusable code to project-specific code. In this third article, we’ll examine what our Settings page example looks like if we do indeed make use of such a Config file.
Read MoreUsing A Config To Write Reusable Code – Part 2
While the first part of this series identified the need to separate business-specific logic from reusable code, we haven’t yet discussed how to best achieve this. Let’s try to think it through…
Read MoreUsing A Config To Write Reusable Code
OOP lures you with the promise of making code reusable, but OOP syntax alone does not make your code reusable. Let’s find out why that is, and how to really write reusable code.
Read MoreIncluding A Constructor In Your Interface
Having a constructor in an interface is a bad idea, even though PHP might allow it. In this article, I want to explore the reasoning behind that statement.
Read MoreOOP-NOOB Series – That Which Cannot Be Named
Wrapping procedural code is known as “Poor Man’s Namespacing”. While it does help avoid namespace collisions in legacy code, it is still procedural code. OOP is not about syntax.
Read MoreOOP-NOOB Series – Introduction
“Object-Oriented Programming – No Object-Oriented Benefit” – a series of articles on how NOT to write OOP PHP code.
Read MoreAttracting Developers To WordPress
Ryan McCue, Senior Engineer at Human Made and WordPress Core Developer, has posted a series of tweets regarding the fact that WordPress is far from an ideal platform for developers, which has spawned a lot of discussion. https://twitter.com/rmccue/status/710464212183572481 https://twitter.com/rmccue/status/710469646680399874 As a long-form response to this, here’s a list of changes I would like to see in WordPress,…
Read MoreType Declarations using Interfaces in PHP
I’ve recently completed a preliminary code audit on an existing WordPress plugin, and one of the goals I’ve set for that audit was to decouple the code from the JavaScript library it was using, so that it could easily be extended to support future versions of that library. A question came back about the constructor syntax…
Read More