<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Luke Benstead</title>
    <description>The latest articles on Forem by Luke Benstead (@kazade).</description>
    <link>https://forem.com/kazade</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F381312%2Fb943d571-d036-49b2-bc7d-3b8be0ee9638.png</url>
      <title>Forem: Luke Benstead</title>
      <link>https://forem.com/kazade</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/kazade"/>
    <language>en</language>
    <item>
      <title>Using Google Cloud Firestore with Django's ORM</title>
      <dc:creator>Luke Benstead</dc:creator>
      <pubDate>Mon, 20 May 2024 14:34:06 +0000</pubDate>
      <link>https://forem.com/akqa_leap/using-google-cloud-firestore-with-djangos-orm-2fin</link>
      <guid>https://forem.com/akqa_leap/using-google-cloud-firestore-with-djangos-orm-2fin</guid>
      <description>&lt;p&gt;&lt;a href="https://www.djangoproject.com/" rel="noopener noreferrer"&gt;Django&lt;/a&gt; has long been the most popular Python framework for developing web applications. One of its most powerful features is its built in object-relational mapper (ORM) which is designed to flexibly and safely interact with SQL databases in an abstract way.&lt;/p&gt;

&lt;p&gt;A long time ago, a fork of Django called “Django-nonrel” experimented with the idea of using Django’s ORM with a non-relational database; what was then called the App Engine Datastore, but is now known as &lt;a href="https://cloud.google.com/datastore/" rel="noopener noreferrer"&gt;Google Cloud Datastore&lt;/a&gt; (or technically, Google Cloud Firestore in Datastore Mode). Since then a more recent project called "&lt;a href="https://pypi.org/project/django-gcloud-connectors/" rel="noopener noreferrer"&gt;django-gcloud-connectors&lt;/a&gt;" has been developed by &lt;a href="https://p.ota.to/" rel="noopener noreferrer"&gt;Potato&lt;/a&gt; to allow seamless ORM integration with Google Cloud Datastore. &lt;/p&gt;

&lt;p&gt;The intention was always to expand that functionality to other Google hosted no-SQL databases, and today &lt;strong&gt;I’m pleased to announce that &lt;a href="https://pypi.org/project/django-gcloud-connectors/1.2.0/" rel="noopener noreferrer"&gt;django-gcloud-connectors now has support&lt;/a&gt; for &lt;a href="https://cloud.google.com/firestore/" rel="noopener noreferrer"&gt;Google Cloud Firestore in Native Mode&lt;/a&gt;.&lt;/strong&gt; This means you can now build a robust Django-powered website or API driven from a Firestore database which could for example be shared with your Firebase backed mobile application.&lt;/p&gt;

&lt;p&gt;It might seem that using Django’s &lt;strong&gt;relational&lt;/strong&gt; mapper on a &lt;strong&gt;non-relational&lt;/strong&gt; database would be like forcing a square peg into a round hole - but it turns out that the Django ORM works quite elegantly with a non-relational database, and gives you the tools you need to build reusable patterns to get the most out of a massively scalable database.&lt;/p&gt;

&lt;p&gt;Take for example the schemaless nature of a non-rel database like Cloud Datastore which allows each document to have different properties to the other documents in the same table; while powerful, in practice you generally need a schema to write code against and to ensure that your data remains consistent. Django’s model structure allows you to maintain a schema (with validation) that can change over time. You can leverage model signals, field defaults or request middleware to migrate data on the fly, without the need for running potentially slow or disruptive database migrations. You hardly need to worry about the database at all while developing, simply add a new model or field in your code and use it. Django with a non-relational database is great for rapid prototyping.&lt;/p&gt;

&lt;p&gt;There are limitations of course; non-relational databases don’t do complex queries - you can’t perform joins; you can have foreign keys, but you can’t fetch or order across those relations in one database query; you can have many-to-many relationships, but not with Django’s ManyToManyField (you need to use a custom list field instead). You might just find some queries are impossible.&lt;/p&gt;

&lt;p&gt;These limitations mean you have to solve problems in a slightly different way. You’ll find you’ll design your models around the queries you need to make; you’ll sometimes have to pre-calculate things when you save a document to make it possible to quickly query for it later, or perhaps use other services like Big Query or background task processing. &lt;/p&gt;

&lt;p&gt;But you can almost always assume that once your code works, it’ll scale well no matter how much data you throw at it; there’s no risk of running an unindexed query on a million rows, or having to think about database replication or sharding. You can rapidly build a product for a startup and know that things will just ramp up when it hits the big time.&lt;/p&gt;

&lt;p&gt;I highly recommend you give it a try, simply follow the instructions in the &lt;a href="https://gitlab.com/potato-oss/google-cloud/django-gcloud-connectors/" rel="noopener noreferrer"&gt;django-gcloud-connectors repository&lt;/a&gt; and you’ll be up and running in no time. If you’re hosting on Google App Engine you might also be interested in the Djangae project which provides useful utilities and Django apps to integrate with Google Cloud services.&lt;/p&gt;

</description>
      <category>django</category>
      <category>webdev</category>
      <category>googlecloud</category>
      <category>firestore</category>
    </item>
    <item>
      <title>How Potato Code Remotely</title>
      <dc:creator>Luke Benstead</dc:creator>
      <pubDate>Thu, 21 May 2020 08:17:15 +0000</pubDate>
      <link>https://forem.com/akqa_leap/how-potato-code-remotely-557f</link>
      <guid>https://forem.com/akqa_leap/how-potato-code-remotely-557f</guid>
      <description>&lt;p&gt;At the time of writing, we’re in the middle of the COVID-19 lockdown. As with most other companies, the lockdown has required us at &lt;a href="https://p.ota.to/" rel="noopener noreferrer"&gt;Potato&lt;/a&gt; to rapidly change the way we work day-to-day. We’re a tech company, so that has given us a big advantage in this rapid and unsettling change of routine. But as a company, we’ve historically encouraged our engineers to travel into our central London office most of the time. Working from home has always been a perk at Potato, but never the default position.&lt;/p&gt;

&lt;p&gt;Fortunately we’ve been unintentionally preparing for this day by making the right choice of tools. In this post I hope to give an overview of our toolset, and how it’s allowed us to continue to operate as normal.&lt;/p&gt;

&lt;h1&gt;
  
  
  Cloud-First
&lt;/h1&gt;

&lt;p&gt;Right from the beginning of Potato, we’ve always pushed to use tools that are hosted by others. We’ve never wanted to spend our time being sysadmins, and we’ve always resisted the urge to host anything inside our offices. We wanted all of our stuff to be available anywhere, from any platform. In the past the option of running a VPN, and hosting software internally has come up, but we’ve steadfastly refused the temptation to do so - the risk of losing access, of having to maintain it, and of a single point of failure (what if the office burned down?!) were all reasons to avoid it.&lt;/p&gt;

&lt;p&gt;Also, we wanted to make sure that any of our Engineers could deploy any of our projects from anywhere with an Internet connection. In the past we’ve deployed from trains, planes, pubs, and on one occasion a long while back - a locked bathroom (long story!).&lt;/p&gt;

&lt;p&gt;Finally, if anyone ever had their laptop stolen out of the back of a van while climbing (true story), nothing would be lost if everything is saved online.&lt;/p&gt;

&lt;p&gt;For this reason, (along with our Google history) we’ve based all of our internal systems on Google’s GSuite. Potato runs on Google Docs, Sheets, Calendar and of course Gmail. This has given us access to everything from anywhere, and the decision to base everything around GSuite has allowed us to continue working seamlessly despite now all being remote.&lt;/p&gt;

&lt;h1&gt;
  
  
  Slack / Google Meet
&lt;/h1&gt;

