Compound interest in your career: how use the power of the environment to accelerate your professional growth

Over the last week I’ve been reading Judith Rich Harris’ The Nurture Assumption, where the author exposes the idea that children are not so much influenced by their parents as they are by their peers. Most examples Harris gives us during the book show that the environment in which children grow up is a lot more powerful in socializing them than their parents. Despite best intentions for getting children to behave in certain ways at home, the world outside and other children are the key to derive their social behaviors which might or might not impact their adult lives.

This got me thinking about a very simple observation from the workplace. Put mediocre engineers in a team of great engineers and watch them grow. Seems obvious once it’s stated like this doesn’t it? And yet how many people forget about this simple principle when applying and choosing a job?

Let me elaborate a little bit on this last rhetorical question. Imagine you’re looking for a new job and after some arduous code tests and technical interviews you finally have a couple of offers in your hand. As a software engineer you want to work with a hopefully recent and great technology (whatever that means for your particular industry and interests), get a nice salary and work on challenging products. These are the most common requirements when thinking about a job offer.

  • What technology do you guys use?
  • How much am I going to get paid?
  • What will I be working on?

These are the typical questions I hear from candidates in interviews. A surprising small number of candidates ask the question “What does your team look like and how do you work together?”.

The reason why that is surprising to me is that working in a team of great engineers who put the focus on sharing knowledge, helping others and educating the team has the same power as essentially compound interest for your career. In other words, it’s a snowball effect disguised in plain sight. Tools of Titans’ author Tim Ferriss already said that you are the average of the five people that you spend more time with. I’ll propose here that you should be using that when it’s time to choose a job.

Let’s think about this for a moment by examining each one of these questions in more detail.

If you take the job with the most recent technology does that guarantee you’ll grow your career, become smarter and get more money in the long run? Maybe. That’s the honest answer. Technologies come and go and in a software engineer’s lifetime you’ll probably end up working with dozens of programming languages, frameworks and techniques. Do you want to bet your career in Angular’s success? What about Spring? Should you be the .NET MVC guy? I’ll grant you specializing in a particular technology could allow you to surf a wave of clients and projects for as much as a decade with great return on investment, especially if you work as a consultant directly for clients, taking out agencies and other services middlemen. Bur surely you can’t be thinking in realistic terms to be using this 15 or 20 years from now and counting on it to pay your bills?

Speaking about bills, what about money? Surely you can’t be saying that I shouldn’t take the highest paying job, all other things being equal. Again, my answer will be maybe. It will depend a lot on which phase of your career you are, on your own personal goals and just responsibilities. Maybe you have a family that depends on you. Maybe you want to make a big investment in a couple of years and you need to save some cash for that. The point is, this will be a contentious answer no matter which way I put it. The reason why I’m bringing it up then is to give you an alternative view to the common position, which is just taking the highest paid offer. What about taking the offer where you’ll be working on more difficult challenges? What about taking the offer where you’ll be working with a great team? If you apply some long term thinking to this, and taking some numbers to illustrate this example, you might be refusing company’s A 50k offer to go work with company B on a 40k offer that allows you to grow at 4x the pace you would in your highest offer. Presumably you will be adding much more value in a year or two at company B that the managers will have no choice but to promote you. The worst case scenario on company A is you being tied down to a 50k+ job in 2 years time without any real options to grow from there. The worst case scenario on company B has you not being promoted by the managers, still making less money than on company A but with confidence and skills to command higher offers from other companies, should you decide to leave. Of course this is dependent on job markets, but just for the numbers themselves. Value is value, no matter what part of the globe you are and if you add value people will jump at giving you opportunities (and money to go with them).

The last of our three questions has to do with what will you be working on. This one is probably one of the most relevant for me. A good product can help you learn a lot about software architecture, design and patterns. Working with legacy code bases, while not pleasant for the most part, could provide an opportunity for relentless refactoring, assuming quality checkpoints such as automated regression testing are in place. Again, the answer here about your career growth being tied directly to the projects you work on is maybe. The project can go horribly wrong and yet you learned so much from it that you have a newfound confidence about tackling other challenges in the next project. The project can also be cruising along well and you can be working on maintenance with very little emphasis on actually improving the product. And this will have me jump straight into my last question and the one that I consider to be the most important one to ask.

