没有合适的资源?快使用搜索试试~ 我知道了~
首页七周精通七种编程语言原著体验
"《七周七语言英文版》是一本备受推崇的语言学习书籍,旨在帮助读者快速掌握并理解编程世界中的多种重要编程范式。作者凭借丰富的经验,将七种不同而又关键的语言——如编程语言的明珠——汇集一书,以一种既简洁又深入的方式进行介绍,使读者能够领略它们各自的优点和存在理由。 该书的重要性在于,它认识到多语言理解和跨范式设计能力对提升开发者的设计技巧具有深远影响。对于寻求扩展知识面、探索新领域的程序员来说,这就像一个精巧的点心菜单,提供了多样化的语言选择,让读者能够在不深入研究某一特定语言之前,对其特性有全面的认识和评估。 Dr. Venkat Subramaniam,一位屡获殊荣的作者和Agile Developer, Inc.的创始人,高度评价了这本书,认为它不仅传授了语言技能,还提供了宝贵的实践经验。他强调了接触新的编程语言、范式和技术对职业发展的重要性,认为本书在这一过程中发挥了积极作用。 Antonio Cangiano,一名软件工程师和技术评估专家,也分享了他的看法,称这本书为程序员们打开了新世界的大门,让他们能够通过浏览不同的语言来评估未来的趋势和发展,有助于做出明智的技术决策。 《七周七语言英文版》是一本极具价值的学习资源,无论是对于希望拓宽视野的初学者,还是寻求提升语言技能的资深开发者,都能从中受益匪浅。通过这本书,读者可以跨越传统的语言学习路径,直接体验和理解多种编程思想,从而提升自己的设计和解决问题的能力。"
资源详情
资源推荐
F
OREWORD
16
I’m pleased to see that Bruce’s taste in programming languages is eclec-
tic. He covers not only the well-established languages such as Ruby but
also less-well-appreciated languages like Io. Ultimately, programming is
about understanding, and understanding is about ideas. So, exposure
to new ideas is essential to a deeper understanding of what program-
ming is all about.
A Zen master might tell you that to be better at mathematics you’d
better study Latin. Thus it is with programming. To better understand
the essence of OO programming, you should study logic or functional
programming (FP). To be better at FP, you should study Assembler.
Books on comparative programming languages were popular when I
grew up as a programmer, but most of these were academic tomes that
gave little practical guidance to how to actually go about using a lan-
guage. This reflected the technology of the age. Y o u could read about
the ideas in a language, but actually trying it out was virtually impos-
sible.
Today, not only can we read about the ideas, but we can try them in
practice. This makes the difference between standing on the poolside
wondering whether it would be nice to swim and diving in and enjoying
the water.
I warmly recommend this book and hope that you enjoy reading it as
much as I have.
Joe Armstrong, creator of Erlang
2 March 2010
Stockholm
Report erratum
this copy is (P1.0 printing, October 2010)
Chapter 1
Introduction
People learn spoken languages for different reasons. Y o u learned your
first language to live. It gave you the tools to get through your everyday
life. If you learned a second language, the reasons could be very differ-
ent. Sometimes, you might have to learn a second language to further
your career or adapt to a changing environment. But sometimes you
decide to conquer a new language not because you have to but because
you want to learn. A second language can help you encounter new
worlds. Y o u may even seek enlightenment, knowing every new language
can shape the way you think.
So it is with programming languages. In this book, I will introduce you
to seven different languages. My goal is not to make a motherly demand
like your morning spoonful of cod liver oil. I want to guide you through
a journey that will enlighten you and change the way you look at pro-
gramming. I won’t make you an expert, but I’ll teach you more than
“Hello, W o r l d . ”
1.1 Method to the Madness
Most of the time, when I’m learning a new programming language or
framework, I’ll look for a quick interactive tutorial. My goal is to expe-
rience the language in a controlled environment. If I want, I can go off
script and explore, but I’m basically looking for a quick jolt of caffeine,
a snapshot of syntactic sugar, and core concepts.
But usually, the experience is not fulfilling. If I want to get the true
flavor of a language that is more than a subtle extension of one I already
know, a short tutorial is never going to work. I need a deep, fast dive.
M
ETHODTOTHE
M
ADNESS
18
This book will give you such an experience not once but seven times.
Y o u ’ l l find answers to the following questions:
• What is the typing model? Typing is strong (Java) or weak (C),
static (Java) or dynamic (Ruby). The languages in this book lean
on the strong typing end of the spectrum, but you’ll encounter
a broad mix of static and dynamic. Y o u will find how the trade-
offs impact a developer. The typing model will shape the way you
attack a problem and control the way the language works. Every
language in this book has its own typing idiosyncrasies.
• What is the programming model? Is it object-oriented (OO), func-
tional, procedural, or some type of hybrid? This book has lan-
guages spanning four different programming models and, some-
times, combinations of more than one. Y o u will find a logic-based
programming language (Prolog), two languages with full support
for object-oriented concepts (Ruby, Scala), four languages that are
functional in nature (Scala, Erlang, Clojure, Haskell), and one pro-
totype language (Io). Several of the languages are multiparadigm
languages, like Scala. Clojure’s multimethods will even let you
implement your own paradigm. Learning new programming para-
digms is one of the most important concepts in this book.
• How will you interact with it? Languages are compiled or inter-
preted, and some have virtual machines while others don’t. In this
book, I’ll begin to explore with an interactive shell, if there is one.
I will move on to files when it’s time to attack bigger projects.
W e won’t attack large enough projects to fully dive into packaging
models.
• What are the decision constructs and core data structures? Y o u ’ d
be surprised how many languages can make decisions with things
other than variations of ifs and whiles. Y o u ’ l l see pattern matching
in Erlang and unification in Prolog. Collections play a vital role in
just about any language. In languages such as Smalltalk and Lisp,
the collections are defining characteristics of the language. In oth-
ers, like C++ and Java, collections are all over the place, defining
the user’s experience by their absence and lack of cohesion. Either
way, you’ll need a sound understanding of the collections.
• What are the core features that make the language unique? Some
of the languages will support advanced features for concurrent
programming. Others provide unique high-level constructs such
as Clojure’s macros or Io’s message interpretation. Others will give
Report erratum
this copy is (P1.0 printing, October 2010)
T
HE
L
ANGUAGES
19
you a supercharged virtual machine, like Erlang’s BEAM. Because
of it, Erlang will let you build fault-tolerant distributed systems
much more quickly than you can in other languages. Some lan-
guages support programming models that are laser-focused on a
particular problem, such as using logic to solve constraints.
When you’re through, you will not be an expert in any of these lan-
guages, but you
will
know what each uniquely has to offer. Let’s get to
the languages.
1.2 The Languages
Choosing the languages in this book was much easier than you might
imagine. I simply asked potential readers. When we rolled up all the
data, we had eight potential candidates. I struck JavaScript because it
was too popular and replaced it with the next most popular prototype
language, Io. I also struck Python because I wanted no more than one
object-oriented language, and Ruby was higher on the list. That made
room for a surprising candidate, Prolog, which was a top-ten language
on the list. These are the languages that did make the cut and the
reasons I picked them:
• Ruby. This object-oriented language gets high marks for ease of
use and readability. I briefly considered not including any object-
oriented language at all, but I found myself wanting to compare
the different programming paradigms to object-oriented program-
ming (OOP), so including at least one OOP language was impor-
tant. I also wanted to push Ruby a little harder than most pro-
grammers do and give readers a flavor for the core decisions that
shaped the design of Ruby. I decided to take a dive into Ruby
metaprogramming, allowing me to extend the syntax of the lan-
guage. I’m quite happy with the result.
• Io. Along with Prolog, Io is the most controversial language I
included. It is not commercially successful, but the concurrency
constructs with the simplicity and uniformity of syntax are impor-
tant concepts. The minimal syntax is powerful, and the similarities
to Lisp are sometimes striking. Io has a small footprint, is a proto-
type language like JavaScript, and has a unique message dispatch
mechanism that I think you’ll find interesting.
• Prolog. Y e s , I know it’s old, but it is also extremely powerful. Solv-
ing a Sudoku in Prolog was an eye-opening experience for me.
I’ve worked hard to solve some difficult problems in Java or C
Report erratum
this copy is (P1.0 printing, October 2010)
T
HE
L
ANGUAGES
20
that would have been effortless in Prolog. Joe Armstrong, creator
of Erlang, helped me gain a deeper appreciation of this language
that strongly influenced Erlang. If you’ve never had an occasion to
use it, I think you will be pleasantly surprised.
• Scala. One of a new generation of languages on the Java vir-
tual machine, Scala has brought strong functional concepts to the
Java ecosystem. It also embraces OOP. Looking back, I see a strik-
ing similarity to C++, which was instrumental to bridging procedu-
ral programming and OOP. As you dive into the Scala community,
you’ll see why Scala represents pure heresy to pure functional
programmers and pure bliss to Java developers.
•
Erlang.
One of the oldest languages on this list, Erlang is gather-
ing steam as a functional language that gets concurrency, distri-
bution, and fault tolerance right. The creators of CouchDB, one of
the emerging cloud-based databases, chose Erlang and have never
looked back. After spending a little time with this distributed lan-
guage, you’ll see why. Erlang makes designing concurrent, dis-
tributed, fault-tolerant applications much easier than you could
have ever thought possible.
• Clojure. Another JVM language, this Lisp-dialect makes some rad-
ical changes in the way we think about concurrency on the JVM.
It is the only language in this book that uses the same strat-
egy in versioned databases to manage concurrency. As a Lisp
dialect, Clojure packs plenty of punch, supporting perhaps the
most flexible programming model in the book. But unlike other
Lisp dialects, the parentheses are greatly reduced, and you have
a huge ecosystem to lean on, including a huge Java library and
widely available deployment platforms.
• Haskell. This language is the only pure functional language in
the book. That means you won’t find mutable state anywhere.
The same function with the same input parameters will give you
the same output, every time. Of all the strongly typed languages,
Haskell supports the most widely respected typing model. Like
Prolog, it will take a little while to understand, but the results will
be worth it.
I’m sorry if your favorite language didn’t make the list. Believe me, I’ve
already gotten hate mail from more than a few language enthusiasts.
W e included several dozen languages in the survey mentioned earlier.
Report erratum
this copy is (P1.0 printing, October 2010)
剩余335页未读,继续阅读
gear1023
- 粉丝: 21
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 最优条件下三次B样条小波边缘检测算子研究
- 深入解析:wav文件格式结构
- JIRA系统配置指南:代理与SSL设置
- 入门必备:电阻电容识别全解析
- U盘制作启动盘:详细教程解决无光驱装系统难题
- Eclipse快捷键大全:提升开发效率的必备秘籍
- C++ Primer Plus中文版:深入学习C++编程必备
- Eclipse常用快捷键汇总与操作指南
- JavaScript作用域解析与面向对象基础
- 软通动力Java笔试题解析
- 自定义标签配置与使用指南
- Android Intent深度解析:组件通信与广播机制
- 增强MyEclipse代码提示功能设置教程
- x86下VMware环境中Openwrt编译与LuCI集成指南
- S3C2440A嵌入式终端电源管理系统设计探讨
- Intel DTCP-IP技术在数字家庭中的内容保护
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功