An Object-Oriented Way of Working with Models and Web Applications

When we talk about the concept of Models in object-oriented programming, we’re usually referring to a class that is a representation of the data stored in the database.

That is is, when information is stored in rows and columns, we populate a class, its attributes, and so on with that information so that we’re able to pass it around the application, manipulate it as needed, and then possibly serialize the data back to the database.

But in a web application, it’s fair to assume that the model might need to be possible to the front-end to be used. That is, imagine a front-end request making a call to the server, requesting a model (or a collection of models), and then rendering them on the front-end.

Though this particular post isn’t code-oriented, I still think it’s worth thinking through the process of translating a model from the server and then rendering it on the front-end of the web application.

Read More

Does WordPress Hold You Back as a Developer, Really?

One of the commentaries that we often read or hear about WordPress is its “low barrier to entry” and why this is good for the web.

The counterpoint to this is that it prevents developers (or “would-be developers,” as some may say) from embracing more modern technologies because WordPress doesn’t require them.

Does WordPress Hold You Back?

To be honest, I’ve even seen some go as far as to say that if someone says they are a PHP developer who has primarily worked in WordPress for their career, then you should subtract, say, three years from their “real” PHP experience.

Yikes.

I see reasons for this – I’m guilty of some of the “older” practices – but does that mean that WordPress prevents us from becoming high-quality, object-oriented programmers?

Read More

Where Are the Amazing WordPress Jobs?

A couple of days ago, John O’Nolan who’s the guy leading the team behind Ghost shared the following tweet:

https://twitter.com/JohnONolan/status/996132104445378560

Amazing WordPress Jobs: Ghost

I quoted the tweet to give context to the following question:

This is a legitimately honest and unloaded question: How many companies built on WordPress have job postings like this?

I can think of maybe 5 off the top of my head, but I’m curious about what’s out there now.

At the time of this writing, I’ve received next-to-nil on responses, so I thought it might be worth sharing a few thoughts about it here.

Read More

Using sprintf and LIKE in SQL Queries in WordPress

When working with queries in WordPress, it’s always best to prepare the query before running it; however, if you happen to be interfacing with a third-party API or working with another variant of SQL (like Transact-SQL), then things may work a little differently.

sprintf and LIKE in SQL

If only databases were really this neat.

The TL;DR of all of this is that handling sprintf and LIKE in T-SQL needs some strategic handling. And the code sample in the next section should provide all you need.

Read More

Let the Code Review Process Stand on Its Own

The more projects I work on with people who I hold in high-esteem, especially as it relates to programming, the more I find myself wanting to pre-justify the reasons I’ve made a decision about how I’ve solved a problem.

This isn’t to say that I try to be defensive about what I’ve done from the start. Instead, it’s more of an attempt to try to justify or rationalize the reason I did something so the person reviewing my code understands it and doesn’t think ill of it. The thing is, I’ve never really had an experience – at least not in the last, say, half a decade or more – completely obliterate my confidence.

Code Review Process: Part 1

Code Review, Part 1 via xkcd

Instead, they’ve done one of three things:

  • The person reviewing the code has made a recommendation as to how the code can be improved,
  • The person reviewing the code has asked why I did what I did (either to better their understanding or to see if there’s not a better way the problem could be solved),
  • The person has provided insight on how to rearchitect the solution simply.

And regardless of which of the above is used, I’m generally grateful.

Thus, one of the things I’ve been trying to get better at doing is merely deciding on how to implement a solution, commit the code, and let the code review process do its thing.

Read More