Java / J2EE and .NET Talk

At the September 2003 Gateway JUG, I gave a talk on the similarities and differences between Java/J2EE and .NET.

At the Sep. 2003 Gateway Java User Group, I gave a talk on the technical similarities
and differences between Java/J2EE and .NET, as well as the non-technical issues
in adoption of each. The presentation is available for download here, as well
as the plain text of it.

Java / .NET Talk PowerPoint Presentation: J2eeNET.ppt

In the past, readers have asked how I got the text of a powerpoint presentation
in to plain HTML. This is a multi-step process, since PowerPoint itself generates
graphic-intensive, frames-based HTML with limited, JavaScript-only navigation.
PowerPoint lost the ability to generate more reader-friend HTML in recent versions.
In its defense, the HTML it generates does a good job of capturing the exact
look of the slides, which is very important to some users but not important
to me; I want the plain text so that search engines can find it and any browser
can read it.

The process is:

  • In PowerPoint, choose Save As, then select Outline/RTF from the file type
    list. Save the file.
  • Open the RTF file in Word. Save As an HTML file
  • Open the HTML file in DreamWeaver; use the “Clean Up HTML” and
    “Clean Up Word HTML” repeatedly to get rid of the massive amount
    of Word-specific HTML in the file. Also remove the span tags. Save it.
  • Open the HTML file in a text editor. Use search and replace operations to
    change the numerous H1 H2 H3 etc. tags to whatever markup you want around
    your bullet items. Replace whatever special character is present for the bullets,
    with something innocous like an asterisk.
  • Now you have clean HTML. Use some CSS to format it as needed.

The text of the talk follows:

Continue reading “Java / J2EE and .NET Talk”

Attacking Code Duplication in Java

An important principle of XP is that duplication of ideas in source code is to be avoided. I gave a talk at the XPSTL group on this topic.

On Feb. 5, 2003, I gave a talk at XPSTL about code duplication in Java. The presentation is available for download here, as well as the plain text of it. If you download the presentation, you’ll find the code snippets inside. The samples did not come along for the (very rough) plain text export below.

http://kylecordes.com/files/OAOOinJava.ppt

Attacking Code Duplication in Java

Kyle Cordes

Oasis Digital Solutions Inc.

XPSTL

Feb. 5, 2003

Once and Only Once

z OAOO is shorthand for the principle that each idea should be expressed exactly once in the source code.

z A tenet of XP

z Predates XP, a good design principle

z Not specific to OO development

A Quote…

“So, duplication sucks. The more rabidly a person hates duplication, the more I trust their opinions on managing information. A programmer, upon noticing some redundancy, should be thrown into a panic, begin hyperventilating, and stammer something about “¡El diablo! !El diablo está en mi software!”.”
from:

http://groups.yahoo.com/group/testdrivendevelopment/message/185?viscount=100

Why Not Duplicate?

z Duplication is not just inconvenient.

z OAOO is not an “architecture astronaut” nitpick.

z Duplication is a clear sign of bad information management and complexity management.

z Building large systems consists significantly of complexity management and dependency management.

Why OAOO?

z OAOO makes systems easier to change.

z OAOO holds back entropy.

z I admit – I follow that quote. I use hatred of duplication as a barometer of design skill.

How Do We Achieve OAOO?

z Usually by refactoring code that contains duplication.

z Usually, a little bit at a time.

z However, when doing or evaluating up-front design, OAOO is a excellent criteria to apply.

Spotting Duplication

z Sometimes it’s obvious

z Other times it’s subtle

z Kent Beck is known for being able to see extremely subtle duplication, refactoring the code to make it clear duplication, then removing it.

Examples and Techniques

z Trivial duplication can be removed with Extract Method, adding a variable, etc.

z Some duplication is harder to address – we’ll look at examples and techniques for attacking it.

z These slides outline the ideas, we’ll do a few examples “live” in the presentation.

Tools to Achieve OAOO

z Anonymous Inner Classes

z Create a class hierarchy

z Command Pattern

z Replace Case with Polymorphism

y Code Generation

y Dynamic Proxies

y Replace class hierarchy with runtime relationships

Fighting a try / finally

z (One solution on the next slide.)

z Simple try / finally example…

z multiple try / finally example…

Anonymous Inner Classes

z They’re not just for Swing listeners.

z They are Java’s version of code blocks (Smalltalk, Ruby).

