17th: The future of the Code

Source: Internet
Author: User
Tags value store

17th: The future of the Code

To go to the southwest on business, but from their shelves and the Kindle can not find interesting books, pro departure to the old sun room to find a lap, selected the "Code of the Future" this book. There are several reasons to select it: The book written by the father of Ruby, the author is Japanese, the Japanese written books are generally more practical, also want to know about Ruby, go through the catalogue found a few new languages, Dart, Coffeescript, lua contrast analysis, Old Sun said on the online evaluation of the book is good.

The plane saw all the way, a breath read the first 2 chapters, more than 90 pages, the key characteristics of a variety of language analysis is quite in place, the development of the language has a general understanding of the history. After a business day busy work, the rest of the evening to read the remainder of the three chapters of the content for me, the attraction is not enough, it may be too technical, we will not study so deep, only to use other people to write a ready-made framework.

Chapter one programming time and space

From the very beginning of programming, programming is to create a language (programming language) that both humans and computers can understand, and to communicate human intentions to computers through such a language, which is called programming . Natural language ambiguity is too strong, the future of the user interface is definitely a comprehensive voice input should be no problem, but with the voice of the problem all say, to the computer to achieve, now seems to be quite difficult, if the future realization, then the programmer is to be laid off? Or are you going to write to the lower code?

programming is a creative work that can create the world according to its own will, which is the greatest charm of programming . Think of a few lines of basic code entered in high school, can complete the tedious calculation, think of writing a small game yourself what is the situation? And fell in love with programming the job.

The development of computer language and Moore's Law also have a very big connection, but the computer algorithm has not changed greatly, especially some ancient basic algorithms are still heavily used. Moore's law is now basically still effective, but the CPU frequency increase has basically reached the limit, in the future, multi-core technology, memory capacity increases, hard disk to SSD transformation will become mainstream. How do our programs and algorithms adapt to these changes?

At this time when the child is small, I was enlightened to let her look at the logo language, let her manipulate the small turtle on the screen to draw a wonderful pattern, she does feel very magical, but to create a new world without much fun, maybe the girl's nature does not like these things, no wonder women programmers so little. I do not want to force the children to instill what programming technology, after all, software development is still a very hard work, or do not let children face the code to live all day.

The author also boldly predicted the future, it technology change Day Crescent benefits, 5 years will find great changes. Prices fall, performance increases, capacity increases, bandwidth increases, and these are exponential relationships that form the basis for it technology forecasts. In these growth, storage capacity seems to increase faster, and the speed of data transfer is not so fast, these development imbalances will also affect our future.

Programmer's ideas are inseparable from programming, the author uses the XP of extreme programming ideas to predict the future. What would the world look like when you put a few indicators on the big picture?

Computer prices are as low as cabbage, now smart appliances have seen some trends. The future world must be full of chips, and the internet of things seems like a trend. The floor is smart flooring, watches are smart watches, lights are smart lights, cups are smart cups, smart boxes, these are in the future, the term will definitely no longer use "smart" so vulgar words, the default is a computer chip device, it is computer, it seems that the programmer things more, the task more complex.

What happens when you have a very high computer performance? Will my notebook be configured to be 1024 cores in the future? Multi-core CPU parallel programming must have a new development, if which programming language has this characteristic, should be the language which needs to focus attention. Maybe the author puts the go language before the comparison is the reason.

Very large capacity? Will my laptop be configured with a 1EB hard drive? No, the hard drive is gone, the memory and the hard disk is 2 1, because the memory is already a cabbage price, configure 1TB memory? Other things are in the cloud, there is no need to control what capacity problem, because the bandwidth is not a problem, read and write 10G data from the network is a few seconds things? malloc () You just have to allocate a eight-dimensional array, don't worry about memory overflow and other exceptions, haha. Now the SSD-based database system and big data analysis technology has come out.

Network bandwidth 1gbit/s? When the computer first came out, it was a centralized era, a large computer, surrounded by only a few terminals. When the hand can have a computer, the C/S system appears. When WWW browser is popularized all over the world, the centralization of B/s mode begins to revert. Now JavaScript in the browser is a big line, and in fact, C/s change a vest resurrection. If b/S is a trend, then what is the use of your personal computer that is so powerful? No, each computer itself is a node in the network cloud computing, you have to provide computing resources to access other people's services?

Chapter II the past, present and future of programming languages 2.1 world of programming languages

Here is a reference to the punch tape, Babbage difference machine, female programmer Ada, the first computer ENIAC, as to who is really the first is the historian. Computer language mainly introduced Fortran, COBOL, LISP, Snobol language, and then talked about the current mainstream language.

What will the programming language look like in 100 years? Not much change? Does the behavior of programming with programming languages no longer exist? Have you invented a programming language with a higher degree of abstraction? I can't see it anyway.

What does the programming language look like after 20 years? Will certainly be more powerful in multi-CPU collaboration and multi-machine distributed processing. The current threading programming model is too painful for programmers.

2.2 DSL (domain-specific language)

an external DSL is a DSL that is implemented by a dedicated language engine and can be highly customizable, but with higher learning costs. YAML, JSON, and regular expressions can all be called external DSLs. XML is very generic, but it is tedious to describe, not suitable for reading and programming, and how will it be improved in the future?

Internal DSL is hosted on the basis of a programming language, so that there is no need to learn a new language, host language syntax, etc. can be used to save a lot of program development time.

The process of designing a stack of APIs is actually a process of designing a DSL.

I have also wanted to make the work of the Basemap and section of the process DSL, the core programmer to develop a component library, the other programmers only need to write this:

A = Basemap.new

A.addimage (image, 0, 0, 1, 1)

A.addsurvey (...)

