Lesson Monday

Throughout Intro to Programming we built projects written exclusively in JavaScript, HTML, and CSS. These are all languages widely readable by web browsers. As a result, we could build our entire project in one folder containing all our assets. By using <link> and <script> tags in the head of our index.html we could manipulate the DOM directly with CSS and JavaScript.

But what if we want to build a larger website, with many pages, that takes in lots of user information, and displays information from sources other than our project's file structure?

In order to accomplish this we will need:

  • A better way to separate our business and user logic into multiple, easily managed files.
  • A system by which variables and information is accessible to us from multiple parts of our program.
  • A way to document and manage all the different libraries and code bases we use to complete these tasks.
  • A language like PHP that can do the job of connecting us to persistent data sources like databases or other servers.

This may sound like a lot, but the good news is we don't have to build this system from scratch! In web development, a system that helps us accomplish a specific set of goals is called a Framework.

Even more specifically, the kind of functionality we need (i.e. take in user inputs, manipulate information with code, save information for a user, and display that information back to the user) requires a specific kind of framework called an MVC or Model View Controller. We'll need a bit more information before understanding exactly how an MVC works, but this week's curriculum is intended to introduce you to the building blocks of a Model View Controller.

At the end of the week, you should be able to:

  • Use Composer to manage project dependencies
  • Build a web app with dynamic routing using a new tool called, 'Silex.'
  • Save and retrieve user information using superGlobals, a new set of variables available to us through PHP.
  • Display information to the user with a templating tool called, 'Twig.'

Independent Project Objectives

Your code at the end of the week will be reviewed for the following:

  • Does your project's GIT history present a clear and incremental development process?
  • Are you using a PHP class to manage private and public key->value pairs with a constructor, getters, and setters?
  • Does your project have the correct file structure?
  • Are you using Silex to complete successful _GET and _POST routes?
  • Are you correctly displaying information using Twig.
  • Are you retrieving, saving, and deleting information using superGlobal variables?