Skip to main content

Posts

Java Keywords (Part XXIV): native

Java keyword list abstract continue for new switch assert default goto * package synchronized boolean do if private this break double implements protected throw byte else import public throws case enum instanceof return transient catch extends int short try char final interface static void class finally long strictfp volatile const * float native super while Keyword marked with an asterisk (*) are keywords that, although valid, are not used by programmers. This is the last chapter of the Java Keyword series. This is probably the keyword I have used the least. In my 20 year career as a software developer, I have used this keyword once, and that was to make some addition to legacy code. The keyword native is a method modifier . Basically, it is a keyword that can only be applied to methods. According to the Java Language Specification (JLS), A method that is native is implemented i...

How to create Javadoc comments

This document is a summary of the information found on the Oracle website: http://www.oracle.com/technetwork/java/javase/documentation/index-jsp-135444.html My goal is to give you a summarized version of the following topics: ·          What is Javadoc and why is it needed? ·          How to document your code using Javadoc ·          How to generate Javadoc documentation ·          How to publish Javadoc What is Javadoc and why is it needed? In simple terms, Javadoc is a tool for documenting your code in HTML format. Because this documentation is in HTML, it can be easily uploaded to a web server and made available online for the whole world to see. An example of this is the Java API ( https://docs.oracle.com/javase/8/docs/api/ ). For many developers, one of the selling points of Java over ...

Aggregation and Composition

When determining the relationship between object at design time, it is easy to succumb to the habit of using inheritance; simply because it is easy.  In a language such as C++, it is even easier to do so because the language supports multiple inheritance. Figure  1 : the java.util. List  Interface Assume that Java does not have a Stack (java.util.Stack) class and you need to create a custom stack (call it MyStack).  You could do this in three different ways, but for the purposes of this paper I will discard the creation of the Stack class as shown in the image above.  Therefore, assume that there are only two ways.  The first way is to extend the ArrayList class.  The second way is to include an ArrayList object as a data member.  The first solution uses inheritance to solve the problem.  Remember, inheritance establishes an “is-a” relationship between objects.  Therefore, the relationship between MyStack...

Specialization, Generalization, and Abstraction

A question was raised on LinkedIn (you can follow me there: https://www.linkedin.com/in/hector-fontanez ) that got me thinking and I decided to blog about it. I am going to start by defining what generalization means in Object-Oriented Programming (OOP) and Design (OOD). Generalization in OOD implies that a specialized (child) class is based on a general (parent) class. This, in turn, implies a "is-a" relationship. When you analyze the object types and their relationships as depicted in the image above, from left to right, it goes from very general to more specific. You could say that an Animal "is a" more general form of Dog, of Canine, and even than Mammal. Likewise, a Canine "is a" more general form of Dog. If you analyze it from right to left, the opposite happens: it goes from more specific to more general. Put in other terms, the type gets broadened. Therefore, you can still refer to dogs as canines, mammals, or even animals. ...

Using Apache POI to create MS Office documents

A question was posted on LinkedIn which caused me to get out of my shell and post again. After all, I know all too well how frustrating it is to try to get something to work and not being able to find any meaningful examples on the web (YES... we have all grown fond of Google to find examples and get lazy researching topics, but that's life...) I decided to post some simple examples on how to create MS Word documents from scratch. This is all based on my postings on LinkedIn on this very topic. To read the thread, you may go  here . First question : What is Apache POI? In simple terms, this is an free, open-source software (FOSS) that provide an application interface for Microsoft documents. This product was created by the Apache Foundation POI team. My examples are based on version 3.8. The latest version is 3.9 and there is a beta 3.10 available. Second question : What kind of Microsoft documents? Simply, MS Office documents (i.e. Word, Excel, Power...

The Importance of Problem Decomposition

This is my very first attempt at blogging. I hope I am not too bad. For my first blog ever, I am choosing a topic that I believe is very important for all students and not just those majoring in Computer Sciences, Software Engineering, etc. Even entry-level professionals might benefit from the contents of this blog. At least, that's what I hope. That said, the example I am using in my blog was the result of a practical exercise I gave my Computer Sciences students a few days ago. I have been teaching part time since 2008. Since I started teaching, I am noticing a trend that alarms me a great deal. It seems to me that students nowadays either lack effective problem solving skills or completely undermine the importance of effective problem solving. In fact, I have even notice this trend on exceptional students. I hope that my effort in shedding some light in the subject is futile. Therefore, I ask of you to leave feedback, positive or negative, once you finish reading ...