Categories
D&D Programming Random Generators

One Dice Six

Table I from Dungeon Master’s Guide Appendix A

It’s common for role-playing rules to include tables for generating complex results, similar to the image to the right from the first edition Dungeon Master’s Guide for generating dungeon maps. The user is meant to roll a twenty-sided dice and find a matching row from the first column. A roll of 4 matches the range of 3-5, indicates a door in the random dungeon and directs the user to Table II.

Automating the results with code provides two advantages over manually rolling. In the moment, at the table, it can be quite dramatic to click once and see a result. The other advantage is being able to rapidly re-roll and pick suitable results, such as when working on a new adventure and riffing on random results.

Categories
Programming

Factors Affecting Code Quality and Estimation

Last September, ZeroTurnaround released analysis of a survey focussed on tools and practices of developers. They reported on how these affected the quality of code and how predictable delivery dates were. The Developer Productivity Report 2013 is a long read with lots of details. In the end, the data support what most developers already know. If you’re a programmer like me, does any of this surprise you?

  • Pair up with another coder sometimes
  • Automate unit tests and keep on top of failing tests
  • Minimize meetings
  • Use source code control
  • Use an issue tracker
  • Use an IDE and a debugger
  • Do code reviews of new code
  • Estimate as a group, but exclude the managers

I accept all of this with the except that I have not found IDEs to be a significant improvement to my productivity. Sometimes I wonder if exposing all the prototypes through popups doesn’t prevent developers from mastering a system and internalizing it. On the other hand, having memorized all the random parameters to PHP’s function might have been a waste of brain space. I’ll probably be fine for now with Geany and grep.

There’s a remarkable nugget about testing (slide 7):

Automated tests showed the largest overall improvements both in the predictability and quality of software deliveries. Quality goes up most when Developers are testing the code (also discussed in Sven Peter’s talk “How to do Kickass Software Development” at GeekOut 2013), which means that you shouldn’t just leave testing to QA team, but bake it into the development process as well. The rest of the measurements were more or less insignificant, although we don’t recommend letting yourcustomers/users test your software for you.

If you can convince your developers to do testing, there’s a big advantage for quality.

 

 

Categories
News Programming

Automated unit tests from Asis

This tool allows you to periodically grab stack traces and record calls to a library that are then saved as unit tests. It’s a shortcut to getting coverage for a library that’s already in production and stable.

zavg/Asis · GitHub

Asis – Tool to deal efficiently with legacy code through creating and running characterization tests automatically.

The main idea is the following: while user or tester is using your product (for example, Web site) the Asis tool records the function calls which are performed, the sets of arguments which are passed to the function and the received output. Output can be any, starting from strings, integers, HTML, JSON and finishing with serialized objects with complex internal structure. We don’t care what we receive – we just record it and approve as correct result, because we know that we are working with the stable release version.

Categories
Programming

Simplify Commerce Event Types

I recently completed a project to integrate Simplify Commerce into Clinalytic, a note-taking application for psychologists. The service’s API lives up to its name. Integration was simple. Being new, there are a few gaps in features and documentation, but engineers are quick to reply to support emails.

In the missing-features box, I’d put the ability to use a card token to save a card to a customer’s account. At the moment, you can create a card token in-browser and then use it to do a one-time charge. But that charge will not be associated with the customer. It’s a minor issue, but would add another layer of security because I would avoid ever having a credit card number reaching my server. The card tokens can be created in the browser alone.

In the missing documentation box, I’ve got a need for more information about incoming events. You can register a URL for accepting callbacks from Simplify that describe various events. The tutorial shows one event, but the docs fail to list the others. Fortunately, the support team sent me a list that I’ll share below.

 

  • chargeback.processed
  • invoice.processed
  • deposit.processed
  • deposit.failed
  • coupon.create
  • coupon.delete
  • customer.create
  • customer.delete
  • customer.update
  • invoiceItem.create
  • invoiceItem.update
  • invoiceItem.delete
  • invoice.update
  • invoice.card.exp
  • invoice.unpaid
  • payment.create
  • plan.create
  • plan.update
  • plan.delete
  • refund.create
  • subscription.create
  • subscription.update
  • subscription.delete

If you’ve read through the API docs, the event names ought to be all you need to understand what they are about. Events fire regardless of source, either using an API call or using the Web interface at simplify.com. And the data returned in the callback generally matches the data returned by the find methods available in the API. I’m told all this will be documented in detail on the Simplify site.

 

Categories
News Programming

Simplify Commerce

Super easy credit card payment processing provided by MasterCard.  They have lots of SDKs, including one for PHP. You can get into a sandbox in five minutes.

Simplify Commerce – Developer-Friendly Payments

It’s that simple.