(staff) 2015-10-24 Week 6th log

Source: Internet
Author: User

Today I reviewed the spring, Hibernate,mina framework and the chat applet that made a multiplayer chat in the previous days.

Morning:
There's a comb for some of the frameworks that I've learned, and I've written some summaries: the key idea of
1.spring
Spring is its inversion of control and dependency injection (spring's AOP is not yet understood)
control inversion: Control is the control of the operation of the program, reversal is relative to the individual, meaning that the control of the program to the spring framework, not ourselves,
previously we do most of our own control, such as in C language programming, each object is our definition, we give him space, The final release,
is not really all of us, C language compiler has done a lot of work, but compared to the spring framework for programming, we have a lot of control of the program, do not have to do
a lot like in C language programming is done, such as creating an object, to release the like. All of this is actually done at the bottom of the program, except that spring has
a high-level package that masks these trivial repetitions and error-prone management processes. How do we give a pretty part of the program control over to spring? The answer is that
relies on XML files, in which we define beans (beans are reusable components under spring), beans have two basic properties, and name and class
name are the names of the beans. Class is the actual class name of the Bean, where the classes can be written by ourselves, or it can be a system, there is no excessive restrictions, as long as the
object can be generated, the bean contacted the specific class, spring through the beans in the XML can freely grasp the class in the Bean, To achieve control of the object, and we write the program
as long as the API under Spring can send a message to spring, such as let spring to generate some of our defined classes for the object, but the object of how to create, how to
recycle, we completely ignore.

2. Dependency Injection
Dependency Injection is a complement to control inversion, and sometimes the bean has to set properties when the class is created, such as creating a database connection with many attributes that can be set in the properties of the
Bean. or setting a reference (that is, referencing another bean), which is injected, injects some properties, does not know why it is dependent, and generates an object for the class
is to set the value of the property, what is the benefit? The advantage is that when you need to change the dependency just change the XML file, such as the dependency of the previous database, change the URL of the connection or
user, password and so on easily, and do not recompile, because the program is dynamically read the XML file to run the


2.hibernate
Hibernate key is to implement the database of the table and Java class correspondence, the implementation of the way through the XML file, the table fields and Java class Map,hibernate can be
Do the database operation, of course, to configure the database connection, and so on, because hibernate can take over your database. When the mapping relationship is defined,
Everything about the database can be given to hibernate, which is what we do with the database through Hibernate's API, without the need to manage the connection to the database.
and specific SQL statements that are safe and simple, such as saving a defined mapped object, as long as. Save is available, and there are a lot of other things to do.

Afternoon:
Started to do a multi-person online chat applet, the basic process is the client to the server to send chat information, the service sends the received information sent to all connected to their own
Client, implemented through Session.getservice.getmanagedservice.getvalue (why, not understand) so that other clients can see
In addition to their own other clients send information, similar to QQ group, feel that the server is a forwarder of information, you can also add some verification and other functions, where the server
Performance pressure is forwarded here, the number of forwarded messages is the amount of information received multiplied by the total number of clients connected to the server, should not have a client will and the server has a seesion
This part also has a lot of overhead, this part is how to deal with not know yet. This afternoon in the implementation of this small program, there are still some problems not resolved, the validation section.

(staff) 2015-10-24 Week 6th log

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.