#100DaysOfBullying – Coding by force?


I started this 100 days of coding challenge that has been going around the net recently. I’m not sure how/why I got roped in. (Actually, that’s not true… I have clear recollection. I was pressured into it by a dear friend who shall remain shameless!) The idea is that you write code for 100 days straight and network with friendly folks who are doing the same while sharing what you’re doing. Hi, I’m Cliff. I’m here because I was convinced (bullied) to participate in the challenge. You’re probably here because you’re new to coding and you want to be down with everything that’s going on. Now that introductions are over let me begin with a few disclaimers just in case you are unfamiliar with how I operate.

I’ll start by saying the challenge is a great idea and I am super excited to participate in it. Also I highly encourage you spread the word to others. I didn’t really understand what it was about at the beginning but now I’m involved and it’s a thrill. I have no hard feelings towards those who encouraged (harassed) me early on and if your life story resembles anything written here it is purely a coincidence. (Don’t message me with the, “how dare you make this sound like a bad idea?” I am all about the challenge and these is mostly just jokes, ok?) Even as much as I love the community and idea of social coding there is something that bothered me early on that I couldn’t put my finger on until now.

It wasn’t the way I got conned into participating. It wasn’t anything to do with the rules or the challenge at all. It was my inability to start. I honestly couldn’t figure out how I would participate or what I would do. I was trying to give the correct answer and I was coming up short. After various failed attempts at crafting the proper contribution and planning my perfect participation I finally just settled on doing what I do best, sitting and hacking together random code, libraries and APIs. It wasn’t until I stopped trying to plan my project that I was able to begin my project. It wasn’t until I stopped analyzing my approach that I was able to remember why I’m here in the first place! That desire to have the right answer was getting in the way of my ability to do the thing that was most important and it bothers me!

I hung out in the #CodeNewbie Twitter chat that same day when I saw the same desire several times in different community members. There was talk about, “I don’t have time” and questions like “where do I begin?” as well as people saying “I lack focus/direction”. All of this banter ignores the core driving factor behind the entire challenge, IT SHOULD JUST BE FUN! I never need to find time or a set of directions when playing my favorite video game and I always know where to begin. Why should the challenge be any different? At what point did we all stop enjoying ourselves and put on the responsibility garments of deadline driven politically correct practical software engineering and what do these garments have to do with the event?

I remember a time where I could just mash buttons on my keyboard without stressing over “a useable project”, “a deadline”, or “the right way to code a project”. It was a time when I would see something cool in an iSeriesNewsNetwork or JavaWorld article, type it into my terminal and tinker with this new thing without ever having any practical need or use case for it. It was a time when I would always have a tech book or magazine tucked under my arm and a time when I would dream of angle brackets stabbing me in the middle of the night. In these days I would merely discover stuff for no reason then there would just so happen to be a need for that discovery mere days later. It would sort of work like, “we have to update every Java class in this project with a VERSION string” and I would remember the trick I just read about using AntLR with the token rewrite engine a day prior. I would have experiences where someone needed a Excel spreadsheet converted to a web page from a non-Microsoft platform and I would draw from the blog post I read 2 nights earlier on the Apache POI project with stuff I got out of my XSLT Michael Kay red book then immediately cobble together some code that did exactly that. There were times when dabbling in random stuff like reverse ssh tunnels to get my Amarok music player running over a remote X11 session (with absolutely no audio) to show on my Mac would allow me to rescue a demo gone horribly wrong due to HTTP proxy issues.

My point is that I never wrote code to earn a paycheck. I never wrote code to meet a deadline. I never used to code for any objective other than the fact that I knew how to cobble together weird mis-matching technologies to make something work. Every project was never a project that was given from a manager. Instead it was a rehashing of an experience from only days prior where I was tinkering with some flashy thing on my Linux Beryl desktop trying to make it work & look like OS X or whatever. Everything I did originated out of a passion to play with computers. It was never planned, mandated or even organized. And now I find myself struggling to plan and organize something that felt mandated at first. It was not fun!

