Since spark provide sparkconf to manage it's config system, we should first get option from sparkconf, then system env(compatible with old version). And we‘d better avoid using system env. 
Actually in sparkcontext it get sparkhome like this

  private[spark] def getSparkHome(): Option[String] = {
    conf.getOption("spark.home").orElse(Option(System.getenv("SPARK_HOME")))
  }
also, we keep consistent.