GWT Designer for Java Developers

Standard

Are you so bored to coding interfaces using swing in Eclipse and You won’t use Net Beans cause NB turns your interface code in a trash ? Your problems are solved with this plugin! I’ve already used some Eclipse plugins to do interfaces using swing, but the GWT is the best. For keeping your code clean.

GWT Designer is built as a plug-in to Eclipse and the various Eclipse-based IDEs (RAD, RSA, MyEclipse, JBuilder, etc.). The plug-in builds an abstract syntax tree (AST) to navigate the source code and uses GEF to display and manage the visual presentation. Using WYSIWYG layout tools, you don’t need to write any lines of java code – the code will be generated for you by GWT Designer.

 

Advertisements

C# for JAVA Developers

Standard

I’m studying these languages at same time. I need to some resources for it. Here a list of resources on the web which are helping me.

There are also a few significant differences between the two languages. Because the developers of C# had the advantage of carefully examining Java while developing their language, it is not surprising that some of the differences attempt to address significant problems that are difficult to deal with in Java.

The major features C# has in common with Java include garbage collection, a virtual machine, single inheritance, interfaces, packages (called namespaces), and the fact that all code is encapsulated within objects.

Links:

The C# Programming Language for Java Developers

JAVA vS C#

A COMPARISON OF MICROSOFT’S C# PROGRAMMING LANGUAGE TO SUN MICROSYSTEMS’ JAVA PROGRAMMING LANGUAGE – By Dare Obasanjo

Green Threads

Standard

The first point we will talk is about native threads, which happens in OS level. An example is POSIX threads. This mainly means that file and memory are shared among all threads.  If you use C to program on Linux you can link pthreads.

In computer science, green threads are threads that are scheduled by Virtual Machine, therefore in JAVA this is made by JVM. Green threads are essentially simulated threads. The Java Virtual Machine would take care of switching between different green threads, but the JVM itself would only run in on OS Thread. This can bring for us some advantages:

  • If we are using native threads, the overhead is so increased. It is also usually slower to switch between native threads than using green threads.
  • A system can usually support a much higher number of green threads than OS Threads.
  • It would be practical to spawn a new green thread for every new connection on a web server, but it is not generally practical to spawn a new native thread for every incoming HTTP connection.

There are disadvantages:

There is only one native thread, so its is  the only thread that gets scheduled. Even if there are multiple CPUs and multiple green threads, only one CPU will be running one green thread at any time. It mains that green threads cannot take advantage of multiprocessor system. Since JVM creates are not threads at OS Level.JVM splits its timeslice among the various threads that it spawns internally. Thus, the JVM threads are bound to run within that single JVM thread that runs inside a single processor.

As a result, native threads can have benefits from multiple processors. There are time when you might to use Green Threads. You must to know what time you can use these specifics threads.

Event Handling in Java

Standard

There are two common ways to event handling in Java:

  1. Anonymous Class
  2. Create other method

Anonymous Class

An anonymous class is a local class without a name. An anonymous class is defined and instantiated in a single succinct expression using the new operator. While a local class definition is a statement in a block of Java code, an anonymous class definition is an expression, which means that it can be included as part of a larger expression, such as a method call. When a local class is used only once, consider using anonymous class syntax, which places the definition and use of the class in exactly the same place.

Features:

One of the most elegant things about anonymous classes is that they allow you to define a one-shot class exactly where it is needed. In addition, anonymous classes have a succinct syntax that reduces clutter in your code.

Continue reading

Deadly Diamond of Death

Standard

The designers of Java avoided multiplhe inheritance. Replacing it is multiple conformance to interfaces. In Java, there is a structure called an “Interface”. A Java interface is almost identical to a C++ class that has nothing but pure virtual functions. In Java you cannot inherit from more than one base class. However you can “implement” more than one interface.

This UML  diagram shows four classes arranged in the diamond structure that creates the need for virtual inheritance. Both of the classes B and C inherit from class A. D multiply inherits from both B and C. Two problem arise from this. First, which implementation of the ’f’ function does D inherit? Should it inherit B::f() or C::f(). In C++ the answer turns out to be neither. D::f() must be declared and implemented. This eliminates the ambiguity, and certainly this simple rule could have been adopted in Java.