TL;DR: If you need to build dynamically regular expressions memoize them. Compiling them is expensive.
I don’t like memoizing methods, or caching in general. Obviously, caching adds more complexity to your source code and might lead to more errors, or even worse, errors which are harder to reproduce because they only happen due to a specific history. For memoized methods, you have to ensure that there are no other dependencies for the result than the passed arguments. Or that the result of a memoized method does not reference a larger object tree ending with a memory leak. There might be even more pitfalls.
Hello World! Welcome to the Babbel Tech Blog.
From today on, we, the Babbel engineering team, would like to share our experiences about developing and maintaining the Babbel platform: The website, various mobile apps and the infrastructure behind it.
Some information about us and our infrastructure:
- We are currently 25 FTE in the engineering department growing rapidly and about 12 FTE in product development.
- We are developing mobile applications for iOS, Android and Windows (Phone and 8), and thus, using Objective C, Java and C#.
- Most of our web applications are Ruby on Rails applications, some special purpose applications like our tracker is written in node.js
- The infrastructure running our web applications is hosted on AWS, mostly on OpsWorks, some an Elastic Beanstalk.