Clean up and offer better code examples.

Idea created by MichaelSegel on Sep 26, 2017
    Planned
    Score30
    • cathy
    • deborah
    • MichaelSegel
    • terryhealy
    • john.humphreys
    • Daniar

    I was looking at some of the MapR blog pages... (e.g Loading HBase tables into Spark | MapR ) and at the end there was a code snippet:

     //put data into table     val myTable = new HTable(conf, tableName);     for (i <- 0="" to="" 5)="" {="" var="" p="new" put();="" put(new="" string("row"="" +="" i).getbytes());="" p.add("cf1".getbytes(),="" "column-1".getbytes(),="" new="" string(="" "value="" "="" mytable.put(p);="" }="" mytable.flushcommits();="" create="" rdd="" val="" hbaserdd="sc.newAPIHadoopRDD(conf," classof[tableinputformat],="" classof[org.apache.hadoop.hbase.io.immutablebyteswritable],="" classof[org.apache.hadoop.hbase.client.result])="" get="" the="" row="" count="" print("hbase="" count:"+count)="" system.exit(0)="" <="" pre="">

    Note: while syntax is ok, the formatting makes it difficult to follow in the blog page, and even when adding to a comment like this.

     

    This makes it more difficult when attempting to learn a new language or how to use the language to perform work.

     

    Good code should be human readable and should contain comments, even if the author may feel it to be self explanatory.