Scala is a good choice for building Web 2.0 applications because it runs on the JVM like Java and other dynamic languages, has features that make concurrency simple and predictable, and has a large and growing community and ecosystem of tools, libraries, and frameworks. While Scala adds some complexity, its benefits of performance, flexibility, and productivity make it worth learning.
Scala is a good choice for building Web 2.0 applications because it runs on the JVM like Java and other dynamic languages, has features that make concurrency simple and predictable, and has a large and growing community and ecosystem of tools, libraries, and frameworks. While Scala adds some complexity, its benefits of performance, flexibility, and productivity make it worth learning.
Docker is an open platform for developers and sysadmins to
build, ship, and run distributed applications, whether on
laptops,data center VMs, or the cloud.
This document discusses HTTP and DNS. It explains that DNS is used to resolve domain names like taobao.com to IP addresses like 110.75.115.70. It also lists common HTTP status codes like 200 for OK and 404 for Not Found. HTTP headers are described, including Request headers like method and path, and Response headers like Content-Length. Links are provided for further reading on HTTP, DNS, status codes, and the domain name system.
This document discusses version control and Git. It begins with an introduction to why version control is useful. It then covers setting up Git, basic Git commands like add, commit, diff and log. It discusses checking out different commits, branches, merging, pushing and pulling from remote repositories. It introduces concepts like stash, remote repositories, cloning and the Gitflow branching model.
The document discusses code review and AJAX techniques. It includes links to the author's GitHub page, SlideShare profile, and Twitter account. It also covers HTML, JavaScript, DOM manipulation, making AJAX calls, caching data, and plagiarism.
This document appears to be notes from a product manager tracking multiple projects, issues, and tasks. It includes sections for a website project with various tasks and bugs assigned as "todo", "in progress", "in review", and "done". Another section discusses developing a master tag and task #216 being completed. Overall it provides a high-level overview of a product manager's work tracking projects, tasks, bugs and issues across versions.
Docker is an open platform for developers and sysadmins to
build, ship, and run distributed applications, whether on
laptops,data center VMs, or the cloud.
This document discusses HTTP and DNS. It explains that DNS is used to resolve domain names like taobao.com to IP addresses like 110.75.115.70. It also lists common HTTP status codes like 200 for OK and 404 for Not Found. HTTP headers are described, including Request headers like method and path, and Response headers like Content-Length. Links are provided for further reading on HTTP, DNS, status codes, and the domain name system.
This document discusses version control and Git. It begins with an introduction to why version control is useful. It then covers setting up Git, basic Git commands like add, commit, diff and log. It discusses checking out different commits, branches, merging, pushing and pulling from remote repositories. It introduces concepts like stash, remote repositories, cloning and the Gitflow branching model.
The document discusses code review and AJAX techniques. It includes links to the author's GitHub page, SlideShare profile, and Twitter account. It also covers HTML, JavaScript, DOM manipulation, making AJAX calls, caching data, and plagiarism.
This document appears to be notes from a product manager tracking multiple projects, issues, and tasks. It includes sections for a website project with various tasks and bugs assigned as "todo", "in progress", "in review", and "done". Another section discusses developing a master tag and task #216 being completed. Overall it provides a high-level overview of a product manager's work tracking projects, tasks, bugs and issues across versions.
11. 一切值都是对象的实例 JVM中的原生类型是对象的实例 123.toByte "1".toInt true.toString 函数也是值,从而也是对象的实例 val compare = (x: Int, y: Int) => x > y compare(1, 2) // result: Boolean = false Java的static方法和域再没有存在的理由,因为它们的所有者也必须是对象的实例(值),所以有了Scala中的单例object object Dog { valwhatever = "dog" // static field in Java } class Dog { defcallWhatever = Dog.whatever }
12. 函数作为值 可以当作参数传递 val compare = (x: Int, y: Int) => x > y list sortWith compare 不管它是实例的方法 class AComparator { def compare(x: Int, y: Int) = x > y } list sortWith (new AComparator).compare 还是匿名子句 object annonymous extends scala.Function2[Int, Int, Boolean] { override def apply(x: Int, y: Int) = x > y } list sortWithannonymous 没有了static域,一切函数,包括object的方法调用现在都是 值(实例)的方法
13. 一切操作都是函数调用(1) 只有一个参数或零个参数的方法在调用时可以省略”.”和”()” 1.+(1) 1 + 1 1.>(0) 1 > 0 (1 > 0).&(2 > 1) (1 > 0) & 2 > 1 stack.push(10) stack push 10 stack.pop stack pop 参数也可以是一系列操作 {...} stack push { vala = 1 val b = 2 a + b } 更多的符号需要用作方法名 def !@#%^&*<=>?|~:/ = println("noop") def √(x: Double) = Math.sqrt(x) valΠ = Math.Pi val r = √(9*Π) ‘<’, ‘>’更适合作方法名,所以用’[’和‘]’来表示类型参数
14. 一切操作都是函数调用(2) for语句是函数调用 for (i <- List(1, 2)) { println(i) } List(1, 2) foreach {i => println(i)} for (i <- List(1, 2)) yield { i + 10 } List(1, 2) map {i => i + 10} 更多的例子 // synchronized is function call instead of keyword def check = synchronized { // isInstanceOf is function call instead of keyword 100.isInstanceOf[String] } 额外的好处:自左向右顺序书写语句 stack.pop.asInstanceOf[Int] // (Integer) stack.pop() in Java
15. 一切操作都返回值 默认返回最后一条语句的值,也可以用return显式返回 val r1 = { // return 3 vala = 1 valb = 2 a + b } val r2 = if (true) 1 else 2 val r3 = // return (): Unit for (i <- List(1, 2)) { println(i) } val r4 = // return List(11, 12) for (i <- List(1, 2)) yield { i + 10 } val r5 = // return java.io.File try { valf = new File("afile") f } catch { case ex: IOException => null }