Why java is not pure OO language?

  1. Java has primitive types which are not objects. ( Scala handles them as objects).
  2. In Java, operators are not methods that are invoked on objects. (In Scala, operators are actually method calls  val x = 1 + 2 is really making a method call 1. +(2)).
Posted in Java, Scala | Tagged , | Leave a comment

Data structures and algorithms

There are  set of videos from UCBerkley to learn about data structures and algorithms. It is really good.

Posted in Uncategorized | Leave a comment

Scala learning resources

Daniel Westheide has written a series of blog(as of now 13 posts) about the scala language  It is useful for those who already knows a bit of scala.

Part 1: Extractors

Part 2: Extracting sequences

Part 3: Patterns everywhere

Part 4: Pattern Matching Anonymous Functions

 

Posted in Uncategorized | Leave a comment

Interesting things about liftweb

Liftweb is functional web application framework which follows view-first pattern. Most of the java web frameworks follow MVC pattern. This view-first pattern gives more reusable code compared with MVC pattern.

There are lot of resources available to learn about liftweb

  1. Exploring lift
  2. Simply lift 
  3. Liftweb cook book

Books

1. Lift in Action

Open source projects that use liftweb

Apache ESME  – micro messaging platform

Posted in Liftweb, Scala | Tagged , | Leave a comment

Eclipse E4 Notes

1. What is Eclipse e4?

Eclipse e4 is the next generation platform to simplify the Eclipse programming model. It provides lot of new features. Some of them are

1. Application is defined as EMF model which can be modified at run time.

2. The model can be extended by other plug-ins.

3. Dependency injection(DI) – Objects can be injected using dependency injection and It uses EclipseContext hierarchy to search for an object. This design allows to reduce the line of code considerably, For example we can store domain model in eclipse context and using DI we can get these objects in UI and business logic.

4. New renderer can be used as presentation engine. In eclipse 3.x versions, SWT/JFace is used as default presentation toolkit.  But using this new presentation engine, UI is defined as EMF Model and different UI kits can be used as renderer. So we can use swings, JavaFx, QT tool kits as presentation engines.  Existing swing applications can be ported on e4 platform using this design. These applications can enjoy the additional benefits of osgi plugin model. Kai has demonstrated this one in http://www.toedter.com/blog/?p=709

5. Eclipse Juno is based on this e4 platform and future Eclipse releases will be based on this platform.

2. what are all the advantages of using e4 with swing application?

Existing java swing applications can be ported on E4 platform and can enjoy the benefits of e4 platform. ( Plugins, modularity, dependency injection and lot of ready made osgi bundles).

3. How to create an instance using dependency injection?

1. get the IEclipseContext

2. Make the instance using ContextInjectionFactory.make method

example to create the NavigatorPart UI

IEclipseContext context  = …

ContextInjectionFactory.make(NavigatorPart.class, context);

4. How to get the IEclipseContext

From Application model Object : if the model object implements MContext ( MPart, MWindow, MApplication,MPerspective), then we can use

IEclipseContext context  = context.getContext();

From OSGI Bundle:

Bundle bundle = Framework.getBundle(this.getClass());

BundleContext bc = bundle.getBundleContext();

IEclipseContext ecContext = EclipseContextFactory.getServiceContext(bc);

ContextInjectionFactory.make(NavigatorPart.class, ecContext);

5. How to create child eclipse context?

1. using the exisiting context

If the object is managed by eclipse context, we can get it

@Inject

public void createContext(IEclipseContext parent){

parent.createChild();

or

parent.createChild(String name);

}

2. Create separate and attach it with parent

IEcliseContext child = EclipseContextFactory.create();

child.setParent(child);

Posted in Eclipse | Tagged , , , , | Leave a comment