Who do you think will have the better chance of becoming a great software professional in the long run, the developer who ended up working with his favorite technology, in a challenging project by himself (and making more money in the meantime) or the developer who had to learn something new from a great team that put time in to teach him and offered so much advice on how to write code, design practices and architecture that he now can teach it himself?

I truly believe it’s the second. Great teams make great software. And great teams are hard to come by, but that doesn’t mean they don’t exist and surely it doesn’t mean you can’t ask about them in a job interview. The environment around us plays a huge role in shaping everything about us. A smart coder turned loose in a team that plays along well with anybody will transform him, one can say 10x him, to use the famous 10x metaphor. Humans are a social species and as such, it’s only natural that we learn from others. I can definitely see great developers ending up in crappy (or non existent) teams, working in recent technology stacks and what it just brings them unhappiness. Unhappy developers are not productive developers. And developers that are not productive don’t learn as much, which directly translates into career stagnation.

Conclusion

Stretching to learn by yourself is a great strategy for growth but it doesn’t beat working 8 hours per day in a team that throws so much feedback and knowledge at you that by the time you realize it you are the equivalent of a veteran in your lone wolf friend’s company. Bringing it back to the idea of compound interest, your learning, your drive to excel, that is the principle. We can assume it will grow linearly throughout time. What you learn via your team, that is the interest that you get and this will grow exponentially. The key to accelerate your career growth is then, counter-intuitively, to give it to others around you and not focus on it yourself too much. Think about it the next time you’re interviewing for a job and who knows, you might just 10x yourself in a couple of years.

Irish Taxes for the Expat (Part 1)

Today I’m going to talk about what I’ve learned so far about Irish taxes. I’m sure there are plenty of nooks and crannies to explore on the subject, and I’ll provide sources for everything that I’ve found to back them, but I’ll leave readers to interpret those sources by themselves. This is my polite way to say that I won’t be held responsible if the Revenue comes for you 🙂

I’m also talking from the perspective of an expat living in Ireland, so keep that in mind. In other words, this is stuff that I would like someone to have explained to me before moving to Ireland.

Overview

The Irish tax system is very progressive. That seems to be a fact. It also seems to work pretty damn well, but this is purely based on my experiences after a few years living and working in Ireland and taking into account that I have other countries where I have lived to compare against.

PAYE

For the purposes of this post I’ll cover only the Pay As You Earn (PAYE) system, which is the traditional system under which all employees (in the sense that you are working for somebody else, usually a company that pays you a salary) earn income. There are different rules for self employed people.

The bands of tax are very simple. There is a Standard Rate of 20% and a Higher Rate of 40%. That’s it. Only two bands. Seems too good to be true right? It is. As we’ll see further down, matter get more complicated, but nothing compared to my native country I assure you.

How do you know which band you pay tax on? I mentioned earlier that the Irish are very progressive with their tax. The rules then are:

Income up to 33.800 euros -> You pay 20%

All other income above that -> You pay 40%

Some countries put the tax payers on a band according to their absolute income. For example, if you were to make 40.000 euros in income other countries would tax the whole of your income at 40% (assuming the same two bands as the Irish system), making it a not so progressive system.

So far, so good, seems pretty simple.

Consult the official Revenue documentation here.

Universal Social Charge

Universal Social Charge, or USC for short, is one of the most dreaded taxes in Ireland. Why, you might ask? Well, once upon a time, not so long ago, there was no USC. The roar of the Celtic Tiger could be heard throughout the land. But one day the Tiger fell down into a rabbit hole, of all places, and a very big one at that. Once it managed to climb back out of the hole the roar was gone and the USC was on.

How does this tax work? It’s applicable to all income and tax credits don’t have an effect on it. It’s also applicable on other things, such as benefit in kind payments. This tax has been reduced for 2016 and again for 2017. The current rate of tax are the following:

Income up to 12.012 euros -> You pay 0.5%

