Visualising your code as a city

I was looking at visualising some code recently and came across CodeCity. It’s somewhat useful and quite interesting, but getting it to work is not as simple as it once was…

This is because CodeCity uses the Famix 2.1 model to visualise your code, and very few of the tools referenced on the CodeCity website and most other blog posts are still available.

I did however find this useful blog post that highlights one tool still available: Analyzing a Java Codebase with CodeCity in 2016

Essentially, you need to download CodeCity and iPlasma.

iPlasma ScreenshotThen you use iPlasma’s Swing interface to import your codebase and then generate a Famix model of your code (This takes a while). After all this you end up with a rather strange looking screen from where you can run the “Moose MSE exporter” tool.

This finally gives you a Famix 2.1 model which you can import into CodeCity and (after some more waiting) generate a city visualising your code.

I found that this works fairly well, however some of my classes seems to be missing from the visualisation (Some big god objects), and I haven’t been able to figure out why yet.

Still, it’s an interesting way to look at your code. It also let’s you generate visualisations of multiple versions of your code and show you how the “city” evolved.

My style guides

After starting to work on an Android project that has a lot of inconsistent styles all over the codebase, I decided to finally document what I consider to be the right style for Java and Android.

You can see them on my Github repo:

I’ve also exported my Android studio ‘Code styles’ and ‘Inspections’ to this repo. This is an attempt to get Android Studio to format our code according to these style guides.

By using the same ‘Code style’ settings across the team, we can get Android Studio to enforce the consistency for us.

You should be able to just run the Install.sh script to copy them to your user folders (or just copy the contents of the config manually if you prefer that).

Android Studio tips – Mouseless development

I heard somebody making the comment that you can tell an expert by the mastery of their tools. Since I’m a developer (and a pretty good one), I figured it’s time to put in some more effort to master my tools (IDE, VCS, etc).

