background preloader

Programming

Facebook Twitter

NodeJS

Composer Namespaces in 5 Minutes – Juan Treminio. Unit Testing Tutorial Part I: Introduction to PHPUnit – Juan Treminio. Advanced PHPUnit Testing: Annotations and Mocking. In the first two parts of this series (Introduction to Unit Testing in PHP with PHPUnit and Getting to Know PHPUnit’s Assertions), I’ve walked you through some of the steps you can take to test your application. I showed you how, with the help of PHPUnit, you can write tests that are as simple or as complex as you need to ensure quality. By now, I hope you understand the importance of having a good set of unit tests. You know that, with those firmly in hand, you can change large parts of your application at will and be sure that the result will match 100%. In this third part of the series, I’m going to explore two features that are a bit more advanced, so they might not show up in your everyday unit-testing practice. PHPUnit has lots of advanced features that can be amazingly helpful when that special case comes around.

Annotations If you’ve ever read a book or taken a note, you’ll be familiar with the idea of annotations. <? Easy, right? . <? Yet, it does have some limitations. <? <? Mocking. How to GitHub: Fork, Branch, Track, Squash and Pull Request. This guide will teach you how to properly contribute to open source projects on GitHub. It assumes that you already know about how to use Git for version control and that you already have a GitHub account.

Psstt.. if you already have a GitHub account and you want to earn more money, sign up for Gun.io with your GitHub profile and we'll pair you with people looking for developers based on your portfolio! Getting Started GitHub displays these instructions when you start a new project. GitHub is pretty great about giving advice to users starting new repositories, but it isn't very helpful when it comes to contributing changes back to other projects. Hopefully, this guide will help. Before you get started, find the page of the project you're looking to improve. Check the Network The network graph. The first thing to do is check the Network tab on the project to see all the other forks that other people have made. Opening an Issue You've got issues, man. Next, head over to the Issues tab. Tada! Gs: git lol - the other git log.

Quality metrics: A guide to measuring software quality. Metrics have always been used to help guide managers with decisions about their organizations. However as technologies and methodologies have evolved, metrics must evolve as well. Defect tracking, for example, has traditionally been a metric used to measure software quality throughout the lifecycle. However, Agile methodologies suggest that pre-production defect tracking may, in fact, be detrimental to software teams. It can be difficult to determine which are the best for giving a true picture of software quality.

This guide will provide insights for CIOs, senior managers and project managers in selecting the right set of metrics to effectively and efficiently manage their software development organizations. Is defect tracking necessary? Who should decide which metrics are most useful? » XDebug, PHP and Sublime Text 2 on Ubuntu 12.04. Getting Xdebug for PHP working with Sublime Text 2 is slightly tricky. Most of the instructions are at – these notes are just a bit extra as a reminder to myself.

