Skip to content

piotr-yuxuan/choose-a-new-phone

Repository files navigation

choose-a-new-phone

A simple re-frame application designed to help you choose the most recent LineageOS phone with the latest android version.

This is a pet project I use to exercice myself to design and code with style. This is an on-going work.

Apart from this educational side, we can find quite a few buzzwords to describe this project:

  • Reactive programming thanks to re-frame. Data are rendered only when changed. Change flow is unidirectional so no loop can happen.
  • Functional programming so it uses Clojure functions which are pure.
  • Edge computing because the long-term goal is to have all the work done by clients. Server or Cloud functions (à la Amazon Lambda) simply shouln’t need to exist at all.
  • Isomorphic because most of the code logic (apart from rendering) can be executed seamlessly in Clojure runtime in the JVM or in ClojureScript runtime in JavaScript environment.
  • Dehydrated data because each client embeds reasonably up-to-date data which are refreshed on start in order to improve time to first rendering.
  • Server-rendering but actually there isn’t anything like a server here, so compile-time-rendering. The loaded page actually is already a reasonably up to date rendering of the script and shouldn’t change that much over time.

Why both Clojure isomorphism and compile-time-rendering?

Right now I have two mechanisms which could appear redundant:

  • Rendering index.html at compile time with an external browser actually builds the latest app-db state available. For that purpose I use library etaoin and Firefox (latest, Developer Edition). I could extract latest app-db from that.
  • Isomorphic cljs allows me to builds the latest app-db state available but no rendering.

However, I don’t want to couple initial html rendering with initial app-db state construction. The two are rather different. In some situation, a breaking change can actually result with the previous app-db being incompatible with new code so I want to maintain a strict separation between the two which gives more flexibility and more power.

Addendum to make sure the license is GPL

Copyright (C) 2018 胡雨軒 Петр

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Additional permission under GNU GPL version 3 section 7

If you modify this Program, or any covered work, by linking or combining it with clojure (or a modified version of that library), containing parts covered by the terms of EPL, the licensors of this Program grant you additional permission to convey the resulting work. {Corresponding Source for a non-source form of such a combination shall include the source code for the parts of clojure used as well as that of the covered work.}

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published