To this end, I’ve been stalking Hadi Hariri (http://hadihariri.com/) for the last few weeks and a couple of things he published has really resonated with me.

My Android Studio setupThe first was an article called No tabs in IntelliJ IDEA, which covers what you would expect – How to use IntelliJ IDEA without tabs. I wrote about my setup based on this here: My Android Studio setup.

This set me on a quest to use my mouse less, which eventually led me to Hadi’s Mouseless Driven Development talk, which is beyond awesome.

These 2 pieces of content has made me both more productive and happier (With my RSI, using a mouse is literally painful).

If you want to be a better developer, ditch the mouse.

Live smarter, not harder

I’ve written about Buffer’s values previously and the fact that I find them pretty inspiring.

One of the values I’ve been thinking about a lot lately is “Live smarter, not harder” and how that applies to me.

According to buffer’s highlights:

  • You value waking up fresh over working that extra hour
  • You always aim to be fully engaged in an activity, or resting
  • You single task your way through the day
  • You are at the top of your game, as you focus on expanding capacity of your mental, physical, emotional and spiritual energy
  • You choose to be at the single place on Earth where you are the happiest and most productive, and you are not afraid to find out where that is

We are working on the last point (finding out where our happiest and most productive place is), but other than that, I’ve been trying to work on my work / life balance, getting more sleep and being focused on one thing at a time.

My average number of hours asleep has slowly been creeping up from about 6 hours a night to 7 hours a night. I think about 7:30 would be good for me, so some work left there.

I’ve also worked hard to not try to multi-task at work and to be fully engaged in an activity at home. I used to try to do other things while watching TV and as a result never really stopped working. I’ve managed to get this right pretty well.

As I mentioned in my 2016 goals post, I was horrified to find out that last year I worked well over 400 hours of overtime… Apart from one crazy ambitious project where I put in about 120 hours of overtime over a period of 3 months, this snuck up on me.

Luckily, this is pretty simple to fix – Just don’t do it 🙂 While this isn’t always easy, just being aware of my tendency to work lots of overtime hours has made a big difference.

I’ve also been working at being more efficient. Less multi-tasking and a better setup has made a big difference. I focused on cutting out mouse usage as much as possible by figuring out a better IDE setup and I’ve upgraded laptop (another 8GB RAM and an SSD) which have had massive improvements on both my productivity and my RSI.

In a nutshell, while there is definitely a lot more improvement to be made, I’ve made huge strides in working smarter, not harder, and it’s had a definite positive impact in what has been a difficult period.

2016 Goals

I’ve previously written about how much I dislike new years resolutions. This is mainly because people usually make what I refer to as new years wishes: I want to have more money, I want to be more fit, I want to be less fat, etc..

Because these things are usually not specific enough, actionable or measurable, they get abandoned and usually wished for on the next new years day again.

monkey-year_3551486aHaving said that, having goals is a useful, so I figured I’d write down some of mine. Because of the horrific start to the year we’ve had, we decided to go with the Chinese new year, so my 2016 will only start next Monday.

My goals are roughly broken up into work related stuff, personal improvement, experiences I’d like to have and things I’d like to do.

There’s a lot here and some of these are not specific enough, but I’m going to treat this as an initial dump from which I can refine actionable items over the next week or two.

Family:

Spend more time doing meaningful things with my family.

  • Sunday breakfast: Have a skottel breakfast with my family every Sunday.
  • Spend time with Lucas every day: Spend at least 30 minutes every day doing something of his choosing with Lucas.

Work / Career:

From a work and financial perspective, I’m pretty happy with where I am. Some good decisions, cutting expenses, negotiating a bigger raise and some circumstances outside my control has conspired to make us pretty financially comfortable.

My main focus this year will be on figuring out a better work-life balance and addressing my RSI. Both of these were negatively impacted by the amount of overtime I worked… I just did a quick calculation and was astonished to find that I worked around 450 hours overtime (unpaid) last year

Some goals I am actively working towards:

  • Working less overtime: Last year, on average I work more than 8 hours overtime every week. This equates to working about 2 and a half months extra over the year! This is unpaid time that I could have spent with my family. My goal is to work only 40 – 45 hours a week.
  • Setting up a better workspace: I’ve been suffering with RSI for about 5 years now, and in the last year I did not pay enough attention to it. It is perfectly manageable if I pay attention to my setup and posture, take enough breaks and use the right keyboard / mouse.
  • Become better known in the Android community: I plan on doing this by talking at a couple of conferences during the year and blogging at least twice a month. I’m also trying to be more active on social media.

Travel:

  • At least 1 international trip this year. Probably to Australia around mid-year.
  • At least one camping trip per quarter. The first one will be to the Clarens beer fest at the end of the month 🙂

Self improvement:

The two main items I want to focus on is fitness and health.

  • Lose weight: I’m currently nearly 20kg overweight, so I need to lose some of that. I’ve been focusing on eating better, by making small changes. I’ve tried to have less refined carbs (especially bread), but the main thing I’ve done is to make sure that I have a breakfast with some  protein and no refined carbs every week day. Doing this, I’m losing about half a kilo a week.
  • Eat better: I’m trying to eat supper without any refined carbs 6 days a week. This is very much a work in progress…
  • Exercise more: I’ve already upped my average daily step count from about 5000 steps to 8000 steps. The next step is to go cycling once a week. No matter where, how long, how fast – To start with, I just need to leave my yard on my bike once a week.
  • Make time for mindfulness and reflection: I’m trying to be more present and to spend some time reflecting on what’s working and what needs improvement. To this end, the plan is to start a 5-minute journal.

Experiences:

Experiences I want to have this year. Some of these will be alone, some with my family and some with friends.

  • Knife making / Blacksmithing
  • Glass blowing: Start with 4-hour taster and take it from there
  • Survival courses: Boswa offers everything from half day intro’s to weekend long extreme survival experiences
  • Archery: Do an intro class and then probably sign up for monthly membership.
  • Scuba diving: Go on at least 1 dive this year.
  • Learn to play guitar: I’ve enjoyed Rocksmith – Just need to make the time to play more. Maybe try to find 15-30 minutes every second night.