Hot answers tagged

124

For smaller companies (it's not clear how big yours is), three environments (dev, stage, production) are common. Larger companies will often have a QA environment between dev and stage. These normally break down as follows: dev: Working code copy. Changes made by developers are deployed here so integration and features can be tested. This environment is ...


107

Java Proper Java Standard Edition is the "normal" version designed for general computing. It, like all other variants of Java, is a strongly, statically typed, bytecode-compiled, Object-Oriented language run on a virtual machine with fully automatic garbage collection. It has most of the features of the language. Examples of applications would be ...


72

It is deprecated as a general technique, because - as you noticed - creation and destruction of short lived objects per se (i.e. memory allocation and GC) is extremely cheap in modern JVMs. So using a hand-written object pool for your run-of-the-mill objects is most likely slower, more complicated and more error-prone than plain new.* It still has its uses ...


48

Field injection is a bit too "spooky action at a distance" for my taste. Consider the example you provided in your Google Groups post: public class VeracodeServiceImplTest { @Tested(fullyInitialized=true) VeracodeServiceImpl veracodeService; @Tested(fullyInitialized=true, availableDuringSetup=true) VeracodeRepositoryImpl veracodeRepository;...


36

The answer to the concrete question: 'Is object pooling a deprecated technique?' is: No. Object pooling is widely used in specific places - thread pooling, database connection pooling etc. General object creation has never been a slow process. Pooling in itself consumes resources - memory and processing power. Any optimization is a trade-off. The rule is: ...


28

The argument of less test initialization boiletplate is valid, but there are other concerns that must be taken into account. First of all, you have to answer a question: Do I want my class to be instantiable only with reflection? Using field injections means narrowing down compatibility of a class to dependency injection environments that instantiate ...


22

I've grown to love Dropwizard for an overall solution Rather than go with some huge application container approach, Dropwizard advocates a lightweight solution that offers much faster development cycles. Essentially, it provides the glue for the following well-known frameworks: Jetty (HTTP) Jersey (JAX-RS) Jackson (JSON or XML) Guava (excellent additions ...


20

Field injection gets a definite "No" vote from me. Like Robert Harvey, it is a bit too automagic for my taste. I prefer explicit code over implicit, and tolerate indirection only as/when it provides clear benefits as it makes code harder to understand and reason about. Like Maciej Chałapuk, I don't like needing reflection or a DI/IoC framework to ...


15

If you haven't read about MVC (model view controller), do so. You shouldn't have code in a JSP, just display. Putting code in JSP is very 1900's. Seriously though, if there is no code in the JSP, you aren't testing the JSP. You are testing the action/flow. Then you could use HttpUnit or Selenium. The big difference is that Selenium tests from a real ...


15

Core Java is not an official name in Java platform (it is the name of a book); also Enterprise Java is not an official name. However these two terms tend to refer to two distinct parts of Java: Core Java usually refers to Java SE which consists of the Java Language, the JVM and JDK (which itself contains the compiler some tools and a pretty large library). ...


13

I am a bit surprised that a test environment is not present as well, as a location for code to go to before being promoted to staging. To answer the question: A stage environment should mirror the production environment as closely as possible. It is used for verification of deployment procedures - making sure that when code is production ready it can be ...


13

I don't think there is a good way to test JSPs, mainly because they were developed before unit testing became a focus of development. Robert Martin wrote an article several years ago about hacking the JSP compiler so that you can direct, non-container based unit tests. His idea was good, but it was broken with the very next TomCat major release. There's ...


12

I don't use Erlang, but I know someone who does, and from everything he's described it as it sounds like exactly what you are looking for. (It was designed by an enterprise (Ericsson) for enterprise use, after all.)


11

You're mixing apples and oranges, kind of. Servlets (or inheriting from HttpServlet) let you access HTTP request parameters and respond with something, via (or on top of) an existing HTTP server implementation. Although using Javascript as the language, Node.js is at a lower level than that. It starts from actually implementing the HTTP server. You can go ...


10

Common Lisp has a long history of being used professionally. It has two commercial implementations: http://www.franz.com/ http://www.lispworks.com/ And several high-quality open source implementations.


9

In situations where you want to avoid garbage collection entirely, I think object pooling is the only viable alternative. So no, it is absolutely not a deprecated technique.


9

First I would have corrected the interviewer by telling him, that since version 5 it's named JavaEE. Further I would have detailed the parts that make up JavaEE, e.g. JPA, JSF, JSP, etc...


9

There are a number of reasons why you might want to upgrade your underlying infrastructure, and you should evaluate each of them as empirically as you can. For example, you might upgrade because: The vendor is no longer supporting the version you're using There's an critical bug or security fix There's a new feature you want to take advantage of It will ...


9

Your primary difficulties I feel are that you have a mismatch between a very linear and custom workflow in an older application that do not coincide with the user interaction workflows that are common on the web. Web applications that interact with a server application that contain the business logic communicate in a Request/Response messaging style. The ...


8

Measure It completely depends on your use case, size of your objects, your JVM, your JVM options, what GC you have enabled and a whole host of other factors. In short: measure it before and measure it after. Assuming you're using an object pooling framework (like from Apache) then it shouldn't be too painful to swap between implementations. Extra ...


8

The Spec Lead and the EG group will decide via a JSR as part of the Java Community Process. They are typically conservative in their deprecation and remove cycles.


8

I would say that just by reading your analysis, you're saying there are alot of static methods and singletons. Static methods shouldn't be an issue by themselves, but if they're being used to proxy calls to the singleton objects, I would work on making those either rock solid, or replacing them with a more sane object model. Static methods are useful for ...


8

I wouldn't suggest doing a rewrite a whole application. Especially one that is currently being used by the customer. You will never cut over to the new system until it can do everything that the old system does. While you are writing the new system, the customer and management are going to get impatient and want those new features. You, or someone else will ...


8

Why Rewrite What you can Get Off the Shelf? Why not use RedDwarf Server (formerly Project DarkStar)? RedDwarf Server is an open source middleware solution for developing the server-side of massively multiplayer online games. It is the official community fork of Project Darkstar, an open source project supported and managed by Sun Microsystems. - from ...


8

It is a little unclear if you mean sharing the same J2EE container or physical server. Regardless, my suggested approach is the same but I don't know if I am suggesting option 2 (which I think I am) or a third option you had not considered. If you try and host lots of apps as one app it means you will suffer from far more from things like threading overhead ...


8

Remember, the original GoF book has the full title "Design Patterns. Elements of Reusable Object-Oriented Software.". And most of the GoF patterns have that purpose - build software which can be put into libraries and/or frameworks and reused in a wide range of use cases, in a black-box manner, mostly following the open-closed principle. So if one is not ...


8

Most frameworks already use a lot of known software design patterns. So you are using design patterns unknowingly. That said, I would strongly suggest you to try learning at least the most common ones. It's funny. In the other hand, in a framework, your classes "fall into place" within the design of the framework, but you have to code your business logic ...


7

You have Haskell for Enterprise Linux. The haskell wiki even includes a survey page about how to use Haskell in the Enterprise. Erlang (as mentioned by Chris) is definitely also a good suggestion. It is built to scale, be fault-tolerant and stay in continuous operation for many years. Personally I'm more of a fan of the static type system that Haskell has.


7

The standard structure for a WAR file is: /META-INF Standard jar stuff like manifest.xml /WEB-INF web.xml /classes /com...etc. /lib Maven generates this for you using your src/main/java, resources, webapp and your dependencies (placing them in /lib) in the maven-webapp-plugin, but that's implementation. The important thing to realize is that ...


Only top voted, non community-wiki answers of a minimum length are eligible