Some of the people chiming in on the Twitter chat sounded like they were setting themselves up for a work assignment. They sounded like they were forcing themselves to do the challenge because it would be somehow good for them. It is all wrong! It bothered me so much that I decided to write about it. What is supposed to be a passionate experience of 100 days spent coding is becoming 100 days spent bullying yourself to finish a project… Some of you are so focused on the end result that you’re robbing yourself of the entire experience.

Then I had all kinds of crazy questions and got to thinking the whole idea was wrong. I mean, why am I spending my time trying to complete a 100 day assignment? Do I plan to only code for 100 days? What happens on day 101? Will I no longer be an engineer? Will I suddenly turn blue, shrink to a 10th of my size and be on the lookout for Gargamel? Where would I find one of those noodle shaped stocking caps that bend forward slightly but never fall of the head? I code everyday professionally, shouldn’t I get credit for that? Who is collecting the credit? Can the credit be exchanged for an Xbox One when I’m finished? It got LL weird and Again, I overanalyze and missed the obvious!

Here’s a radical idea if you are taking the challenge and feeling lost or stuck. Don’t plan a coding project or do anything work related. Just break out your favorite IDE, programming language or framework and start tinkering. Don’t obsess over what the end result will be because that is not the point at all. I am in day 2 or 3 of the challenge and my project has a generic name and absolutely no purpose! I still don’t know what it does or will do, all I know is that I am having a blast tinkering with Azure, NodeJS, Express, Facebook and Twitter APIs. (I might even throw in some TypeScript and write my build system with Yarn!) For the first time in a long while I finally feel the way I did back in 2000-2005 when I would read my RPGIV programmer’s manual in the laundromat.

How to suck at programming #D – Build a terrible web experience


You have a home grown site devoted to delivering information. Maybe this information is news-like containing important product updates or company statuses and decisions. Maybe the information is more comical like attire articles bashing celebrities. Whatever the case, your site is rather important to people on the other side of the internet. These other-side people wish to download your content using the typical web browser. Hi, I’m Cliff. You’re here because you suck at programming. I’m here because I’m not much better. Together we can all learn how to build a decent web experience by example of what not to do. That’s the general idea. Now, back to our story.

Your site begins to trickle in visitors. First there are a few in your immediate LinkedIn or Google plus circle that know you. Then there are more stragglers arriving by word of mouth. You eventually reach what you deem to be critical mass of 75 unique visitors a day! Time to beautify and monetize! You investigate and research various JavaScript magic files that offer everything from Twitter integration to animated puppies that trample paw prints across the page content as they walk. You find things that feel plug and play giving you incoming traffic analysis and other files that embed ads from 3rd party vendors. You add two to a few then sprinkle four then more. Eventually you arrive at what you decide is the perfect pages. It demonstrates your site building prowess by integrating daily polls, half-screen popup ads that engage visitors with mini games because people get bored just reading the news don’t they? The occasional spider will lower itself from the top of the screen during Halloween covering 45% of the top article and scare the bejeezus out of people who are unexacting!

Your design was originated around the now defunct Opera core engine but you have since tweaked it to sort of work with WebKit and Safari. Still you spend most of your time using FireFox and you don’t even own a Mac so what’s the point? Mobile responsive design is out the window because nobody can enjoy your interactive mini-game popups on a smaller screen! Meanwhile your site continues to pickup traction as it gets Tweeted, re-Tweeted, and shared all across social media. Your visitors continue to increase as do the number of JavaScript widgets. More visitors must mean more interactive content is necessary, shouldn’t it?

The occasional visitor that arrives from a Facebook share on mobile is stuck as your main content, the article which was linked in the share appears beneath the fold which is primarily occupied by the awesome interactive Tide commercial which is bringing in a whopping $.05 per view and making the site un-scrollable as an unnoticed side effect. It takes over 1.5 minutes to load your top banner over mobile and half of your visitors close the page since they never even see the content they visit for rendering your stat counter pointless.

