At the beginning of learning programming, one of my classmates asked me a question in the dormitory, for example, I want to implement a delay of 5 seconds before the next operation, how to achieve it. Another student at the time said that he had programmed in high school by looping 10,000 times to achieve delay. But is it accurate? There is also the implementation of different delays, how to ensure consistent, we are very confused, especially the processing time problem.
In fact, the computer has a set of hardware and software matching to achieve, the hardware is a crystal oscillator and the corresponding peripheral circuit. DOS clock that calculates hours, minutes, and seconds a PC’s real time clock, powered by a battery, that still runs normally after a shutdown. When the PC is started,DOS reads the time from the machine’s real-time clock and converts it to a BIOS daily clock reading. This value is then automatically increased by 18.2 per second, and when DOS needs to know the time, it converts the calendar clock count back to hour/minute/second format. PC microcomputer by performing 18.2 INT 08H interrupt per second, to complete the BIOS daily clock timing; Reading or modifying the value of this counter is done by the daily clock I/O interrupt INT 1AH. If the INT 1AH interrupt modifies the counter value, the system’s daily clock will start at this new value. In addition,INT 1AH can also complete reading, setting the system’s real clock and setting the alarm clock.
Computer programming before there is no operating system, writing programs directly and hardware to deal with, simply write a hardware program may be relatively easy, different applications to call this hardware, and there are multiple hardware. And the hardware has different manufacturers, the technical specifications of each manufacturer are not the same, the same equipment, different manufacturers to rewrite the code, and the upper call different manufacturers are completely different, can imagine, it is how troublesome. Fortunately, since the operating system came out, all these problems have been unified, whether it is to write the hardware driver, or the application of the call, are unified into a unified style of code, which is the most Linux procedures.
The Linux operating system has turned most kernel developers into driver engineers, because Linux has a driver framework that only needs to implement the interface of Linux device drivers.
Linux abstracts all devices into files, and the driver engineer’s job is to realize the function of the driver file, that is, to realize the function of the driver, while the application developer calls the device, only needs to deal with the corresponding device file, open the file device, and carry out the corresponding read and write. Application developers manipulate hardware devices by simply reading and writing files. As for application development on Linux, the Unix environment programming forks, pthreads, pipes, sockets, file reads and writes, C library calls and so on.
Programming in Unix environments is a bit messy, especially with C Pointers, which dissuade a lot of programmers.
Fortunately, Java appeared again, no pointer, intelligent management of memory, the language is very simple and clear, very easy to get started, attracted a large number of people to join the Java camp, Java has a concise language, no pointer, automatic memory management, Java has rich collections, libraries and so on. Java development is much easier without programmers having to reinvent the wheel.
To the advent of the Internet era, various frameworks emerge in an endless stream, among which the most classic even Spring, the core design idea of Spring is inversion of control, dependency injection, inversion of control, dependency injection, what is the simple point, is not to let the code control code, such code control binding, modify, When the code is ported, it needs to be modified accordingly, resulting in contamination of the associated code. Inversion of control is the abstraction of entities, binding them to each other as needed, and the final place of control is only injected when dependency injection is needed. So there’s only one place where the code depends on each other, and when the code needs to be migrated, there’s less code that gets corrupted, and when the code needs to be migrated, it’s easier to change. Spring programming is about defining beans, defining their relationships through annotations, and the Spring framework does the loading, parsing, interaction, and life cycle of beans. Application developers only need to focus on the specific business logic, simplifying programming.
With the advent of smart phones, Android integrated Linux and Java and soon created a very good framework. Due to the large group of Java developers, a large number of Java developers were attracted to the Android platform, and Android quickly occupied the entire mobile phone market. It’s really a developer’s game.
Android designed four components, Binder to achieve interprocess communication, four components, Activity is an interface component, specifically used to achieve the interface; Service, Provider is used to share data, Service is used to share memory data, and Provider is used to share file data. Broadcast is an asynchronous mechanism.
Technology will be constantly updated, new technology emerge in endlessly, said many programmers have to keep learning, will be affected by any carelessness, indeed, from the perspective of the development of the whole technology, change is always the only constant is all kinds of framework, language, the emergence of new technology, make the programming more simple, the programmer’s introduction to become low. So be aware of the trends. To learn, understand the framework, know the underlying design mechanism, its design idea is the fundamental, grasp these fundamental, we are not afraid of change.
Developers have the world, so the top companies are to build platforms, programming languages, compilers, systems, and frameworks. For example, Apple has its own operating system kernel Darwin, from which it derived macOS, iOS, watchOS and tvOS. It has its own programming language Object-C, Swift and compiler LLVM, and has built its own complete and closed ecosystem. According to statistics, Apple has more than 20 million developers. At the same time, the huge app ecosystem is so sticky that it cannot seize Apple’s market and shake apple’s position.
Android benefits from a large Java development community. Android uses Linux as the kernel and Java as the development platform to build its own development ecology. Java virtual machine is a set of standards, and it only needs to realize this standard to realize its own virtual machine. Java programmers can move seamlessly to the Android platform. All you need to do is configure the four components and use Binder to basically master Android development. Soon, Android built up a huge ecosystem of apps of its own, and the huge stickiness made Android untouchable. Because of the ecological advantage, Windows and Hongmeng need to be compatible with Android.
Technology is not about how great it is, but how simple it is. The simpler it is, the easier it is to use. The more people use it, the more successful it is. Technology is layered, the primary is to provide users with application developers, another is to provide developers with technical system framework, system framework itself, in addition to ensure the stable and efficient, but also make technology more concise, let developers are very easy to use, and use a little out of the question, even if there is a problem, can also have the technology to optimize solution.
Is now even with their own application platform, such as WeChat out their own small program, since then, byte, taobao, baidu also have their own small program, small program is based on JavaScript and WebView, easy to use, has attracted a large number of developers, however, it needs to have large application user base to support, Once the user of the application is lost, this also loses meaning, and the small program is done on the basis of the application, it is easy to be limited by the platform, can not do big, very rich, can only do simple functions.
The more low-level the technology, the more sophisticated the technology, the more users it has, the more firmly it stands. In this way, only Apple is the most powerful. In terms of chip design, operating system, programming language, application framework and ecosystem, it can define products at any time and overturn them at any time. IPhone, iPad, iPad Pro, M1 chip and many other black technologies are coming.
As a technical programmer, FIRST of all, I can use and skillfully use the framework provided by others. I can use Java, write Android APP and use Spring for development. Secondly, to a certain extent, we should understand the principles of these framework systems, such as Java virtual machine, Android four components design, Spring inversion of control; Third, ask why it is designed this way, what convenience it provides, and for what type of developer, think about it; Finally, with these design ideas in mind, and the ability to code proficiently, I tried to provide concise code for business programmers. The more accumulation, the stronger the code ability, there is code to review other people’s code, you can do the evaluation, a program is good or bad, whether the performance is good, whether stable, transplantation, expansion is easy and convenient. It should be easy to see that no matter how much technology changes, the idea remains the same, which is to develop cleaner code for applications. Anyway, frameworks are designed to let application developers program foolishly, but they can’t keep programming foolishly for a long time.