Tuesday, August 07, 2007

Flex

After a brief hiatus I'm back. I was busy relocating. Just a dump on what I understood about Flex so far.

JavaFX Script = ActionScript.
JavaFX Pad = Flex Builder, in the long run.
JRE = FlashPlayer.
MXML no real equivalent, but AjaxToolkits (Dojo, etc and jMaki are of help here).
Flex seems to be a clear leader, innovator in this space.

Presentation tier if it resides on client, what's the use of JSP/Servlet technology! A web app is just a packaging of Flex applications: a set of SWF files and HTMLs that refer them. A web server that dishes out such HTMLs and its embedded objects (SWF files) is just enough.

Looks like presentation with its dynamic aspect is back on the client box.
State management is back on the client box, i.e. state is maintained at client box, server gets back its scalability (to dish out data, or execute business logic, or any Web 3.0 functionality).
Business logic, if simple, can be part of client-side following MVCS (MVC with a communication service S to fetch data) pattern. If business logic is complex say transactional in nature, it can reside in a JEE server.

Flex application can use two free/open RPC services, HTTPService and WebService, to interact with remote servers (to fetch data, or perform a business logic step). By "free/open" I mean you don't need any special proprietary (or for pay) infrastructure on the server side. The third type of RPC service, using RemoteObjects, is available if you have Adobe provided Flex Data Service (FDS) server infrastructure that maps Action Message Format (ActionScript binary object marshalling format) message to instantiate Java objects on server side. FDS is not free; may have changed now. { TODO: Not sure if it allows instantiating .NET CLR compliant objects for M$ platform. }

Flex Builder is Eclipse plugin; to develop Flex application you need C++ based IDE, and at run-time it needs JRE! { TODO: Why it needs JRE at run-time? }

Just a side-note: FlashPlayer is about 1.5MB size, JRE is about 15MB in size. Probably it is good for Sun to break JRE as say full vs minimum (to compete with FlashPlayer considering JavaFX).

Friday, April 13, 2007

Semantic Web


http://www.w3.org/DesignIssues/Principles.html
http://www.w3.org/DesignIssues/Evolution.html
http://www.w3.org/DesignIssues/Extensible.html
http://www.w3.org/People/Berners-Lee/UU.html

http://www.w3.org/DesignIssues/Semantic.html

Achieving a set of connected applications for data on the Web in such a way as to form a consistent logical web of data.


http://novaspivack.typepad.com/nova_spivacks_weblog/
Nova Spivack. Founder Radar Networks; SFO based Web 3.0 startup!


http://www.xml.com/pub/a/2007/03/14/a-relational-view-of-the-semantic-web.html?CMP=OTC-TY3388567169&ATT=A+Relational+View+of+the+Semantic+Web
A relational view of semantic web. With query language SPARQL, a query framework for RDF-based store.


http://www.mkbergman.com/?p=354
DBPedia, largest source of structured data on Internet. Freebase is another competing technology or consortium, based on Wikipedia.
DBPedia represents data using Resource Description Framework (RDF) model. RDF uses a triple "subject-predicate-object" to model data; subject is the resource, predicate denotes traits or aspects of resource and a relationship between the subject and the object. The subject, predicate and object can be individually identified using URIs.


http://blogs.sun.com/bblfish/entry/short_interview_for_semantic_web
Henry Story, Sun's Staff Engineer
Semantic web brings together the web, data bases, object oriented programming, and reasoning.
Claims that to bring these things together, we've to be extremely simple and clean and build on the core thought of "everything is connected".
Semantic web is about making information more connect-able.
Schema = Ontology, in semantic web terms. SPARQL can work with half-baked ontology/schema; it can determine ontology dynamically.

http://www.businessweek.com/technology/content/apr2007/tc20070409_248062.htm
Semantic web use cases!
Semantic web is about data mining; building relations using data in dynamic fashion.


