Chapter 1: Introduction to Objects-One Month to Read "Java Programming Thoughts" Reading Notes

20200331
I am a Java beginner, and the knowledge reserve is limited to the C language knowledge taught in the university classroom, and I have almost forgotten it. The foundation of Java has always been unreliable. The most basic types will not be used, and there is no one. . .
It is estimated that there is less than a month to go back to school and start school. This time I bought this "Java Programming Thoughts Fourth Edition" to take a good tutorial. Until you learn enumeration, the window program will not be read first. It is estimated that 30 days, 25 pages per day, every night to organize the learning on the blog for recording and sharing. I hope to make good use of my leisure time and lay a solid foundation.
Seeing that there are many online PDF versions, I transferred a DOCX and put it on CSDN. It is inevitable that there will be errors if I transfer it myself. But it is much more convenient to read on e-books

Java Programming Ideas Fourth Edition DOCX

Chapter 1: Introduction to
Objects 20200401
"" is a complete citation of the original text. Other formats are a summary or inspiration of the original book's knowledge. If there are any errors, please ask the seniors to criticize and correct them. I am grateful.

"The reason why we decompose nature, organize into various concepts, and classify them according to their meanings is mainly because we are participants in an agreement that the entire oral communication society abides by. This agreement is fixed in the form of language ... unless this agreement is approved The organization and classification of language information as specified in the article, otherwise we cannot talk at all. – Benjamin Lee Whorf (1897-1941) ”
“ The computer revolution originated from machines, so the production of programming languages ​​also started from imitation of machines. ”
Numerous Expressions (including OOP) are no longer like machines but more like a part of our minds, so what will be the new form of information flow or new understanding? If you want to come to AI, it may not replace humans. It is likely to be combined with humans through brain-computer interfaces, but at that time, people may no longer be humans, and they will lose some of them now because of accepting new features. It would be interesting to think about it, what could it be?

"All programming languages ​​provide abstract mechanisms. It can be assumed that the complexity of the problems that people can solve depends directly on the type and quality of the abstraction."
"Programmers must build on the machine model (solution space) and the actual problem to be solved. Model (problem space) ". "
Would n’t it be nice if you could generate the association yourself without the need to create a mapping ... Let the problem to be solved be automatically associated with the possible solution, and it will be resolved automatically ... It ’s great to think about it

"We refer to the elements in the problem space and their representation in the solution space as objects. However, you also need some objects that cannot be compared to the elements in the problem space." For example, the related tables in the database represent the daily Think about what else.

The five basic characteristics of Smalltalk summarized by Alan Kay:
1. Everything is an object
2. A program is a collection of objects that tells each other what to do by sending a message
3. Each object has its own storage made up of other objects
4. Each object has its type: the most important characteristic of each class that distinguishes it from other classes is "what kind of message can be sent to him"
5. All objects of a certain type can receive the same information

"Objects can exist in different machines and address spaces, and they can also be stored on the hard disk. In these cases, the object's identity must be determined by something other than the memory address."

A diagram in the form of UML (Unified Modeling Language). Can learn

"The class created by the class creator only exposes the necessary part to the client programmer, while hiding the other parts, which means that the class creator can modify the hidden part at will

access specifier: public, protected, private, the default is the package access permission, public in the package, private outside the package

"Code reuse"
"1. Use an object of this class directly; 2. Put an object of that class in a new class, called creating a" member object "
" Member objects of new classes are usually Declared as private, so that client programmers using the new class cannot access them "
?? Modify these member objects at run time, dynamically modify the program ??
" "When creating a new class, you should first consider composition"

"The concept of objects allows you to encapsulate data and functions together through" concepts "

extends
"You can create a base class type to represent the core concepts of certain objects in the system, and derive other types from the base type to indicate the different ways in which this core can be implemented"
"Convert the solution into the same term The problem is very helpful "

"All messages that can be sent to the base class object can also be sent to the export class object, which means that the export class and the base class have the same type"
"There are two ways to make the base class and the export class different: 1 .Add new methods in the exported class, but you should consider whether the base class also needs this newly added method. 2.Overriding, change the existing base class method behavior, override
"can be is-a try not to be like-a "

The polymorphic
method operates on the generalized generic shape, and does not care about the specific shape. Complete the unified expression
of the code , really cool "such code will not be affected by the addition of new types"

"A function call generated by a non-object-oriented programming compiler will cause the so-called early binding. However, in OOP, the program cannot determine the address of the code until runtime. given. " "
in order to perform late binding, Java uses a special short code to replace the call to the absolute address. this code uses the address information stored in the object to the calculation method (???) " " C
++ to use virtual Realize dynamic binding, but in Java, dynamic binding is the default "
" The code that interacts with the base class is decoupled from the specific type "
" The process of treating the exported class as its base class Called upcasting (upcasting) "

Single-root inheritance mechanism
Object
"All OOP languages ​​except C ++ are single-root inheritance"
"Common interface"
"Everything is ultimately the same basic type"
"Will not be deadlocked by the inability to determine the type of object, for the system Level operations (such as exception handling) are particularly important and bring great flexibility to programming "

