These days the project uses the IBATIS specification SQL statement so that all SQL statements are entered manually. Especially when you encounter a table that has more than 30 fields, updates, insert statements that are simply annoying. It feels like programmers are really yards, or bricks, And no one else has a high salary. But recall that this kind of mechanical input can be avoided, and then I went to think about writing some tool classes, directly generated Ibatis entity class and XML mapping file, this generation process took only a minute. Just blame yourself for being stupid and then have a little insight
1, as a good programmer must be proficient in using a variety of tools to assist the development, or directly write their own needs of the tool class, so as to avoid a variety of repetitive mechanical labor, can not become "yards of farmers"
2, must be inherited and encapsulated this two Java concept deep imprinted in their own mind, the development process, can not be drawn up a variety of common methods encapsulated for their own multiple calls, such as a lot of people just getting started, the program needs to use session to obtain data, and then each method to get a session, Does this time feel very inconvenient, you just need to write a common method, then need to use the method of the session you will inherit (extends) your common method is OK,
protected HttpServletRequest req; Request Scope
protected HttpSession ses; Session scope
Protected HttpServletResponse res;//Response response
public void Setservletrequest (HttpServletRequest req) {
This.req=req;
This.ses=req.getsession ();
}
public void Setservletresponse (HttpServletResponse res) {
This.res=res;
}
For example, other methods inherit this method. This is not a great degree of simplification of the development!
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Java Sentiment inheritance and encapsulation (do not do yard farming)