Live data from Hacker News

Developing and running a Java EE Hello World application

wiki.jetbrains.net

41–50 of 84 posts

Re: Developing and running a Java EE Hello World application

#41
post #17
post #2

I don't do web apps with java, so I honestly don't know if it's the proper way to do it, a satire, or if there is a more straightforward way. Especially, I don't see why one has to write both the class HelloWorldServlet and HelloWorldBean; couldn't one just inherit from one class or implement one interface?

You could just have the servlet write "Hello World" directly. The Bean is not really useful in the example -- it's mean as a stand in, to know how to write one for your business logic needs, e.g user or product bean etc. (Btw, beans are just lightweight classes used mostly as structs, with getters and setters).

>>You could just have the servlet write "Hello World" directly.

It's been years since I've had to write a Java webapp, but from what I remember using the servlet code to directly write the webpage output was considered bad. That was the job of the jsp file. e.g., "views" in bottlepy and Rails: http://guides.rubyonrails.org/layouts_and_rendering.html

Re: Developing and running a Java EE Hello World application

#42

I've also done some JEE quite a long time ago and I hated every second of it. I'm not sure however if my experience is representative of the the Java community. There is no problem with the language itself nor the VM which is also working quite fine (while taking a lot of RAM). But I really have a problem with the community, everything seems over-engineered and super complicated in Java, even with simple things. Noth…

> they are building pyramids while other languages are building stuff out of bricks

Pyramids are engineering feats, Java EE people are building stuff which look like works from M. C. Escher, it bends your mind when you try to understand the code :)

Also a little anecdote to the complexity of enterprise stuff: at the company I worked before, they were writing an entire persistence framework from scratch (with annotations instead of xml) so they could get away from hibernate.

Re: Developing and running a Java EE Hello World application

#43
post #37
post #32

Earlier quoted context omitted.

How about: apt-get install php5 apache echo " Hello World " > /var/www/index.php The end.

And are you going to use this process for development work? I doubt that. Plus, in your example, at the end you're stuck with PHP. I'd rather be stuck with Java EE :)

I like how you upped snark at one language with snark at another ;)

Re: Developing and running a Java EE Hello World application

#44
post #32
post #12

Setting up any web stack is a pain in the ass and probably just as long of a tutorial. For example, write out a tutorial which goes from base Ubuntu install to "hello world" on Rails, I bet it's just as long or longer. I suppose it depends on how much detail you want to include. There are just more "one click" install options for other stacks.

How about: apt-get install php5 apache echo " Hello World " > /var/www/index.php The end.

let's go simpler (and imagine logic coded in vanilla js if this project ever goes bigger :) :

  apt-get install apache
  echo "Hello World" > /var/www/index.html

Re: Developing and running a Java EE Hello World application

#45

Taking a cheap jab at Java EE just because their "Hello World" introduction article is a bit lengthy is bad form. Judging by the insulting "kids" reference in your title, Java EE has a completely different mindset than you are used to and the target audience doesn't include you. That doesn't mean the millions of other developers and billions of other platforms running Java are inferior.

You're right. It's still funny though.

Re: Developing and running a Java EE Hello World application

#46
post #43
post #37

Earlier quoted context omitted.

And are you going to use this process for development work? I doubt that. Plus, in your example, at the end you're stuck with PHP. I'd rather be stuck with Java EE :)

I like how you upped snark at one language with snark at another ;)

It seemed fitting :))

Re: Developing and running a Java EE Hello World application

#47

Except that that's not just a "Hello Word" page. That's routing to the right page, transaction and session control, storing the text of the message in a separate class than the one that returns the response, and using a template to return the resulting HTML. Looking at the section with the actual example code in it, you could do it in about half that, if you wanted a simple version that just returned "Hello World". I…

This does almost everything (and sending it to another class is pretty trivial): http://flask.pocoo.org/docs/0.10/quickstart/

Re: Developing and running a Java EE Hello World application

#48
The main problem with JavaEE is hardly the development part. It's the maintenance and support part. When relatively inexperienced programmers write complex applications (because it makes this easy) and then something goes "wrong" in this pyramid of abstractions and layers and layers of libraries / frameworks interacting with one another and the application servers. That is when it gets interesting. Yeah there are great production performance monitoring tools like Dynatrace but it's not a silver bullet.

Re: Developing and running a Java EE Hello World application

#49

Taking a cheap jab at Java EE just because their "Hello World" introduction article is a bit lengthy is bad form. Judging by the insulting "kids" reference in your title, Java EE has a completely different mindset than you are used to and the target audience doesn't include you. That doesn't mean the millions of other developers and billions of other platforms running Java are inferior.

At a previous employer, we've migrated a complex J2EE (with EJB 2.0 and such) E-Banking system to use only Jetty and JDBC directly. No one in operations noticed the difference. But the developers did. Oh they were about 5x as productive afterwards. With no missing features. Perhaps I'm not included in the target audience. But if E-Banking can do it, what remains of the "target audience" ?

As much as I agree that J2EE is bloated, the fact that you can migrate a project to a less bloated stack and still run it proves nothing. The whole point of the whole "bloatiness" is so that supporting/changing the system in the the long run will be faster, easier, and cheaper.

Re: Developing and running a Java EE Hello World application

#50

I've also done some JEE quite a long time ago and I hated every second of it. I'm not sure however if my experience is representative of the the Java community. There is no problem with the language itself nor the VM which is also working quite fine (while taking a lot of RAM). But I really have a problem with the community, everything seems over-engineered and super complicated in Java, even with simple things. Noth…

> Maven is a nightmare to use, it's so complicated I would generally not use it. I would just like a package manager which is only doing packages like any other language.

Before Maven, generally I remember there being Ant. And I remember that if an application needed dependencies, unless one explicitly used a dependency manager like ivy, one had to go find the jars and download them, and ensure they were on the class path. Ant was simpler, in the sense that if you wanted something to happen, you would create an ant target and instruct ant on what was going to happen.

Maven isn't simple in the same way, so it does require one to learn more about how it works in order for things to fit together, but I find it drastically simplifies working with java projects. The location of all dependencies are defined, they are downloaded, and there is default behaviour to be expected with each of the maven goals. Overridable properties enable one to have a build which works first time directly after checkout. I much prefer it to what was there before.

If we look at what has come since - sbt, gradle, and leiningen all seem to use a similar mechanism to Maven for dependencies.

Post reply on HN