Home » Author Archives: Peter Verhas (page 2)

Author Archives: Peter Verhas

Creating proxy object using djcproxy

java-logo

During the last weeks I have shown how to create a proxy object using Java reflection API and cglib. In this article I will show you how this can be done using djcproxy. Oh, not again, another proxy implementation! What is the point to write about this in addition to the selfish fact that I created this proxy? The point ...

Read More »

Creating a proxy object using cglib

java-logo

In the previous post I was talking about the standard Java based proxy objects. These can be used when you want to have a method invocation handler on an object that implements an interface. The Java reflection proxy creation demands that you have an object that implements the interface. The object we want to proxy is out of our hand, ...

Read More »

Java Dynamic Proxy

java-logo

Proxy is a design pattern. We create and use proxy objects when we want to add or modify some functionality of an already existing class. The proxy object is used instead of the original one. Usually the proxy objects have the same methods as the original one and in Java proxy classes usually extend the original class. The proxy has a ...

Read More »

Value types in Java: why should they be immutable?

java-logo

Value types need not be immutable. But they are. In the previous post I discussed the difference between pointers and references in Java and how the method parameters are passed (passed-by-value or passed-by-reference). These are strongly related to value types that do not exist in Java (yet). There is a proposal from John Rose, Brian Goetz, and Guy Steele detailing ...

Read More »

Pointers in Java

java-logo

Are there pointers in Java? The short answer is “no, there are none” and this seems to be obvious for many developers. But why is it not that obvious for others? http://stackoverflow.com/questions/1750106/how-can-i-use-pointers-in-java http://stackoverflow.com/questions/2629357/does-java-have-pointers https://www.google.hu/search?q=pointers+in+java That is because the references that Java uses to access objects are very similar to pointers. If you have experience with C programming before Java it ...

Read More »

Do Not Create DSL for the Customer

software-development-2-logo

Domain Specific Language (DSL) solutions are many times created with the intent to give a tool to the hands of the customer representatives (business people) to do the configuration of the application on their own. Most of these attempts fail miserably: the DSL ends in the hands of the developers. (Sometimes there can be exceptions those I have never experienced.) ...

Read More »

Do we need coding conventions?

software-development-2-logo

There are things that just come natural and we forget to wonder if it could be some other way. It is like that the sun rise morning and sets evening. But scientists raise the question and even though the sun still rise in the morning and still sets evening we gathered a lot of knowledge about it. It is similar ...

Read More »

Use of optional is optional

java-logo

After the article of last week “Optional in collections” today I can’t help but talking a bit more about the same beast. A bit more detail. The class Optionial originally introduced by Google Guava and later included in the Java 8 package is simply a wrapper that wraps an optional object. The wrapped object is optional in the sense that ...

Read More »

Optional in collections

java-logo

Sometime it is argued that the type Optional is worth being used in collections. It allegedly solves the problem of e.g.: HashMap that returns null in case there is no mapping for a key as well as when the value null is mapped to the key. If you use a Map<Optional<Something>> then you can clearly separate a missing mapping and ...

Read More »

Some thoughts about yagni

software-development-2-logo

Yagni means “You Aren’t Gonna Need It”. This is a phrase used many times to refuse the development of some features that may be needed later but not now. Yagni means that you should develop a feature in your code, which is needed and when it is needed and not sooner. Why do we have this term at all? Do ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns