Geocoding, PHPUnit/TDD & D3.js (PHP & Laravel)

Listed below are the packages/tools which I used for my CS-15 final project, which may help any readers looking to start their own Laravel apps in PHP.

Geocoding: Convert address into lat/long, useful for Google Maps, etc.

Geocoder Package: https://github.com/geocoder-php/Geocoder

Notes:

  • Install using “composer require willdurand/geocoder”
  • Documentation is useful and outlines how to work with the Geocoder class/methods
  • getLatitude & getLongitude methods return values to plug into Google Maps API, etc.

TDD: Catch errors as code base grows and becomes more complex

PHPUnit (Installed with Laravel – example tests included): https://laravel.com/docs/5.2/testing

Notes:

  • Integration tests help test by process, e.g. logging in, viewing pages, etc.
  • Changes within MVC stack may result in errors elsewhere (regression testing)
  • Ideally, tests are written concurrently with development code
  • PHPUnit output can be sparse, so options are useful
  • Verbose output: “vendor/bin/phpunit –verbose –debug –tap”

PHP Integration Testing Tutorial:

https://mattstauffer.co/blog/better-integration-testing-in-laravel-5.1-powerful-integration-tests-in-a-few-lines

Integration Testing Example:

https://github.com/walteryu/dwa15-p4/blob/master/tests/ProjectPageTest.php

Regression Testing: https://en.wikipedia.org/wiki/Regression_testing

Data Visualization & Charts: Display user data using visualization/charts

D3.js: https://d3js.org/

C3.js (Add-on): http://c3js.org/

Notes:

  • D3.js is a great tool but may require lots of time depending on chart/feature
  • C3.js provides similar functionality with a simpler API/interface
  • Basically comes down to putting data into arrays, then passing into D3/C3

D3.js & C3.js: http://stackoverflow.com/questions/31387455/loading-c3-js-into-an-html-file

Database Primer: ERD Diagram, Normalization & MySQL Workbench

For anyone new to databases (critical for web development), the following topics will be useful for getting started:

  1. Relational Databases – Understanding how tables are constructed, relationships connect tables and data types/integrity.
  2. Data Normalization – Understanding how to clean up data before placing them in tables to prevent redundancy and issues down the road.
  3. ERD Diagrams & MySQL Workbench – Practicing how to sketch out tables/relationships, MySQL Workbench is a great tool for doing so.

Benefits on reading up and/or brushing up on these topics are follows:

  1. Plan out the database schema with an ERD diagram before committing it to code, which can be costly later once tables/relationships are created.
  2. Cleaning up data and plotting out the schema will help one think through their domain and process for mapping out the application back-end.
  3. An ERD diagrams with all tables, relationships, fields and data types are a handy reference document even after initial database setup.

That said, I hope that helps and please see links below for more information:

Data Normalization (first 3 forms are most common/useful, 4th & 5th normally not needed): https://en.wikipedia.org/wiki/Database_normalization

ERD Diagrams (recommended to sketch out tables using Data Normalization): https://en.wikipedia.org/wiki/Entity%E2%80%93relationship_model

MySQL Workbench (free ERD digram tool, works on all platforms): https://www.mysql.com/products/workbench/

Atom & Chocolatey Package Manager (For Use with Windows & CMDer)

I recently started programming in Windows at work (otherwise, I am on Mac/Ubuntu) and came across some handy tools in addition to Atom & CMDer which made the work environment more bearable:

Chocolatey Package Manager (call from CMDer to install packages): https://chocolatey.org/

Atom Package Manager (for anyone who did not explore yet): https://atom.io/packages

Chocolatey is a good way to install packages similar to port, brew, curl, etc. from the bash command line and the Atom Package Manager is a good way to install additional features, especially if working with other languages and frameworks.

That said, programming tools in Windows have come a long way since the SciTE Editor and Cygwin Shell