java feelings along the way
napoleonn http://www.jdon.com Oct 1, 2004 3:42 PM Reply
Confucius said: "Learning without thought is indiscriminately, thinking without learning is perilous." Projects from my experience, I sighed deeply trouble the ancients Di cavity?
Last year, I graduated from design time to do a graduation project is the design of management systems. At that time, the teacher asked to us is to achieve jsp and Javabean. I am primarily responsible for project modeling and Javabean part of the students was in charge of the database was not SARS storm back home, so part of the database for me to complete. At that time, the knowledge of java is very poor, only the basis of a simple syntax, even the jsp, javabean heard the first time. Do not know where to start, so the study of the teacher to demonstrate a very simple project, first of all think javabean is a relatively simple thing, then start on the analysis of user needs.
How to describe this demand? Due to the limitations of school education, together with their research for a long time high number of political, English (We all know that what you used), resulting in a serious lack of knowledge. I graduated from designers in order to participate as the center, the establishment of a list of their needs. However, the demand for such a description is very one-sided, almost all the needs of static, and difficult to design the interaction of several users, and some state of change. And this demand is really in line with the needs of a problem, so I immediately and students to design web interface, the purpose is very simple, because the user's needs are achieved through the interface of the interface design to cover the final submission of the user's function, and can discover a lot of non-users. This realization of these functions, I have a few time. In a year when I have read carefully the use case analysis, uml the impression that after the treasure. All the knot in my heart open.
Modeling how to build? At that time, what the concept really did not, although aware of uml, but just know that fur. I object very simple from the point of view, first of all to find graduate design management system involved, this is obviously to find out, involving students, teachers, administrators, and further projects to extract the object, all staff message communication object, Document Object graduation project, and so on. Then the design database tables, as the school when the database is only about the relationship between ER diagram to model the transformation, and there is no talk about the relationship between ODL mode conversion (now, ODL should be better understanding of O / R Mapping has more help.) painting was on the ER diagram, the creation of tables, set primary keys, foreign keys, and so on.
The first problem I encountered is that students, teachers, administrators how to do that every Object to build a table, it seems that there is no problem. However, when the object the establishment of the news there is a problem because the message is to students, teachers, administrators can send any of the two, I built the table when the news is the design: the contents of a message, message sender who the recipient of information (message content and sender of a table, in order to address the recipient of a single redundant table), so this news will have a great degree of flexibility, the message sender can be any between the three roles of a species, further, such information can be system-generated message and the recipient can be any kind of role. However, brought the question is: message sender, the receiver to go with reference to whom? Obviously filling a sender, the receiver's id is not enough, even the sender must also fill the role. The second method, each role has a list of messages received by it to refer to a single source table id, this can also solve the problem. The third method, the students, teachers, administrators into a user table, then the message sender, a receiver with just a simple reference to a generic user id of. The combined sub-type of approach will result in teachers, administrators and some null values of the line, but taking into account the number of teachers and administrators is far less than the number of students, so this kind of redundancy is negligible. Finally, I chose the latter method. But I still feel that the object model to the relational model of a compromise.
Then I started the design javabean, access the database using a simple JDBC. Interface on the front because I want to access an object attribute is not aware of what, in fact, not in the know. So I can only retrieve from the database the object of a complete and let him to decide whether to visit those properties. But the object is modified so that future amendments to the new object's properties, I came to more databases simultaneously. So my javabean there have been this way: load (), store (), update (), delete () this kind of objects and database tables synchronized methods. This year it seems today, in fact, do I have an O / R Mapping of the work. At that time, so do the O / R Mapping is a very painful thing, but the methodology used is also the most shallow, that is, the entire database objects more synchronized, even in the absence of modified attributes are synchronized, so if want to synchronize, it is necessary to first object from the out of the database, modify and then write back. And requires that all property must be a nullable type of non-primitive. Second question, on the table how the foreign key in response to the bean? For example, each student has a guidance teacher, in the database table it is clear students need a foreign key reference to teachers id, but the teacher StudentBean property object is written Teacher, or Teacher id value so, in accordance with object-oriented, it is clear that should Teacher object, but I think this is a matter of how heavy it! Re-think the situation of teachers, a teacher has a Collection of Student is how "heavy"! Load means that a teacher should load all of the students. So I used is: or use objects, such as student teacher attributes, or a collection Student object, at the same time provides a loadStudents () method, load teacher does not load object when students attribute, only the user explicit bean Call loadStudents () will be loaded when a group of student object, which now seems to be consciously or unconsciously, I realized the lazy loading?
Was now prepared to examine javabean, committed the biggest error is the largest data access object and business workflow mixed together. For example, all teachers have to call the function inside the object on the teachers, and some features are sometimes necessary to involve several of the bean. Now read the design is simply appalling, although the confusion was over, but it has no brain to solve, I now saw the idea of session bean, I feel are so comfortable and natural.
There was confusion on the jsp of the deal, jsp is responsible only for the show, but why a jsp data submitted jsp give another treatment? This is a very comfortable way, so have the initial idea of the controller servlet to do, but the study was not so much care and did not finally realize, after all, the future is not my responsibility. When I now know that the Structs, MVC Model2 the time, I have followed to solve the puzzles. It's very comfortable once again.
I am a novice more than the first item in some cases is a very isolated environment in which to do all the calling card dial-up Internet access, there is no access to mainstream technology, but this environment is the accumulation of the countless confused, I encountered by EJB, Hibernate, Structs Ganlu time, such as drinking, the rapid absorption of their nutrients. Otherwise, I would like to learn about these technologies is no doubt that the amount of time spent, because there is no more resonance this technology, they do not know what frame to engage so many want to do, and I have had a resonance, they frame, it is open I lock doubt in my heart.
Back to the beginning of the words of Confucius, in fact I am doing the project has been in accordance with their own way of thinking in the "thinking" and did not go to "learning", so often feel tired and no income, that is "almost." But if we do not actually own hands, and the optical light j2ee, will be very confusing, that is, "indiscriminately." I feel more confused first solution is to grasp the technology and the consolidation of a very effective way, and very creative, is a way of thinking into. So having problems, first of all, common sense of the need to think about how to solve, then how to find someone else to solve, so their will improve very rapidly.
Java skills and code Articles
- [Java] examples of the basic learning
- Study Notes
- Right java pop-up menu
- Java design patterns using UML to prepare examples of FactoryMethod Pattern
- Installation, upgrade, and uninstall the central part (java in preparation)
- To encapsulate the database operations Javabean
- JAVA dynamic compilation and static compilation
- java simple application of io
- Written in cipher with the Java classes
- The preparation of mine clearance with Java games - code for Thought
- Application of a simple timer: VarTimer (java)
- java feelings along the way
- java class in the use of Properties
- JAVA + ACCESS programming experience
- Getting Started javaRMI procedures and configuration
- On the development of JAVA VM
- How Java is rapidly becoming a master
Can't Find What You're Looking For?
Rating: Not yet rated