There are times when you are coding that you are not sure what you writing can be done. Oh, sure most anything can be done if you sit down and look at it logically and have enough hardware and time. What I mean is you have not seen it done before so it feels harder. It is easier to give up and work on something else.
But what if you have seen it done before? A really cool transition effect on a mobile device, a pop-up menu on a double tap of a row, fragments that work differently between a phone and a tablet in a unique manner, etc. You know it can be done, you have seen it running on similar hardware to what you have, now duplicating it is a challenge.
Same thing goes when you have written similar code in the past at maybe another job. You don't have access to that source code but you know you basically wrote the same thing before. Again you have a programming challenge instead of a "how the heck can this even be done" task.
I ran into this again today as I was converting code from straight activities to ActionBarSherlock fragments. Everything I was doing I had solved in some manner in the past. I totally knew it could be done so even when it was not working I knew it was because I had done something stupid. My frustration level was pretty low. I did get stuck on one issue but a lunch break and trying to word a question mentally for a web search triggered a new thought showing where I had messed up.
If you are writing a new piece of functionality and it is not working you are unsure if you totally screwed up or if there is a limitation of the SDK or language you are butting up against. Of course you don't want to blame yourself so you start looking for things that are wrong with the API especially if you are new to this framework. You tend to get frustrated quicker and the frustration will be deeper. "This just can't be done" you tell yourself. "There must be a bug in the SDK" rolls through your mind.
Grabbing at straws comes into play. Move it to another thread, yeah that's it. Change the order you call things, that'll fix it! Try a 3rd party API or another widget, the one I first picked must be a steaming pile even though it was the highest rated one on Stack Overflow. This stupid thing has got to work, ain't nobody got time for that.
Finally you solve the problem. Turns out you were at fault the whole time. You were on the right track but you thought the range was 1.0f to 0.0f when it was 0 to 100. You found an obscure post on the web and you spotted the author passing 75. The API is fine, in fact once you stopped cussing at it there are some really cool features it has that you hadn't gotten a chance to use yet.
Programming is a really weird occupation. You spend a good part of the day dealing with the unknown, trying to pull something off you think can happen but maybe can not. Some days you are writing code nearly from memory just humming right along. You have done something similar and this is nearly a no brainer. Just create some objects and parse some JSON, easy peasy.
Other days you are trying something totally new. You have to integrate a third party pie chart widget. You barely know where to start. You spend some time pouring over documentation so hopefully it works the first time. You find some example code and pull it off the web. Do you start a test app? Do you try to drop it into the existing app? Is all the example code in fragments and you are using activities? Can't I just find an exact example of what I am doing? Of course not, the chance of someone else doing the exact same thing you are doing is really low. Heck if everyone needed it then it probably resides in the base language, one of its core libraries or somewhere in the SDK.
The best we can do it post things we figured out to our blog or answering questions on blogs or Stack Overflow. Let others learn from our experiences. Coding should be about solving specific issues for a company not constantly reinventing everything. Grab as much code as you can from other projects you have done, other websites and the SDK itself.