SD West 2007 - Random Notes


March 21, 2007 – Day One
Session 1: Effective Aspect-Oriented Programming – Ron Bodkin

rbodkin@newaspects.com
http://www.eclipse.org/aspectj

Eclipse with AspectJ Plugin or Spring AOP or JBoss also have tools for eclipse as well.

Pointcut defines the join point where we want to call the aspect.

public aspect MeteringPolicy {

pointcut useTitle() :

execution(public void Song.play()) ||
execution(public void Song.showLyrics());

after() returning : useTitle() {
MeteringService.trackUse();

}

}

Terms: advice method (do the following thing), pointcut
ajc links the aspects to the java objects. You need to use ajc at some point to grab the pointcuts in the java code. However, Spring will use proxies that are called instead of requiring the use of ajc (aspects compiler) to modify the bytecode.

Used for tracing, monitoring, handling boiler plate code, used for understanding your system better.
Example:

call(* Remote+.*(..) throws RemoteException);

This example can be used to handle all the RemoteExceptions so the programmer doesn’t have to write the code to handle RemoteExceptions. This removes the boiler plate code of the try/catch in every call that throws a RemoteException.

Advice: Start small, only a few should write the aspects. Incremental adoption works best

Random Notes:
AspectJ 5 (latest, most flexible)
Spring AOP – handles a subset of the JAspects advices handles
JBoss AOP
Check out Glassbox for performance monitoring and problems. Uses load time weaving.

Session2: Crystal Clear: A Human Powered Methodology for Small Teams – Alistair Cockburn

Talk about agile coming out well or not well. What’s the difference?

Crystal Clear – Questions
Small teams hasn’t been working well…

Nothing written down
specs not clear
more changes than people can do
resource-starved project … req’ts /it infrastru /

Techniques for getting max benefit from limited resources
Guidelines to use agile
When Customer/sponsor

Successful projects where listening to the people (people-centric) and constantly modify the methodology.

Different people do different things. Can’t drive a methodology down someone’s throat. Different projects and people use different methods (pair programming, uml design, test driven development, etc). happy people ship, happy code! People like to be told what to do, so they won’t do it. Each person has to say what they are going to do.

Crystal’s purpose: Keep people from hurting each other, keeping each other informed
Crystal’s nature: A set of conventions that get updated

Six people or less. Give them a whiteboard, let them ship code, and you’re almost done.

Thinks of each project as a game.
Primary Goal: Deliver the project
Secondary Goal:

From the seven principles of methodology design
Face-to-face communication is the cheapest and fastest channel for exchanging information

Recommended Reading
The Goal (Paperback)
by
Eliyahu M. Goldratt (Author), Jeff Cox (Author)

Frequent Delivery
Osmotic Communication – no private offices, communication is easy
Reflective Improvement – What are we doing, how are we doing it. How do we improve.

Personal Safety
Focus – don’t work on two or more projects
Easy Access to Expert Users
Technical Environment with (agile places this first, that’s ok)
Frequent integration
Automated testing
Config management

Critical technique in Crystal: Slide 20 Reflection Workshop. Discuss and determine what things you’re going to try. Try these are things you can control and do.

Sets projects based on color. Clear, Orange, Yellow, etc.

Session 3: An Overview of TR1 – Scott Meyers

smeyers@aristeia.com
http://www.aristeia.com

Technical Report 1 – Future standard of functionality to be in standard C++

Currently in the std::tr1 eventually maybe in the std namespace. You must have a TR1 conformant library for this to work.

New Functionality: C99 Compatibility

TR1 is a specification. This is an interface specification not an implementation. To understand the functionality in TR1: http://www.aristeia.com/EC3E/TR1_info.html

10 of the 14 libraries in TR1 are modeled on Boost libraries. Boost will bring its libraries into conformance with TR1.

gcc 4.0 – has some of the TR1. To get it, you can use Boost library, it has 11 of the 14. You can also look at Dinkumware.

Smart pointers declared in the header <memory>. Check out auto_ptr and shared_ptr. “this” is a raw pointer. Be careful when returning shared pointers to yourself.

Operators: static_pointer_cast, dynamic_pointer_cast, const_pointer_cast
Relational: ==, !=, <

Output: <<

auto_ptr solves the problem of exclusive ownship. shared_ptr solves the problem of shared ownship. auto_ptr always deletes its resource.

tr1::weak_ptrs can’t keep resources alive. Solve the problem of dangling pointers and cyclic references.

TR1 tells you nothing about where these features are thread safe.

HashTables

Regular Expressions
declared <regex>

Pete Becker’s Book on TR1. Slide page 54.

Session4: Puzzlers

Review the slides…

Examine - Autoboxing, varargs, generics

March 23, 2007

Session1: What’s coming in Java6 – Jason Hunter

StaX – pull parse, doesn’t store the whole document in memory, good good.

Annotations
Thrid Party @Nullable, @notNull – IntelliJ
@Test, @Before, @After in JUnit 4
@Immutable, @ThreadSafe, @NotThreadSafe, @GuardedBy from Java Concurrency in Practice

Java 5 – apt (annotation processor tool)
Java 6 – (standardized) java –processor

Core HTTP Server
Mini-Servlets, in com.sun.net.httpserver. Designed to support JMX and JAX-RPC. Only used for their own purposes.

New Deque = Double Ended Queue
acts like a Queue + Stack
Navigable Sets and Maps, let’s you get near missed items. I’m looking for this, if its not there, give me the one right above it or the one right below it.

Randomized Skip Lists - http://en.wekepedia.org/wiki/Skip_list
A linked list capable of large forward jumps

Removing feature’s in Java 6
Aimed at reducing the Java Runtime jar. The first thing to remove is javax.sound.midi, it has a target.

Java 7
Just thinking about stuff right now.
JAM to JARS. Java Modules proposed in JSR 277
Use the metadata to discover, load, and check module
Also superpackages, package families, which has special rights to classes in the superpackage

Dynamic Languages – new invokedynmaic bytecode
JSR 292 would let you invoke methods in the absensce of static type information

NIO 2 – JSR 203
A new filesystem API
Asynchronous filesystem calls
Better tie socket channels and sockets
(Fuse) -
http://fuse.sourceforge.net/

Javadoc Update
More easily identify factory methods

Non-API features
Putting XML in as a standard data type
Strings in switch statements
Comparisons for enums
Closures?

http://java.sun.com/avase/6/docs/api
http://planetjdk.org
get slides @
jhunter@marklogic.com

Session2: Extreme Web Caching – Jason Hunter

javap -public -classpath jsse.jar java.lang.Class
Determines the public interface
Based on “HTTP Caching & Cache-Busting for Content Publishers by Michael Radwin

Client
GET /index.html HTTP/1.1
Host:
www.server.com

Server
HTTP/1.1 200 OK
Date: …
Last-Modified: …
Content-Length: 2750 (Good for keep alive, this helps the client know when it’s the client’s turn to talk again)
Connection: close
Content-Type: text/html

<html><head><title>

Side note: JSPs buffer 8K by default
expires tag means the jpg or whatever is still go until that date. If-Modified-Since revalidates that the content hasn’t changed. If the content hasn’t been modified the server returns status code 304, not-modified-since, but doesn’t return the content the user requested.

1. Use “Cache-Control: private” for personalized content

Issue with cookies, sending a cookie say from jane back to john. So you should use Cache-Control header. Cache-Control: private
Disallows shared caching, allows private (browser)

Cache-Control: public
Explicitly allows shared caching

2. Implement “Images Never Expire” policy

Dictate that images (icons, logos) once published never change

Set Expires header 10 years in the future

Check – http://use.perl.org/~geoff/journal/22049

3. Cookie-free TLD for Static

Use a separate domain for static content

A domain without cookies

www.server.com for html

static.server.net for images, PDFs, etc

4. Apache Defaults for CSS/JS

Rely on If-Modified-Since request header
No special configuration needed

How can a server know when servlet content changes?

The .class timestamp is meaningless

Help the ser with getLastModified()

public long getLastModified(HttpServletRequest req) {

Return datamodified.getTime();

}

Called before doGet(), possibly avoiding doGet()

5. Random URL strings

Add javascript to create random url

Point all the ad servers to localhost 127.0.0.1, this removes all the adds when browsinghttp://www.everythingisnt.com/hosts.html

http://www.mnot.net/cacheability/http://www.mnot.net/cache_docs/

http://www.radwin.org – he’s blog

Session3: Java Persistence API Overview – Cay Horstmann

San Jose State University
Influenced by Hibernate, Oracle TopLink, JDO
Annotation the fields in the class, not the getter and setter.

There are five requirements for an Entity
Annotated with @Entity
primary key
no-arg constructor

Persistence context = set of managed entities
Entity manager = object that manages persistence context (find, persist, createQuery, …)

Need the persistence.xml file.

Can’ persist inner classes and final classes

With eclipse wait for Dali and WTP.

Address issues of refactoring the objects. What happens if we change the foreign key relationship or we modify the way that relationship between entities are modified.

What happens with the cache? If we get a result from a query and then modify the table so we have a new entity. If I query again the cache returns the original result set before the insert. How do we get around this?

Away around naming objects like “User” this is a sql reserved word. However, Hibernate has a method of getting around this does JPA.

Java Persistence Query Language (JPQL)

Lazy Fetching
Fetching is eager by default for @OneToOne, @ManyToOne.

To use an EJB container or not? Use annotations to get EJBs and a handle on the EntityManager.

Session4: What’s New in XML in Java 5 and 6 – Elliotte Rusty Harold

JAXP
DOM 3
Java XPath API
Java Validation API
Java XML Digital Signature API
StAX

Java 5 added DOM Level 3 support
Remember, getTextContent() and setTextContent(String textContent) cuts dozens of lines out of programs.

User Data – a user-defined callback class that is invoked when a node is cloned, imported, etc.

Bootstrapping
DOM2 has no implementation-independent means to create a new Document object

