Chapter 10. Selecting Libraries, Design Patterns, and Frameworks

In This Chapter

  • Leveraging existing tools and patterns

  • Picking out a library and framework for Twooshes

  • Understanding the MVC design pattern

When you sit down to start coding your Web application, you shouldn't start from scratch. Much like how you don't have to start coding from 0's and 1's, you don't have to start from a blank PHP file. You can build on top of the previous generation's breakthroughs by using free, high-quality libraries, frameworks, and design patterns. Leveraging these tools saves you time, increases your code quality, and lets you get straight to the core of your project.

Twitter API Libraries Can Speed Up Development

Earlier in this book, I showed you how to interact with the Twitter API. You may have noticed it is pretty straightforward but the code is a little redundant. Every time you connect to Twitter using cURL, and parse data using DOMDocument, the code looks the same as the last time you called the API. This is a great opportunity to create libraries, functions, or classes to reduce the amount of redundant code, and make interacting with the Twitter API easy.

By centralizing your code and removing redundancies, you make it easier to read, maintain, and consequently decrease the potential for bugs. However, you don't need to build your own library from scratch. Other developers have already created open-source libraries, in numerous programming languages, that you can use for free. Thanks to their ...

Get Twitter® Application Development for Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.