What do you like more in your application? Handling complexity when reading the data or when updating it?
Imagine you have a model such as
Product with three potential date attributes:
publication_on- Nominal date of publication. This date is primarily used for planning, promotion and other business process purposes, and is not necessarily the first date for retail sales or fulfillment of pre-orders.
preorder_on- Preorder embargo date. Earliest date a retail ‘preorder’ can be placed (in the market)
announce_on- Public announcement date. Date when a new product may be announced to the general public.
Also, three additional…
Sometimes you would like to define a method which takes an optional argument, but the programmer might pass
nil. And your code needs to distinguish between the value not being provided (default value) and
nil. How can it be achieved?
The usual solution for default value is to define them as
nil or other empty/zero values which makes sense such as 0 or an string, an empty array, etc.
def bar(one, two: nil)
But what if you need to distinguish between
nil and no value being provided? What if you want to distinguish between:
Around a month ago, I worked on a task, which required a more dynamic frontend behavior. I worked on a component with 2 selects and 2 date pickers and depending on what was selected where the other pickers or select inputs had to be updated based on some relatively simple business rules. I decided to implement it using React.js and it was fun and pretty straight-forward to finish it. Also, working with http://airbnb.io/react-dates/ turned out to be a very pleasureful experience. But that’s not what this post is about.
If you have low self-esteem and constantly worry (like I do), your own thoughts might be the biggest obstacle preventing you from getting great things done. Here are 4 mental tips that I use to overcome my objections.
Don’t think about finishing a project. About the end of it. You will get there. Just start working. Because this is not how things get done most of the time:
Last week I added a final chapter about Event Sourcing to Domain-Driven Rails. It presents how you can build your aggregates using Rails Event Store with SQL DBs. It also shows how to achieve the same with EventStore.org DB. A dedicated database for storing events. So far, we have almost 400 readers and I am very proud of it.
So what can you find inside it now? 11 techniques for simplifying your code in large, complex and legacy Rails applications.
It’s not unusual to see tables with 50 columns in Rails. It’s not unusual to have hundreds of models without…
As developers there are a few things we can do with our time:
and there is always the 4th option. Fuck it and enjoy your time doing something non-programming related, which is completely valid and I won’t discuss it today :-)
When you deliver code, especially when you work on an hourly rate, you trade your time for a short-time benefit in the form of financial gratification. …
A few years ago I started blogging and I try to keep doing it weekly or bi-weekly. Why? What’s the point? Why spend time on this? What do you gain?
Everyone of us has its own taste and list of acceptable hacks. By blogging, I make sure that in Arkency, and in other companies that I somehow influence, my way of coding is known and propagated by other developers.
Think about Uncle Bob, Martin Fowler, and Michael Feathers or Sandi Metz. They influence thousands (if not millions) of developers around the world. You might not always agree with them, but…
Today I was listening to DevTalk.pl podcast and its 1st episode of DevTrio talks. In this episode, 3 famous Polish developers discuss the topic of whether you would want to and whether you could be a programmer for your whole career.
In the rest of the world, the answer was probably found as programmers have a much longer history. In Poland, the industry boomed after the fall of communism and now the most visible, experienced developer are only 30–40 years old. There are older devs, but not many, and not famous.
There are two questions here:
I just came from my 2 week-long vacations and here is my quick summary. At age 32 you just can’t handle same shit you did 10 years ago. Planning time for rest is nowadays essential for me and my wife (same age). Otherwise, I just become a whining, tired, unhappy asshole. Seriously. And this year I planned badly, unfortunately. Here is how it went.
Last year I had good vacations in September. So I planned next ones for January. I took a break from consulting work. But it was a moment before our 2nd Rails DDD Workshop. I really wanted…
RubyMine (and probably many other editors as well) have a nice feature called bookmarks. It lets you mark certain lines and easily navigate to them. I wanted to present you two scenarios in which I use the feature.
Let’s say I am in a quite long spec file. Quite long means between 200–2000 lines and multiple scenarios in it. I am editing/tweaking one of them and there is lot of code around. I want to focus on one test only. What do I do? I add a bookmark in the place I want to change. I used to use comments…
Ruby (on Rails) programmer