Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
Миллисекунды при загрузке учитывать — вот что точно бездумное программирование.
def myfunc
..
..
..
..
myfunc2
end
def myfunc2
..
..
..
..
myfunc3
end
def myfunc3
..
..
case a
when 1..5
puts "It's between 1 and 5"
when 6
puts "It's 6"
end
VARIANTS.detect { |v| v.value === value }.do_something_special
Conditional code clutters methods, makes extraction and reuse harder, and can lead to leaky concerns. Object-oriented languages like Ruby allow developers to avoid conditionals using polymorphism. Rather than using if/else or case/when to create a conditional path for each possible situation, you can implement a method differently in different classes, adding (or reusing) a class for each situation.— Ruby Science
- (BOOL)automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers. Тут, конечно, везде своя специфика. Для Objective-C, например, данные правила будут очень затруднительны — особенно про строчки.
Правила для разработчиков от Sandi Metz