Welcome!

From the Trenches of the Enterprise Software

Yakov Fain

Subscribe to Yakov Fain: eMailAlertsEmail Alerts
Get Yakov Fain via: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Top Stories by Yakov Fain

In 2011 Wiley (Wrox) published my book “Java Programming. 24-Hour Trainer“. To be honest, I don’t like the title because it misleads people as if this book promises that the reader can learn Java within 24 hours. But creators of this series (many titles were published under this umbrella) meant to say that this book was like your personal instructor; 24 hours a day. Whatever. It’s not my call. But earlier this year I got a call from the publisher stating that they’re happy with the book sale numbers and want me to update the book and release the second edition reflecting the latest changes in the Java Language. I agreed because with the latest release Java became more interesting than ever. The magnitude of changes to the Java 8 language and APIs can be compared with Java 5 that was released back in 2004. It’s exciting to program in Java again. In the second editio... (more)

Closures in Java With Lambdas

While working on the second edition for my Java 24-hour Trainer book I’m re-writing some of the code samples to use lambda expressions. Today I was re-writing an example for wait/notify for the chapter on multi-threading. Beside illustrating the wait/notify, I used a closure in this example. Since Java closures are not well presented in the blogosphere, I decided to write a quick blog on the subject. My goal was to write a program that starts a thread and waits for the notification from that thread until its execution is completed. When the main thread receives the notification ... (more)

JMS 2.0 remote client for embedded HornetQ in Wildfly 8

While testing the new JMS 2.0 API, I wanted to see an example of the remote client connecting to a messaging server. I decided to start with the HornetQ messaging server that’s embedded into JBoss Wildfly 8. Folks from JBoss sent me a link to the the GitHub project Wildfly/Quickstart with lots of Wildfly Java EE 7 examples. The HelloWorldJMSClient was the one I was looking for. The readme file contains detailed instructions on how to compile and run the example. Seeing a requirement to have Maven 3.1 or better looks like an overkill for a helloworld type example. Installed Maven... (more)

Losing Polymorphism with Java Lambda Expressions

Yesterday, I decided to re-write with lambdas one of the example I use while explaining polymorphism during my Java trainings. I realize that lambdas promote functional style of programming, while polymorphism is one of the crucial object-oriented features. Still, I decided to try mixing OOP and functional styles to see what happens. The Task The class Person has two descendants: Employee and Contractor. Also, there is an interface Payable that’s used to increase pay for workers. public interface Payable { int INCREASE_CAP = 20; boolean increasePay(int percent); } Both Employee ... (more)

Losing Polymorphism with Java Lambda Expressions

Yesterday, I decided to re-write with lambdas one of the example I use while explaining polymorphism during my Java trainings. I realize that lambdas promote functional style of programming, while polymorphism is one of the crucial object-oriented features. Still, I decided to try mixing OOP and functional styles to see what happens. The Task The class Person has two descendants: Employee and Contractor. Also, there is an interface Payable that’s used to increase pay for workers. public interface Payable { int INCREASE_CAP = 20; boolean increasePay(int percent); } Both Employee ... (more)