If you want suck at programming, ignore the principles of minimalistic and mobile responsive design and dazzle your visitors with interactive sorcery. You’ll accumulate page hits but nobody will ever know what your site has…

Evidence of TDD in the Bible (Eph 1:4 NLT)


I read a scripture this morning which shows clear evidence that God practices some form of Test Driven Design. Bear with me as it may sound non-obvious or one huge stretch. Just read Ephesians 1:4 NLT where it says:

Even before he made the world, God loved us and chose us in Christ to be holy and without fault in his eyes.

The key phrase is Before he made the world… That is before he wrote the code of humanity he chose us. Again, this may be counter-intuitive, but think about it. He chose us… he designed who we were to be before we existed. That is, he designed our outer interface or the blueprint for who we were to be in advance of implementing us. Y’all probably think I’m playing but I don’t kid around when it comes to scripture. This particular passage strikes me in a certain way as it’s the first I’ve read that clearly paints a connection from my faith to my coding practices. I’ve always known there was a pattern between what I study at church and the how I practice development but I couldn’t put my finger it. Then this passage jumps right out of the good book and describes the connection.

No long winded rant is necessary for tonight’s post, I believe the word says enough as it is written. Think about it.

How to suck at programming #FEFE23 donate your day to a bug


It’s a holiday, everyone is partying but you got better things to do. Up early in the morning, you power on your vehicle and head to the office like the model employee you know you are. The wife queries, “Isn’t it a holiday?” to which you mumble, “I gotz deadlinez!” The looming release date of the project you’ve been working on for the past couple of months is beginning to weigh on you like last Thanksgiving’s turkey and yams. Hi, I’m Cliff. You’re here because you suck at time management. On with our story… The air around your shoulders now feels like lead and you can almost make out the text of the actual delivery date as you watch its molecules adhere to one another with each passing hour. Today will be different! You have the entire office to yourself and you will be Mr. Super Productive Programmer Guy ready to close out the 12 top Jira items in 1 heroic effort!

You arrive bright and early, and only dabble on Social media for an hour because, “hey, it’s the holiday and you gotta have some enjoyment!” Finally dismissing further distractions you power up your IDE and go to work! You finally restore the memories tucked away in the soft tissue inside your skull which originated last Friday when you came up with the terrific idea to finish your work over the holiday. “Yes, this is the issue I needed to resolve!”, you verbalize audibly knowing that nobody is in the office to witness your late morning schizophrenia.20 minutes into your effort you hit a snag which sends you off in a whirlwind of meta-problem resolution, also known as yak-shaving. Undeterred you press on, confident because you weird the most powerful IDE on the planet and no amount of yak hair will keep you from making your deadline.

Finally it bites you. The one bug that makes absolutely no sense because the source code was working entirely different just prior to your recent changes. The changes you introduced are the absolute logical equivalent of the original version of the source code. There is no way in the world the behavior should be altered. You have made what is the textbook definition of a safe refactoring yet things have dramatically stopped working! You refuse to use your debugger because everything is TDD on this project. Unit test failure after unit test failure eventually causes you to break down and add log statements, then finally use the debugger. The debugging session leaves you even more puzzled as you Google random log output and red-herring type error codes. You glance briefly out the window and the sun has grown several shades darker and you start to feel your heroic day slip into night. Hour after hour leaves you more stranded, frustrated, and confused as you throw different possible solutions into your IDE, practically reauthorizing the entire project along the way. The emulator that your app runs on mocks you with scorn, the internet feels like its laughing at your pain, you have no other recourse but to throw in the towel but you refuse to give up.

Finally you begin a round of rubber-duck (or teddy bear) debugging speaking aloud each line of source code as you step through your logic mentally. Three minutes into the ducky-debugging it becomes painfully obvious where the problem is originating! The most obvious oversight of a relative URL which should have been absolute! How could you be so blind? Why did you go through all the chaos of rewriting your entire project??? 7 extra characters is all it takes to make the original version of your modifications green bar!

