Programming

Selecting Your Next App Dependency

We often turn to open source or proprietary packages for adding functionality to our apps. Here are some key points and questions to ask when selecting your next dependency. This list can help compare multiple packages to determine which fits our needs better. The goal is to find well thought out packages because our apps depend on them.

Documentation

Documentation is often the first place we look when there are questions. If the package is well documented then developing a solution will be easier.

  • Does documentation exist?
  • Is the documentation up-to-date?

Community

An active community signals to us this package is adopted and being used by other people. Finding whether the community is active should be easy. My go to places are:

  • Stackoverflow (Are people asking questions about this package? Are the questions answered?)
  • GitHub (When was the last time the package was updated? How many issues exist? Do the maintainer(s) respond to issues? How many pull requests? Do the maintainer(s) respond to pull requests? Does the package follow semantic versioning? How many stars?)
  • Package specific forum (Does it exist? Is the forum active?)
  • Google

If the community is actively helping other people it’s a good sign. The chances of getting help with an active community are higher than if there was little to no community.

Extendability

Often times the package won’t meet our requirements 100% so we must add additional functionality.

  • How easy is it to build a module?
  • Are there hooks or events to add additional functionality without modifying core code?

Code Coverage

Well tested code can lead to less defects. Depending on a package that isn’t tested is risky.

  • Does the code base have tests?
  • How much of the code base is covered by the tests?
  • Are the critical parts of the package tested?

Framework Convenience Trap

The idea is “x” framework provides a level of convenience that can make developers sloppy.

This often happens because frameworks tend to make developing easier. So easy we forget to take a step back and figure out how all the pieces come together.

If the framework is modeled on the model view controller (MVC) pattern. The convenience trap for developers is adding unnecessary amounts of logic into controllers or models. It’s easy to do and get the work “done” and out of the way if no testing is involved. Generally the problem with putting unnecessary amounts of logic in controllers or models is hard to test which subsequently causes the application to be brittle.

For example:
Oh looky here something database related this needs to go in a model or hey this interacts with the user’s input this probably goes in the controller.

The framework should not be the application, but a portion that compliments the development.

Note: The above generally applies to larger apps and not small apps that may have a short lifecycle.

How to mitigate the framework convenience trap?

  1. Write tests for the application. If tests are written chances are the structure of the app is designed better.
  2. Learn software best practices.
  3. Don’t code in a silo. Talk to other developers.
  4. Realize no one has perfect code and let someone critique your code. DON’T TAKE IT PERSONAL.

Understanding AJAX In WordPress Plugins

For me it’s difficult to retain and grasp the programming concept, especially if it’s new, if I don’t understand the why behind the concept. I didn’t  understand how to properly use AJAX in WordPress. I started searching google and found many article explaining how to use it. The problem was it didn’t go into enough detail for me to understand why. The articles said do it this way, but didn’t explain.

The following article from Smashing Magazine goes into great detail on how to use AJAX in WordPress.
http://wp.smashingmagazine.com/2011/10/18/how-to-use-ajax-in-wordpress/

Send me an email [email protected] if you have questions.