WWW first decade of Internet: 1989 to mid-1990s; HTML. Server generated Web; users were just fetching data published as HTML. Few services like email, calendar that were used by users.
Web 2.0 second decade of Internet: Late 1990s to early naughties; services on Internet; amazon, ebay, google. AJAX-based rich UI, XML Web Services. Social networking, blogging, Wiki, photos, etc. Ability to categorize data by tagging. User generated Web.
Web 3.0 third decade of Internet: Late naughties to early teens; HyperData markup or Semantic Web. May be streamlining tagging a bit; allowing Internet end-points/applications to build relations between data available on the Net and/or themselves.

http://www.businessweek.com/technology/content/apr2007/tc20070409_961951.htm
Semantic web = Data web; its about finding and co-relating information.

Tuesday, March 20, 2007

Dependency Injection = GoF Builder

http://www.martinfowler.com/articles/injection.html

Component = Software that is intended to be used, without component-source-code change, by client applications. Component and it's client are typically co-located, e.g. in same JVM or in same executable.
Service = Service and it's client are not co-located, or client accesses a remote service.

If you see
public interface Injector {
public void inject(Object target);
}
, it injects (or sets) target to act on for a component. Basically, a setter on a component that implements Injector-interface.

Tester class or Assembler (actor) is nothing but a GoF-Builder-participant-Director that knows how to construct a GoF-Builder-participant-Product (MovieLister) that has GoF-Builder-BuildPart (MovieFinder).

Can we then say that Dependency Injection is nothing but configuring a GoF-Strategy (or algorithm in general) using GoF-Builder pattern?
Or, in general, Dependency Injection is nothing but GoF-Builder?

Builder is supposed to separate the construction of complex object (data and procedures that operate on that data - a GoF-Builder-participant-Product, or MovieLister in Martin's link above) from its representation (MovieLister with certain implementation of MovieFinder in Martin's link above).


Dependency Injection (DI) is referred as specific case of the general pattern "Inversion of Control", i.e. how framework invokes call-backs from client source code. For example, how MovieLister (say part of framework source code) invokes MovieFinder (say part of client source code). Inversion is in terms of framework invoking client, rather than the most typical case of client invoking framework methods.


http://java.sun.com/developer/technicalArticles/J2EE/injection/

Java-EE 5 seems to be using such DI using Java-SE Annotations mechanism. The Java-EE 5 Web/Application Container is the Builder-Director that builds Java-EE-components like Servlets, EJBs. The Java-EE-components are the Builder-Products.

Java-EE 5 Annotations (examples at least) seem to promote hard-coding of such "dependency" names-or-identifiers, e.g.
@Resource(name="jms/demoTopic")
private javax.jms.Topic demoTopic;
Just wondering if it's possible to pass such names dynamically to the annotation!

Thursday, March 15, 2007

Big O Notation


O(1) = Constant-time = Time to execute an algorithm or operation doesn't depend on size of input
Getting or accessing array element is a constant-time operation.

Constant-time is sort of "dream come true" for an algorithm, the best!


O(log n) = Logarithmic time = Time to execute an algorithm or operation is proportional to logarithm of size of input n.
Binary search on a sorted list is logarithmic in complexity.


O(n) = Linear time = Time to execute an algorithm or operation depends on size of input n, or is directly proportional to size of input n
Determining smallest element in an unsorted array is a linear-time operation.
Determining smallest element in an unsorted, fixed-size array can be considered as a constant-time operation (since n is a constant in this scenario).

Linear time is desirable attribute of an algorithm!


O(n log n) = Log-linear time
Heap sorting is log-linear in nature.


O(nk) = Polynomial time = Time to execute an algorithm or operation is no greater than a polynomial function of a constant k irrespective of size of input n.
O(n2) = Quadratic time
O(n3) = Cubic time

Polynomial time is considered "fast" (enough) for an algorithm.


O(kn) = Exponential time = Time to execute an algorithm or operation is an exponential function of size of input n.

Exponential time is (considered) "slower" than polynomial time for an algorithm.