background preloader

Development

Facebook Twitter

Html5

Algorithme. VIM. One Assertion Per Test. Shift Your Paradigm! One Assertion Per Testby Dave AstelsFebruary 23, 2004 Summary For some time I've been thinking about how TDD tests can be as simple, as expressive, and as elegant as possible. This article explores a bit about what it's like to make tests as simple and decomposed as possible: aiming for a single assertion in each test. A while ago there was a bit of fuss on the testdrivendevelopment Yahoo group about the idea of limiting yourself to one assertion per test method, which is a guideline that others and I offer for TDD work. An address parser was the example of a situation where it was argued that multiple assertions per test made sense. Date was formatted with one address per line, each in one of the following formats: The poster went on to say: My first inclination is/was to write a test like this: They didn't see how to achieve this with one assertion per test, as there are obviously four things to test in this case.

So, where to start? Squeak: Java: That's well & good. Stop Using Backbone As If It Were A Stateless Web Server. In the web development world with MVC based back-end servers, nearly everything is kicked off with routes. Look at rails for example. If you want a list of items, you hit /items and the router executes the index method on ItemsController. Add a new item, view an item, edit an item and post the updates back to the server – even deleting an item works with a route. Unfortunately I see the same patterns emerging in a lot of sample code for javascript MVC frameworks, like Backbone. Stop doing that. Why It Works For The Server A web application is a stateless system. Because of the stateless nature of web servers, it makes sense for every action you want to do to have a route associated with it. State. A Backbone app is closer to a desktop client application than a web application in a few respects.

Because of the stateful nature of a Backbone application, there are times when it doesn’t make sense to use a route, though it technically works. Problem: Routing A Delete Yes, this is functional.

Ruby

Starters Guide to iOS Design. As someone who does work on both the development and design side of iOS apps I find that many designers struggle with the transition to UI work, or with the different processes involved in iPhone and iPad app design. In this guide I'll describe the deliverables you'll be expected to produce, outline the constraints of the medium and introduce fundamental iOS and UI design concepts. The Medium Knowing your medium and its quirks is an important part of being a good designer. I'm sure you've been witness to large print-outs with horrible pixelation artefacts - the result of misunderstanding print media.

Similarly misunderstanding the role of pixels on screen can result in blurry, squished, or pixellated designs. iOS devices come in two main form factors, the iPhone and the iPad[…] For simplicity I'll be leaving the iPod Touch range out. Retina Most recent iPhones and iPads are fitted with Retina screens, a high resolution screen intended to make pixels invisible.

Pixels Points Storyboards Segues. FactoryGirl Tips and Tricks by Arjan van der Gaag. FactoryGirl is an awesome fixture replacement library that gives you a lot of power and flexibility, at the cost of more code to maintain and increased mental overhead. It pays get to know it, so you can wield its flexibility to improve your tests and your productivity. Get the most out of FactoryGirl 1. Use traits for modular factories Traits are reusable pieces of attribute definitions that you can mix and match into your factories. For example, say you have a Post and a Page object that both have a publication date. FactoryGirl.define do factory :post do title 'New post' factory :draft_post do published_at nil end factory :published_post do published_at Date.new(2012, 12, 3) end end factory :page do title 'New page' factory :draft_page do published_at nil end factory :published_page do published_at Date.new(2012, 12, 3) end end end FactoryGirl.create :draft_page FactoryGirl.create :published_post The repetition should be obvious. 2.

Consider an example of a blog post with comments: 3. Ctags and Taglist: Convert Vim Editor to Beautiful Source Code Browser for Any Programming Language. This article is part of the on-going Vi / Vim Tips and Tricks series. As a programmer or system administrator, you will be constantly browsing source codes and shell scripts. Following are some typical activities that you may perform while browsing a source code file: Navigating to the function definition by specifying the function name. Navigating to the function definition from ‘function call’. Returning back again to function call from the definition. Viewing the prototype/signature of functions or variables.

Viewing the number of functions in a file, etc In this article, let us review how to perform the above activities efficiently in Vim editor using ctags and taglist plugin. I. Step 1: Installing ctags Package # apt-get install exuberant-ctags (or) # rpm -ivh ctags-5.5.4-1.i386.rpm warning: ctags-5.5.4-1.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e Preparing... ########################################### [100%] 1:ctags ########################################### [100%] 1. 2.

Git

Mocks Aren't Stubs. The term 'Mock Objects' has become a popular one to describe special case objects that mimic real objects for testing. Most language environments now have frameworks that make it easy to create mock objects. What's often not realized, however, is that mock objects are but one form of special case test object, one that enables a different style of testing. In this article I'll explain how mock objects work, how they encourage testing based on behavior verification, and how the community around them uses them to develop a different style of testing.

I first came across the term "mock object" a few years ago in the XP community. But as often as not I see mock objects described poorly. This difference is actually two separate differences. (In the earlier version of this essay I had realized there was a difference, but combined the two differences together. Regular Tests I'll begin by illustrating the two styles with a simple example. Tests with Mock Objects Using EasyMock Driving TDD.