Chapter 2 On Object Oriented Programming
I finished reading and studying chapter 2 and completed the self-test for chapter 2. This chapter has been very helpful in understanding how tricky this test can be.
Chapter 2
“Being a 1.5 SCJP means you must be at one with the object-oriented aspects of Java. You must dream of inheritance hierarchies, the power of polymorphism must flow through you, cohesion and loose coupling must become second nature to you, and composition must be your bread and butter.”
I love how Sierra and Bates have opened chapter 2. On Saturday, I experienced a moment of ‘aha’, a quiet confirmation of the meaning of object oriented programming principles. I felt at peace and felt my knowledge had deepened. I find the text is easy to understand and I look forward to study.
Interfaces and Abstract Classes
I watched the CBT video on Interfaces and Abstract Classes. I have spent at least 2 hours each day studying Java exam topics. It is starting to make sense. I answered 100% on questions from Javaranch a few times in a row. I am looking for additional question answer sites to keep practicing.
Generics — what is it?
Generics add stability to code by making more bugs detectable at compile time. By convention, type parameter names are single, uppercase letters and type parameter names are single, uppercase letters.
The most commonly used type parameter names are:
- E – Element (used extensively by the Java Collections Framework)
- K – Key
- N – Number
- T – Type
- V – Value
- S,U,V etc. – 2nd, 3rd, 4th types
Another week
My goal is to understand how to document Java code using Javadocs and UML. I purchased “UML 2.0 in a nutshell” to help me get started creating class diagrams. I am studying the javadocs 1.5 and wrote my own javadocs specification for creating javadocs. I will write javadocs in my code. I will start writing Junit tests.
Learning from Chapter 1
I finished my first pass with chapter 1. I took the Q&A Self test and I missed most of the questions. I carefully looked at why each answer was incorrect. I entered the code samples and compiled it to see for myself what errors the compiler reported. This is its job–to catch execeptions. It makes me a lot more curious how exceptions work and why some exceptions are checked and others are left to hang during run-time. I was surprised by enum; a new key word added to 1.5. Enums are very interesting. You can declare a type and give it a name that becomes a constant. It can be declared like a class; even add contstructors. Continue reading
The invitation
I invited a few developers at work to join me in studying for the SCJP 1.5 certification. I suggested using instant messaging to ask and answer questions during the day. I also suggested sacrificing a lunch or too a week and putting the money towards the certification cost of $200.
I learned about ‘Static Initialization Blocks’ today. These provide initialization for class variables. I keep studying.
The Two’s Complement
Numeric primitive types use the Two’s complement to hold a negative to positive range of numbers. Operators ~
- byte 8
- short 16
- int 32
- long 64
- float 32
- double 64
The primitive type ‘byte’ is represented with 8 bits. The left most bit is used as a sign bit. If the bit is 0 the number is positive and if the bit is 1 it is negative
sign bit | |||||||||
0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | = | 127 |
0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | = | 2 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | = | 1 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | = | 0 |
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | = | −1 |
1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | = | −2 |
1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | = | −127 |
1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | = | −128 |
8-bit two’s complement integers
Math and Dates
I watched the “Working with Math and Dates” nugget video. The video shows how to use Math and Date classes access Java’s API documentation and he shows how to format a date. I replicated the sample code but I was surprised when my code didn’t compile. I looked up the java.util and java.text in the javadocs 1.5. I found the DateFormat class in the Java.util folder.
Object Oriented Programming
What makes a programming language object oriented?
-
Recent
- API Introduction
- Preparing a Technical Writing Portfolio
- What are Documentation Services worth?
- Move Networks Silverlight Developer Guide
- Writing Usable Documentation
- Learning Java Head First
- Whizlab SCJP 5.0 Preparation
- Writing PHP Script
- Java Language Specification
- Yellow Belt Passed
- Passed Object Oriented Test
- A Java App of My Own
-
Links
-
Archives
- December 2008 (4)
- November 2007 (1)
- January 2007 (2)
- December 2006 (7)
- November 2006 (16)
- October 2006 (17)
-
Categories
-
RSS
Entries RSS
Comments RSS