Java Programming Ideas

Source: Internet
Author: User

Chapter 1th: Getting Started with objects

The ultimate goal of all programming languages is to provide an "abstract" approach. Between the machine model (in "scenario space") and the problem model that is actually solved (in the "Problem Space"), the programmer must establish a connection

Object:

    1. All things are objects. The object can be imagined as a new variable; it holds the data, but it can be required to manipulate itself. Theory

      Speaking, all conceptual components can be presented from the problem to be solved, and then expressed as an object in the program.

    2. A program is a combination of objects, and by message passing, each object knows what to do. To make a request to an object, "send a message" to that object. More specifically, the message can be imagined as a call request, which invokes a subroutine or function that belongs to the target object.
    3. Each object has its own storage space, which can accommodate other objects. Alternatively, a new object can be created by encapsulating the existing object. Therefore, although the concept of objects is very simple, but in the program can achieve arbitrary high degree of complexity.
    4. Each object has a type. Each object is a "instance" of a "class", according to the syntax. where "class" is a synonym for "type". The most important feature of a class is "what message can be sent to it?" "。
    5. All objects of the same class can receive the same message. This is actually a statement that has no meaning, and we will understand it soon. Because an object of type ' circle ' also belongs to an object of type shape, a circle can receive shape messages entirely. This means that the program code can command the "shape" uniformly, so that it automatically controls all objects that conform to the "shape" description, which naturally includes "circles." This feature, known as the "replaceable" object, is one of the most important concepts of OOP.

Object-oriented programming languages use the "class" keyword as the "type" keyword, and vice versa.

Java uses three explicit (explicit) keywords and an implicit (implied) keyword to set class boundaries:

public,private,protected and suggestive friendly. If no other keyword is explicitly specified, the default is the latter. The use and meaning of these keywords are fairly straightforward, and they determine who can use the following definitions.

    • "Public" means that any subsequent definition can be used by any person.
    • Private means that no one else can access the subsequent definition information except yourself, the creator of the type, and the internal function member of that type. Private has erected a wall between you and the client programmer. If someone tries to access a private member, they get a compile-time error.
    • "Friendly" (friendly) involves the concept of "wrapper" or "package"--the method that Java uses to build libraries. If something is "friendly", it means it can only be used within the scope of the package (so this level of access is sometimes called "wrapper access").
    • "Protected" (protected) is similar to "private", except that an inherited class can access a protected member, but not a private member. The question of succession will soon be addressed.

Back to shape : According to the basic class of modeling is a process inherited from the above, that is, "upcasting". where "cast" refers to the creation of a ready-made model, and "up" indicates that the direction of inheritance is from "above"-that is, the underlying class is at the top, and the derived class is expanded below. The interface that applies the parent class.

Bottom -up: Instances of the parent class apply the subclass's interface, resulting in the inability to

Dynamic binding: When sending a message to an object, if you do not know what the other person's specific type is, the action taken is also correct, which is called "polymorphism" (polymorphism). The method of realizing polymorphism is called "dynamic binding". In C + +, the keyword virtual implements dynamic binding.

A collection or array is used to implement: A new object holds a handle to another object (the name of the object encapsulates the object called a handle).

The method of embedding a handle into a collection: push.

Vector vectors: Only index operators or functions can be used.

Iterator: It belongs to an object that is responsible for selecting the elements within the collection and giving them to the user of the inheritors.

The use of vectors, lists, deque.

Vector

Represents a contiguous area of memory where each element is stored sequentially in this memory, and the random access to the vector is highly efficient, but the insertion and deletion of non-end elements is very inefficient.
Deque
Also represents a contiguous area of memory, but unlike a vector it supports the efficient insertion and deletion of elements in its header, implemented by a two-level array structure, one level represents the actual container, the second level points to the first and the end of the container
List

Represents a non-contiguous area of memory and is linked in two directions through a pair of pointers to the end-to-end elements, with high insertion efficiency and low random access efficiency

1. If you need efficient immediate access, without the efficiency of insert and delete, use vector
2, if you need a large number of insertions and deletions, and do not care about the immediate access, you should use the list
3, if you need to immediately access, and care about the end of data insertion and deletion, you should use Deque.

Client/server Computing

A key to client/server overview is that the information is "centrally stored".

The combination of elements, information warehouses, software used to deliver information, and the machine in which information and software are located are called " servers " (server).

Software residing on a remote machine that needs to communicate with the server, retrieve the information, handle it appropriately, and then display it on the remote machine, called " customer " (client)

It is generally possible to consider having a client load some of the processing tasks, but sometimes it can also be assigned to other machines where the server is located, which is also known as " middleware " (middleware is also used to improve system maintenance).

The basic HTML language provides a simple data collection mechanism: Text entry boxes, checkboxes, radio button, lists, and drop-down lists, among others, and a

button, the data in the form can only be reset by the program to be passed back to the server.

The server typically generates static Web pages for the client browser, which the browser simply interprets and displays.

"Common Gateway Interface" (CGI)

Plug-ins are actually a "backdoor" to the browser, allowing the creation of new client programming languages (although not all languages are implemented as plug-ins)

The purpose of scripting language is to be as simplified and fast as possible

An information network is confined to a specific company, so after applying web technology to it, it can be called "intranet" , which provides a greater level of security than the Internet, because it is physically possible to control the use of servers within the company.

Java Programming Ideas

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.