Posts

Showing posts from 2015

Geecon 2015

Image
So last month I've attended  Geecon  and I really loved it. Geecon is a conference focused on Java and JVM technologies, hosted annually in Cracow (usually). Geecon had a Steampunk theme This year’s it was all about microservices, so it’s no surprise that I enjoyed Fred George ’s “Challenges in implementing microservices” the most. In his talk Fred George shared his experiences with replacing monolith applications with microservices. He explained how microservices facilitate a Service Oriented Architecture and “going faster” as shorter reaction time for the whole company. What was most interesting to me was the comparison of asynchronous and synchronous approaches to microservices. He mentioned his friend Chad Fowler suggests synchronous communication on default mainly because it’s easier for most of the modern programmers. In contrast Fred George believes that asynchronous messaging gives so too much of an opportunity for robustness and graceful degradation to ignore in

Creation method in Mongoose.js, alternative to custom constructor or hooks

Creation method is a neat way of creating objects in the same way by using the object's well-named static method instead of constructor. While similar, creation method should not to be confused with factory method pattern , which involves the concrete implementation of created objects). If you'd like to know more about creation method's benefits and application I highly recommend Joshua Kerievsky's Refactoring to Patterns . Here's how this alternative to custom constructor or hooks can work in Mongoose. Let's use an Article model in Mean.js app generated by Yeoman as an example: Let's say we'd like article to have an url field, which we'd like to generate from the title. We'd like to avoid copying the url generation code everytime we'd like to create an article. One way to do this is to create a creation method which does that. Since all static methods have to be defined before the model class is created creating a creation method