bejaeger / goodwallet

0 stars 0 forks source link

The Good Wallet

The Good Wallet (TGW) is a novel altruistic payment system, where people can transfer money into a fund that is committed to donations. We want to empower individuals and communities to more easily engage in philanthropic activities and create a positive impact.

Technical Planning

The following should give a rough outline about the current technical setup of TGW. We use a separate repository for the server-side backend code where we use google cloud functions, GoodWalletCF.

Features

App High-Level Technical Overview

As app architecture and state management solution we use stacked by FilledStacked which realizes an MVVM architecture in flutter [stacked] (see below for how to get started with stacked). We use Firebase as a serverless backend solution. High-level

Backend Technical Planning

High-level

How We Collaborate

The following describes a few guidelines that we would like to follow when contributing to this project.

How To Get Started With Stacked

Stacked Architecture Principles (see here)

The architecture functionally consists of only 3 parts. Views, ViewModels and Services. Views on top, the closest to the user, ViewModels are below that taking input from the Views and Services below that which is what the ViewModel's make use of to provide functionality. That's it. It comes with some rules that I highly recommend not to break.

Stacked Architecture Cheatsheet

See application setup in stacked README.

Steps to add a new view

Steps to add new service

Other development considerations

Documentation and logs

Documentation of classes and functions is very useful and is desired. Sometimes a well chosen naming is good enough, however, to describe what is happening. What is very important and useful is to add reasonable log outputs to your code, especially in the service classes. You can instantiate a custom logger with getLogger("<name of file>") where we follow the convention to name the logger after the file it is used in. Please consider these guidelines to write logs and also see logger on pub.dev.

Git workflow

We follow the git feature branch workflow, see for example here.

Learning Material

Further comments

More Things

Git workflow - for everyone that has never used git

I think we should follow the feature branch workflow [explanation]. We're quite a few people and I think it would be nice to always have one version of the app that is state-of-the-art and more importantly works!; this is the version in the master branch (please read about what branches are in git e.g. on the above webpage). Whenever you work on the code, just create a new branch and commit your changes in this branch first. Then we don't interefere with each other in the development and we can also discuss the code in github pull requests!

Here a short blob I wrote on git workflow once upon a time:

checkout latest master in your working directory and get updates from remote

git checkout master; git pull

create new branch and directly check it out (with -b)

git checkout -b my-awesome-new-feature

Now, develop your new feature, push it, and create a pull-request on github webpage with potentially assigning the issue. By pushing early we have the option to talk about details in the pull request during ongoing developments and can help each other. To push the branch, do something like this:

git push --set-upstream origin my-awesome-new-feature

I can only recommend to adopt a “commit early, push often” policy during feature developments ([see nice read]). The above command doesn't push anything if you haven't committed a change yet. A commit is (NOT LIKE IN SVN!) not uploaded!!! (that's what git push does) but only creates a local snapshot of the current code.

git commit -m "add awesome function" path/to/awesome/function; 

(I usually use git add file1 file2 and then commit everything at once with git commit -m "my changes".) Once you think you are done, check for potential changes that happened to master in the meantime (from other people), merge them into your branch with

git pull origin master # (one command to fetch updates in remote and merge master)

Here, you might encounter cases where you can’t merge because of local changes that aren’t committed or you will get merge conflicts you need to resolve. If you have done changes to files that you want to disregard you can e.g. stash them with git stash or just checkout the file from the remote master with git checkout origin/master file/with/your/wrong/changes and then git pull origin master again. Afterwards, push your branch once more to the remote with

git push

You can also nicely follow the changes in the code in the github pull request and once you think everything is working and nice, you can merge it to master! Afterwards, you might want to switch to master again in your local working dir and get the changes from the remote.

git checkout master; git pull