books

books

The concept of full-stack was pronounced dead at the close of 2019.
2020 Stack is the new name for the new generation. Follow ⚪⚪⚪

windrose

Library layer

Back-end stack

No great software stands alone. Just as Isaac Newton said, "If I have seen further it is only by standing on the shoulders of giants," so too with great software: standing atop the accomplishments of other programmers and their creations is the key to success.

One important way that this is done is by using libraries of other software that serve specific needs.

Layers

Five-layered approach to back-end, server side, development:

Libraries

Some of the more important types of libraries that your web site may need include: database access, photo manipulation, graphical display, networking, and search. In a nutshell, these are merely categories for describing the types of libraries that have been developed; the real list of libraries covers the gamut from Arachnid to Zebra (That is, from Web Spider Frameworks to Network Routing libraries.)

Database access. Storing your web accessible data in a database is de rigeur in today's world. Doing that is what the data layer is all about, but there are aspects to this that fall outside the data layer itself. Libraries that address these needs generally help solve three problems: language access, database independence, and object mapping.

  1. All relational databases these days handle requests using SQL (Structured Query Language). But since your logic layer is written in something like PHP or Ruby or Java, you'll need an API—an Application Programmer Interface—to communicate with the back-end.
  2. When you need to write an application that can work on more than one DBMS, such as MySQL or PostgreSQL or Oracle, you can use a library that smooths out the differences in connection establishment and data type handling. Just remember that doing this means working at the least common denominator level, so this is not a good choice when you need the extra features that the back-ends provide.
  3. If you write your logic layer using a fully object-oriented approach you'll want to use an ORM (Object Relational Mapper), that uses objects with properties and member functions, to initiate CRUD operations—create, retrieve, update, delete—instead of directly issuing SQL commands.

Photo manipulation. With today's widespread use of digital cameras, the world of photography has moved from the mainstay of family snapshots, journalism and fine art, to become a part of many traditional business work processes. This calls for an increased number of web sites that need basic pan and zoom, rotation, cropping, compression, resizing, contrast and brightness adjustments, and touchups like red-eye removal. These needs and many more are amply met with libraries such as "GD" and ImageMagick.

Graphical display. Scientific data is ideally suited to statistical analysis and graphical display using X/Y scatter plots, regression lines, histograms and the like; business data is often viewed with high-low-close charts; simple survey data is effectively displayed with pie charts. All of these are possible with open source software libraries like the pChart library and the Open Flash Chart library.

Basic calendaring is another graphical display feature often included in web sites that show events or that coordinate schedules. These libraries solve common problems related dates and times: like time spans that wrap around the end of days, weeks, or months; calendars that adjust to local customs for start of week, work week, weekend; and calendar layouts that squeeze the most out of limited screen real estate, while still conveying the intended information.

Note that many calendaring libraries are also available for the front-end, using Javascript with AJAX and very stylish CSS. For an interesting solution to the multi-scaled time problem (where some events span a long time period, but many events happen in close proximity), take a look at the MIT incubator project called SIMILE Timeline.

Networking. For network access to resources using URLs, the cURL library is a powerful resource, allowing your back-end to use URL syntax to get and send data—using secure transfer technologies—via FTP, HTTP, SCP, and more.

Search. Menus and navigation are important, but search is where it's at! Lucene has long been the open source search engine of choice, but Sphinx shows great promise for increasing relevancy and dramatically reducing CPU usage—overall providing your users with quicker access to what they're looking for.