Income between 12.012 – 18.668 euros -> You pay 2.5%

Income between 18.668 – 70.044 euros -> You pay 5%

Income between 70.044 – 100.000 euros -> You pay 8%

Income above 100.000 -> You pay 8%*

*I believe this value is 10% for self employed. I’m not sure if this changed for 2017.

See more about the USC here.

Tax Credits

The Irish system works by using a number of Tax Credits against your income, in order to assess how much money you owe to the Revenue. The Tax Credits are essentially allowances that reduce the amount of income that is taxable. Under the PAYE system all employees are entitled to a Tax Credit worth 1.650 euros.

Another tax credit that all people are entitled is worth another 1.650 euros. From this we can deduct that the majority of employees in Ireland have at least 3.300 euros worth of tax credits.

Examples of other tax credits include dependent care, single parent or health insurance.

See more about tax credits here.

Pay Related Social Insurance

PRSI is not exactly a tax, since it’s not charged by the Revenue. It’s charged by the Irish Welfare system and the goal is to provide Social Welfare to citizens and residents. The rate for employees is 4% on all income subject to PRSI, which typically is the same as all income subject to USC.

Learn more about PRSI here.

Emergency Tax

Finally, an important note on emergency tax, which typically happens when you start working in Ireland as an expat or change jobs. Let’s imagine you land in Ireland in June and you start working. The Revenue assumes you should be paying tax since January 1st and when they see you haven’t they also assume you’ve been making the amount of your first paycheck since January 1st. This is due to the fact that they haven’t received a P45, which is a statement an employer gives an employee after the contract has finished, for tax purposes. You’re brand new so there’s no P45 in store for you! Relax, there’s a solution, and a simple one at that. Give the Revenue a ring or contact them by email and they’ll update your status. Usually this takes one or two months until solved and when it happens you’ll get all the extra money you might have payed in taxes in the beginning of your employment.

Learn more about emergency tax here.

Find here an Excel spreadsheet to help you simulate the amount of taxes you have to pay.

Debt: The First 5000 Years by David Graeber

Every once in a while I read a book that feels like opening a windows to the world, insofar as reading books about our world, presumably (can be debated, in another day) increases our knowledge of it, since apart from the oral tradition it has consistently been the best way to transfer information through the ages.

Debt is one of these books. Written by David Graeber, an anthropologist by trade, it delves into the History of Humanity and explores relationships about debt, money, slavery, war and capitalism. This is not, by any means, a light book, since it has an extensive bibliography and many notes, but the good news are that it’s very well written, to the point that I don’t feel like I’m reading a university worthy tome (it certainly is). I actually came out the other side feeling like this can probably belong on a curriculum of books that everyone should read. It’s also a book that should prove it’s value on a reread, since many of the concepts and relationships that the author uncovers will take some time to settle.

The author starts by examining the story of how debt and money came to exist. Typical assumptions have that primitive economies worked on barter and trading goods directly, and that only when this system outgrew it’s boundaries people became concerned with creating artificial instruments to carry value (i.e. money, usually in the form of coins) and when these were developed enough, more complex financial instruments such as credit and debt came to be.

Barter -> Money -> Credit -> Debt

What the author exposes is then, an inverse of the traditional story. What if the reality is that debt came at the very beginning and is the root of all economies? An example of this can be evidenced by the fact that the Bank of England, one of the first central banks in the world, came to the be after a £1.2 million loan from a group of wealthy bankers to the then King.

In a fascinating journey throughout all corners of the world, we learn about how the Abbasid Caliphate had a standing army of slaves, and how the Islamic souks could well possibly be the original free markets that libertarians today talk about. We spend some time in Medieval China too, where we learn about Buddhist monks that used financial instruments in their temples to the point that we would now call them corporations.

The author identifies periods of History which alternate between virtual and bullion currency, that is periods where systems of credit were the main currency in use and periods where gold, silver and other metals were the main currency (or backing of that currency) circulating.

