Lesson Learned at Work


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.

Labels

adsense (5) Algorithm (69) Algorithm Series (35) Android (7) ANT (6) bat (8) Big Data (7) Blogger (14) Bugs (6) Cache (5) Chrome (19) Code Example (29) Code Quality (7) Coding Skills (5) Database (7) Debug (16) Design (5) Dev Tips (63) Eclipse (32) Git (5) Google (33) Guava (7) How to (9) Http Client (8) IDE (7) Interview (88) J2EE (13) J2SE (49) Java (186) JavaScript (27) JSON (7) Learning code (9) Lesson Learned (6) Linux (26) Lucene-Solr (112) Mac (10) Maven (8) Network (9) Nutch2 (18) Performance (9) PowerShell (11) Problem Solving (11) Programmer Skills (6) regex (5) Scala (6) Security (9) Soft Skills (38) Spring (22) System Design (11) Testing (7) Text Mining (14) Tips (17) Tools (24) Troubleshooting (29) UIMA (9) Web Development (19) Windows (21) xml (5)