Impressions after GeeCON 2010
Two days ago I came back from Poznań, Poland, where second edition of GeeCON conference took place. After attending the first edition my expectations were very high and sadly I left Poznań a bit di...
Two days ago I came back from Poznań, Poland, where second edition of GeeCON conference took place. After attending the first edition my expectations were very high and sadly I left Poznań a bit di...
When you find a bug during development, you typically run a debugger trying to track down the potential cause*. Now imagine for a while you can’t use a debugger. For example, because the bug manife...
Logging pattern is a wonderful tool, that transparently adds meaningful context to every logging statement you make. But you must consider very carefully which information to include in your patter...
Each logging statement should contain both data and description. Consider the following examples: log.debug("Message processed"); log.debug(message.getJMSMessageID()); log.debug("Message with id '...
Logging statements should have no or little impact on application behavior. Recently a friend of mine gave an example of a system that threw Hibernates’ LazyInitializationException only on some par...
Every time you issue a logging statement, take a moment and have a look what exactly will land in your log file. Read your logs afterwards and spot malformed sentences. First of all, avoid NPEs lik...
Every time you are making a logging statement, you think hard which logging level is appropriate for this type of event, do you? Somehow 90% of programmers never pay attention to logging levels, si...
Many programmers seem to forget how logging application behavior and its current activity is important. When somebody puts: log.info("!@#$%"); happily somewhere in the code, he probably don’t re...
Few weeks ago I had pleasure to give a speech “Mule ESB vs. Apache ServiceMix” at Warsaw Java Users Group, together with Łukasz Dywicki. During this live coding session I have been implementing som...
…or “Thou shalt not hard-code any output messages in Java code”. Code is for program, algorithm, behavior, action. Code in any programming language is intended to express the data flow, not the da...
I assume you are familiar with RSS/Atom protocol, probably you are even reading this post using feed delivered by my blog. Atom and his older brother RSS are used to publish various materials (arti...
In my article about adapter pattern I have written an adapter that allows to access Ehcache cache instances through a simple Map interface. The basic idea was to write a Map implementation that act...
In the first part of this article I have shown a semi-real life example of the Chain of responsibility pattern (also mentioning about Iterator, Adapter and DTO). This behavioral design pattern has ...
Chain of responsibility behavioral design pattern is a wonderful solution for complex logic of processing a requests. In this pattern single request (message, database record, external system call,...
Few days ago popular Apache Commons Lang library gained new utility method in Validate class: notBlank(). This also happens to be my first contribution to the open source community (see: LANG-533 a...
Yesterday I had pleasure to participate in Java Developers’ Day in Kraków, Poland. It was a great experience to see Mark Richards (author of Java Message Service) and Scott Davis (Groovy Recipes) g...
UPDATE: Over the years I learnt that the solution provided below is not really an example of domain-driven design. It’s more like an active record implementation on top of Spring. But the technical...
Some domain objects in many enterprises applications include a concept of state. State has two main characteristics: the behavior of domain object (how it responds to business methods) depends on t...
In one of my previous posts I gave you an example of some unexpected behavior when using Spring AOP proxies. Few days later I began to read “Pro Spring 2.5” by Jan Machacek, Jessica Ditt, Aleksa Vu...
Suppose you have some client code (developed by you, legacy code or third-party library) which requires object of some specific type. On the other hand you already have almost exactly the same obje...
I recently finished reading “Programming Groovy: Dynamic Productivity for the Java Developer” and this book really opened my eyes on what Groovy language really is. Most tutorials or lectures I hav...
“Java Concurrency in Practice”, written by Brian Goetz et al., is not brand new, but certainly one of the best Java books I had pleasure to read. But first two other books should be mentioned. Few ...
Spring support for aspect oriented programming is very wide, but sometimes you may shoot yourself in the foot if you are not careful enough. Consider the following service interface: public interf...
…and prefer Spring. After passing my SCBCD exam lately, I gathered few disadvantages of EJB3 standard, which I found especially irritating and annoying. 1. Whole concept of session beans is unclea...
While preparing for SCBCD exam I encountered many difficulties in securing remote EJB 3 stateless session bean, and then calling such a component from remote standalone client. I hope this short in...
Co prawda już ponad miesiąc upłynął od mojego egzaminu SCWCD (CX-310-083), a i 88% nie jest wynikiem powalającym, ale padło pytanie o przygotowania do tego certyfikatu. Nic odkrywczego nie wymyślił...
Dawno nie pojawiałem się na blogu, ale chociaż po trosze mogę się usprawiedliwić zdobytym ostatnio tytułem magistra inżyniera Wydziału Elektroniki stołecznej polibudy i nie mniej zaszczytnym certyf...
W poprzednich artykułach udało nam się nakłonić Springa do załadowania skryptu w Groovim z bazy danych i uruchomienia go. Jednak to nie wszystko - chcielibyśmy również w łatwy sposób móc testować n...
Właściwie mógłbym się ograniczyć do standardowego “było super, niech żałują Ci, co ich nie było” - i nie minąłbym się z prawdą. Ale po kolei… Z voucherem otrzymanym od Warszawa JUG, za co bardzo d...
Przypominam, że naszym celem jest pobieranie skryptów Groovy z bazy danych, a użyjemy do tego JPA. Oczywiście chcemy maksymalnie wykorzystać wsparcie springowe, jednak nie obejdzie się bez małego “...
Na początek scenka rodzajowa: w pewnym systemie istotną rolę odgrywała wstępna weryfikacja klienta opisanego następującym obiektem: public class CustomerProfile { private long pesel; private i...
Chciałbym dzisiaj pokazać niekoniecznie odkrywczy, ale dość ciekawy przykład integracji frameworku Struts2 z EJB3 - a wszystko sklejone za pomocą Springa. Tytuł posta jest bowiem tendencyjny: EJB m...
Wizytator (odwiedzający) jest bardzo ciekawym wzorcem projektowym. Ponieważ wytłumaczenie w dwóch zdaniach do czego ten wzorzec służy jest dość trudne, zacznijmy od przykładu. Załóżmy, że w naszym...

Kontynuuję moją opowieść o Struts2, zamykając wątek z części pierwszej. W tak zwanym międzyczasie zacząłem czytać “Groovy in Action”, potem zobaczyłem też wpis na blogu Jacka Laskowskiego. Cóż, za...
Elegancki CRUD w jednej akcji Struts2 część 1/2 Wreszcie pojawiło się Struts2 w stabilnej wersji z gałęzi 2.1.x. Branch ten wprowadza wiele nowości, dlatego z niecierpliwością czekałem na edycją o...
Bez zbędnych wstępów, chciałem pochwalić się zdanym certyfikatem Sun Certified Java Developer (SCJD, CX-310-027), którego przyjemność zdawania umożliwiła mi moja ulubiona firma :-). Przyjemność tym...
Postanowiłem sporządzić krótki tutorial z jednym prostym przykładem pokazującym podstawowe możliwości Freemarkera. Wbrew pozorom nie stanąłem przed koniecznością migracji plików JSP na Freemarker, ...
Postanowiłem przedstawić, moim zdaniem, jeden z najciekawszych wzorców projektowych: Command. Idea tego wzorca opiera się na zamknięciu logiki w posiadających jednolite interfejsy obiektach i możli...
Ponieważ od kilku dni mogę się pochwalić brązowym pasem na JavaBlackBelt, postanowiłem wypróbować narzędzie JavaRebel, do którego to licencję otrzymałem za darmo. Padło na aplikację w Struts2 na To...
Jednym z częściej spotykanych przeze mnie problemów w Javie jest ogarnięcie różnych rodzajów strumieni i metod reprezentacji danych. Jak bowiem poradzić sobie np. z biblioteką, która wymaga danych...
Dzięki uprzejmości mojej firmy miałem w tym roku niewątpliwą przyjemność uczestniczyć w Java Developers’ Day 2008 w Krakowie. Krótko o prelekcjach, których miałem możliwość wysłuchać: Na początek ...
Począwszy od Javy 1.3 programistom (głównie frameworków) została udostępniona niezwykle użyteczna klasa Proxy. Zasadniczo klasa ta pomaga w implementacji wzorca projektowego o tej samej nazwie, jed...
Często piszę króciutkie programy z samym mainem tylko po to, aby sprawdzić działania nieznanej funkcji API czy właśnie zaimplementowanego algorytmu. Ot taki proof-of-concept jeszcze przed napisanie...
Wydawałoby się, że JUnit jest na tyle prostą biblioteką, iż nic nie jest w stanie nas w niej zaskoczyć. A jednak, odkryłem niedawno ciekawą adnotację @Parameters pozwalającą na generowanie testów z...