Alas, the day is old and the curtain call has begun on your life as the credits begin to roll announcing the tail end of your holiday. You look at your progress and realize that you have fixed one minor insignificant bug in an area of the app that only you and the night time janitor know exists. (The janitor only know because you spend nights discussing your problems and have been stuck on this issue for months.) Hooray for you! You have devoted your entire holiday towards fixing the only feature in the entire app that does’t actually get used anymore. So if you wanna suck at programming, skip a holiday, go to work, and obsess over that one unused feature. You’ll learn more about the edge cases of the web browser in your emulator and never live to appreciate those precious 24 hours again in your life.

Where are my assets?


I have a quick post today while I work during my holiday. (I don’t want to forget this tip!) If you have an Android app that uses files from the assets folder and you want to inspect whats in the assets folder during runtime use something like the following:

activity.getAssets().list("")

This will get you a list of everything directly under the assets folder bundled with your app. Do NOT do something like this:

activity.getAssets().list("/")

…as this will get you a list of everything bundled outside the assets folder and confuse you. I did this earlier and saw the actual “assets” folder in this list so I thought I could do this:

activity.getAssets().list("assets")

…or this:

activity.getAssets().list("/assets")

Neither which gave me what I wanted. Again, the magic method call is this:

activity.getAssets().list("")

Getting stabbed by Dagger on Android


Did you read the title?It saysI got stabbed, by Dagger, on Android. The non-technical reader would assume something serious occurred followed by hospitalization. Those who know me are already wondering what the dependency injection framework I’ve come to love and how it could have any pointy edges. While I actually have physically been stabbed in the not too distant past (long embarrassing story and I don’t wanna get into it) I can assure you today’s situation does not involve anything breaking my skin. Hi, I’m Cliff. You’re here because you’ve been stabbed by Dagger. You may not need bandages or medical care but it hurts kinda bad. I’m here because I was bleeding a little while ago and I want to share my experience.

The catalyst for today’s post revolves around the suspicious error messages I was seeing from Dagger from time to time. I sort of know how to use it pretty well but when I’m in a rush I tend to make subtle mistakes that lead to even more subtle but hard to decipher error messages. These errors don’t always steer me to the source of the problem, rather they leave me with a feeling of, “that doesn’t make sense!” As Dr. House says, “When something doesn’t make sense, one of your assumptions is flawed.” (I love House!) All rambling aside, let’s get to the important part. Below I’ll list a few error messages along with what they might be trying to tell you. Remember, the best way to debug a program is to force an error early on and get used to the random messages it generates. I’m saving you a bit of time by doing some of this rework for you in Dagger.

Error:
java.lang.IllegalArgumentException: No inject registered for members/com.your.package.YourInjectedClass. You must explicitly add it to the 'injects' option in one of your modules.

at dagger.ObjectGraph$DaggerObjectGraph.getInjectableTypeBinding(ObjectGraph.java:302)
at dagger.ObjectGraph$DaggerObjectGraph.inject(ObjectGraph.java:279)
at com.your.package.YourInjectedClass.init(YourInjectedClass:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)

Cause:
You may have tried to inject a class that is not declared in the Module you’re using to do injection. For eg., if you call ObjectGraph.create(MyModule.class).inject(this); and this object does not appear in MyModule then you probably should add it to the @Module annotation like so:
@Module(library = true, injects = YourInjectedClass.class)

Error:
Compilation completed with 1 error and 0 warnings in 2s 455ms
/Users/you/src/YourProject/src/test/java/your/package/YourInjectedClass.java
Error:Error:line (37)java: your.package.someInjectedDependency could not be bound with key your.package.someInjectedDependency required by YourInjectedClass for YourInjectedClassModule

Cause:
You may be missing a providing method in our module or more likely you’ve forgotten the @Provides annotation. If YourInjectedClass decades an injected variable of type your.package.someInjectedDependency, check that your.package.someInjectedDependency is returned from some providing method and that the method includes the @Provides annotation like so:

