Elliott Hughes | ad1225a | 2019-11-06 09:19:31 -0800 | [diff] [blame] | 1 | # libbase |
| 2 | |
| 3 | ## Who is this library for? |
| 4 | |
| 5 | This library is a collection of convenience functions to make common tasks |
| 6 | easier and less error-prone. |
| 7 | |
| 8 | In this context, "error-prone" covers both "hard to do correctly" and |
| 9 | "hard to do with good performance", but as a general purpose library, |
| 10 | libbase's primary focus is on making it easier to do things easily and |
| 11 | correctly when a compromise has to be made between "simplest API" on the |
| 12 | one hand and "fastest implementation" on the other. Though obviously |
| 13 | the ideal is to have both. |
| 14 | |
| 15 | ## Should my routine be added? |
| 16 | |
| 17 | The intention is to cover the 80% use cases, not be all things to all users. |
| 18 | |
| 19 | If you have a routine that's really useful in your project, |
| 20 | congratulations. But that doesn't mean it should be here rather than |
| 21 | just in your project. |
| 22 | |
| 23 | The question for libbase is "should everyone be doing this?"/"does this |
| 24 | make everyone's code cleaner/safer?". Historically we've considered the |
| 25 | bar for inclusion to be "are there at least three *unrelated* projects |
| 26 | that would be cleaned up by doing so". |
| 27 | |
| 28 | If your routine is actually something from a future C++ standard (that |
| 29 | isn't yet in libc++), or it's widely used in another library, that helps |
| 30 | show that there's precedent. Being able to say "so-and-so has used this |
| 31 | API for n years" is a good way to reduce concerns about API choices. |
| 32 | |
| 33 | ## Any other restrictions? |
| 34 | |
| 35 | Unlike most Android code, code in libbase has to build for Mac and |
| 36 | Windows too. |
| 37 | |
| 38 | Code here is also expected to have good test coverage. |
| 39 | |
| 40 | By its nature, it's difficult to change libbase API. It's often best |
| 41 | to start using your routine just in your project, and let it "graduate" |
| 42 | after you're certain that the API is solid. |