The Solo Hacker's Guide To Clojure

栏目: IT技术 · 发布时间: 4年前

内容简介:4 February 2020This is a continuation of my previous post "Learn Clojure with Web Dev," which I've renamed toThis is the starting point for a series of articles I'm planning to write. My target audience is people who want to use Clojure for side projects o

4 February 2020

This is a continuation of my previous post "Learn Clojure with Web Dev," which I've renamed to First Steps With Clojure . I've moved some of the content from there to here, so I may sound like I'm repeating myself a little if you've read that previously.

This is the starting point for a series of articles I'm planning to write. My target audience is people who want to use Clojure for side projects or new startups—i.e. I'm trying to help fellow solo hackers learn to bring new ideas to the MVP stage quickly, and my recommendations will be made accordingly.

This will also be an opinionated guide which teaches how I personally do web + mobile development. Rather than give an overview of X, Y and Z, I'll say "use X" and include a footnote that compares X to other options. I want you to feel the leverage that can come from Clojure as soon as possible, without having to wade through the jungle first.

Please let me know what topics you'd like me to write about. I'd love to hear what things you're trying to learn and build. I'm not an expert by any means, but I've been doing Clojure full-time for over a year now at least. And I recently started a habit of writing every Monday, so I'm hoping to make consistent progress on this.

Roadmap

I'm doing this breadth-first. Currently, what follows is mostly just an outline of what I'm planning to write.

1. Language fundamentals

For the rest of this guide, decide on a web application you'd like to build. If you need ideas, I think board games are great since they involve complex logic (not just CRUD), it's easy to be a genuine user yourself, you end up with something that's easy to show off, and you can go on to extend it with an AI if you like.

2. Frontend development

TODO write articles & examples for the following:

  • Make a "Coming soon" landing page for your app. Include an email signup form using JS + Firebase Firestore for persistence. No ClojureScript yet; we'll just use Clojure to generate the HTML files. Use Bootstrap for styling unless you already have another CSS toolkit you like. Deploy with Firebase Hosting. Tell all your friends to sign up.

  • Add a login form with Firebase Authentication. Set up ClojureScript with Shadow CLJS. Create a basic welcome page with Rum. Add CRUD operations, still using Firestore for persistence. Learn to make complex UIs with Rum.

  • Learn about normalization, derived values and effect isolation (i.e. state management) so you don't go insane later (insanity can be harmful to your velocity). Rejoice that you don't have to use a DI framework like I did while working at an Angular shop.

3. Backend development

TODO write articles & examples for the following:

  • Write Firebase Functions using ClojureScript. Learn when it makes sense to use Functions + Firestore and when it makes sense to move to a Clojure backend instead.

  • Set up a Clojure backend with DigitalOcean, Crux and managed Postgres. Probably Terraform as well, plus Nginx and Letsencrypt. Deploy with rsync (maybe Github Actions?). Set up logging and alerting (optionally, come back to this step later).

  • Set up communication between your frontend and backend. Add Ring middleware for authenticating Firebase tokens. Move your CRUD from Firestore to Crux, using a rules system so you don't get a proliferation of endpoints. Use Firebase Storage (or maybe DigitalOcean Spaces?) for BLOB storage, with foreign keys stored in Crux (and utility fns for making it look like everything's in Crux).

  • Learn about system management with Integrant (or maybe just roll your own).

  • Use your editor-repl integration for testing and administration. Learn my own opinionated approach to testing, meant to give you reasonably high confidence in your code without having to spend much time writing tests.

  • Consume 3rd party APIs, including things like Oauth, caching and self-throttling. Set up cron jobs. Provide a pagination API for your frontend. Any other stuff I can think of that might be useful.

  • MAYBE: use Datomic Ions instead of Crux. Ions are actually what I'm familiar with; I've never used Crux. But I've had enough headaches from Ions/AWS that I don't think the overhead is worth it for solo hackers. Plus, you have to use the solo topology for production (which is unsupported) until your app has enough traction to warrant a pair of i3.large instances (on the order of a few hundred bucks/month). Solo topology means no direct HTTP/dealing with lambda warmup times and, more importantly, deploys that often require 5-30 minutes of downtime (in my experience). On the other hand, I believe I've worked through most of the quirks of Ions, so maybe it'd be useful if I wrote an article about it.

    Another option is using Datomic On-Prem with DigitalOcean. That would make it easier to migrate to Ions later on. I'll evaluate Crux vs. On-Prem when I get to this point in the course.

    (Also, there is Datomic Cloud without Ions. However, you have to give up data/code locality which I consider a killer feature. It's been especially helpful to me in building recommender systems, but even for just CRUD, having data/code locality makes it easier to introduce abstractions. I probably would only use Cloud without Ions for one-off services.)

4. Miscellanea

TODO write articles & examples for the following:

  • "Library-driven development." Set up your own collection of utility libraries so you can easily abstract away code that isn't specific to your project. Besides letting you share code between projects and with other people, I think doing so makes it easier to hold the application code in your head.

  • Tooling. Set up an editor (probably Atom or VS Code, with a mention of Cursive) with plugins etc. Learn how to use it for Clojure development. Learn about tools.deps, Lein and Boot. (I'll include links to relevant sections in this article throughout the course).

  • Tooling for the enlightened: learn Vim and set it up for Clojure. For the really enlightened: use Dvorak instead of Qwerty (ok, just kidding, sorta).

There's more where that came from if you subscribe to my newsletter.


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

测试驱动开发的艺术

测试驱动开发的艺术

Lasse Koskela / 李贝 / 人民邮电出版社 / 20101023 / 59.00元

在传统的软件开发中,开发人员对于代码是否正确心中无底,一切依赖于后期的测试环节。极限编程反其道而行之,主张采用测试驱动开发(TDD)的方法,即通过测试定义所要开发的功能的接口,然后实现功能的开发过程。TDD通过不断地测试推动代码的开发,既简化了代码,又保证了软件质量。 本书采用“手把手”的教学方式,通过大量实例来解释TDD,还专门用几章的篇幅来讲解如何为难于测试的技术编写单元测试。全书内容循......一起来看看 《测试驱动开发的艺术》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试