superclass param, subclass argument

      Dog(Number o) {
      }
      Dog(Integer s) {
      }
      public static void main(String[] a) {
            Number ptr = new Integer(22);
            /**
             * won’t call the (Integer) ctor.
             * Won’t compile if you remove the (Number) ctor. Compiler doesn’t know
             * ptr points to an Interger object. Compiler only knows ptr is a Number (or
             * subclass) object. Runtime type of the pointer ptr is known only at runtime.
             */
            new Dog(ptr);
      }
}
Advertisements

RBS IV – risk

Q: have u used atomic variables like AtomicInteger?

Q: A web app showing on demand employee address + employee investment valuation which could take a while to compute and return. As a server side java guy, how do you show the employee address on the browser and then show the valuation when it becomes available.
A: I often have another thread (pool) for long-running jobs

Q: is there some rule saying a web app should not start new threads?

Q: what DB tuning techniques did you use?

Q: if you have so much data in DB and it is a bottleneck, did you try to avoid the DB?

Q: did you try partitioning?

Q: why does polymorphism only apply to methods and not fields?

why java/c# iwt c++for me

* c++ (and analytics) requires more accu and know-how than java — my strength
* accu — I want to build on my insight and knowledge, rather than chasing the tail of new technology. C/C++/java/c# (Big 4) build on each other.
* Looking at the most influential c++ books, the style suits more better
* c++ is more error prone — my strength
* c++ needs more care and feeding — my strength
* c++ doesn’t have “someone else” taking care of lots of things for you the developer, so you must take care of lots of things yourself.
* c++ is not a rapid development language
* c++ is an older language, undergoing less rapid change
* c++ has a higher entry barrier. Look at mainframe.
* c++ is more “engineering” and requires more crafting than java/c# — my strength
* c++ is more low-level — my strength
* c++ is less accessible to self-taught developers. More things to go wrong.
* c++ (and analytics) is non-trivial portable knowledge.
* the more “bookish” a subject, the more suitable. Hopefully with unifying principles, not knowledge-intensive like medicine. I read about cold calling but it’s not bookish.

what(GTD+)skills differentiate trading developers

I said before that core java trading system developers need a few special skills

1) multi-threading
2) messaging
3) data structures and algorithms
?) distributed caching — trading system often avoid hitting database, so they keep large amounts of data in memory
?) serialization
?) Spring DI beyond MVC
?) java tuning
?) distributed computing using RMI, web services, ejb etc

1 and 2 are by far the most broadly recognized requirements.

Now I feel most of these skills are built on top of fundamental java skills. Messaging system uses threading, serialization, data structures. Caching uses threading, data structures, serialization …

I don’t know a well-defined list of “fundamental java skills” but interviewers often zoom into threading, collections and OO. Among these, threading presents by far the highest complexity in reality, but most applications stick to well-tested fool proof patterns.

I feel java generic collections (in a multi-threaded environment) is perhaps the 2nd in complexity. (I realized this after reading c++. C++ generic collections are quite a bit messier than java.) Most java developers I know never need to go beyond scratching the surface of generics.

In conclusion, to pass interviews, over-prepare on threading and collections, and prepare for high-level questions on messaging. To be a good trading programmer, become really good at threading and serialization… among other things

net revenue, unrealized pnl

For a financial controller overseeing a trading desk, MTD [1] net revenue is the profit or loss of a trading account [2]. One way to compute this number is

 

  Realized pnl + unrealized pnl [3] – sales force commissions [4] paid out + interest accrued while holding the security

 

[1] or daily or YTD – just some period

[2] or a group of trading accounts

[3] paper loss or paper profit

[4] aka sales credit

##growing in java — where to focus when learning c++/c#

I feel stronger than a rookie java developer because we are comfortable with both GTD and IV:
1) IDE
** (remote) debugging. Also consider my Perl sss()
2) threading — idioms, principals
** thread creation, synchronized, wait…
** threadlocal
** thread pool
** immutable
3) reflection + proxy
) syntax of overriding, constructors, final, singletons, generics
) design patterns — large idioms
) unit test

other signs of strength:
) generics — creating generic classes
) serialization
) garbage collections
) RMI
) inner classes
) collections and data structures — choosing

What about spring, hibernate …? I feel these fads come and go.

trading sys architect interview – coding tests

Most of the SG/HK employers (UBS, RBS, Mdaq) perceive a wall street veteran (like me) more as a architect/tech-lead candidate than a senior dev. However, the toughest tests are always coding tests esp on IDE.

You would think an architect interview would not focus so much on the fine details. Well, most details (by definition of the word) are not important to an arch interview, but some (1%?) of the details are. Fundamentally, this is because any large of small software architecture is always conceived and ultimately implemented using __basic_comp_science_constructs, such as stackVar/heapVar/staticVar, thread safe iterators (loops), queues (linked list), circular array, concurrency primitives …

Fact is, these architect roles are extremely hands-on. In low-latency architect roles, a key value-add is the experience, insight, techniques, tools on low-level optimizations.

Among the 3 types of domain knowledge (see my other blog), your jargon/math experience is not relevant in a coding test. How about your trading arch experience? Relevant to some extent.

hibernate mock interview question

short and imprecise? ok
[m=answer found in official hibernate manual such as http://www.hibernate.org/hib_docs/v3/reference/en/html/tutorial.html ]
page numbers -> [[ java enterprise in a nutshell ]]

  1. how do you process a bunch of records when you select half the columns? What kind of data structure does hibernate return? P 650
  2. how do u update a “disconnected object”
  3. why proxy?
  4. Lazy loading? (seems to be important)
  5. write a finder statement used in your (pushmail) DAO class to illustrate the difference hql ^ sql
  6. big signature of Session.load(). AR-revealing!
  7. access modifier for fields in a domain object? P 630
  8. name the 2 types of hib config files
  9. generator class=”native” means? P 627
  10. what typical java types to use for persistent fields?
  11. what happens if there’s a clash in an id field/column when writing to DB? P627
  12. describe exactly when hibernate writes to DB. I think this is covered in my blog. P643
  13. what’s a bag?
  14. describe the session object
  15. describe the query object
  16. what’s the difference between the properties file vs the xml file
  17. what performance issues did you face using hibernate?
  18. how did you integrate hibernate with proc?
  19. 2 types of hibernate caching? (2nd-level caching)

non-iview questions:
* how does hibernate manage connection pool(s)? P641
* what if you try to load one object and all the linked objects are loaded and it takes huge memory and db query resources?