&lt;p&gt;For communication, we’ve been long-time users of Slack, (although before this we were pretty sold on Hipchat). As it’s cloud-based we’ve just continued messaging as normal without disruption (though probably making a bit more use of threads to keep things organised).&lt;/p&gt;

&lt;p&gt;For video calls we’ve always used Google Meet (previously Hangouts). The number of ad-hoc catch-ups has increased, and we hold daily drop-in sessions for people who just want a bit of socialising. On Fridays we’ve rebooted our traditional TPIF (Thank Potato It’s Friday) into a virtual mass video call, armed with beverages of choice and reams of friendly banter!&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a href="https://www.gitlab.com" rel="noopener noreferrer"&gt;GitLab&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;A couple of years ago we moved all of our development over to GitLab. The intention was to bring all of our end-to-end product development life-cycle under one tool. Although we had the option of hosting GitLab ourselves, using GitLab.com’s hosting has saved us the overhead of managing it, and of course it means that our project management tools are available from anywhere.&lt;/p&gt;

&lt;p&gt;Now that we’re all a bit more involved in using GitLab directly day-to-day, we’ve also &lt;a href="https://dev.p.ota.to/post/5631671361601536/" rel="noopener noreferrer"&gt;implemented a Chrome/Firefox extension&lt;/a&gt; that makes things a little easier. &lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a href="https://visualstudio.microsoft.com/services/live-share/" rel="noopener noreferrer"&gt;Visual Studio Code - Live Share&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.p.ota.to%2Fimages%2F5640825748848640%2F" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.p.ota.to%2Fimages%2F5640825748848640%2F" alt="Code editing with Visual Studio Code" width="800" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The ability to grab another developer to help solve a problem has always been a key part of Potato culture, and historically one that required that other dev to be in the same room. When we were forced into remote working this was one area where we needed to find a new tool to help us, and we did so by using Visual Studio Code’s “Live Share” plugin. This plugin lets you host a programming session that you can invite others to collaborate in (think Google Docs, but for code editing). Combined with a Google Meet call it makes for a great, and simple pair-programming experience.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a href="https://www.figma.com/" rel="noopener noreferrer"&gt;Figma&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;The final tool in our toolbox is Figma. Until recently our designers were heavily invested in using Sketch as their main design tool, but we’d noticed issues even ahead of the lockdown that made this problematic. &lt;/p&gt;

&lt;p&gt;Firstly, it broke the cloud-first rule. Sketch ran locally, saved files locally, and it wasn’t cross-platform which caused a load of headaches for our Linux-using developers. We came up with workarounds for these things (e.g. using the “Measure” plugin for detailed exports, teaching the designers how to use Git etc.) but it never really fitted the culture of Potato.&lt;/p&gt;

&lt;p&gt;Then Figma came along, and not only did the designers find that it was a better tool, but it’s based in the cloud and so is platform-agnostic. &lt;/p&gt;

&lt;h1&gt;
  
  
  Honourable Mentions
&lt;/h1&gt;

&lt;p&gt;In addition to our development toolset, we use a number of other web-based tools day-to-day, these include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.getharvest.com/" rel="noopener noreferrer"&gt;Harvest + Forecast&lt;/a&gt; - for time tracking and project scheduling&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.bamboohr.com/" rel="noopener noreferrer"&gt;Bamboo&lt;/a&gt; - for managing our people&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.trello.com" rel="noopener noreferrer"&gt;Trello&lt;/a&gt; - For workshopping and lightweight task tracking&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.trakstar.com" rel="noopener noreferrer"&gt;TrakStar&lt;/a&gt; - For managing the career progression of our people
# Summary&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There we are, a complete toolset for seamless remote working - that were built up accidentally by just following the rule that our stuff should be accessible from anywhere, and we don’t want to be the ones running it!&lt;/p&gt;

</description>
      <category>development</category>
      <category>engineering</category>
      <category>tools</category>
      <category>remoteworking</category>
    </item>
  </channel>
</rss>