After installing Xdebug with “sudo apt-get install php5-xdebug”, you have to add some xdebug settings in /etc/php5/conf.d/xdebug.ini: zend_extension = /usr/lib/php5/20090626+lfs/xdebug.so xdebug.remote_enable=On xdebug.remote_host="localhost" xdebug.remote_port=9000 xdebug.remote_handler="dbgp" xdebug.remote_autostart=1 In ST2, you use SHIFT+F8 to get the Xdebug menu, and select “Start debugging”. ? The page request should hang while the debugger has control – if nothing’s happening in ST2, you’ll need to check the console window by using “CTRL`”.

You may get this output: In which case you’ve got the problem with Python versions – 2.7 is the default on Ubuntu 12.04, and ST2 and the Xdebug plugin are using Python 2.6. Then restart ST2 and try again. Bulletproofing Database Interactions with PHPUnit Database Extension. There’s already a great article here that discusses Test Driven Development, but did you know that you can also test the code that interacts with your database?

Especially if your application is data intensive, subjecting your CRUD code to a battery of tests is good practice that helps ensure that your application is working correctly. In this article you will be learning how to write database tests in PHP using PHPUnit and its database extension. Accompanying code can be found on GitHub, so feel free to check the source and play with it. For this exercise you’ll need PHPUnit and the PHPUnit Database extension. You can install both using PEAR. Just follow the instructions listed in the PHPUnit documentation. Editor Note Oct 20 2012: You can install both PHPUnit and the PHPUnit Database extension using Composer.

Warming Up It’s time to get your feet wet! Imagine you are the back-end ninja of an online webzine and you’ve just received the spec for a new magazine you’ll be building: Summary. » PHPUnit Training Course for free Programming the new world: Programming your life and the net, one day at a time. Posted in November 4th, 2010 Today is an awesome day my dear fellow programmers. Today is the day I decide to freely distribute the first couple of pages of the PHPUnit workshop I have been giving for some time now.

It is a workshop that builds a small demo application the Test Driven Development way. The reason I open this workshop course is because I strongly believe everybody should understand and use PHPUnit in their projects. Another reason is marketing. As a Zend Framework Certified Engineer I am writing a wonderful book. Part of that book will have similar contents as the complete course, which today I decided to freely distribute. But the bottom line: you get a nice introduction to PHPUnit for free. Warm winter greetings from Belgium Nick. The Beginner's Guide to Unit Testing: Building a Testable Plugin.

In the first part of this series, we took a high-level look at testing methodologies and gave some cases as to why it's beneficial for us to begin doing in our WordPress projects. We also took time to setup PHPUnit and the WordPress Tests in order to begin building our first testable plugin. In this final article, we're going to define a methodology for unit testing, begin incorporating it into our work, and walk away with a fully functional (albeit simple) plugin that also has a small set of tests to ensure that it works exactly as expected. When it comes to testing, there are generally two ways to do it: Write your tests, then write code to make your tests passWrite your code, then write tests that pass In my experience, the first approach is always better.

To that end, I find it better to write the tests first. With that in mind, we're going to be building with this simple methodology: Write a test and run it. Let's stub out the unit test class: At this point, you should see a failure: Tutorial: Introduction to Unit Testing in PHP with PHPUnit. It’s a familiar situation: you’ve been developing on an application for hours and you feel like you’ve been going round in circles. You fix one bug and another pops up. Sometimes, it’s the same one you found 30 minutes ago, and sometimes it’s new, but you just know it’s related. For most developers, debugging means either clicking around on the site, or putting in a whole load of debugging statements to hunt the problem down.

You’ve been there, right? You’ve had these same frustrations with all your applications, and have sat back and thought that there has to be a better way. Well, you’re in luck! There is, and it’s not as difficult as you might think it. The key to understanding unit testing is to define what we mean by “unit.” Once you’ve written up your set of tests, whenever you make a change to your code, all you have to do is run the set of tests and watch everything pass. Debunking Unit-testing Myths It Takes Too Long There’s No Need to Test: My Code Already Works! It’s No Fun <? <? Starting An Open-Source Project. Node.js v0.10.1 Manual. Composition versus Inheritance | Chad Myers' Blog. One score (minus five) years ago, in the age of yore and of our programming forefathers, there was written a little book. A seminal book. A book that would change things. That book was called Design Patterns: Elements of Reusable Object-Oriented Software.

There were many other greater and some lesser (but still great) works that were released around the same time (1995), but this one has remained a popular favorite among the object-oriented development crowd for some time. Recently (as in the last 4-5 years) this book has seen a resurgence of popularity due to the increasing use of and references to various design patterns contained in the book.

But this post isn’t about design patterns. As I have grown in my understanding of design and architecture, I have come to realize that the first chapter — titled “Introduction” — of this book is actually the most valuable part of it. Programming to an Interface, Not an Implementation In the book, the author says: Consider this code example: GitHub Flow – Scott Chacon. August 31, 2011 Issues with git-flow I travel all over the place teaching Git to people and nearly every class and workshop I’ve done recently has asked me what I think about git-flow.

I always answer that I think that it’s great - it has taken a system (Git) that has a million possible workflows and documented a well tested, flexible workflow that works for lots of developers in a fairly straightforward manner. It has become something of a standard so that developers can move between projects or companies and be familiar with this standardized workflow. However, it does have its issues. I have heard a number of opinions from people along the lines of not liking that new feature branches are started off of develop rather than master, or the way it handles hotfixes, but those are fairly minor. One of the bigger issues for me is that it’s more complicated than I think most developers and development teams actually require. Its simplicity gives it a number of advantages. GitHub Flow Conclusion. I Want To Teach My Kid How to Program.

Computer programming is a practical skill that can be applied to many professions and hobbies besides software development. However, it can be intimidating to break into. This guide will help parents point their kids in the right direction to get started in programming. (And it is also useful for anyone to get into programming.) The Gist Kids as young as 9 (or even younger) can learn programming, it doesn’t require math skills beyond basic arithmetic.Making video games is the best way to learn programming and stay interested.Python is one of the best programming languages to learn for a first language.If your kid finds typing frustrating, then Scratch might be a better language to learn.

There is no “best” age to start programming; any age is fine. Learning to program, like learning anything, is not about having a high IQ so much as being enthusiastic enough to practice and wanting to learn more. Deciding on a Programming Language Programming languages I recommend you not start out with: Functional Programming in Javascript. This is an interactive learning course with exercises you fill out right in the browser. If you just want to browse the content click the button below: This is a series of interactive exercises for learning Microsoft's Reactive Extensions (Rx) Library for Javascript. So why is the title "Functional Programming in Javascript"?

Well it turns out that the key to learning Rx is training yourself to use functional programming to manipulate collections. Functional programming provides developers with the tools to abstract common collection operations into reusable, composable building blocks. Map filter concatAll reduce zip Here's my promise to you: if you learn these 5 functions your code will become shorter, more self-descriptive, and more durable. Finishing the Interactive Exercises This isn't just a tutorial, it's a series of interactive exercises that you can fill out right in your browser! Note: Use the "F4" key to toggle full screen mode for each editor.

Working with Arrays Querying Trees.