@Provides
public someInjectedDependency providesSomeInjectedDependency() {
return new someInjectedDependency();
}

Error:
java.lang.UnsupportedOperationException: No no-args constructor on at com.your.package.YourInjectedClass$YourInjectedClassModule$$ModuleAdapter

at dagger.internal.ModuleAdapter.newModule(ModuleAdapter.java:58)
at dagger.internal.Modules.loadModules(Modules.java:41)
at dagger.ObjectGraph$DaggerObjectGraph.makeGraph(ObjectGraph.java:174)
at dagger.ObjectGraph$DaggerObjectGraph.access$000(ObjectGraph.java:138)
at dagger.ObjectGraph.create(ObjectGraph.java:129)
at com.your.package.YourInjectedClass.setUp(YourInjectedClass.java:22)

Cause:
I got this error by doing something really strange/non-standard. It just means that it cannot instantiate your Module class. In my case I had defined my module class in the same file as the class that was asking for injection but outside the class definition. (This is outside the last curly brace enclosing the contents of the class’ methods.) I then moved inside the class definition but forgot to make it a static. This caused Dagger to not be able invoke the constructor because that only works for static inner classes… if none of this makes any sense to you don’t think about. Just know that the error above means that you should check the visibility of your module class (eg. is it a private class or a public class? Does it have a public no-arg constructor? Is it in the classpath?)

There’s other weird errors I’m trying to get used to and I’ll either post here or write a new article as I discover them.

Year 1 at the worlds oldest company, GE


Earlier I tried to log into the task board at work. Y’know that board thingy that has the cards that represent the work you could’a should’a would’a done but you’re still in the middle of that other task thing that is no where on the board. Anyway, as soon as I opened the page I was greeted by an awful terrible thing… something so rotten it will keep you up in cold sweats… you’ll never look at a computer screen the same way after seeing this thing… It was the password reset screen! Hi, I’m Cliff. You’re here because your password just expired and I’m here to remind you not to use the same one over with just two characters transposed.

It’s that time of year when stock options start to vest and you begin to lose access to critical systems while mis-keying your new uncommitted to memory nonsense word that most include at least two digits, one capital letter, begin and end with a letter, and rhyme with “silver”. You must also compliment this nonsense word with random answers to common questions like, “other than pink, fuscha, green, red and yellow what is your favorite color?” and, “what is your first car which everybody remembers you driving from high school because you crashed it into a tree?” These hard to guess combinations will guarantee that everyone but you can access your sensitive accounts as you struggle to remember the proper casing for the name of the city you grew up in. (was it “Mt Holly” or “Mount Holly” or did you get totally lazy and key in “mount holly”?) A few dozen call to IT and a couple hours later and you’re right back to trying to recall your first pet’s name while setting a new gobble-gook phrase that you’re sure to remember since this time it reminds you of the lady at the grocery store that hooks you up with extra paper bags without charge the $.10 fee.

So what have I done this past year? I’ve managed to write an Android app which my team is hoping to finish and publish as part of our mobile platform. I’ve picked up the Kotlin language. (…and put it back down once I realized how over-committed my schedule became.) I learned nodeJS/TypeScript/Electron by fire. I helped to organize a mobile workshop. I helped a developer’s hangout. I’ve done several product demos. I’ve basically been Mr. Mobile Phone-pants around the office. I would say that I’ proud of my accomplishments but I don’t really feel like I’ve accomplished anything.

Overall I really love working at this company… it’s not something I thought I’d every get used to. I mean, let’s be honest… this place is not known for anything fancy like social networking or streaming video, or fancy cartoony game characters or anything. AS a matter of fact, the first thing that comes to mind when hearing or thinking of the GE brand is some sort of chore I used to try to avoid when I was younger. That said, I am blown away with how much fun I’ve had over the last 12 months. Here’s hoping the next twelve are just as exciting!