These major periods of History end in 1971 with the US president Richard Nixon announcing that the US dollar will be no longer redeemable in gold, effectively dropping what had become known as the gold standard. This recent age is then a mix of what happened throughout History, with no clear conclusion on what is going to happen, but the evidence of the last 40 years stands to say that the US dollar, the de facto world currency, is again a virtual one, but this time backed by the military power of the US:

“If history holds true, an age of virtual money should mean a movement away from war, empire-building, slavery and debt peonage (waged or otherwise), and toward the creation of some sort of overarching institutions, global in scale, to protect debtors. What we have seen so far is the opposite. The new global currency is rooted in military power even more firmly than the old was. Debt peonage continues to be the main principle of recruiting labor globally: either in the literal sense, in much of East Asia or Latin America, or in the subjective sense, whereby most of those working for wages or even salaries feel that they are doing so primarily to pay off interest-bearing loans.”

It’s a frightful ending to the book, but it’s not the only conclusion. There are many more the reader should be aware of, and not all as dark as the paragraph above. It’s a great read, and one that should get better with the years.

Ireland Budget 2017 after the dust settled

October 11th was Budget day in Ireland and with it new rules to learn and explore as usual. It’s interesting to note that the fast pace of our modern world (and economy) is reflected on this. I wonder if there ever was a day when we just took for granted that we would pay the same amount of tax, social security and get the same protections. I guess in the really old days the answers would be a lot, none and none, respectively.

I like to be a bit more meticulous and so let’s see what is new for people living in Ireland in 2017. The two biggest changes are the Universal Social Charge (USC) being lowered by half a percentage point on the lower three bands and a 5% tax rebate on first time buyers of new homes.

I plan to talk more in the future about the tax system in Ireland but for now I’ll highlight only these two points.

A bigger overview can be found here.

Most of the measures introduces left most of us very skeptic, especially in matters concerning the housing market crisis that is ongoing. Allegedly, prices on new homes have already risen since the Finance Minister officially announced the measures.

Overall, the tendency of the last two years to lower taxes is continuing, despite a slowing down this year. The 2015 and 2016 budgets were arguably more generous from this point of view. Ireland is still a very progressive system and these numbers, before the Budget for 2016, show that the lowest income people pay very little to no tax, while the tax burden falls on high income earners.

Another interesting point is that according to that article, Irish high income earners (characterized as earning 75.000 euros per year) already pay more effective tax than their Swedish counterparts. I’m not too sure about this, and I would direct anybody interested in this matter to dive on their own (one of these days I’ll whip up my own research about this). What matters though is that (as fame and my own experience would have it) the Irish taxpayer doesn’t get nearly as much bang for their buck as the Swedish one. We can dig into this in another post, but scratching the surface on things such as maternity and paternity leave, childcare and healthcare leaves us in Ireland way behind the Swedes.

Finally, I’ve added an Excel spreadsheet to calculate taxes in Ireland which offer more flexibility than traditional solutions found online, such as adding bonuses, voluntary contributions to pension schemes and passive income from dividends and capital gains. You can find it here.

Why should you be financially independent?

Today I’ll approach a subject that I’ve been researching the last few months, more in depth. I’ve toyed with the notion of being financially independent in the past, not because I don’t like what I do, as I am fortunate enough to have a great job which I actually like, but essentially because I like imagining what would happen if that was ever the case. You are considered to be financially independent when you don’t depend on a fixed source of income that relies on you having to work for someone, a certain number of hours, a certain number of days, for a long period of your life, or as most people would put it, a job.

Googling returns the following quote:

Financial independence is generally used to describe the state of having sufficient personal wealth to live, without having to work actively for basic necessities. For financially independent people, their assets generate income that is greater than their expenses.

Not having a job typically frees up time. What would I do all day? I’m an avid reader, does that mean that I could read hundreds of books per year? Would I get bored after a while? Would I finally set down the laptop and write a novel? Would I build a startup worthy project? Dust off my Japanese and read up on my stockpile of manga? And the million euro question, do I even need all that time to do those things?