z Example…

Create a Class Hierarchy

z Raise the duplicated code to a base class.

z Example…

Command Pattern

z (Also the Template Method pattern)

z Base class has a doFoo() and abstract realFoo()

z Descendants have a realFoo()

z doFoo() wraps realFoo() with whatever code would have been duplicated.

“Heavy Lifting” to Achieve OAOO

z Replace class hierarchy with runtime object relationships

z Replace application code with code generation

z Dynamic Proxies

z Aspect Oriented Programming – makes it much easier to remove many kinds of duplication.

Replace Class Hierarchy…

z An extreme step, not in the XP sense

z Useful when a previous designed has created a great number of “glue” classes that don’t contain much information

Code Generation

z The essence of code generation is to have a specification, and set of rules for producing code.

z Example: the many support and utility classes, coded in a formulaic way, in a typical EJB application

z Example: O-R persistance code

z Example: GUI code

What about Generated Duplicated Code?

z This doesn’t bother me – I only care about duplication in the checked in code

z If it bothers you, nearly every problem that can be solved with code gen, can be solved with a dynamic mechanism instead.

z (Note – Don’t check in generated code. Please.)

Adding a Field

z As an example of large scale duplication issue… if you want to add a field to some entity in a typical J2EE application, how many places in the code/configuration do you need to touch?

Duplication in Legacy Systems

z Legacy systems often contain extensive duplication

z Can we find some in JBidWatch?

Normalization

z OAOO in software design, is closely related to normalization in DB schema design.

What About Tests?

z Sometimes I find that things are duplicated between test code and production code.

z I’m not comfortable with this…

z But sometimes getting rid of it seems to negate the point of the test.

Discussion Topics:

z More examples, anyone?

z War stories?

z What additional / different tools does C# have to offer?

z Why do we see so much duplication in software?

z What about people who like duplication?

Code Examples

z These are some snapshots of the code we worked through during the presenation.

Starting Point – Parallel Loops

Extract Methods

Anonymous Inner Class

AIC, with Template Method

Lessons Learned

z AICs are the Java syntax for blocks / closures.

z AICs are really ugly syntax compared to Smalltalk, Ruby, etc.

z OAOO techniques sometimes create code that non-expert Java developers find very hard to fathom.

z The syntax is a big pain for small examples, but OK in real apps.

THE END

Slides will be on my site:

http://kylecordes.com

Introduction to the Ruby Language

Presentation and notes from a talk on the Ruby language to the St. Louis Unix User Group.

On June 12, 2002, I gave a talk at the St. Louis Unix user group introducing the Ruby language. The presentation is available for download here:

http://kylecordes.com/files/IntroToRuby.ppt

The text of the presentation, without useful formatting also appears here, so that search engines (particularly the one I need to add to this web site) will be able to find it.

We don’t use Ruby much (yet?) at Oasis Digital, but there are some interesting and useful ideas in it; I recommend looking it to expand your exposure to what’s possible in language design, even if you don’t need or plan to use yet another scripting language.

Addendum: Oasis Digital’s resident “Pythonista” pointed out that like Ruby, Python now supports multiple inheritance and garbage collection (not just reference counting).

Continue reading “Introduction to the Ruby Language”

Test Intensive Development in Delphi

Slides from a Birds of a Feather session at BorCon 2001

At the 2002 Borland Conference, I presented a “Birds of a Feather” session on Test Intensive Development in Delphi. A couple of dozen people attended, in spite of the early morning time slot. Most of the attendees were new to test intensive development, though a few were experienced in it and shared useful tips.

My introductory talk and demo was adversely impacted by a technical problem with the projector and missing microphone; hopefully this slightly expanded set of slides will fill in the gaps that caused.

Download TID-Delphi-BOF-Borcon-2002.ppt

Design Considerations in a Mobile/ Wireless Application

Mobile / Wireless applications must let the user get work done even with a network connection is not available. That and other consideration were covered in this talk to the St. Louis Wireless SIG meeting.

On April 23, 2002, I gave a talk at the St. Louis Web-developers Wireless SIG (what a mouthful!) on design considerations in a mobile/wireless application. The slides from that are available at:

http://kylecordes.com/files/DesignConsidMobile.zip

Of course, there was much more in the talk (a very full 90 minutes) than is shown in the slides; hopefully they are useful nonetheless.