Recently at work there was a need to improve a scheduling application. There were two scrolling JTextArea's that would reset to the top of each of their lists when (yet another) JTextArea was manipulated. At first the thought this would take a really long time to correct. It was good to know that the needed change was fairly quick and straight forward.
That small change provided an opportunity to better the application a little more. This was to add a few things to it's only tool bar. These small things were a JTextArea (non-scrolling), plus a few more JTextArea's to visually balance the tool bar's appearance. While doing some internet research on these changes, stumbled upon the addSeperator(). What a neat method, addSeperator(). While all this was going on, consideration was to find yet another Java book as a reference for toolbars and such. Even went so far as to go to Barnes and Noble to see if they had one of those good Nutshell books.
I came back empty handed and decided to look through books on my book shelf to see if the needed reference material was available. Sure enough, this book had everything I needed for the scheduling application improvement work I was doing.
A few days after getting this book off the book shelf, I realized this book is an excellent reference book for this scheduling application. There are no scheduling type examples in the book, rather, it is helpful from the basic conceptual point of view, class and object fundamentals.
I've been through this book and other Java books several times. Each time, once the topics gets to talking about Inheritance, well, I'm just about asleep by then.
This time though, I did not fall asleep and got through the topic of Inheritance and actually can remember what I read. Starting with a class A for example. Well, you need to make a new class B. You find that class B needs many of same datatypes and methods in class A. So you code this as,
class B extends A{
}
So what you now have is class A is now a super class. Class B is a subclass. Class B has all the stuff that class A has. Superclass, subclass, I'm confused. Though to me that sounds backwards. The book definition on page 205 makes this clear:
The prefixes super and sub come from the language of sets used in theoretical computer science and mathematics. The set of all employees contains the set of all managers, and this is said to be a superset of the set of managers. Or, to put it another way, the set of managers is a subset of the set of all employees.
So in my case of using class A, this was the employee class and class B is the manager class. So I hope to have the permanently clear.
Suppose one last helpful topic shown in this book was on page 145. This shows how a class should be defined. It goes like this (and it is typed in straight from the book).
class ClassName
{
field 1;
field 2;
field 3;
constructor 1;
constructor 2;
method 1;
method 2;
}
Finally, one more area that put me to sleep is the relationship between classes. Good for an afternoon nappy time. Here is goes. Relationship between classes are: Dependence (Uses a), Aggregation (Has a) and Inheritance (Is a). More on that later as well as "just what is the use of this super word used for. Good stuff, very helpful. I hope to expand on this soon.
