create functionality without jvm restart]strategy pattern

Strategy patterns allows you to define a family of interchangeable algorithms, to be selected at runtime. In extreme circumstances, a new algorithm is to be created and to be added immediately without jvm restart. This would be a higher level of flexibility.

Perhaps the highest level of flexibility is offered by a DB containing classnames in the “family”. After you create a new algorithm, you insert its classname into the DB.

Class c = Class.forName( “com.myPackage.Myclass” );
Thing t = (Thing)c.newInstance( );

Also see detailed sample code in

"PREDICATE" = boolean-expression OR other meanings

In STL, the 2 types of predicates — filter vs the comparator — could cause major confusions to beginners learning the STL syntax details

predicate = any statement that evaluates an expression and returns a boolean.
predicate (xsl) = a filter
predicate = a proposition
predicate = an assertion

— contexts —
sql where-clause? filter on list
matlab? filter on list

one-word intro 2 outer join

Outer join (amidst other joins) can be confusing for beginners. Different authors use their favorite anchor keywords. Best one-word intro: subset

Sometimes, one join-column is a subset of the other join-column, where outer join and inner join show their difference. Focus on subset scenario for now. Once you get your mind around this scenario, you are ready to look at the generic scenario where one join column is not a subset of another join column

–2nd word after “subset”? union

In some SQL implementations, u need a union query to do outer join

I believe unions solve more problem than outer joins.

–simplest example: bonus
show employees with and without bonus
“bonus” table {employee_id (forkey), bonus}

wait() means, to a beginner

To avoid overwhelming a beginner, the simpler meaning is “current thread please wait”.

* wait() means “current thread please wait at this statement, inside this waiting area”
* wait() means “Hey the thread executing this statement, please wait at this statement, in this object”

Note: Remember the method enclosing the wait() statement belongs to the “this” object? The “waiting area” is the “this” object.

Note: The “thread” is the real world thread, not to be confused with the Thread object returned by Thread.getCurrentTrhead()

runtime change to object behaviour

[[ head first design patterns ]] repeatedly favors *runtime* change to program functionality, rather than compile-time ie source code change. I assume they have a *practical* reason instead of a doctrine.

Related concepts: Strategy pattern, Decorator pattern,

When we need to change from an old functionality to a new functionality, a good approach is
* we try to create a new functionality class, if at all possible,
* at runtime, use existing setters to assign the new functionality, replacing the old, when needed.
* minimize edits to existing, tested classes

See also post on [[ create functionality without jvm restart]strategy ]]

I think this probably incurs least-impact to existing, tested functionalities.
=> regression test@@ no need
=> Low stress for fellow developers, managers, clients, internal users and any non-technies.
=> no need to worry “Did we miss any other existing classes that need edit?”
( documentation on interdependencies is crucial but often neglected by developers. )

be prepared for entry-level java position interviews

Hi XR,
在美国这三个月, 见面和电话面试了接近十个 Java 职位.
有个不能确定的感觉. 我这样(新移民?)的应聘人, 在 Java 领域主要被看做底层动手编程的角色. 要求手快, 记性好, 写程序”产量”高, 质量 (Performance, Security….) 也不能有明显弱点. 三个字 — 快而准.


我的另一些不大不小的特长, 面试公司欢迎但不常问到. 比如 High Volume Java App server 维护, Basic Weblogic Configuration/tuning, Cluster 入门知识, Database design, tuning 入门知识, Java 与 External System 的 Integration …也许有别的人员务责这几块. 但如果是小公司, 可能没有全职 DBA, 全职 Weblogic Admin 之类. 如果真的没有这些方面的专家, 那务责的人可能经验不多, 跟我一样在这些领域只有半桶水. (我曾经单枪匹马挑过 Oracle, Mysql, Weblogic… 这几个重担)

想做小公司的 Architect. 但是没有人考虑我. 也算公平, 自认 Java / SQL 还不精深. 希望你的运气比我好些, 也希望我的运气能慢慢改善. 还希望我能通地更多的面试实战, 能对 Java 就业市场有一个更深入更准确的把握, 不再象这样靠一丁点微弱的灯火摸着黑前进.

你问到工作有多累. 同事们大都是 9 – 5, Mon-Fri. 我每周干 50 个钟头. 9:30 – 6:30. 连续 5 个周六主动回公司加班几个钟头. 在路上/家里, 每天至少一小时学 Java/SQL/PHP, 不觉得苦.
New York 的工作项目更累. 平均 10 小时/天, 路程更长, 单程一个多钟头.