GUI-server communication — HFT (Piroz)

Mostly based on a veteran’s input…

Most GUI clients I have seen use some sort of messaging and you want that to be as asynchronous as possible.  There is no reason to keep the user waiting.  User clicks on something, the client sends a message to the server and the client is now waiting for a response.  When a response comes in (on a separate thread), the GUI takes it and displays whatever it needs.  Some people stick a unique request id in the message so when the response comes they can figure out to which request it belongs.

You also have subscription cases where you subscribe to prices for a security and the server will tell you listen to this channel for all updates.  That should be encapsulated in some sort of handshake.
RV, 29West and JMS are good choices.

MS iview – DB centric

Q: how do u speed up a stored proc?
%A: join order; index selection; avoid table scan; update stats

Now I think we should first establish performance target, by estimating minimum I/O required. (U can’t make a huge query run faster than a tiny query.) Then measure actual logical i/o. See the gap? Usually u can find clues in the execution plan. Improve the plan.

Q: How could a string object’s content be modified?
A (right): reflection to access the char array.

Q: how does a singleton become a 2-ton?
A: 2 class loaders, but i thought class loaders form a delegating hierarchy so no 2 loaders compete to load a class?
A (from interviewer): you can create a class loader outside the hierarchy. Indeed singletons are per-classloader.

Q:diff between clustered and non-clustered index
The answer I forgot to give: a column with lots of updates is no good as clustered index

Q: Users complain about a delay/slowness. we know it’s due to a Unix process. How do you investigate.
A: top; thrashing.

Q: What’s garbage collection?

Q: I have an object in a cache. it’s not referenced from anywhere outside the cache. After using it once, i don’t need it anymore. How do i get it garbage collected?
A: weakHashMap
A: just delete the entry from the cache

Q: lots of insert/delete/updates to a table. how do u keep track of all changes and by who? How do u ensure changes are always tracked?
A: %_hist table and milestoning

TYPE — different meanings in java vs c++

PRECISE meaning of Type differs between java and C++.

Java :
– any (even marker) interface,
– any class,
– any primitive….
is a type. We say “the declared type of the variable”.

c++ :
* any class, paramtrized or not
* primitive data type … is a type.
* typedef can declare new type names like aliases, but can’t create new types. Consider const_reverse_iterator.

java naming convention — registration

For an architect and a student, it’s good know ..

when a method or field or argument is named like …register…, it often means “add a CALLBACK to an OBSERVABLE”. The observable (subject, dispatcher..) often holds a list of listeners. When some life cycle event occurs, it /notifies/ them. See other posts on callback, listener, async…

Registration is used in DI, Hollywood principal and many “frameworks”

examples:
* registerShutdownHook

FCD vs regular *.h files

A footnote on the post about FCD. Here’s another aha moment — *.h file is #include’d into the the host class (I call it the “umbrella class”).

If the component class changes any part of its field listing including field types, umbrella “detects” it through the #include, tantamount to a text change in the umbrella file. Umbrella is marked dirty and needs a recompile.

Q: If you don’t #include the *.h but use FCD instead, can we avoid the recompile?
A: not sure. How about sizeof(Umbrella)? can compiler calc it if you use FCD? See Item 34 eff c++. I believe the trick borrowed from java is a pointer field, so sizeof(Umbrella) is independent of sizeof(Component)

again, what’s a header file for a c++ class

defining feature: MY Header file is #included by OTHER code, using macro expansion

feature: header file usually contains MY field listing so compiler can do sizeof()

Q: Does the object file include field listing?
A: not important

Q: is header file NOT compiled into the object file? In that case, the field listing is not physically saved in the object file?
A: At runtime, the assembly instructions in the object file has enough details to instantiate objects of my class.

Q: header file creates compile-time dependency, but how about run-time dependency?
http://www.gotw.ca/gotw/007.htm
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml – is a real-world coding standard in a real software company.