-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Billy enhancement proposal #24
Comments
Hey
|
Thanks for your input. About using SQLite, could you explain your concern? Because I am pretty sure SQLite can be used in production environment (although my main idea is to ease the barrier for developing billy). It's only a matter of what kind of scale it is, is it suitable. SQLite has its drawback, it is not good for highly concurrent read and write due to its locks. SQlite is used in Android smart phones, iOS devices and many other production environments. OpenStack Swift (the open source project which provides Amazon S3 alike cloud service) also uses SQLite as the internal database storage of nodes in very large cluster without a problem (of course in production). You can also read this article http://www.sqlite.org/testing.html They have millions tests are running against SQLite, including all kind of crazy tests, that's very few open source projects have been done in this kind of quality assurance as far as I know. As billy is a simple recurring payment system, I don't see there is any advance SQL feature would be required, otherwise, that might be a overkill. When the usage scenario is about thousands (or even million) recurring payment records, surely SQLite can do the job very well. It can also save some time of users to install and setup a real database before their volume hit the point for switching to a real database. |
Thanks for that link, interesting testing scenarios there. My concern with SQLlite isnt the robustness of it, but rather the common-case usability of it. Here are some things that come to mind that pushed us towards Postgres:
Currently we're not really limited to sqllite (Removing the constraints using pgsql_where and the enum types should make us fully compatible), so in the meanwhile I'm cool with it moving, but I predict in the long run we'll switch back and make use of the added power of pg. Do you have a pull I can review for sqllite compatibility? |
A big point there is when you are going to run tests, or start some quick hacks, you will not like to install a SQL server just for it, unless it is a really interesting project. I had a completely start over branch there trying to reach best practices with minimum features, you can reference to it https://github.com/victorlin/billy/tree/major-refactory It uses SQLite as the backend. The way to run tests on my branch is just like this
And if there is a specific SQL server required, it would be
I have two workplace, one PC at my home, one at my office with my Macbook Air. I just installed PostgresSQL on my home PC last night, for now, I am using Macbook, I will need to install it again to start developing this project. These time are all costs, bro. Yes, I don't need to install the server every single time, but it is important to make it easy for people to get tests run and start hacking, otherwise, why do we open source it? Enum type is not a problem as SQLite can support it in a string manner. Also, if you are running tests on a SQL server, then certainly you will need to be careful to maintain a clean environment for them. With SQLlite, you can always have a completely clean environment for tests everywhere. I think we should see this in a team player role and open source developer perspective. |
@victorlin as I said:
I'm no longer full-time maintainer of billy, I will be working on it sometime this week to update the API but for other changes please check with @mahmoudimus and make the appropriate decision with a pull. |
@victorlin @pnegahdar you both have really valid arguments however I have to lean towards the side of @pnegahdar here. @victorlin your concerns are easily addressed using something like Vagrant where we use VirtualBox to control the environment of hacking on Billy. What you're really asking for is, how quickly can we get up and running to hack on Billy. Vagrant solves this problem. All you have to do is two steps:
And in 10 minutes, you have a virtualbox where you can start messing around w/ Billy. The reason I think the Let's do this the right way - this is a solved problem. Use Vagrant and move on. |
Personally, I like to use tools that can let us reach the goals with minimum effort but also provide good quality. I also prefer lightweight weapons when heavy weapons cannot bring too much benefits. For this project billy, at this moment, at this complexity and requirements, there is no need for heavy weapon. The core business model here is pretty simple and clean, when to charge, who to charge, date-time calculations and so on, there is no need to use advance SQL features, at least for now I cannot see there is a need to. However, yeah, you are right. There were no easy-to-use tools like vagrant for running stuff in VM. Now things changed. So, I will leave testing for core business logic on SQLite, and functional or integration tests running on PostgreSQL, as it would be our production environment. I will write a Vagrantfile there for setting up billy environment later. And as I was MySQL user rather than PostgreSQL user, I am not familiar with advance features of it, if you see there are some advance features which help billy project a lot, please tell me, we may can use it. (however, that would possibly make billy bound to PostgreSQL, people can only use PostgreSQL afterward. So here is a trade off) You know, experience can be right in this environment, but it would be wrong in another. Thanks for your input, what I did might be correct in previous context but may not be right here. Please let me know if you see anything I seeing it wrong in Balanced context. |
This project works fine, so far so good. However, the barrier for letting people getting work on this project is a little bit high, namely, technical debt should be reduced. I would like to do some major refactorying. Before we go into implementation, some goals to achieve are listed here to remind us.
#1. Documentation
We should write some documents. Developer could understand how to use this project, what are some classes and module for. Some comments in code could be helpful. For example, when you are using a dirty hack, it's better to write why you are doing this, and what kind of side effect it may have. Something might look like this
Also, when you left something unfinished or not sure what to do, you can leave a # TODO comment on it:
# TODO: get rid of the brute force and improve performance
High level document should also be added to make people understand the project easily. Such as some how-to-use-it API call example.
Something like that.
Document is important, but do not overkill.
#2. Isolate data model from the table definition
Data model and business logic should be extracted from tables and put in some isolated classes. Do not expose too much SQLALchemy details to the client side (the web framework views). In this way, it is much easier to test, also, when we don't want to use another web framework, it is much easier to adopt. Or, when we are switching to a NO-SQL database, the data model in middle also do help. We don't need to rewrite the whole client-end code, the data model interface should remains almost the same, we only need to rewrite under layer database querying stuff. Some visual explanation would looks like this.
The original design
the new approach
#3. Use SQLIte as the default database storage
To make it as easier to test and deploy as possible, we should use SQLite as the default database storage. The way we use SQL should also be as standard as possible (do not use XX database only feature). In this way, developers who like to get involved can jump in and start hacking quickly without installing any database server on their machine. The testing suites can also be ran without any extra setups. Users can also even use SQLite as the database in production environment when it is really easy to get started.
When SQLite based operation is well tested and proved. Surely SQLAlchemy can support almost any other SQL database without too much effort.
#4. Define operations and usage scenarios clearly
I think it is necessary to define what kind of operation this service should provide and what kind of scenario they will be used. With those descriptions, we can then implement those feature correctly and understand when to use them. For example, Niko wants to charge protection fee weekly from Tony (ah.. what a badass). Then he can create a
plan
(orbill plan
more clearly?) like this:Otherwise, without clear blueprint in mind, people can hardly understand it.
Cannot recall some ideas passed my mind, will update this when they come back to me.
The text was updated successfully, but these errors were encountered: