2015年6月19日星期五

Site News: Popular Posts for the Week of 06.19.2015

Popular posts from PHPDeveloper.org for the past week:

Loosely Coupled Podcast: Episode 24: Minimum Viable Product


The Loosely Coupled podcast, with hosts and PHP community members Jeff Carouth and Matt Frost, has posted their latest episode today - episode #24: Minimum Viable Product.



In this episode Jeff and Matt talk about the concept of a minimum viable product and what it means to us as developers. The concept of an MVP is simple but it often gets used as an excuse to put out poorly-implemented products. Listen as Jeff and Matt discuss their opinions about the problems with MVP in our industry and how we as developers can fight against them.


You can listen to this latest episode either through the in-page audio player, by downloading the mp3 or by subscribing to their feed to get this and other episodes as they're released.


Link: http://looselycoupled.info/blog/2015/06/18/episode-24-minimum-viable-product/

HHVM Blog: Trait and interface requirements in Hack


On the HHVM blog there's a recent post looking at some of the requirements around traits and interfaces in the Hack language. More specifically, they talk about type checking with traits and how interfaces can be used to help provide extra structure.



In PHP, traits are a mechanism of code reuse that, while very powerful, are also difficult to type check both efficiently and exhaustively. In this post we'll dive more deeply into the reasons for that and see how Hack solves those problems, allowing you to use traits in a safe way without limiting their expressiveness.


They start by talking about the main problem with PHP's handling of traits (essentially copy and paste into the current class) and how they felt Hack should "just work" in allowing type checking on these "pasted" methods too. Performance limitations prevented them from handling it how they do with other variable types, so they changed things up, using a "require extends" syntax to tell the Hack engine how to allow the checking based on an interface. There's a lot more to it than this, so be sure to read the rest of the post on how they came to that conclusion.


Link: http://hhvm.com/blog/9581/trait-and-interface-requirements-in-hack

NetTuts.com: Programming With Yii2: Rich Text Input With Redactor


NetTuts.com continues their series about programming with the Yii2 framework in this new article moving on to the use of the Redactor rich text editor that comes bundled with the framework.



In this Programming With Yii2 series, I'm guiding readers in use of the newly upgraded Yii2 Framework for PHP. In this tutorial, I'm going to introduce you to using the rich text editor Redactor within the Yii Framework. For these examples, we'll continue to imagine we're building a framework for posting simple status updates, e.g. our own mini-Twitter.


Thanks to the Yii community purchasing an unlimited license for the Redactor rich text editor, it's easy to install and use via the "yii2-redactor" extension. They help you get it installed and update a sample form to use it instead of the normal basic HTML textarea for content input. They also show you how to add image support and what it looks like both inline in the editor and the resulting HTML output.


Link: http://code.tutsplus.com/tutorials/programming-with-yii2-rich-text-input-with-redactor--cms-23174

Run Geek Radio: Episode 005 - Time Estimation, Conference Talk Rating, Contest Winner


The Run Geek Radio podcast has posted their latest episode today. In it (episode #5) host Adam Culp talks about time estimation, thoughts on conference talk ratings and the contest winner from his standing desk contest mentioned in an earlier episode.



This episode Adam Culp announces the winner, David Stockton (Colorado), of the contest launched in Run Geek Radio episode 004. [...] Adam also talks briefly to clarify his views on "soft talks" versus "soft skills talks", and how he was misrepresented as disliking soft skills talks though the opposite is true. [...] Then this episode is rounded out with a detailed coverage of time estimation in relation to projects, and why it is so vitally important to be accurate. Adam also speaks about how important proper requirements gathering is to the process.


You can either use the in-page audio player to listen to this latest episode or you can download the mp3 of the show. Be sure to subscribe to the feed if you enjoy the show and want to hear more from Adam.


Link: https://rungeekradio.com/episode-005-time-estimation/

Giorgio Sironi: Property-based testing primer


Giorgio Sironi has a new post to his site today talking about a method (and tool) around a different sort of testing practice: property-based testing. The difference is that, instead of hard-coding values and evaluating them post-processing, you're generating random values and ensuring they match against a set of properties, not values.



I'm a great advocate of automated testing and of finding out your code does not work on your machine, 30 seconds after having written it, instead of in production after it has caused a monetary loss and some repair work to be performed. [...] However, classic test suites written with xUnit and BDD styles have some scaling problems they hit when you want to exercise more than some happy paths. [...] Property-based testing is an approach to testing coming from the functional programming world.


He helps to make the point a bit more clear with an example of testing the "sort" function and its results. He talks about how to test it using normal data, empty data, etc. but notes that this kind of testing can become "boring and error-prone". Instead he proposes the property-based testing of the results. He generates random values to feed into the method and checks to ensure the results are sorting by comparing them to each other. He expands this with a bit more complex example, showing how to test some DateTime handling and evaluating the result with logic in a closure. To help make this kind of testing easier, he's created a library (Eris) that extends PHPUnit and provides the methods seen in his examples.


Link: http://www.giorgiosironi.com/2015/06/property-based-testing-primer.html

Sammy Powers: Contributing to the PHP Manual


If you've wanted to contribute something back to PHP but aren't familiar with C (or don't feel comfortable enough with it) Sammy Powers offers another solution. In his latest post he shows you how to contribute to the PHP documentation and update the manual for new features, missing information or fixes to current code examples.



If you've been wanting to contribute to PHP internals, starting with the documentation can be a great entry point; especially because it doesn't require dusting off those old C books from college. But knowing where to start can be tricky since information on how to contribute to the docs is scattered across the internet. This article is a step-by-step guide of how to contribute documentation to the PHP manual.


He starts with the "quick and dirty" way of editing the manual through the edit.php.net site, but points out that it's really only useful for smaller changes, not large documentation updates. The rest of the post shows you how to set up the documentation locally and generate the results to validate your changes. He talks some about the DocBook format they're written in, the build process with the PhD (PHP docs generator) and running the php.net test suite against the changes. This ensures that nothing else has broken on the site in the process.



He shows you where to make your changes, how to generate it from either a skeleton or using the docgen script and submitting the changes back to the repository. There's also a few other random changes to make before committing the files back via SVN and pushing them back upstream. He ends the post talking about the GoPHP7-ext project and how to find extensions that are missing documentation or where it's incomplete (easy thanks to an included "check-missing-docs" file included in the repository).


Link: https://www.sammyk.me/how-to-contribute-to-php-documentation