This page was saved using WebZIP 6.0.8.918 (Unregistered) on 01/20/05 오후 3:27:46.
Address: http://www.leepoint.net/notes-java/15principles_and_practices/idioms.html
Title: Java: Java Programming Idioms  •  Size: 2409  •  Last Modified: Fri, 14 Jan 2005 00:25:13 GMT

Java: Java Programming Idioms

Introduction

Every programming language has its ways of writing common programming constructions. Sometimes these are used to solve particular problems in a programming language, and other times they are just the "style" that is used in that language.

For example, Java has four equivalent ways to add one to an integer variable:

   i = i + 1;
   i++;
   ++i;
   i += 1;
introduction compute compute + output input, compute, output input source screen console (prompt) command line paramters file net device input - read until EOF (test with read vs. test first) hmmm, that sounds like a pattern used by iterators also until count until value input - data representation binary character error detection range checks overflow check (hard) null check input consistency internal consistency tracing error handling (types: data vs programming) reprompt loop stop ignore fix and continue ask give message call error routine throw exception logging ignore - crash or let system handle it
introduction right column