“和任何编程概念一样,理解抽象数据类型的威力和用法的最好办法是仔细研究更多的例子和实现” — algs4 ch1.2
- Counter
- Interval1D
- Interval2D
- Date
- Transaction
- from_user
- to_user
- created_at
- amount
- currency
- souce_id
- source_type
- List
- Stack
- Queue
- Bag
- Tree
“和任何编程概念一样,理解抽象数据类型的威力和用法的最好办法是仔细研究更多的例子和实现” — algs4 ch1.2
Inspired by SublimeLinter plugin for ruby, using ruby -wc
1 | parallel "ruby -wc {}" ::: $(find . -name \*.rb) 1> /dev/null |
it only detects local variables for “warning: assigned but unused variable - xxx”
not working for instance variables
probably work with unused-code/unused to detect other unused tokens
1 | # https://github.com/universal-ctags/homebrew-universal-ctags |
“The mind behind Linux | Linus Torvalds”
Sometimes you can see a problem in a different way and rewrite it so that a special case goes away and becomes the normal case. And that’s good code.
To me , the sign of good people I really want to work with is that they have good taste.
This is a small example , Good Taste is much bigger than this.
Good taste is about really seeing the big patterns, and kind of instinctively and knowing what’s the right way to do things.
rvm list known
not showing the latest ruby versionrvm instal 3.2
failsrvm fix-permissions
not working for “_rvm_log_dotted:23: permission denied” error1 | rvm reinstall "ruby-3.2.0" --with-openssl-dir=`brew --prefix openssl@3` # not ok, [ruby don't support openssl 3 yet.](https://github.com/ruby/openssl/issues/369) |
review: unix-processes 15 * 15 min = 225 min(done 20220517)
read: 元编程 240 页 / (10页/15 min) = 360 min(done 20220521)
listen/review: 史蒂夫乔布斯传 (76 - 18 + 1) * 20 min = 1180 min(done 20220524)
read: 暗时间 244 页 / (10页/15 min) = 366 min(done 20220623)
read: CSAPP 730 页 / (10页/20 min) = 1460 min(ff)(done 20220512 -> 20220925)
review: 现实一种(余华) (done 20220925 -> 20221001)
read: unix编程艺术 (done 20200704 -> 20220924)
read: refactoring (done 20220929 -> 20221012)
read: DDD (done 20221107 -> 20221213)
best thing learned this year
I’m proud that we have testing culture and code review
how I test my code before?
how I test my code now?
hopefully I’ll benefit from TDD style sooner
raise a question: we’re relying on tests to guarantee code work as expected, who guarantees our tests are correct then?
testing helped on
testing drives me to write simple code
example of using let
(private git repo pull request)
key points:
let’s put performance aside while coding & refactoring
let’s focus on clarity/simplicity/readability/maintainability, not performance
How I do code refactoring?
unused
)flog
(rely on metric tools, not “feeling”)example of simplifying code(private git repo pull request)
The point is: “business complixity is the lower limit of system complixity”
Enumerable
module is amazingkey points:
these are just my limited experience on testing & refactoring; I’m pretty sure I have a lot more to learn
I really want to learn from everyone about these two topics
pls correct me if I’m wrong. pls discuss with me if you’re interested~ Orz
This one doesn’t have a TL;DR
I wrote two specific shell aliases for rspec, re
for running specs without error backtraces, ree
for with error backtraces
1 | alias re="DISABLE_SPRING=1 bundle exec rspec --format=progress --no-profile" |
One day, I found it looks better if I change them to this(alignment):
1 | alias re=" DISABLE_SPRING=1 bundle exec rspec --format=progress --no-profile" |
Later, I forgot the change
Somehow, I find the frequently used re
command never got remembered by type re and press the up arrow(which acts as searching from history in OMZ)
rspec
commands again and againrspec
related command won’t be remembered by history!(still didn’t connect to previous changes…)code alignment
Core idea: using multiple repository remote