How to Write an Equality Method in Java
This article describes a technique for overriding the equals method that preserves the contract of equals even when subclassses of concrete classes add new fields.
Related cards:
How to write modular code
Or: How to avoid and refactor spaghetti code
Please note that I tried to keep the examples small. The effects of the methods in this card are of course much more significant with real / more complex code.
What are the benefits of more modular ...
How to write complex migrations in Rails
Rails gives you migrations to change your database schema with simple commands like add_column
or update
.
Unfortunately these commands are simply not expressive enough to handle complex cases.
...
RSpec: How to write isolated specs with cookies
Background
Rails offers several methods to manage three types of different cookies along with a [session storage for cookies](https://guides.rubyonrails.org/action_controller_ove...
How to write good code comments
Code comments allow for adding human readable text right next to the code: notes for other developers, and for your future self. You can imagine comments as post-its (or sometimes multi-sheet letters ...) on real-world objects like cupboards, ligh...
How to write a good changelog
We want to keep a changelog for all gems we maintain. There are some good practices for writing a changelog that adds value, please stick to these.
- Add a notice to the README's contribute section about th...
Rails: How to write custom email interceptors
Nowadays it is fairly easy to intercept and modify mails globally before they are sent. All you have to do is register an interceptor class which responds to `.deliver...
How to use helper methods inside a model
Simple
If you want to use a helper_method my_helper_method
inside a model, you can write
ApplicationController.helpers.my_helper_method
When using multiple helpers
delegate :helpers, to: ApplicationCon...
InfoQ: How to Design a Good API & Why it Matters
A well-written API can be a great asset to the organization that wrote it and to all that use it. Given the importance of good API design, surprisingly little has been written on the subject. In this talk (recorded at Javapolis), Java library desi...
How to call overwritten methods of parent classes in Backbone.js
When you are working with Backbone models and inheritance, at some point you want to overwrite inherited methods but call the parent's implementation, too.
In JavaScript, there is no simple "super
" method like in Ruby -- so here is how to do it ...
Rspec: How to write better specs
betterspecs.org is a documentation on how to write better RSpec tests.
Note that there are also other approaches like The Self-Contained Test, which is complementary to the dry-approches in bette...