Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 JAVA


  Java API vs Framework

What is the difference between a Java Library and a framework? The two concepts are essentially important for a Java developer. The most important difference between a library and a framework is Inversion of Control. It means that when you call a library you are in control. But with a framework, the control is inverted: the framework calls you. (This is called the Hollywood Principle: Don’t call Us, We’ll call You.) This is pretty much the definition of a framework. Basically, all the control flow is already in the framework, and there’s just a bunch of predefined white sp...

8,227 0       JAVA FRAMEWORK DIFFERENCE API LIBRARY


  Java Doesn't Need to Be So Bad

I do a lot of Java coding and I enjoy it. I admit that there is a lotof typing, often a lot of boilerplate and getting even simple tasksdone can involve too much work. Most of the tools that try to fixthese problems trade one moment saved for another lost. Maven's XMLbased configuration file is a good example: Thank you for making myproject easier to manage and I won't forget that you made me edit XMLto do so.These are the things that you live with, these are the things youtrade for using a language that thinks it's finishing what C++started; a language that is loved equally by mammoth corpora...

2,491 0       JAVA CODING ENTERPRISE APPLICATION TEDIOUS


  Why I love everything you hate about Java

If you’re one of those hipster programmers who loves Clojure, Ruby, Scala, Erlang, or whatever, you probably deeply loathe Java and all of its giant configuration files and bloated APIs of AbstractFactoryFactoryInterfaces. I used to hate all that stuff too. But you know what? After working for all these months on these huge pieces of Twitter infrastructure I’ve started to love the AbstractFactoryFactories.Let me explain why. Consider this little Scala program. It uses “futures”, which are a way to schedule computation to be done in parallel from the main flow of a pro...

7,106 0       JAVA COMPARISON MODULARITY API


  Java is not the new COBOL

If you Google “Java is the new COBOL” you’ll find a glut of articles proliferating this mantra. I don’t know its origins, however I’m inclined to think it’s mostly repeated (and believed) by the Ruby community. Ruby, from a developer’s perspective is a low-friction language. A developer can just sit down at a text editor and start banging out code without really thinking about such superflous things as types. Java on the other hand, well, you have to think a lot about types. Java is a statically typed language after all, and it makes the deve...

2,428 0       JAVA COMPARISON RUBY TYPE COBOL


  Can private method be overridden?

The private methods are not inherited by subclasses and you cannot be overridden by subclasses. According to Java Language Specification (8.4.8.3 Requirements in Overriding and Hiding), "Note that a private method cannot be hidden or overridden in the technical sense of those terms. This means that a subclass can declare a method with the same signature as a private method in one of its superclasses, and there is no requirement that the return type or throws clause of such a method bear any relationship to those of the private method in the sup...

3,460 0       JAVA PRIVATE METHOD OVERRIDDING IMPOSSIB


  Java Polymorphism and Overriding Methods

Most Java developers will be familiar with polymorphism – we’ve all seen the example of the Dog and Cat classes inheriting from some abstract Animal class and having their say() methods produce different results. But it’s still worthwhile to look at a few simple examples to reinforce the concepts.First, we define a simple class with one instance method and one static method.public class A{ public String getName() { return "I am A"; } public static String getStaticName() { return "Statically A!"; }}Then we extend that clas...

2,745 0       JAVA POLYMORPHISM DEMO OVERRIDING DYNAMI


  Command Line Arguments

Our Hello program still isn’t very general. We can’t change the name we say hello to without editing and recompiling the source code. This may be fine for the programmers, but what if the secretaries want their computers to say Hello to them? (I know. This is a little far-fetched but bear with me. I’m making a point.)What we need is a way to change the name at runtime rather than at compile time. (Runtime is when we type java HelloRusty. Compile time is when we type javac HelloRusty.java). To do this we’ll make use ofcommand-line arguments. They ...

2,211 0       JAVA COMMAND LINE ARGUMENTS FIRST ELEMEN


  Java’s toLowerCase() has got a surprise for you!

Have you ever encountered a surprise while using toLowerCase()? This is a widely used method when it comes to strings and case conversion. There is a nice little thing you should be aware of. toLowerCase() respects internationalization (i18n). It performs the case conversion with respect to your Locale. When you call toLowerCase(), internally toLowerCase(Locale.getDefault()) is getting called. It is locale sensitive and you should not write a logic around it interpreting locale independently.import java.util.Locale; public class ToLocaleTest {  ...

2,726 0       JAVA TOLOWERCASER() LOCALE SPECIFIC STRA