[vox] What is you opinion on having a Java EE talk for March?

Harold Lee harold at hotelling.net
Wed Feb 22 11:21:18 PST 2012


No language is perfect, but I thought I'd chime in with some points in
Java's favor.

Even at big companies, Java often isn't done in that "enterprise" way.
I don't like what I've seen of EJBs, and fortunately I've never had to
use them (even at IBM).

As far as cheap hosting, Google App Engine is one place to look. For
low traffic sites (e.g. pre-launch) it's free. And you can use your
domain name or theirs. And Amazon AWS offers the 1st year free (their
Free Tier: http://aws.amazon.com/ec2/pricing/).

Servlet containers can take a while to start up and deploy your app,
use some memory, etc. but they're getting ready to handle a lot of
concurrent traffic. And there are other web frameworks / APIs built on
the Servlet API that feel more modern, like Play
(http://www.playframework.org/).

Scala makes Java much less verbose while compiling to Java class files
/ byte code. Many variable types and return types will be inferred by
the compiler providing compile-time type checking without the typing.

What might be

Clock clock = new Clock();
System.out.println("Some text");

becomes

val clock = new Clock()
println("Some text")

and you can fit a main class (object in Scala declares a singleton) into 1 line:

object App { def main(args: Array[String]) = { println("Some text") } }

And there are 10 or more other features added by Scala that feel like
major wins in removing boilerplate code, like lightweight closures:

  val closure : Int => Int = { _ + 1 }

or

  List(1, 2, 3).map { _ + 1 }

Harold

On Wed, Feb 22, 2012 at 10:14 AM, Brian Lavender <brian at brie.com> wrote:
> Let me preface the Java seems to be encumbered at times with verbosity.
>
> System.out.println("Some text");
>
> Or, the following, has got to make one wonder.
>
> public static void main() {
> }
>
> Yet, with its strong typing, it can at times promote better safety. Yet,
> I know the Python guys have a lot of good stuff going.
>
> On Tue, Feb 21, 2012 at 06:10:05PM -0800, Eric Rasmussen wrote:
>>    Let me preface this by saying that according to some web development
>>    communities, Java's niche seems to be enterprise web development by
>>    large teams. The reasons I hear (warning: possible stereotypes and
>>    faulty assumptions ahead!) are:
>>    1) The language itself is limited and results in a lot of boilerplate
>>    code, requiring more development and maintenance time
>
> I think with EJB 2.1 the whole thing to stubs and skeletons and
> configuration files scared people off. EJB 3.1 is a whole lot easier. If
> you are writing Plain Old Java Objects (POJOs) and not having to focus on
> all this outside infrastructure, life is a lot better. Today's measurment
> of success usually measures whether or not you can focus on POJOs. Yet,
> Context Dependency Injection (CDI) also brings a better separation
> of concern.
>
>>    2) Deployment requires powerful servers, tons of configuration, etc.
>
> A little more overhead. But, if you all you want is a servlet container to
> serve up your pages, jetty is relatively light weight. If you want to see
> something cool, try the following:
>
> $ sudo apt-get install maven2
>
> Using the the following will create default web application that uses
> Wicket framework.
>
> $ mvn archetype:generate -DarchetypeGroupId=org.apache.wicket \
> -DarchetypeArtifactId=wicket-archetype-quickstart \
> -DarchetypeVersion=1.5.4 -DgroupId=com.mycompany \
> -DartifactId=myproject -DarchetypeRepository=https://repository.apache.org/ \
> -DinteractiveMode=false
>
> $ cd myproject
> $ mvn jetty:run
>
> Point your browser to http://localhost:8080 . It's pretty lightweight. Not to mention,
> if you send your source code to someone, they can run it too without having to grab
> a whole bunch of jar dependencies. Pack up and send your project to a friend using
> the following:
>
> $ mvn clean
> $ tar zcvf myproject.tgz myproject
> $ ls -l myproject.tgz
> -rw-r--r-- 1 brian brian 20K 2012-02-22 10:11 myproject.tgz
>
>
>
>>    3) The apps use a lot of memory so many web hosts don't support it
>>    It sounds like some of the libraries you've found might mitigate that
>>    and give people a reason to rethink Ruby on Rails or Django for their
>>    next app. In particular I'm really interested in how Java might benefit
>>    lone developers and small teams, either in terms of increased
>>    productivity or the security/stability/performance of the end product,
>>    and maybe a basic rundown of how to affordably launch a Java app.
>
> Unpredictable Garbage Collection can be a hinderance, yet ehcache is supposed
> to do a good job at managing memory. I believe it uses a slab allocator so there
> are less system calls to alloc and free.
>
> So, I would like to invite people to download Netbeans 7.1. Get the version that
> does either Java EE or "All". It has the application server, the database. You will
> also need to have the OpenJDK installed. If not do a "sudo apt-get install openjdk-6-jdk".
> You can also use OpenJDK 7 if you like.
>
> Once you have downloaded OpenJDK, run it similar to what follows:
>
> $ sh ./netbeans-7.1-ml.linux.sh
>
> Now that you have it installed, create a new web project.
>
> File->New Project
>
> Select a web project:
>
> Java Web     Web Application
>
> Choose the defaults. Enter the name as SimpleWebApp
>
> Once the project has been created, right click the project and select "Run".
>
> Voila, you have a running Java Web Application. Netbeans has some great tools at facilitating the
> process. Netbeans should launch your web browser with the url referencing your application. It launched
> it using the included GlassFish application server.
>
> I worked through the book titled:
> Java EE 6 Development with NetBeans 7
> by David R. Heffelfinger
>
> It walks you through many of the features of creating Java EE Applications.
>
> brian
> --
> Brian Lavender
> http://www.brie.com/brian/
>
> "There are two ways of constructing a software design. One way is to
> make it so simple that there are obviously no deficiencies. And the other
> way is to make it so complicated that there are no obvious deficiencies."
>
> Professor C. A. R. Hoare
> The 1980 Turing award lecture
> _______________________________________________
> vox mailing list
> vox at lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox


More information about the vox mailing list