Lesson Learned at Work
Here, I would like to write down the lessons I learned at my work.Hope I can learn something, bear them in mind, and won't repeat similar mistakes twice.
Misleading API - Calendar.before
The parameter of Calendar is Object, so I mistakenly pass a Date object, and it just always returns false.
public boolean before(Object when)
Lesson Learned:
Ensure to use Calendar as the parameter for these operations.
These before, after APIs in Calendar are really bad.
Design your API wisely.
Add a new field DaysToExpire to User Class.
This value is calculated dynamically at server: Its formula is like this:
DaysToExpire of user = Expiration days of system password setting - {current time - the user's last password change time}
Simple? But there are several things that must be considered.
1. DaysToExpire of user < 0, what value it will show to user?
A value like -30 may confuse user.
2. What if Expiration days of system password setting is 0, means password never expires, what value it will show to user?
3. Compatibility issue
As this value is newly added, we must consider what will happen when client and server are in different version: old client - new server, new client - old server.
Especially, in new client - old server, as old server doesn't include this field, client would always get 0 for DaysToExpire? Is this suitable? If not, what value should be displayed?
Learn and know common problems/issues.
Think and consider more, things are always not easy as they appear.
Event: Innovation Idea Presentation
Need Improve Presentation Skills and Public Speaking Skills are important.
Improve the skills to Speaking without Notes
Improve English Listening and Speaking Skills
Need Improve Time management Skills
Give more time to important thing.
Make well preparation for the important stuff.
Take your time and effort to do important thing.
Be brave and take responsibility
Answer the question as possible as you can.
Lesson 1
We use Google WindowTester Pro to automate UI test for our Eclipse RCP test.
It runs well in my laptop, but can’t run in my colleague computer.
The UI test can be started, but it doesn't replay mouse click event.
We dug it for a while, and at last my colleague brought up that this may be because his left and right mouse buttons was swapped, so we tried to change it back, and it worked.
We both knew the fact he has changed the left and right mouse buttons.
But it took us a long time to realize that it may be the root cause of this problem.
Lesson learned:
Reason logically, and think.
For this kind of problem, think and compare what's the difference between my and his environment, consider all possible reasons, and guess, and exclude them one by one.
Run simple unit tests first
When debug and run unit test for your change, usually multiple test-cases should be covered, design your test cases carefully, categorize them and consider all cases.
And run unit tests that are simple, quick, safe and easy first. After they are passed, run the tests that are slow, hard or even danger later.
Miscs
Use correct jdk in your project; otherwise you may use java methods that don’t exist in JDK used in production environment.