The answer to this last question is, most probably, no I don’t. It comes down to prioritizing your life and doing only the things that are worth doing. Having said this, having all the time in the world wouldn’t hurt. I remember reading somewhere (I forgot where) that your best work comes out when you don’t need to get paid for it. For every person the reasons will be different, but there are discernible patterns emerging among all of us:

  1. Not having to work a typical 9 to 5 job
  2. Not being tied to a physical location
  3. Ability to travel more and having more time off

Let’s examine these three points in more detail.

Not having to work a typical 9 to 5 job

Once you’re financially independent, you really don’t need to work for anybody, anymore. It doesn’t mean you can’t do it, it just means that you’ll be able to live more “on your terms”, which roughly translated can be considered being able to not take any job that doesn’t connect with you, doesn’t pay enough for the troubles it creates or just sit back and not work at all. The main point is indeed, the fact that you now have a choice. And having that choice is what most of us fight for during our lives.

Not being tied to a physical location

This one resonates with me. I’m an economic migrant and have been one for a while. Coming from Portugal, a country that doesn’t really have many opportunities for good jobs or decent pay, I have been living on and off from my country for almost 7 years at this point. Between a brief stint in California and my current life in Ireland I wouldn’t expect going back to Portugal in the near future. Having the ability then to choose where to live, is very important to me. I could go live in other countries, stay in Ireland, retire in Portugal, who knows? Even though I like Ireland I wouldn’t mind living in other countries in the future. I believe living abroad is one of toughest things you can do in your life and at the same time (as with all hard things) it’s a great opportunity for self growth and discovery. Picking up a brand new culture, new language, new friends and landscapes will enrich your life and for me it runs the risk of being an addiction and not wanting to go back to the old life in my own country. The important thing then, is that with financial independence, I will have some wiggle room on where I choose to spend my days.

Ability to travel more and having more time off

It’s no secret I love traveling. Most people like it, so  I’m not in any way special or even different. Some like going to resorts, while others are more attracted by the backpacking style of it. If you have to work a job, independent of where you are in the world, you’ll have limited time off. Some of us have it better than others, but make no mistake, with a job comes a bunch of strings attached and one of those is pretty much the limited ability of doing whatever you want with your days (otherwise known as time off). I’m not even considering the paid aspect of paid time off, as most jobs might give you the ability to take time off without being paid, but in my experience those are few or next to none. In conclusion, then, being financially independent will allow you to take control of your holiday plans, which might not even include travel, it could be just spending a few weeks of the year relaxing with your family or friends.

And there you have it. Three reasons that I suspect cover 99% of the reasons why people decide to pursue financial independence and early retirement. There are of course a myriad of other reasons, some people want to spend more time bring their children up, others do it for reasons that are more in line with their ethos, such as rejecting a consumerism life style, but those will differ for each and all of us and in reality they are secondary effects of these main reasons.

As I mentioned before, a secondary effect, if you want, of having more time off, is that you can use that time to actually just…work. Like I mentioned before, maybe there’s a side project that you always wanted to work on, or maybe there’s a passion that you want to turn to full time job and earn a living at. Once you buy that time, you can do it.

In the future I’ll talk more about the why, but mainly the what and how of financial independence, with some details that I hope my European audience finds interesting, so stay tuned!

Flash Boys by Michael Lewis

Michael Lewis is now one of my favorite authors. His style reads like water flowing freely from the Icelandic glaciers, which essentially means that I can binge read one of his books in a couple of days and feel like that I didn’t got enough of that sight. His latest effort, which I came to be aware of, originally via this article in the New York Times Magazine, a couple of years ago, is truly amazing. I believe you really need to stand out as a non fiction writer to be able to deliver this level of novel like experience to an otherwise FinTech tale. I bet if I was going to tell you the story you’d drift off into some unicorn infested land after the first thirty seconds. Instead, I’ll just state a couple of main points to draw you in.

Michael Lewis comes at this story in his fast paced style grabbing you very quickly with his rogue Brad Katsuyama, the unlikely Canadian hero that brought the high frequency trading world to the public eye. By positioning our hero as an innocent bystander that happens to walk into a broad daylight robbery in action by some shady characters, seeing himself being dragged in to the plot, even though there’s no real desire on his part to be a part of it. It’s a great premise which delivers all the way to the end with a few twists and interesting revelations in the middle.

