tag:blogger.com,1999:blog-362788945979237212.post5894052065423061548..comments2023-10-12T08:48:48.368-07:00Comments on Wabi Sabi Software: Hard because its hard or because its easy?Brian Tarboxhttp://www.blogger.com/profile/11506285455540985587noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-362788945979237212.post-74924096671587463722012-05-03T07:05:24.224-07:002012-05-03T07:05:24.224-07:00After some back and forth we came up with the foll...After some back and forth we came up with the following as an implementation. The conclusion was that this was good use case for pattern matching on Option but still not for using get.<br /><br />def simpleMax(a:Long, b:Long) = if(a >b) a else b<br /><br />def max(otherTime: Long, time: Option[Long]): Option[Long] = time match {<br /> case Some(t) => Some(simpleMax(otherTime, t))<br /> case None => Some(otherTime) <br />}Brian Tarboxhttps://www.blogger.com/profile/11506285455540985587noreply@blogger.comtag:blogger.com,1999:blog-362788945979237212.post-4198689385283270262012-05-01T05:49:25.700-07:002012-05-01T05:49:25.700-07:00Brian,
Calling get on an Option is highly discour...Brian,<br /><br />Calling get on an Option is highly discouraged as it creates a nice opportunity for a null pointer exception to happen. So, I would recommend you always use getOrElse.<br /><br />In addition, pattern matching on an Option is not considered the best coding style in Scala.<br />Take a look at the Option API page (http://www.scala-lang.org/api/current/index.html#scala.Option) where it's explained at the top how to deal with Options.Nermin Serifovichttps://www.blogger.com/profile/14390690705192426597noreply@blogger.comtag:blogger.com,1999:blog-362788945979237212.post-379790030908470202012-05-01T01:29:25.195-07:002012-05-01T01:29:25.195-07:00They might also be needed to perform an interview ...They might also be needed to perform an interview with officials, submit a resume and go through an English and/or math skills assessment. <br /><br /><a href="http://www.eduberry.com/eduberryher_overview/" rel="nofollow">College Automation Software</a>eduberryhttps://www.blogger.com/profile/07904298670378024230noreply@blogger.com