Container:
"Anytime you need to expand yourself to accommodate everything you put in it. Just create a container object. Then let it handle all the details."

Different containers have different efficiencies, pay attention when learning.

"Upward transformation is safe, but downward transformation is dangerous if you are not sure of the specific type"

The parameterized type <> paradigm, not the other generic type, the paradigm should take the meaning of the canonical type

Life cycle
"Every object needs resources to survive, especially memory"

Where is the object's data located? How to control the life cycle?

"C ++ implements objects by placing them on the stack or static storage area. This approach places storage space allocation and deallocation at a priority."
"Objects are dynamically created in a memory pool called the heap. In this approach, I do n’t know how many objects are needed until runtime, what is their life cycle, and what their specific types are. ”
“ The dynamic approach has such a general logical assumption: objects tend to become more complex, so finding and releasing resource storage space The overhead will not have a major impact on the creation of objects "
" Garbage collection mechanism can avoid hidden memory leaks "
" Java's garbage collection mechanism is designed to deal with the problem of memory release, but it does not include other aspects of cleaning up objects "

"An exception is an object that is thrown from the point of error and is" captured "by a corresponding exception handler that is specifically designed to handle specific types of errors. Exception handling is like parallel to the normal execution path of the program. "Another path to be executed when it occurs"
"Exceptions cannot be ignored, so it is guaranteed to be handled".
"The only acceptable way to report errors in Java during exception handling. If the correct code for handling exceptions is not written correctly, Then you will get an error message at compile time "

Concurrent programming
"Initially, the suspension of the main process is triggered by a hardware interrupt and cannot be transplanted"
"The parts that run independently of each other are called county towns"
"Hidden: Shared resources. If there are multiple parallel tasks, all must access the same resource" .A task locks a resource, completes its task, and then releases the resource lock so that other tasks can use the resource "

Java and Internet
C / S
systems have a central repository of information (central repository of information), which is used to store certain data. It usually exists in the data air, and you can distribute it to certain personnel or machine clusters as needed. The key to the client / server concept is that the location of the information storage pool is concentrated in the central
load balancing. Any small delay in
transaction processing
will have a huge impact. In order to minimize the delay and reduce the load on the processing task, sometimes so-called middleware is also used Distribute the load to other machines on the server side

In the case of the Internet of Things, a set of rules and a file format are stipulated. When a connection occurs, it is sent, including the calling interface, instructions, and authorization. The corresponding control interface is automatically generated. What is accurate? What I mean is that when designing all the devices that can be accessed, it is so standardized, and then unified and automatically realized. If you have time to write a small program to try it out, is it like a hacker?

"The Web is actually a giant server"
"Initially, there was only a one-way process, you made a request to a server, and then it returned you a file, the browser software on your machine (client) according to the local machine To interpret this file. "
" A big step forward, a piece of information can be displayed on any type of computer without modification. "
" The browser does not have significant interactivity, and it tends to block the server and the Internet. In order to solve this problem, methods such as graphics standard enhancement were first made, and the rest was solved by client programming "

"Interactivity of server browser programming is completely provided by the server"

CGI (common gateway interface) common gateway interface? ? ? ? ?
Take a good look at this part

This part may be outdated, I don't know, there is no relevant knowledge, but? ? ? At the beginning, I should go back and take a look at it, do my homework, at least understand its thinking
.

"The advantages of HTML are fast loading, easy to understand, and the disadvantages of the code are exposed to anyone to browse or steal."
"Scripts provide an easier and faster way to develop. Before considering complex solutions, you should first consider the scripting language."

"Intranet" (Intranet)

"A lot of problems can be solved by reusing existing library code."
To change your thinking, you can work hard to know why, but in the process of working, you should be happy to be a tuner. This is the advantage of Java. , Can also greatly improve efficiency and focus on solving their own problems. Many times, due to the level of my own garbage and the characteristics of this major, learning should be divided into work-oriented learning and deep-digging learning. Once you are clear that you are in working learning, you must be clear about what your input and output are like a constructor, so as to clarify your depth of learning. The vast ocean of knowledge is boundless. Being able to explore the principles is of course happy, but no one should pay for your happiness at work, and there should be output when there is input and demand. This is my great problem. It must be corrected. Come on. Ori ! ! ! Haha

So seeing the students who are learning Java together here, if you want to get started quickly at work, then I do not recommend that you read this book first, just find a JDK document or any quick check things to do first. My blog also took some free time and wanted to systematically study and sort it out. It wouldn't be too late to sort it out if it felt valuable.

"OOP and Java may not be suitable for everyone. The important thing is to correctly assess your needs and decide whether Java can best meet these needs, or whether to use other programming systems (including the one you are currently using) is the most suitable. Good choice. If you know your needs will become very specific in the foreseeable future, and Java may not meet your specific restrictions, then you should consider other options. "
" Even if you still choose Java, at least you must understand There are also options to choose from, and a clear understanding of why this direction should be chosen "

Published 14 original articles · Likes0 · Visits 259

Guess you like

Origin blog.csdn.net/m0_46619073/article/details/105226027