If you’re anything like me, you are also craving good stories that have some element of software engineering on it. While Neal Stephenson and William Gibson provide some good alternatives, it feels like there’s nothing really out there apart from cyberpunk and sci-fi tales to cover for it. It’s refreshing then to see a non fiction tale that uses a few characters, real world people, that really do put technology in front, despite the dollar signs to do otherwise. I’m referring of course to Sergey Aleynikov, one of the central figures of the story and a very interesting one at that. The fact that you can actually learn something from such a good story like this one in this sense it was a surprise. The explanation of all the different types of orders and puzzles that our high frequency traders unravel was particularly interesting. It’s also interesting to note that the complexity that governs financial markets today eclipses whatever 99% of the world thinks its happening at any moment in time. Think about it this way: if you think that calculating your taxes is something that only your math wiz cousin really can do, imagining him telling you that really only his math wiz PhD third degree cousin/acquaintance who also holds a dual degree in Genetic Engineering and Statistics has some idea of, should do the trick.

Overall, you’ll feel you’re not only one step closer to understanding our world after reading this book, you’ll probably feel like you understand even less, which is fine too. If it leaves a few burning questions on your head than that’s worth your time.

One final scary thought. The book was published back in 2014, which means that whatever is happening now should be changing a lot faster and be a tidy bit more complex.

Happy readings.

 

How to create a blog using GitHub Pages and JBake

Recently I was looking into creating a blog in order to write down some thoughts. In looking for simple ways to create one, but being a bit more technical than the average user, I started by discarding Blogger, WordPress, Medium and the like. I wanted to keep content under my control (let’s pretend for a second that GitHub is under my control) and still have a workflow that allows me to write, save and publish with simplicity and flexibility.

As a software engineer, a very simple solution that I found is using Git, which I already use on a daily basis for development work.

So without further ado let’s get started with the details of what we need to get writing and publishing.

GitHub Pages setup

The first step is creating a regular GitHub account. There is nothing fancy here and I will not go into any details on how to do this, although it should be pretty straightforward.

Once you have your repository created you should install Git locally in your machine. It’s worth mentioning that the repository name must obey the rule username.github.io where username is your username on GitHub.

After you have Git locally set up you can clone the repository by copying the clone URL of your repository GitHub page and using it on your terminal.

$ git clone https://github.com/jdmartinho/jdmartinho.github.io.git

For user repositories GitHub Pages requires that you put your site in the master branch. For project repositories, you should use the gh-pages branch. For the remainder of this article, we’ll assume we’re interested in creating a page for the user and so we’ll use the master branch.

GitHub Pages will pick up whatever content you have in the master branch and it will serve it in the **http://username.github.io** URL. This means that if you just add a simple HTML document to your repository, you instantly get a page on that URL. Despite not being extremely interesting it’s a start.

Domain setup

If you have a domain name bought and paid for you can use it to point to your new page with some more configuration steps that I’ll explain now.

You’ll need access to your hosting provider (e.g. GoDaddy) typically to your control panel like cPanel or a custom interface. Here you need to add a CNAME or A record, depending on your goal.

The first step is creating a file called CNAME and adding it to the root of our repository. On this file, the only thing we need to add is the domain name we’ll be using to access this site, for instance jdmartinho.com.

After having this file in place in the repository, we go to our hosting provider control panel and we look for the option to zone records or alias. Here we’ll add a CNAME record with jdmartinho.github.io pointing to the subdomain that we want to use like www.jdmartinho.com or blog.jdmartinho.com. If we want to use the actual top level domain we’ll need to add an A or ALIAS record for jdmartinho.com to 192.30.252.153 and another A record also for jdmartinho.com to 192.30.252.154. These IP addresses belong to GitHub and are subject to change (they have changed in the past). Typically GitHub help will contain articles on the latest IP addresses that you should use so check here for the latest news on this.

You can quickly check that the domain is correctly set up by running the dig command online here. You should see something like this:

