Sunday, July 01, 2012

Tip of the Day: Documentation Code Review

Documentation

Here are some general best practices to consider around documentation code review.

These tips are by no means definitive, but serve as reminders to developers what they should consider in a checklist.

Note: documentation and code reviews are really not separate processes.
  • All methods are commented in clear language. If it is unclear to the reader, it is unclear to the user.
  • All source code contains @author for all authors.
  • @version should be included as required.
  • All class, variable, and method modifiers should be examined for correctness.
  • Describe behavior for known input corner-cases.
  • Complex algorithms should be explained with references. For example,  document the reference that identifies the equation, formula, or pattern. In all cases, examine the algorithm and determine if it can be simplified.
  • Code that depends on non-obvious behavior in external frameworks is documented with reference to external documentation. 
  • Confirm that the code does not depend on a bug in an external framework which may be fixed later, and result in an error condition. If you find a bug in an external library, open an issue, and document it in the code as necessary.
  • Units of measurement are documented for numeric values.
  • Incomplete code is marked with //TODO or //FIXME markers.
  • All public and private APIs are examined for updates.

ISO-8859-1 Character Encoding

Cuneiform Inscription in Persepolis
This chart is based on my original which I did in 2004 for HTML 4. I decided to update it, and post it since it seems I am always looking for it. This should give a Java, or web developer the Unicode, numeric, and named entity values.

ISO-8859-1 Character Encoding

Unicode Escaped Numeric Entity Named Entity Symbol Description
\u0009 	 \t Horizontal tab
\u000A 
 \n Line feed
\u000D 
 \r Carriage return
