I’m a “Leader Mentor” for my Service Unit. It’s a new position mostly intended for the mento to help new troop leaders getting up to speed, but I’m happy to help any troop leader facing a new issue.
So I got a question recently from a troop leader who is trying to do a Journey with her troop. The question basically consisted of “WTF?!” (Okay, the troop leader was more polite and probably said something more along the lines of “huh?!!” But I knew what she meant.)
When I was a troop leader, I did a Journey with my troop and I found the whole thing incredibly confusing and daunting. It was just after Journeys were introduced. Unlike the badge directions which were super clear, the Journey directions seemed to wander all over the place talking at times about the girls’ potential, what GS wanted the girls to learn from the Journey, and occasionally they even included information on what the actual steps were.
There was no way I was going to spend the money on buying a book for every girl. Plus, it felt like homework to ask the girls to read the book and I didn’t want to scare them away from the troop; they came to the troop for the socializing and low-stress activities.
I ended up creating my own “bonanza” of activities that covered a lot of the do-and-learn activities the girl book suggested. At another meeting brought in several articles I found that were pertinent to the Journey and had the girls each read an article and report back to the whole group about what they learned. I know the Journey took up several other meetings, too, because I remember having to schedule extra meetings just to get through it.
So my question is… what do you think of Journeys? How did you get your troop through a Journey?
I knew I wanted to include unit testing in my application from the beginning. Even though unit tests are boring to write (understatement!), I’m really glad I’ve included them, especially when I look at my test suite and realize I already have 13 unit tests with multiple methods/test and multiple assertions/method.
There is a section on unit testing in the Definitive Guide to Yii, but I found the Definitive Guide to be difficult to follow (much of the guide was written for the Yii-of-several-versions-ago so behaves differently than current Yii). I used the Yii Application Development Cookbook which was super-easy to follow (and has a lot of other great “recipes”, too).
How unit tests help
Some of the reasons unit testing is useful are:
- it’s much easier to submit weird data through unit tests than when testing manually, so testing is more thorough
- writing unit tests often makes me think slightly differently about my model and I end up catching a potential problem just while coding the test
- unit tests help catch errors in models, either newly coded or when you make a seemingly insignificant change to an existing model
- unit tests help catch errors in previously coded, tested and working models when you make a change to the table that seems small and innocuous
I have experienced all of the above!
Taking (some of) the pain out of writing unit tests
Once I had written a couple unit tests, I had a pretty good idea of what I wanted each test to do. At that point I wrote a generic unit test which I edit and Save-As each time I have a new model to test. The generic code uses “Xxx” as the model name, so my first step is to do a replace-all, changing “Xxx” to “User” or “Blog” or whatever the new model is.
The generic test file has cases for the set of tests I usually run for each model. The test file has test methods for:
- testCreateFail1 (tests for bad data)
- testCreateFail2 (tests for missing data)
- testUpdateFail1 (tests for bad data)
- testUpdateFail2 (tests for missing data)
On the successful creation and update tests, I test twice: once with minimal data and once with all the data. Originally I was putting all my assertions in one test method, but I found it easier to read when it was broken into smaller methods.
I always want to check the # of rows in each test method, so my generic code includes lines to get the number of row before/after, and make an assertion about the 2. It looks like this (before doing the replace-all of “Xxx” for the new model):
$countBefore = Xxx::model()->count(); // code to set the model attributes $this->assertTrue($model->save()); $countAfter = Xxx::model()->count(); // assert: one more row in the database $this->assertEquals($countBefore+1 , $countAfter);
Make it fun
Even with my generic code making the process faster, I still have to force myself to write unit tests. I try to gamify it by rewarding myself after writing a unit test (sometimes with just a gold star in my notebook when I write unit tests… silly, but it works). But the more often unit tests catch an error, the easier it is to talk myself into writing another test. And as my site grows I realize that I can’t test everything manually each time I roll out a new feature.
It’s never fun writing code that feels like it does nothing; if you’ve written everything correctly, you run the unit test and nothing happens. But my unit tests have helped me catch bugs before I even finish writing the model, when the model is first completed, and long after the model is done when I’ve “tweaked” it or even changed a table definition slightly.
The last several weeks I’ve been trying to create a marketing video for my website, TheTroopSite. I’m a programmer, NOT a marketer, so this is new to me. This definitely, positively, absolutely is not my favorite part of running a business by myself, but I’m trying to welcome the chance to try something different and appreciate learning a new skill.
I hear two basic steps to marketing are “Understand your Brand” and “Know your Audience”.
Understand your brand
I’ve heard the term “brand” a million times but never really stopped to think what it meant. I’ve since seen it described as the “personality” of your product; the brand should have consistent messaging, tone, imagery, color palette, and logo. I spent a bunch of time trying to figure out what the brand should be, but it seems so elusive, not like a nice programming question that has right/wrong or true/false kind of answers.
In the end, I decided to just make sure the wording sounded natural to me and that I liked the colors/tone/imagery. I’m sure a professional marketer could do a better job, but if it looks and feels right to me, then it will have a (mostly) consistent brand.
Know your Audience
“Well, duh”, I thought, “my audience is Girl Scout troop leaders”. After about my 3rd revision of my script, I realized my audience is anyone involved with the troop since the site will benefit everyone in the troop. The troop leader is the most likely person to be looking for an online tool to communicate and organize the troop, but parents will benefit from the site just as much (or more) since they’ll be able to access troop information any time. So, toss out script version 3, start over.
I can honestly say that this is miserable work for me. But I know marketing is important; I could have the best set of online web tools for Girl Scout troops but if no one hears about it then no one will use it. So, I need to suck it up and finish the video script this week so I can make the video and get back to what I love: coding!
I used the Yii framework to code The Troop Site. I’ve used a couple other frameworks long ago, but this is the first MVC framework. I wanted to be able to list experience working with a PHP/MVC framework on my resume, but I also wanted to take advantage of producing consistent code faster that comes with using a framework.
I thought I’d need a couple weeks to get up to speed, but it ended up taking me almost 2 months. There’s a lot to understand about Yii, especially if it’s your first time using a Model-View-Controller framework, but I like to understand what’s going on in the background and how things work together so I ended up reading a lot of the base code. Also (and maybe more importantly), I didn’t want my first use of Yii to be my website so I volunteered to write a demo site for a friend as my first use of Yii. That demo website was one of the best decisions I’ve made; I learned a ton and it really helped cement my knowledge of Yii. (My friend didn’t need anything robust or permanent, just something to show others as a conversation starter, so he was happy.)
If you‘re just getting started with the Yii framework, I highly recommend The Yii Book written and self-published by Larry Ullman. It’s an ebook, so you pay online and download the book immediately. As of February 2014, the book wasn’t finished, but most of the chapters are done and there’s plenty to get you up to speed on the fundamentals (and more) of Yii.
The Yii 1.1 Application Development Cookbook by Alexander Makarov was also really helpful. I used some of the early chapters in this book to help me get up-to-speed and recipes from advanced chapters helped me develop a few crucial features in my app. (The chapter on unit testing was invaluable!) I started with a copy of the book from the library but ended up buying my own so I could make notes in it.
The learning curve definitely slowed me down in the beginning, but I’m really seeing the benefits now. I can add features quickly using the Yii code generator and everything works together easily. It’s also nice to have access to the extensions. I’ve only used one but will probably use more in the future.
I finally added payment processing to TheTroopSite.com! I’ve been procrastinating doing the integration, but kept telling myself it wasn’t “rocket science”. Sure enough, the coding itself was easy, but PayPal’s online documentation for developers was a navigational nightmare and their descriptions were so confusing that I had to read everything… then read it again… and again!
Sample code is worth a thousand words
Before I go any further, if you’re integrating PayPal to your site, here are a few links to sample code on github:
- a general listing of sample code
- samples in several languages for using IPN (Instant Payment Notification)
- samples in several languages for using PDT (Payment Data Transfer)
I recommend deciding what kind of integration you want to do, then checking out the code samples. You’ll have to read some of the documentation to do the sandbox setup, but the sample code shows everything you’ll need to implement basic integration with PayPal.
On the developer’s site, the navigation changes without sense or warning. Sometimes there are 4 tabs (Documentation, Applications, Dashboard, and Support).
But sometimes there are 3 tabs (Documentation home, REST API reference, and Classic APIs).
Setting aside the inconsistency of the tabs….
PayPal employs a navigation layout of tabs across the top and subnav on the left column. That’s a very common layout and easily understandable. Navigation on the page below works; it’s clear that the subnav is a list of options related to the tab I chose. Note the subnav header (“Classic APIs”) is the same as the “active” tab, making it super-clear that the subnav relates to the tab I selected:
It’s even common to have navigation layers within the subnav (in other words, click on a subnav option and more options will show up immediately below the one you selected). But PayPal just adds a new section below the existing subnav!
Wait!! I’ve lost track of where I am in the online documentation!! What subsection of “Classic APIs” is “Instant Payment Notification”? How would I navigate back here later if I needed clarification?
indecipherable writing and organization
Their writing is full of PayPal-specific terms which have changed over the years, but the documentation site still uses a mix of old/new terms. Sometimes terms are defined too late and sometimes not at all. In the paragraph below, they define “Classic API test credentials” but they already used the term in the previous paragraph!
“The Sandbox assigns each Business account a set of Classic API test credentials. Get your test credentials by navigating to the Profile > API credentials tab of the Business account you want to use in your request…
Still, after reading the paragraph twice, I’m certain I want to go get my test credentials. I look all over the page for a link to Profile, but there is none! Okay, turns out I’m on the documentation site and need to go to the sandbox site, but they don’t say that!
Often one page of documentation would take 9 or 10 clicks to scroll through the whole page. I just checked the page on HTML Variables for PayPal Payments Standard and it took me 23 clicks to scroll to the bottom!
alls well that ends well
PayPal sorely needs to clean up their documentation, but I feel really good about the integration in the end. The sandbox was great for testing once I figured out that the account was completely unrelated to my production account. (Hint: if you set up 3 buttons in your production account, you have to set up 3 button in your sandbox. If you turned on PDT or IPN in your production account, you have to turn them on in the sandbox account.)
Last week I wrote about my resolution to get back to work faster after being off for a while. Today will put me to the test; I just got back from traveling over the 3 day weekend so I have a strong urge to spend time getting everything unpacked, washed, and back in place. I admit I did do a few “recovery” tasks (“thank you” emails) but I’m setting everything else aside to focus on work now.
Now that I think about it, this also relates to making my work a priority; it’s more important to get my work done today than to deal with the family laundry right now.
Working from home means I don’t get to chat with coworkers at the water cooler (I guess it’s the coffee machine these days). I do get a little stir crazy at times from being alone so much of the time. I’ve found that my mental state and even my productivity is helped by taking some time off once a week to meet a friend for lunch.
Today I met with an ex-colleague who is also a dear friend. She has started doing a headstand-a-day and blogging pictures of it. She invited me to be her “guest headstand” for today.
I don’t know if my new perspective was from was seeing things upside down, the break from home or the wonderful conversation, but I returned home excited to solve the coding issue I had been avoiding all morning.
Between carpool going “on break” before school was actually out, house guests, the holidays, and a cold, I essentially got no work done in December. Finally, holidays were over, guests had gone home, carpool was back on track and last week was my my first day “back at work”…. Except my daughter ended up staying home sick on Monday and there was no school Wednesday. Once again my work week was cut into pieces and I was not nearly as productive as I had hoped.
One of my resolutions this year is to make my work more of a priority. I’ve figured out I need to work on these three behaviors:
- truly making my work a priority over other things
- transitioning faster back into productive work time after having time off
- find ways to be productive in smaller increments of time
Making My Work a Priority
It’s easy to fall into the habit of putting others’ needs first. When my daughter was home sick last week, my first impulse was to spend the day pampering her. But I reminded myself that she really just needed to sleep. So I shut myself in the office, put on headphones so I wouldn’t be distracted by her movements, and actually got some work done. It took a mental effort, but it worked.
Realistically, a lot of what happened in December was unavoidable; I couldn’t ignore house guests or hand the car keys over to my (not-yet-driving-age) daughter to get herself to school. But there’s always a lag between when the distraction is done and when I get back to being productive. Some transition time is reasonable, but I know some of it is me feeling bummed about all the “lost time”. I need to let go of my anger/disappointment/frustration over lost time faster and move on with the present.
Being Productive in Smaller Increments
I’ll often find myself thinking along the lines of, “I have to leave to pickup my daughter in an hour, so why bother trying to fit work into this fragment of time?” But it’s easy to lose an hour here, an hour there, and suddenly productive working time is cut in half. Some work tasks really can’t be done in an hour; if I’m writing some complicated code I definitely need a longer time to focus. But I’m compiling a list of common tasks that I can fit into smaller periods of time and hope to start fitting in those tasks when I have a fragment of time here-or-there.
My mantra for 2014 will be: My work first, get back to work faster, fit work in.
This is a blog about developing my website, The Troop Site, a website for Girl Scout troops to help leaders get more volunteers, parents find information, and everyone share and communicate more efficiently.
I plan on blogging about developing the site. That includes web design, database decisions, marketing, tracking statistics, and other issues around building and marketing a website. But it will also include issues I face trying to balance being a mother with my work. And I might occasionally slip into discussing gender issues as a female geek.