Swagger for Spring


More specifically, Spring Boot. Swagger is meant to describe your APIs in a quasi-HATEOAS way, but you must provide Swagger definitions and run code generators to output your documentation. What if all the definitions were in Java annotations and code generation never has to happen? And the Slate UI picks up all your changes in real time and generates sample code in multiple languages and provides a real-time console to experiment with each endpoint?

This is what I did with these projects.

I’m using the Swagger-springmvc (now springfox) project as a basis for better documentation generation through annotations. All the work I did on this has been committed to my fork at https://github.com/clatko/swagger-springmvc/commits/master and my Swagger Core fork at https://github.com/clatko/swagger-core/commits/master.

I’ve also ported Slate UI to auto-ingest Swagger-based JSON endpoints as described above, but this is not yet in github. Will set up a new repo as the fork is drastically different (php vs. ruby, etc).

PHP Slate is now on GitHub.


A lot of people think there is a hard and fast rule that POST is to create and PUT is to update. This is not entirely true as they can be used interchangeably. The key difference between these verbs is their idempotence as described in RFC 2616. The idea of idempotence is also reflected in the target of these verbs, for example:

  • POST generally goes to a generic address such as /articles/ and a new article is spawned, for example /articles/42.
  • PUT goes to a specific address such as /articles/12 and updates that resource.

To sum it up, PUT can be run once or a thousand times and the end result will be the same. POST on the other hand always has side effects and this is the main difference between the two.


Phoobox – An MVC Version of PHP Fusebox

Pretty early in my professional programming career, I got hooked on the Lasso/FM stack, which most people probably never heard of… and for this reason I was able to get the Lasso code introduced to the 99 Bottles of Beer website – “One Program in 1,500 variations”. My other contribution at that time was to figure out the right combination of Lasso 3.6.x and FMPro Japanese to produce workable double-byte characters. This was all before the year 2000.

I graduated to ColdFusion and used that for several years. This wasn’t all pain and misery, I did get introduced to the inner workings of the JVM and to the Fusebox 3.0. framework. In its purest form, it was a great way to organize code, but really did not help separate logic from display and things like MVC were off in the distance in Fusebox 4.0+. Debugging was a huge pain as all routes went through a single file so all errors were invariably in the index.cfm file. Grr. When 4.0 came along, the bloat caused me to abandon the framework and I discovered the power of MVC in Mach-II.

I graduated to PHP and saw the near limitless number of frameworks and was lost in a sea of mediocrity. The current state of affairs is much better than it was in 2004. I saw this as an opportunity to port the Fusebox framework to PHP and deal with a lot of the shortcomings I felt needed fixing… and that brings us to Phoobox.

I basically cherry picked the parts of Fusebox I loved (routing, nested layouts, circuit-wide settings) and added object oriented PHP to the mix, giving the framework the true power of MVC. It allowed me to amass a huge library of classes that I could pick and choose for each project and in the parlance of red bull, gave me wings. I’m happy to finally share this framework with the world, but am doing this piecemeal. I want to eventually share my entire class library, but the code must be reviewed and embarrassing comments removed. I will also share some of the advanced capabilities of the framework, such as form rendering and validation; css/javascript tidy, minify, and obfuscation; and templating plugins.

Check out the README.md for more info on Phoobox.

Cleaning House

Welcome to the new design. There is still a bunch of stuff missing, mainly my non-blog related pages. I’m going to miss my Instapaper-like reading queue the most so this will be fixed fairly shortly. I still have a bunch of new hooks to write into new APIs so stuff will gradually make its way back here. I’ll also start writing a bit more content now that I have some time. And say hi to my new logo.

Unfollowing 400,000 People on Twitter

About nine months ago, I was near the magical 1.1 ratio when I suddenly could no longer follow anyone. I unfollowed to about a 1.0 ratio, but this didn’t help and of course no word back from Twitter. I also noticed that my followers were still growing even though I wasn’t following back. This was a bit of a surprise so I let the experiment run…

  • No new friends – I was bound by a bug in Twitter, nothing I could do here (after three months, this was fixed)
  • Unfollow deadbeats – I kept a bot going that unfollowed people that were not reciprocally following
  • Unfollow abandoned accounts – If the account did not tweet for 4 days, unfollow
  • Unfollow bots – keywords in tweets/descriptions and number of total tweets got flagged and unfollowed
  • Unfollow non-English speakers – even Japanese accounts (which I could read), kanji, cyrillic, greek, hangul, and kana. No offense to anyone, I just can’t parse info that fast.
  • Unfollow spammers – keywords would flag my bot and the user unfollowed

This left me with about 20,000 friends which I attempted to weed out manually over the course of a few weeks. I also tightened the screws on the bot params above and caught more in my net. Then I started catching too many false positives. I was at 8k friends by this point so I decided to be indiscriminate and unfollowed everyone. Everybody but Dave McClure (this was purely just a fluke). Twitter shows me following almost 400 people now, but that actually isn’t true – 350 of those users are invisible to me. Invisible users are fine, but I still see their crap in my feed. I’m sure this will get straightened out as my info propagates.

So I pulled a “Scoble” on everyone? I guess, but this was a carefully controlled process over a nine-month period. It was only when I unfollowed everyone the jig was up. Did I lose a ton of followers doing this? No, I’m actually getting more followers now than I ever did.

Why did I do this? I use lists, a lot, but they just were a pain. I also didn’t like the signal I was sending people – I’m not thrilled by the f4f community and all I got in my @ stream was “follow me!” or my favorite, “follow me or i unfollow u”. I don’t want to be part of that community and really just want to user twitter in a new way – to remain informed, to network, and chat with friends.

The last thing is the amount of auto-tweeting I do – I have a ton of feeds from my other networks set up to tweet, the only external source is the Slashdot rss feed (yes, I parse app store information to tweet about iOS app price drops, a huge effort behind the scenes). So I will most likely cut down on the auto-tweets. My first step towards this is a curation of my own Tumblr feed.

If I unfollowed you, don’t be offended, I will get back to following you soon.