Introduction to the object of "Java programming idea"

Source: Internet
Author: User
Tags export class

As an electronic professional, after learning nearly 3 years of embedded technology, decided to go to the mobile Internet, rapids in the Internet tide!

In order to learn OOP (object-oriented programming), in order to turn to the mobile Internet, I decided to start learning Android development, then start from Java!

Java has a lot of learning materials, after a few days of research, decided to start with the "Java Programming thought" book.

And before this book, I have finished watching a training instructor of Java4android's Java instructional video, looking very fast, because I learned C and C + +.

But my Java level is still very poor, mainly in the object-oriented programming and programming ideas have not been completely converted, say not more, start!

----------------------------------------------------------------------

1.1 Abstract Process

So language provides an abstract mechanism, such as assembly language is a slight abstraction of the underlying machine, C language is an abstraction of assembly language, but the main abstraction they do is to seek to solve the problem based on the structure of the computer, rather than based on the structure of the problem to be considered. So OOP allows you to describe the problem based on the problem, rather than describing the problem on the computer that is running the solution.

There are 5 basic features of pure object-oriented programming:

1) all things are objects;

2) programs are collections of objects that tell each other what they want to do by sending messages;

3) Each object has its own storage composed of other objects;

4) Each object has its type;

5) All objects of a particular type can receive the same message;

1.2 Each object has an interface

UML (Unified modelling Language, Unified Modeling Language)

1.3 Service for each object

Seeing an object as a service helps improve the cohesion of an object. High cohesion is one of the basic quality requirements of software design.

1.4 Concrete implementations that are hidden

Divide program developers into class creators and client programmers by role.

Hiding the implementation can reduce program bugs, so the first reason for access control is to make it impossible for client programmers to reach the parts they should not touch, which is actually a service for client programmers.

The second reason for controlling access is to allow the library designer to change how the inside of the class works without worrying about affecting the client programmer.

1.5 Multiplexing specific implementations

When creating a new class, you should consider the composition first, because it is simpler and more flexible.

1.6 Inheritance

There are two ways to make a base class with an exported class (parent and subclass):

One: Add a new method directly in the export Class (subclass).

Second: Change the base class (the parent Class) method, called the Replication (voerriding).

1.7 Interchangeable objects associated with polymorphism

The process of seeing an exported class (subclass) as its base class (the parent class) is called upward transformation (upcasting).

The reverse is the downward transition.

1.8 Single-Root inheritance structure

All classes have an Ultimate base class (the parent Class), and the name of the base class is object.

1.9 Containers

A parameterized type, which is a generic type. This piece seems more complicated, I haven't read too much ...

1.10 creation and lifetime of objects

1.11 Exception Handling

Try...catch...final

1.12 Concurrent Programming

In multithreaded programming, it should be noted that access to public resources should be locked during use.

1.13 Java and the Internet

Web

1) Customer, server computing technology

2) The web is a giant server

3) client-side programming

① Plug-in

② scripting language

③java

④ Alternate Method Java applet

⑤.net and C #

⑥internet and Intranet

4) server-side programming

Summarize:

At present, I am still in from the process-oriented language programming ideas to object-orientated programming ideas of the transformation process, grasp the existing resources, in layman's terms.

"==================end================="

  

  

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.