Survey. Hide

Seismicline.show Zxcvolume Inline 200

......

Unfortunately, the implementation of internal DSL in C # is rather hard, only temporarily using the API.

The authors believe that Lisp, Smalltalk, and Ruby are suitable for use as internal DSL languages, which may be related to their meta-language programming characteristics.

The elements of DSL design: contexts, statements, units, vocabularies, hierarchies, which I can not grasp for the time being.

2.3 Meta Programming

Program to write programs is meta-programming metaprogramming. At this time also think of the digital oilfield all day in the meta-data, it is important to store these meta-data, but the metadata from the application must not be collected, there will be no place to live. If both meta-data and meta-programming are implemented, the logic for the programmer to get the data should be like WELL1. Getwelllog ("AC") this way? You do not need to write SQL, do not need to write ORM mapping relationship, do not need a realistic body class, writing is convenient, but it seems to learn more difficult.

In both Java and C #, it is primarily the reflection of reflection to get and change the information of the program itself, while Ruby's meta-programming is quite powerful and can generate 100 of methods in a few lines of code, and in Java and C # only by writing a specialized code generator.

The program in Lisp is represented by an S-expression, whose program and data are identical, so meta-programming has been deeply integrated into Lisp.

Meta-programming is powerful, but it can't be used too much, otherwise it's difficult to understand the source code.

2.4 Memory Management

Garbage collection GC Three ways: Mark Purge, copy collection, reference count. The principle and implementation of the reference counting method is simple, but there are many shortcomings, so it is almost no longer used recently. Think of the memory management in Qt is also a reference count, let the programmer to decide when to increase 1, minus 1 is really a pain.

The new garbage collection algorithms are: generational recycling, incremental recovery, and parallel recycling.

There is also an IBM scholar who uses the great Unified Theory of Physics (Grand Unified theory, abbreviated gut) for garbage collection, unified for tracking recycling and reference counting.

2.5 Exception Handling

Today's high-level languages have exception handling mechanisms that make it easier for programmers to handle exceptions. The traditional method of using special return values is easy to let the original normal program be buried by error handling code.

Java's check-type exception forces the compiler to check for exceptions, which is sometimes inconvenient. An exception is called an exception because it is difficult to anticipate beforehand. Knowing this, it's too painful to be forced to declare exceptions in the code beforehand to avoid compiling errors.

Ensure, rescue, and retry in Ruby refer to the reserved words in the Eiffel language.

2.6 Closures

When I was learning Haskell, I used to think that closure was a higher-order function that could pass functions as arguments to functions.

The biggest weakness of function pointers in C language is the inability to access external local variables. Being able to access external variables (references, updates) is one of the constituent elements of closures.

Chapter III New trends in programming languages

In this chapter, the authors mainly introduce four programming languages go, Dart, Coffeescript and Lua. See here I opened the tiobe about the Software programming language (as of November 2014), the go language ranked outside of 20 (in the rankings), Dart rankings 22,coffeescript did not see, may be merged in JavaScript, LUA ranked 41.

Java 2,javascript leaped to 7,ruby a bit down, in 18th place, and the fastest-growing R and Swift did not appear in the author's book.

3.1 Design of the language

More bugs can be found during static types of language compilation and easier to read and understand. The advantage of dynamic type language is its simplicity and flexibility.

Duck Type Duck Typing: If you walk like a duck and do it like a duck, it must be a duck.

3.2 Go (rank 46)

Can be called the modern version of the C language. Languages that claim to be new, experimental (experimental), Concurrent (concurrent), garbage-collected (with garbage collection), systems (System level). The author most optimistic about it, probably mainly because it built-in support for concurrent programming, and then it is famous door bar.

3.3 Dart (rank 22)

Dart wants to replace JavaScript, but the latter already has a large number of users, and it seems that Dart's future is not bright.

3.4 Coffeescript

JavaScript has been put in a lot of money to continue to evolve, it has been faster and faster. Since JavaScript is becoming more and more important, can it not abandon JavaScript and overcome its shortcomings? Coffeescript is this way of thinking, its compiler implementation is JS written, coffeescript program will be fully compiled to the JS code to execute, its development is worth looking forward to.

3.5 Lua (rank 41)

LUA focuses on the embedded field, characterized by lightness, speed and responsiveness.

Chapter fourth programming in the era of cloud computing

Starting with this chapter, it's a little interesting to read, just a few ideas.

4.1 Scalability

From the simple dichotomy, the hash table and the Bron filter, and the DHT (distributed hash table), Roma (key-value store database), and MapReduce in the distributed environment are also mentioned.

4.2 c10k Problems

C10K is the abbreviation for the client 10000 problem, which means "the service is not available even if the hardware performance is sufficient in an environment where there are more than 10,000 clients connected to the server at the same time." Epoll, Libev and Eventmachine, these are not understood.

4.3 hashfold

Not interested.

4.4 interprocess Communication

Look at Ruby implementation of the Web server code is quite concise, there is a chance to try.

4.5 Rack and Unicorn

Not interested.

The fifth chapter supports the data storage technology of big data

This chapter is beyond my comprehension and lists a few terms, CAP, NoSQL, MongoDB, OD Mapper, Voltdb, memcached, Redis.

Chapter sixth programming in the multi-core era

This chapter mentions the pipeline functionality in Unix, which is quite graceful and powerful, by contrast, the pipeline in Windows is implemented through temporary file emulation, which is quite rubbish.

Other content about non-blocking I/O, node. js, Eventmachine is temporarily outside my interest.

With regard to interprocess communication, the author mentions Zeromq, a library that provides inter-process communication for distributed application development. Have a chance to try.

17th: The Future of code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.