Thursday, January 21, 2016

About good practices and mistakes

As I'm not new to software development in general, I have certain personal preferences already. For example, I think it's very important to follow what are known as good practices in whichever language I'm writing on. And that is kind of hard to know at first, when you are learning, and it just intensifies if you're learning alone as I'm doing now with Android.

This is because one of the most important (and often underrated) uses of code review, in my opinion, is the transmission of best practices knowledge. With experience, you learn to write better and cleaner code. You learn to tackle common problems with tried and true strategies, but that takes time, coding, failing and corrections.


What did I try to alleviate this issue?


First, I asked around. I reached out to my good friend +Santiago Alvarez who is a professional Android Developer to ask him to take a quick look at my code and poor styling. He gave me a few suggestions and recommended me some good reads. What a great guy.

Second, I used Google, of course!


What to search for?


That's almost always the question. Google knows a lot and will tell you about it, if you ask the right questions.

Do you know what do mistakes and solutions have alike? Chances are you're not the first one to find out about them.

I searched for mistakes most beginners do. This allows me to learn about them, and avoid repetition, possibly annoying a more experienced developer who happens to come across my code in the future (that could even be my future self!).


I was glad I found some "Top 5~10 mistakes" lists. Some entries were similar through the lists, some of them were unique. I think I've learned around 11 or 12 common mistakes. Some of them a bit obvious (write clean, modular code, etc.), some others I did not even have a clue they were problems yet! (don't grab the UI thread, be careful with the weight attribute in a LinearLayout that has to be calculated all the time, even when overwritten, be careful with the LinearLayout nesting instead of using GridLayout when making big grids, etc.). That felt really good, because it felt as if I've "saved time" or "made progress" already. Hope that's rewarded in the future.

And what about good practices?


Well, that's another thing I asked my friend Santi about when I saw that my first pieces of code in the Android world were crappy, to say the least. Everything welded together, little to no modular things, etc. The answer was what I expected it to be: it depends. It depends on who you're working for, who teaches you, who reviews your code. There are almost as many standards as there are developers, but that's not an Android exclusive, so I already knew that.

He recommended me to check out the MVP approach on Android, at least to start somewhere. From there I can continue my way and see where I find myself more comfortable.

I'm still very new at this and have a lot to learn. I'm now focusing on Java core details that I vaguely remembered (or didn't even know), and how to make a UI that does not suck a lot, given that I'm no designer (actually, I'm far from it). I found out that the official Material Design guidelines are quite complete (a very long read), but I think it's better to invest that time now than having to redo entire applications.

Tuesday, January 12, 2016

Learning within a team vs. learning alone

I have worked in teams for more than two years. This might not seem like a lot, but given that a lot of that time was spent learning new stuff from scratch, it's enough for me to notice some core differences between doing that alone and when within a team. Now I'm learning Android programming on my own. How do I find both of these learning situations?


Perks of being in a team


When you work in a team, you most certainly work with people that know more than you in some areas, and less than you in some others. You can learn a lot from your teammates, both the ones that tackle the same problems as you (or at least, within the same problem domain) and the rest.

You can learn about stuff that they have encountered that you never thought about. They can give you an idea or a first approach to a problem they have previously solved and you're attacking for the first time. Maybe you can learn about tools that they have used for specific cases and you may end up finding useful some months down the road. You can even have them look at your code and review it from a different perspective than the one you're used to in your team.

What about learning alone?


Learning alone is a whole different thing. You get to investigate a lot more. You get a lot of new information that may or may not be relevant for your specific goal. You may end up reading a lot more than you need, just because you don't know exactly what to read or how to find it.

That's not necessarily bad, though. You end up having a broader view of a lot of things. You "know" about more topics, even if not thoroughly, you have more "a-ha" moments when looking for a tool or specific way of doing things, when you remember you've read about it somewhere or about something that might help you with your current task. With enough time, you learn how to learn alone too, because you know where to look for the specific stuff you need to learn about.


So? What's best?


Neither. They both have advantages and disadvantages as I've stated before. It all comes down to what you need, what you are doing, and who you are doing that with.

Being in a team or having someone who you can ask about stuff helps a lot when you need to get things done quickly.

Figuring it on your own makes you spend more time learning stuff, both necessary for the specific task you have to do at the time, and more collateral stuff, which is also good too, given it might not help you inmediately today, but maybe it will speed things up for you down the road.

Thursday, January 7, 2016

Android Tinkerer - Third time's a charm?

Today is January 7, 2016 and it's the third time I "learn" Android programming. "Why the third?" you might ask. I'll tell you, but first I'll tell you some of my background.

Where I come from:


As many might know, I have been an Android tinkerer since... well... since I've got my first Android powered phone: the Motorola Milestone (aka. Motorola Droid. The original sliding-keyboard one). If I remember correctly, that was also the first successful Android device ever (I mean, there was the Google G1 before it, and some more I guess, but I consider this one the first mainstream Android phone).

And when I say tinkerer, I mean to someone who does not settle for the stock phone they receive when they buy it. I started walking the dark halls of the custom ROMs and kernels world and loved it. The main difference I see from that era to where we are today, is that the performance improvement was evident.

What I want to say with this is that today most phones perform well enough. You can see a difference in synthetic benchmark numbers or when comparing side to side, but apart from an occasional stutter and such, they aren't horrible.

That was not the case back in the day (ha! I feel so old!). I remember being very happy when I could overclock my Milestone from a clock speed of 600 MHz to 800 MHz and the improvement was very noticeable (or an awesome placebo :P).

But I'm deviating from the main topic here. What I wanted you to know is that even though I'm not an experienced Android developer (yet), I've been an experienced Android enthusiast for 5 full years now, and I intend to have that same enthusiasm and experience in Android development. What brings me to...

Third time's a charm?


This is how I started this post, and I'll tell you why this happened.

Today is the third time I start learning Android development. The first time was at my university, as an elective subject called Mobile Computing. This was supposed to be a course that explained the basis of mobile computing and it's special characteristics against regular desktop computing, but kinda wasn't the case. Instead, it was like a big "how to program Android" course. It was fun and entertaining, and I think I learned quite a bit, but it's not what I hoped.

In this course, I learned the basics of Android programming, some within the course, some by my own interest and reading, and did with a couple of classmates a "Taxi calling app" (this was all before Uber and that kind of services, but I learned later that it wasn't that new of an idea either).

It was fun to program and try, but it was a toy app. What happened later is that we presented the app, passed the subject and it died there. I never touched that app again.

Many months later, I enrolled in a Udacity course by Google called Developing Android Apps (so original!) and completed it. That was the second time I started learning Android, because my first try was so soft that I didn't remember much, and also, this app was a bit more complex and well done, so I ended knowing quite a bit more (how to interact with sensors, an external API and such things). But again, that was in the middle of 2014.

Now we are in January 2016 and again, everything I knew is kinda gone. I started following the official Building Your First App tutorial by Google and that concludes my third time of learning Android programming, and I intend it to be the last.

I want this to be the start of some more serious development, by dedicating more time to it, be it coding, reading docs, tutorials or videos. My main goal is to get my first app published in the Play Store as soon as possible, and see where this goes from there.

As they say, third time's a charm. Will this be it? I certainly hope so!