\u0020   Space
\u0021 ! ! Exclamation point
\u0022 " " " Quotation mark
\u0023 # # Hash mark
\u0024 $ $ Dollar sign
\u0025 % % Percent sign
\u0026 & & & Ampersand
\u0027 ' ' Apostrophe
\u0028 ( ( Left parenthesis
\u0029 ) ) Right parenthesis
\u002A * * Asterisk
\u002B + + Plus sign
\u002C , , Comma
\u002D - - Hyphen
\u002E . . Period
\u002F / / Slash
\u0030-\u0039 0-9 0-9 Digits 0-9
\u003A : : Colon
\u003B &#059; ; Semicolon
\u003C &#060; &lt; < Less than
\u003D &#061; = Equals sign
\u003E &#062; &gt; > Greater than
\u003F &#063; ? Question mark
\u0040 &#064; @ Commercial at sign
\u0041-\u005A &#065;-&#090; A-Z Letters A-Z
\u005B &#091; [ Left square bracket
\u005C &#092; \ Backslash
\u005D &#093; ] Right square bracket
\u005E &#094; ^ Caret
\u005F &#095; _ Underscore
\u0060 &#096; ` Grave accent
\u0061-\u007A &#097;-&#122; a-z Letters a-z
\u007B &#123; { Left curly brace
\u007C &#124; | Vertical bar
\u007D &#125; } Right curly brace
\u007E &#126; ~ Tilde
\u0082 &#130; , Low left single quote
\u0083 &#131; ƒ Florin
\u0084 &#132; ,, Low left double quote
\u0085 &#133; ... Ellipsis
\u0086 &#134; † Dagger
\u0087 &#135; ‡ Double dagger
\u0088 &#136; ^ Circumflex
\u0089 &#137; ‰ Permil
\u008A &#138; Š Capital S, caron
\u008B &#139; < Less-than sign
\u008C &#140; Œ Capital OE ligature
\u0091 &#145; ` Left single quote
\u0092 &#146; ' Right single quote
\u0093 &#147; " Left double quote
\u0094 &#148; " Right double quote
\u0095 &#149; • Bullet
\u0096 &#150; - En dash
\u0097 &#151; — Em dash
\u0098 &#152; ~ Tilde
\u0099 &#153; ™ Trademark
\u009A &#154; š Small s, caron
\u009B &#155; > Greater-than sign
\u009C &#156; œ Small oe ligature
\u009F &#159; Ÿ Capital Y, umlaut
\u00A0 &#160; &nbsp; Nonbreaking space
\u00A1 &#161; &iexcl; ¡ Inverted exclamation point
\u00A2 &#162; &cent; ¢ Cent sign
\u00A3 &#163; &pound; £ Pound sign
\u00A4 &#164; &curren; ¤ General currency sign
\u00A5 &#165; &yen; ¥ Yen sign
\u00A6 &#166; &brvbar; | Broken vertical bar
\u00A7 &#167; &sect; § Section sign
\u00A8 &#168; &uml; ¨ Umlaut
\u00A9 &#169; &copy; © Copyright
\u00AA &#170; &ordf; ª Feminine ordinal
\u00AB &#171; &laquo; « Left angle quote
\u00AC &#172; &not; ¬ Not sign
\u00AD &#173; &shy; - Soft hyphen
\u00AE &#174; &reg; ® Registered trademark
\u00AF &#175; &macr; ¯ Macron accent
\u00B0 &#176; &deg; ° Degree sign
\u00B1 &#177; &plusmn; ± Plus or minus
\u00B2 &#178; &sup2; 2 Superscript 2
\u00B3 &#179; &sup3; 3 Superscript 3
\u00B4 &#180; &acute; ´ Acute accent
\u00B5 &#181; &micro; µ Micro sign (Greek mu)
\u00B6 &#182; &para; Paragraph sign
\u00B7 &#183; &middot; · Middle dot
\u00B8 &#184; &cedil; ¸ Cedilla
\u00B9 &#185; &sup1; 1 Superscript 1
\u00BA &#186; &ordm; º Masculine ordinal
\u00BB &#187; &raquo; » Right angle quote
\u00BC &#188; &frac14; 1/4 Fraction one-fourth
\u00BD &#189; &frac12; 1/2 Fraction one-half
\u00BE &#190; &frac34; 3/4 Fraction three-fourths
\u00BF &#191; &iquest; ¿ Inverted question mark
\u00C0 &#192; &Agrave; À Capital A, grave accent
\u00C1 &#193; &Aacute; Á Capital A, acute accent
\u00C2 &#194; &Acirc; ¯ Capital A, circumflex accent
\u00C3 &#195; &Atilde; Ã Capital A, tilde
\u00C4 &#196; &Auml; Ä Capital A, umlaut
\u00C5 &#197; &Aring; Å Capital A, ring
\u00C6 &#198; &AElig; Æ Capital AE ligature
\u00C7 &#199; &Ccedil; Ç Capital C, cedilla
\u00C8 &#200; &Egrave; È Capital E, grave accent
\u00C9 &#201; &Eacute; É Capital E, acute accent
\u00CA &#202; &Ecirc; Ê Capital E, circumflex accent
\u00CB &#203; &Euml; Ë Capital E, umlaut
\u00CC &#204; &Igrave; Ì Capital I, grave accent
\u00CD &#205; &Iacute; Í Capital I, acute accent
\u00CE &#206; &Icirc; Î Capital I, circumflex accent
\u00CF &#207; &Iuml; Ï Capital I, umlaut
\u00D0 &#208; &ETH; Ð Capital eth, Icelandic
\u00D1 &#209; &Ntilde; Ñ Capital N, tilde
\u00D2 &#210; &Ograve; Ò Capital O, grave accent
\u00D3 &#211; &Oacute; Ó Capital O, acute accent
\u00D4 &#212; &Ocirc; Ô Capital O, circumflex accent
\u00D5 &#213; &Otilde; Õ Capital O, tilde
\u00D6 &#214; &Ouml; Ö Capital O, umlaut
\u00D7 &#215; &times; x Multiply sign
\u00D8 &#216; &Oslash; Ø Capital O, slash
\u00D9 &#217; &Ugrave; Ù Capital U, grave accent
\u00DA &#218; &Uacute; Ú Capital U, acute accent
\u00DB &#219; &Ucirc; û Capital U, circumflex accent
\u00DC &#220; &Uuml; Ü Capital U, umlaut
\u00DD &#221; &Yacute; Ý Capital Y, acute accent
\u00DE &#222; &THORN; Þ Capital thorn, Icelandic
\u00DF &#223; &szlig; ß Small sz ligature, German
\u00E0 &#224; &agrave; à Small a, grave accent
\u00E1 &#225; &aacute; á Small a, acute accent
\u00E2 &#226; &acirc; â Small a, circumflex accent
\u00E3 &#227; &atilde; ã Small a, tilde
\u00E4 &#228; &auml; ä Small a, umlaut
\u00E5 &#229; &aring; å Small a, ring
\u00E6 &#230; &aelig; æ Small ae ligature
\u00E7 &#231; &ccedil; ç Small c, cedilla
\u00E8 &#232; &egrave; è Small e, grave accent
\u00E9 &#233; &eacute; é Small e, acute accent
\u00EA &#234; &ecirc; ê Small e, circumflex accent
\u00EB &#235; &euml; ë Small e, umlaut
\u00EC &#236; &igrave; ì Small i, grave accent
\u00ED &#237; &iacute; í Small i, acute accent
\u00EE &#238; &icirc; î Small i, circumflex accent
\u00EF &#239; &iuml; ï Small i, umlaut
\u00F0 &#240; &eth; ð Small eth, Icelandic
\u00F1 &#241; &ntilde; ñ Small n, tilde
\u00F2 &#242; &ograve; ò Small o, grave accent
\u00F3 &#243; &oacute; ó Small o, acute accent
\u00F4 &#244; &ocirc; ô Small o, circumflex accent
\u00F5 &#245; &otilde; õ Small o, tilde
\u00F6 &#246; &ouml; ö Small o, umlaut
\u00F7 &#247; &divide; ÷ Division sign
\u00F8 &#248; &oslash; ø Small o, slash
\u00F9 &#249; &ugrave; ù Small u, grave accent
\u00FA &#250; &uacute; ú Small u, acute accent
\u00FB &#251; &ucirc; Û Small u, circumflex accent
\u00FC &#252; &uuml; ü Small u, umlaut
\u00FD &#253; &yacute; ý Small y, acute accent
\u00FE &#254; &thorn; þ Small thorn, Icelandic
\u00FF &#255; &yuml; ÿ Small y, umlaut

