Posts published by: Scott Triglia

"A New Year"

All the cool kids wrote New Year posts, so I figured that was excuse enough for me to chime in with a quick one.

Writing here has been a nice outlet for the end of 2012, but I figure now's as good a time as any to make a couple …

"Hiding complexity with Context Managers"

Very reliably, my favorite part of programming is the simple process of taking a series of steps that I used to have to do by hand and packaging it up in a nice, reusable form. It's pretty wonderful that it remains just as rewarding now as it did when I wrote my first function in C++ 8 years ago.

So in that spirit, I figured I'd write down a few thoughts on python's context managers -- the latest built-in feature that I've grown quite attached to.

"Testing with Mock"

More than any other area, I've found software testing to be the discipline which I knew the least about before joining up at Yelp full time. Sure, there was the normal insistence in my time as an undergraduate that I learn how to test units of code, and I'd heard plenty about the value of unit testing from any number of people or blogs, but when it came right down to it relatively few people I knew ever employed it to a meaningful degree during college and my graduate work. The simple truth was that projects rarely lasted long enough for the fruits of proper testing to be borne out.

Now I am sure plenty of people would disagree with that statement, pointing to how their various school projects were made better or simpler by judicious application of unit tests, but the goal of this post isn't arguing about whether or not testing is worthwhile. My goal is to dive in a little bit to one particular area of testing that I had essentially zero exposure to before joining industry -- the mocking of methods in tests.

"Why namedtuples?"

If you had asked me to explain all I knew about Python's namedtuple class at the start of this year, I would have probably muttered something about mutability and trailed off into an uncomfortable silence. The fact of the matter was, I had seen them used once or twice but never really understood the reason they were used. Hopefully by the end of this entry I can explain at least a couple of places you might consider using them over the typical Python class.

"First things first"

As all good internet citizens do eventually, I've decided to try writing down my various software-related trials and tribulations down in a blog. For the time being, I'm sticking with Octopress as I care more about the content than the web design. Maybe later this will become an exercise in …