Skip to main content

Posts

Showing posts from May, 2011

Why we need BO(Business Logic Object) in the system design

When working with current system, the previous developers just use the Struts2 Action to deal with all the logical things in the system. Then, it becomes a problem. It introduce huge duplicated codes which made me just like a robot to fix one issue 3 or 4 times. One solution could be move those kind of common methods to the super action, which is just a bit bad smell :) This is why we need BO(Business Logic Object) in the system architecture design phase

Busy 1st week in Bayleaf

Fixed a bunch of bugs this week. Moved many duplicated codes to the super Strtus2 actionsupport class to simplify the codes. The new Jira is great, I can just drag the tasks to different process. And you can know what you(or other people) are doing now easily.

First day at Bayleaf

Yesterday was great. I met with other co-workers and fixed two issues. It was so nice to have discussion with the co-workers and I got improved with my knowledge of the database design and the usage of mysql Workbench. I see some very nice words from Daniel in Today's Vancouver Metro "We treated every game in the regular season as a playoff game. That's how you get ready for playoffs. We were up a lot of games during the regular season, so we got a lot of practice at that" -  Canucks forward Daniel Sedin It is helpful for me also. Cheers for the new day.

Time to say good bye

(Hockey) San Jose Sharks won Detroit Red Wings in Game 7 last night. Then   Vancouver  Canucks will face Sharks  this Sunday in Game 1 of the western conference final.  Go Canucks Go. I had very good time to work together with other Tantalusers in the last 6 moths. It is time to say good bye to all of my friends in Tantalus. I got improvement in my English and technologies when I was in Tantalus. Siu-Ki helped me a lot on Oracle PL/Sql. And David showed the way to deal with issues carefully. Each time I talked with Yanik at the new Java Technologies, he can always provide me some surprise and guide me to the correct direction.   Discuss technologies with Ben is always such a good time, I also learned a lot from him. Marc S. is a Scrum master, It's always enjoyable to discuss with him about applying scrum in the team. Thanks to boss Marc, I am more familiar with Jasper Report now and no fearing of any requirement for the jasper report, which is really a great product! Thanks to

Java Web Application Error Handling solution

1. Create a filter to monitor the request and response. public class ErrorHandlerFilter implements Filter { public void init(FilterConfig arg0) throws ServletException {     }     public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {         ErrorAwareResponseWrapper wrapper = new ErrorAwareResponseWrapper((HttpServletResponse) servletResponse);         filterChain.doFilter(servletRequest, wrapper);            }     public void destroy() {     } 2. A ResponseWrapper to check the error codes if applicable, public class ErrorAwareResponseWrapper extends HttpServletResponseWrapper{     public ErrorAwareResponseWrapper(HttpServletResponse httpServletResponse) {         super(httpServletResponse);     } @Override public void sendError(int errorCode, String msg) throws IOException { // TODO Auto-generated method stub  if (errorCode == HttpServletResponse.SC_NOT_F

The Magic of Using Hibernate

The new project(actually just new for me, this project has been there for 1.5 years) has many duplicated codes. And the client, may ask for adding or reducing functions or fields or other database schema change requirement, which could a a nightmare if it applies to the my project in 2002. With Hibernate, it will map the database table to the object. Because I didn't operate the database directly, the application is loss coupling with the database. Adding and reducing table field never becomes so easy and safe. It is just amazing!

Why Can't Developers Estimate Time?

by  Ashley Moran A few interesting points came up on a mailing list thread I was involved in. Here are a few of them. The original comments are presented as sub-headers / quoted blocks, with my response below. This isn't a thorough look at the issues involved, but what I thought were relevant responses. Note: I've done some editing to improve the flow and to clarify a few things. Why can't developers estimate time? We can't estimate the time for any individual task in software development because the nature of the work is creating new knowledge. The goal of software development is to automate processes. Once a process is automated, it can be run repeatedly, and in most cases, in a predictable time. Source code is like a manufacturing blueprint, the computer is like a manufacturing plant, the inputs (data) are like raw materials, and the outputs (data) are like finished goods. To use another analogy, the reason Starbucks makes drinks so quickly and repeatably is

Struts2 - Working with Struts2 Action

First up, actions do the core work for  each request. They contain the business logic, hold the data and then select the result that should render the result page. Struts2 is an action-oriented Framework and actions are at its heart. What does an action do? Actions do three things. First, as you probably understand by now, an action's most important role, from the perspective of the framework's architecutre, is encapsulating the actual work to be done for a given request. The second  major role is to serve as a data carrier in the framework's automatic transfer of data from the request to the view. Finally, the action must assist the framework in determining which result should render the view that will be returned in the request response. Whether you declare your action components with XML or Java annotations, when the framework creates your application's architecture, it'll organize your actions and other components into logical containers called packages.

Struts2 - How Struts2 works

The struts2 provides a cleaner implementation of MVC. These clean lines are only possible with the help of a few other key architectural components(ActionContext, Interceptors,  OGNL,  and ValueStack) that participate in processing every request. The ValueStack is a storage area for all application domain data that will be needed during the processing of a request. You could think of it as a piece of scratch paper where the framework does its work while solving the problems of request processing . Rather than passing the data around, Struts2  keeps it in a convenient, central location - ValueStack. OGNL is the tool that allows us to access the data we put in that central repository. More specifically, it is an expression language that allows you to reference and manipulate the data on the ValueStack. ValueStack and OGNL don't belong to any of the individual framework components. Both interceptors and results can use OGNL to target values on the ValueStack. IThe data in the Va

Spring - AOP Terms

• Aspect: a modularization of a concern that cuts across multiple classes.In Spring AOP, aspects are implemented using regular classes (the schema-based approach) or regular classes annotated with the @Aspect annotation (the @AspectJ style). • Join point: a point during the execution of a program, such as the execution of a method or the handling of an exception. In Spring AOP, a join point always represents a method execution. • Advice: action taken by an aspect at a particular join point. Different types of advice include "around," "before" and "after" advice. (Advice types are discussed below.) Many AOP frameworks, including Spring, model an advice as an interceptor, maintaining a chain of interceptors around the join point. • Pointcut: a predicate that matches join points. Advice is associated with a pointcut expression and runs at any join point matched by the pointcut (for example, the execution of a method with a certain name). The concept of join