My New Mini Project – Automating My Grocery Shop

I’ve thought for a while now that it’s time for me to create my own app, if for no other reason than to prove to myself I could do it. I’ve been working on a couple of things with a couple of friends/colleagues but due to limited time, and the fact that they’re quite large projects, progress has been slow.

I started work on a small app to help me with my fortnightly grocery shops (because seriously what is more boring than supermarket shopping?!) I’ve been getting into a routine where I create a meal plan for the next two weeks, look through my recipes and stick the list of ingredients I’ll need into a supermarket’s website to get it delivered. In fairness, this isn’t that bad but I thought, why not automate the aggregation of ingredients? There’s no reason for me to spend time doing that mind-numbingly boring job! And there’s the premise of my new app – it looks at all files which I drop into a “meal plan” directory, and spits out a shopping list (version 1.0). I copy and paste that into a supermarket website and (manually) select the best looking product in that category (who knew there were so many different brands of salt?!)

The exercise proved useful in a number of ways:

  • My next online shop will be done in record time!
  • Along the way, I had to make definite decisions about how to design my code, which classes should house which logic and where the responsibility for certain behaviour lies. More on this later.
  • I had to think from the user’s perspective for my code. Even though currently the app has just one user (me), the requirements still evolved as I developed it and are continuing to do so! Examples:
    1. a few recipes required a pinch of turmeric, and 1 tsp of chilli powder. Both these spices have certain qualities that make including these in a shopping list questionable – they don’t really go off, and are sold in quantities larger than pinches or teaspoonfuls – so I usually have adequate supply at home. Maybe it’d be a better idea, instead of having to remove them (and others like them) manually from the list every week, to classify them separately and not include them in the final list.
    2. I also buy meat from a halal butcher rather than my local supermarket, so maybe I should enhance it slightly to have a separate list depending on where the item will be sourced from.
  • Eventually this sort of thing may be useful for others, and so the implementation had to be done in a way that those who are slightly less tech-savvy can still run it.
  • I learned how to use the gradle shadow plugin to create a fat jar housing my app and all its dependencies. So eventually, my mum’s next online shop will also be done in record time!
  • I actually just got more familiar with gradle as a whole. Many times my build didn’t work because I was missing a dependency, or because something in my gradle configuration wasn’t quite right.
  • I feel a sense of accomplishment because for the first time I have taken something from nothing to working, myself. I spoke to people about decisions I made along the way, and sought advice where needed but this was MY idea which I brought to fruition. And that’s valuable. Sure, it may not be the prettiest code one has ever seen (in fact, having finished it only yesterday I can already think of improvements I can make), but I did it, and it fulfils the first rule of good software – it works!

I’ll use the next couple of posts to document some of my thought processes as I developed the app, as well as to write up descriptions of some new concepts I came across:

The link to the project is here:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s