Functions Descending More Than One Level of Abstraction

A function should only go down one level of logic. This mixes with a function should do one thing only. Example:

public String render() throws Exception {
  StringBuffer html = new StringBuffer(''hr'');
  if (size > 0) html.append('' size = \'''').append(size + 1).append(`\`'');
  return html;

This function contains both html structure and html syntax (two different abstractions) in the same function and instead be broken up, e.g.

HtmlTag hr = new HtmlTag(`hr`);

bj 2019-09-22