Monday, May 07, 2012

JSF 2 Tip of the Day: Learning the JSF Lifecycle with a PhaseListener

I have to do some JSF training in the next couple of weeks for some of the staff at the company where I work. The learning curve for JSF has often been called a vertical wall. In part this is due to the JSF Lifecycle. The JSF Lifecycle has a number of phases, and before and after each phase there is an extension point where we can intervene in the process using a PhaseListener.

Since the PhaseListener intercepts the process, you can use it to learn the phases. The PhaseListener below is an example of one that reports on all PhaseEvents. You should modify it to learn what occurs during each phase.

PhaseListenerImpl.java

Here is the output:
INFO: Before Phase: RESTORE_VIEW 1 invoked.
INFO: After Phase: RESTORE_VIEW 1 invoked.
INFO: Before Phase: APPLY_REQUEST_VALUES 2 invoked.
INFO: After Phase: APPLY_REQUEST_VALUES 2 invoked.
INFO: Before Phase: PROCESS_VALIDATIONS 3 invoked.
INFO: After Phase: PROCESS_VALIDATIONS 3 invoked.
INFO: Before Phase: UPDATE_MODEL_VALUES 4 invoked.
INFO: After Phase: UPDATE_MODEL_VALUES 4 invoked.
INFO: Before Phase: INVOKE_APPLICATION 5 invoked.
INFO: After Phase: INVOKE_APPLICATION 5 invoked.
INFO: Before Phase: RENDER_RESPONSE 6 invoked.
INFO: After Phase: RENDER_RESPONSE 6 invoked.

Popular Posts