DOMImplementation impl = DOMImplementationImpl.getDOMImplemenation();
Document fibonacci = impl.createDocument(…);

To read a document, must import

org.w3c.dom.ls.*;
org.w3c.dom.bootstrap.*;

Checkout LSParserFilter, org.w3c.dom.ls, for removing parts of the document when reading.

Writing LSSerializer serializer = implls.createLSSerializer();

LSOutput output = implls.createLSOutput();
…blah… blah

XPath
Query without detailed DOM navigation
eg. //book[author=”Neal Stephenson”]/title”
javax.xml.xpath package

Java Validation API
package javax.xml.validation
JDK bundles W3C schema support

http://www.cafeconleche.org/slides/sd2007west/java5xml/

BOF – Interviewing in Silicon Valley

http://www.techsmith.com
htdye@linkedin.com

paultima.blogspot.com

Interesting bit of information about interviewing for jobs in Silicon Valley, from Google perspective. Discussion included a log of emphasis on algorithms and Big O runtime for algorithms. How would you sort a collection of A, for example, why? Advice was to focus on some open source projects that are interesting. This helps when potential employers look at your resume they see that you’re interested in the community and making contributions to projects.

March 23, 2007
Session1: Everything New in ASP.NET 2.0 - Stanfield

This session was a complete waste of time. The speaker was fumbling around, finished early and started his next presentation on AJAX. In addition, the presentation is available online from Microsoft, so the session was completely unhelpful.

Session2: Using Visual C++ To Light Up on Windows Vista – Nikola Dubar

Microsoft is trying to make development on Vista easier for C++ developers. Includes WCF, and WPF. The demonstration utilizes Visual C++ Orcas. Second part of the talk will be improvements to MFC. Check the article, Top 10 Ways To Light Up.

Orcas is coming out pretty soon.

User Access Control
Reliability and manageability
Restart Manager – saves the application’s state, shuts the app down, updates the application code and restarts the application.

Application Recovery and Restart – register callback functions, if the app dies this function is called to restart the application.

Function Discovery – enables apps to discover and manage lists of devices or objects sorted by functionality or class. Available before but it is more organized now, a standardize method for retrieving this information.

Cancelable I/O –

Customer Feedback Loop

Windows Quality Online Service, register with ms and get your app dumps when they crash. The apis provide ability to customize reports for your dumps. Check this out!

Windows Vista style guidelines

New Common Item Dialogs
Windows Vista Wizard Framework – PSH_AEROWIZARD
Checkout comctl32.dll

WPF – Rich library of controls – core component of .NET 3.0
No native code alternative
WPF, WCF, XPF – is only available in managed code
MFC part is all native

Organize and Search
All mechanisms are exposed via COM interfaces

WCF – Windows Communication Foundation
Helps with evolving client app into service oriented applications
Single programming model
Part of .Net Framework
No native code alternative

Mix mode allows you to use native C++ and call the .NET framework for features that use .NET features through C++ CLI.

Three modes
–clr (native and managed)
-clrpure (all managed code)
-clr (verifiable code)

RSS library

Document data
XML-based document packaging
XPS

Additional libraries for Mobile Devices
Network Awareness APIs
Sync Center
Power Management
Window SlideShow

10 new features in Vista only 3 are managed code the others are native code

VC++ Orcas
UAC-ready
Base Address Randomization – prevents hacker for getting address of dll. Hacker has to guess where dlls are loaded.
Data Execution Protection doesn’t allow buffer overflow

JPA – possible app rss reader that persists content
Or java accessing the .net apis for rss feeds etc

Session4: How to Build a Scalable Multiplexed Serer With NIO – Ron Hitchens

ron.hitchens@marklogic.com
ron@ronsoft.com
http://javanio.info

How to use NIO to build a server. Lower level i/o that is more sufficient for io than the java.io package. Gives access to some of the lower features that the OS has for I/O.

Three ways for multiplexing in a server.
Poll each socket – not very good cause we have to check each socket for a request. If there’s one there process it. This could starve other processes

Thread-per-socket – this is how java worked before. Overhead of managing many threads.

Readiness selection (NIO)selects the sockets that are ready, requires OS and JAVA VM support

The Reactor Pattern – Google for Douglas Schmidt*

http://www.cs.wustl.edu/~schmidt/patterns-ace.html

From the UML PatternDemultiplexer – knows which sockets are ready. This is the object that answers that question.
Event on a handle is some data has arrived

NOTE: buffer bytes and reconstitute the structure. Structured messages will be fragmented across the network.

Handler can’t write directly to the socket. This is by design it should only read and write to queues. Handler checks the queue to see if it do something with data. If there isn’t enough data the handler replies back to the Dispatcher, I don’t have enough data. Once all the data is there, the handler will do its thing with it.

Old model is thread per socket, bad. This new model is one thread per message.

NIO Reactor UML – blue objects are part of the jdk

O’Reilly – Ray Lischner’s C++ in a Nutshell

Trackbacks

    No Trackbacks

Comments

Display comments as (Linear | Threaded)

    No comments


Add Comment


Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

 
Submitted comments will be subject to moderation before being displayed.