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

Here’s  is a quote from the About page of the Web site ehow.com: “eHow is your one-stop online resource for life’s challenges. Professionals in every field come together to offer expert advice, backed by the additional support of a can-do eHow community.“ Experts are also human beings and sometimes they make mistakes too. But when I’ve read the following article I was stunned: Guys and girls, I’m not an eHow-grade expert, but I’ve been doing both Java and JavaScript for while. Trust me, the above description is absolutely wrong! Please ignore. Also, if you know any of the 35 people who found this helpful, get in touch with them and tell them the truth! There is well known statement that “Java is to JavaScript as ham is to hamster”. So I’m looking forward to a new article at eHow that will be a creative interpretation of the Wikipedia definition: “Hamster, aslo known... (more)

GlassFish, Open MQ, and the Ear-Eye Problem By @YFain

GlassFish, Open MQ, and the Ear-Eye Problem Yesterday I’ve been updating code examples for the messaging chapter for the 2nd edition of my Java book. While doing this, I ran into an issue, then fixed it, but the cause and the solution illustrate the situation that we call “Ear-Eye”, which comes from and old joke popular in the USSR, where TV propaganda was stating that everything is great while people had hard time finding food in store. Here’s the joke: An old lady comes to a medical center saying that she needs to see an Ear-Eye specialist. The receptionist replied, “There is n... (more)

What’s the Difference Between Abstract Classes and Interfaces?

Probably the most popular question during Java technical interviews is “What’s the difference between abstract classes and interfaces”.  In my own three year old book I’ve offered the following answer: “An abstract class may contain code in method bodies, which is not allowed in an interface.With abstract classes you have to inherit your class from the abstract one because Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.” But starting from Java 8 this answer is wrong. This is how I’d answered it now: “Both abstract... (more)

Java Basics: Processing GUI Events

Various events may happen to a running program: a user clicks on a button in a window, the Web browser decides to re-paint the window, and so on. I'm sure, you've tried to click on the buttons of the calculator from the lesson on Swing Basics, but these buttons were not ready to respond to your actions yet. This time, let's teach window components to react on such actions. Each window component can listen to and process a number of events, and your program has to register window components with Java classes called listeners. You should make components listen to only those events th... (more)

Are You Using Abstract Classes, Polymorphism, and Interfaces?

If the answer is no, at a minimum your project needs a code review. Let's work on the following assignment: a company has employees and consultants. Design classes with and without the use of inheritance to represent the people who work for this company. The classes should have the following methods:   changeAddress promote giveDayOff raiseSalary Promotion means giving one day off and raising the salary by a specified percentage. For employees, the method raiseSalary should raise the yearly salary and, for consultants, it should increase their hourly rate. Abstract Classes A clas... (more)