Диан обнови решението на 21.01.2014 14:30 (преди почти 11 години)
+REPOSITORY = 'http://github.com/chazbg/ruby-retrospective-3'
+
+# Lessons learned
+#
+# Task 1
+# 1. Integer#prime? works with negative numbers
+# 2. Integer#digits works with negative numbers
+# 3. Refactored Integer#digits to a single line and at the same time got rid off the unnecessary calculations.
+# 4. Fixed Array#combine_with to work with nil values
+# 5. Refactored Array#combine_with into #combine_with and #merge methods for readability
+# 6. Now using to_f for converting to from Integer to Float in Array#average instead of Float(x)
+# 7. Using (start..end) and (start...end) for ranges instead of start.upto(end) - they look cleaner
+#
+# Task 2
+# 8. Instead of adding elements to a new array with each, the elements of the array can be modified more elegantly with map and then the resulting array will be returned. Changed Criteria#conjunct, Criteria#&
+# 9. Similar methods can be transformed into one single method by overriding method_missing and checking the method name.
+# Overriden TodoList#method_missing, removed TodoList#tasks_todo, TodoList#tasks_in_progress, TodoList#tasks_completed.
+# 10. StringUtils#stripSplit:
+# - no need to initialize an array - string.split() returns a new array either way
+# - no need to create a local array at all - all of the actions can be done on the strings parameter
+# 11. No need for 3 methods that call the same constructor of Criteria.
+# Overriden the class method method_missing. This will possibly allow easier modifications in the future.
+#
+# Task 3
+# 12. map can be called directly on a Range object - no need to convert it to array. Removed the unnecessary code from Ascii#render and Html#render
+# 13. Do not create an empty Array with Array.new and empty Hash with Hash.new. Use [] and {} instead.
+# 14. Previous lessons learned here:
+# - The canvas class doesn't need to know the exact types of renderers that are supported. It's better to pass the type to the renderer's constructor and then the renderer itself will decide the render mode.
+# - The rendering method is better implemented when traversing the canvas with map. This abstracts the concrete graphics and allows working with any type of renderer.
+# 15. It's better to try to make more detailed (or generalized) condition to avoid repeating some parts of it in the cases handling.
+#
+# Task 4
+# 16. It's better to create a constants and freeze them instead of creating local (or even worse - instance/class) variables.
+# Created constants for jump operations, register operations and instructions hashes and array.
+# 17. Previous lessons learned here:
+# - Most of the time class variables can be avoided (depending on what the purpose of the class is).
+# If the class can be instantiated then by design it should have only instance variables and methods.
+# The opposite is valid for the classes that are not going to be instantiated by design (for example utility/factory classes).
+# Currently a ScriptParser class is used to evaluate the block and keep the variables and methods that used to be class variables and methods for the Asm module.
+# 18. Don't use case operator for only one case. It provides an easy way to check the type of a variable but #is_a? works the same way.
+# 19. Removed Evaluator#value_of - its body could be reduced to a single line and only Evaluator#calculate used it either way, which made it unnecessary.
+# Another plus is that no additional allocations are made.
Не съм сигурен защо си писал на английски, но окей... :) Проблемът е, че решенията ти не минават тестовете, както и нарушават skeptic ограниченията и затова получаваш нула точки.
- По нещата, които си научил, тези за задача 1 не са обяснения, а изглеждат като commit съобщения.
- Точка 7 не винаги е вярно. Когато става дума за обхождане на диапазон, по-добре да ползваш upto/downto.
- Точка 9 е коварна практика, внимавай с нея.
Щях да ти дам някоя и друга бонус точка за научените неща, но в решенията имаш груби нарушения на конвенциите в Ruby (като например camelCased имена), а в решението на четвърта задача си оставил накрая пример с употреба на Asm, което е много лоша практика. Ще трябва да се задоволиш само с научените неща :)