Modern Development Workflow

  • 2,523 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,523
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
72
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. The Modern Development Workflow Automate, Automate, Automate! Net Perspective, LLC. http://www.net-perspective.com/
  • 2. Before We Get Started… • I Am… o Daniel Cousineau • Lead Developer at Net Perspective, LLC • dcousineau@net-perspective.com • We Are… o Full service web agency (development) firm based out of College Station, TX • About This Topic… o The utilities presented are biased towards PHP and OSS • All are interchangeable with other languages and utilities o We are always improving and getting better o Constructive feedback always welcome Net Perspective, LLC. http://www.net-perspective.com/
  • 3. Source Control • More than 0 people on a project? o Extremely beneficial when with 2+ member teams • SVN most popular o Integration with EVERYTHING o Showing its age • No native branching/tagging • GIT: the up-and-coming superstar o Not as well integrated o Still new Net Perspective, LLC. http://www.net-perspective.com/
  • 4. Unit Testing • Old and Busted: GDB, New Hotness: TDD o Test Driven Development o Write tests first, code until all tests pass • PHPUnit very popular o Based on the NUnit standard (JUnit sound familiar?) • Our Goal? 100% Code Coverage o Means every line of source code should have been executed at least once when all tests completed • Alternatives o SimpleTest, PHPT Net Perspective, LLC. http://www.net-perspective.com/
  • 5. PHPUnit Example class StringFunctionTest extends PHPUnit_Framework_TestCase { protected $_fixture; //Run before each test public function setup() { $this->_fixture = fopen(quot;./sample.txtquot;,quot;wquot;); } //Example test public function testStrToLower() { //Object is constructed/destructed after each test //Data saved to a fixture here is not preserved for the next test $actual = strtolower(quot;SaMpLequot;); $expected = quot;samplequot;; $this->assertEquals($expected, $actual, 'comment here'); // } //Run after each test public function tearDown() { fclose($this->_fixture); } } Net Perspective, LLC. http://www.net-perspective.com/
  • 6. Build Management • Generating AutoDoc, running UnitTests, and packaging is BORING o “Laziness is the mark of a great developer” – Me • Automate with Phing o Native PHP build system based on the popular Ant build system for Java o $ phing TARGET_NAME • Looks for build.xml which contains commands for the target o Tasks for running PHPDoc, PHPUnit, and… Net Perspective, LLC. http://www.net-perspective.com/
  • 7. Phing Example <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <project name=quot;Latitudequot; default=quot;distquot; basedir=quot;.quot;> <target name=quot;testquot;> <phpunit2 haltonfailure=“truequot; haltonerror=“truequot; printsummary=quot;truequot;> <batchtest classpath=quot;${project.basedir}/libquot;> <fileset dir=quot;${project.basedir}/testsquot;> <include name=quot;RouteTest.phpquot; /> <include name=quot;DispatcherTest.phpquot; /> </fileset> </batchtest> </phpunit2> </target> <target name=quot;docquot; depends=quot;testquot;> <phpdoc title=quot;Latitude API Documentation“ destdir=quot;${project.basedir}/docs/“ > <fileset dir=quot;${project.basedir}/libquot; > <include name=quot;**/*.phpquot; /> </fileset> </phpdoc> </target> <target name=quot;distquot; depends=quot;testquot;> <tar destfile=quot;${project.basedir}/builds/latitude.tar.gzquot; compression=quot;gzipquot;> <fileset dir=quot;${project.basedir}quot;> <exclude name=quot;**/.svnquot; /> </fileset> </tar> </target> </project> Net Perspective, LLC. http://www.net-perspective.com/
  • 8. Database Versioning • DBDeploy o Every change to the database structure is in its own .sql file • Each file contains the SQL to perform changes and SQL to roll back those changes o Revision information is stored in a table o Written in Java, Phing has a native port built in o Only version structure changes and default values • Don’t version test and sample data! Net Perspective, LLC. http://www.net-perspective.com/
  • 9. DBDeploy Example db/deltas/1-REVISION_COMMENT.sql --// CREATE TABLE `sample` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT , PRIMARY KEY (`id`) ) ENGINE = InnoDB; --//@UNDO DROP TABLE `sample`; --// Net Perspective, LLC. http://www.net-perspective.com/
  • 10. Continuous Integration • Wraps everything up… o Ties in Versioning, Build Management, Unit Testing, [Auto generated Documentation, ] and Database Versioning o Xinc (http://xinc.eu) (a pure PHP solution) • CruiseControl would be the “original” • What happens? o CI monitors SVN working copy o On update, run specified build script (Phing) • Phing generates UnitTest reports, API documentation, and archive files • Deployment code (upload to live server?) • UnitTest fails? Build fails o Store “artifacts” (generated reports, etc.) for each build Net Perspective, LLC. http://www.net-perspective.com/
  • 11. Xinc Interface Notice the Deliverable and Documentation artifacts Net Perspective, LLC. http://www.net-perspective.com/
  • 12. In Conclusion Charts Are Useless Pac Man Blinky Net Perspective, LLC. http://www.net-perspective.com/