const nihongo = "日本語" for i, v := range nihongo { fmt.Printf("%#U starts at byte position %d\n", v, i) } // 输出: // U+65E5 '日' starts at byte position 0 // U+672C '本' starts at byte position 3 // U+8A9E '語' starts at byte position 6
Organizations which design systems are constrained to produce designs which are copies of the communication structures of these organizations. - Melvin Conway(1967)
第一定律 Communication dictates design 组织沟通方式会通过系统设计表达出来 第二定律 There is never enough time to do something right, but there is always enough time to do it over 时间再多一件事情也不可能做的完美,但总有时间做完一件事情 第三定律 There is a homomorphism from the linear graph of a system to the linear graph of its design organization 线型系统和线型组织架构间有潜在的异质同态特性 第四定律 The structures of large systems tend to disintegrate during development, qualitatively more so than with small ystems 大的系统组织总是比小系统更倾向于分解
微服务
The microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services , which may be written in different programming languages and use different data storage technologies. – James Lewis and Martin Fowler
Martin Fowler是国际著名的OO专家,敏捷开发方法的创始人之一,现为ThoughtWorks公司的首席科学家.福勒(Martin Fowler),在面向对象分析设计、UML、模式、软件开发方法学、XP、重构等方面,都是世界顶级的专家,现为Thought Works公司的首席科学家。Thought Works是一家从事企业应用开发和集成的公司。早在20世纪80年代,Fowler就是使用对象技术构建多层企业应用的倡导者,他著有几本经典书籍:《企业应用架构模式》、《UML精粹》和《重构》等。—— 百度百科
funcfib(n int)int { if n == 0 || n == 1 { return n } return fib(n-2) + fib(n-1) }
funcBenchmarkFib(b *testing.B) { for n := 0; n < b.N; n++ { fib(30) // run fib(30) b.N times } } 只需要在 go test 添加 -cpuprofile 参数即可生成 BenchmarkFib 对应的 CPU profile 文件: $ go test -bench="Fib$" -cpuprofile=cpu.pprof . goos: linux goarch: amd64 pkg: example BenchmarkFib-81966071636 ns/op PASS ok example 2.046s