www.jdmartinho.com.    14399    IN    CNAME    jdmartinho.com.
jdmartinho.com.        14399    IN    A    192.30.252.153
jdmartinho.com.        14399    IN    A    192.30.252.154

JBake setup

JBake is a great project that takes the Jekyll static site generator and brings it to the JVM world via Java. JBake allows us to edit pages using HTML, Markdown or AsciiDoc, process these pages with templates defined using Freemarker, Groovy or Thymeleaf and style them using CSS frameworks such as Bootstrap or Foundation.

Jekyll is what GitHub Pages actually uses behind the scenes to serve the content that you are uploading to the repository. If you want to use Jekyll locally you’ll have to install Ruby and RubyGems. In order to use JBake you’ll just need Java 6+ and since I’m quite lazy and I happen to use a Java/JVM environment on a daily basis I decided to give it a try.

We’ll start by going to the JBake website and downloading the latest release. Unpack the zip to a location of your choice and add that location to your Path environment variable so that we can launch JBake from any location.

Now let’s take a look at the structure of the site with JBake. I’m borrowing the structure from the official documentation to exemplify:

.
|-- assets
|   |-- favicon.gif
|   |-- robots.txt
|   |-- img
|   |   |-- logo.png
|   |-- js
|   |   |-- custom.js
|   |-- css
|   |-- style.css
|
|-- content
|   |-- about.html
|   |-- 2013
|   |-- 01
|   |   |-- hello-world.html
|   |-- 02
|   |-- weekly-links-1.ad
|   |-- weekly-links-2.md
|
|-- templates
|   |-- index.ftl
|   |-- page.ftl
|   |-- post.ftl
|   |-- feed.ftl
|
|-- jbake.properties

On the assets directory, we have the typical static files that we’ll need to load the pages, such as CSS, JavaScript and image files. Usually, we’ll edit this folder once at the beginning and then let it be unless we’re adding a new JavaScript library or editing our CSS in order to get a new look on the site.

On the content directory is where we will keep our data that will be used by JBake to craft the site. This is where we put our HTML, Markdown or AsciiDocs, which means this is where we’ll spend most of the time after our initial setup. After all, the whole point of this is getting us to write more and spend less time fiddling with the process of publishing.

On the templates directory, we keep the template files to edit with the language of our choice. Below I have a simple example in Freemarker for the post page that comes with JBake.

<#include "header.ftl">    
    <#include "menu.ftl">    
    <div class="page-header">
        <h1><#escape x as x?xml>${content.title}</#escape></h1>
    </div>
    <p><em>${content.date?string("dd MMMM yyyy")}</em></p>
    <p>${content.body}</p>
    <hr />    
<#include "footer.ftl">

We can easily create an example site by issuing the command

$jbake -i

It’s very useful to run this command the first time as it will provide us with the structure that we can then adapt to our needs. Finally when we have some content and we are ready to generate the site we can do

$jbake -b . blog

This will generate the site from the root of the repository and put it into the blog directory. Bear in mind that the blog directory will be overwritten by this. An easy way to bypass having to issue this command to generate the site with the source and output directories is to configure the default in jbake.properties such as

destination.folder=blog

Having configured this, we can just do $jbake -b from our root directory.

Workflow

Now that we have the site structure in place a typical workflow for me goes like this:

  • Pull the latest code available because I’ll use multiple laptops to work on. I’ll do this with $git pull origin master or any other branch name that you might be working on.
  • Navigate to my content directory and create a new file for a new blog post. This usually takes the form of year-month-day-post-name and I’ll usually write in Markdown which is starting to become ubiquitous.
  • Save the work on and commit it with git commit -m "My message.".
  • If it’s a work in progress then we have two choices: either I’ll push the commit to a branch different than master and later when it’s finished I’ll merge that branch or I’ll push it to master now but I’ll keep the header options of the post as status=draft. In the latter, I’ll then change the status to status=published when I’m done with the blog post so that JBake will pick it and publish it.
  • Run the $jbake -b command, pushing the content to the remote repository and see it published.

Here are the links for the official documentation. Go explore!

JBake Documentation – http://jbake.org/docs/

Freemarker Manual – http://freemarker.org/docs/index.html