Jesse Krantzler


Attending Engineers in Residence at the University of Illinois

Jesse Krantzler // in Technology

Later this week, a few Vodorians, most of whom double as University of Illinois Alumni, will be heading back to the place that taught them (almost) everything they know. Vodori will be participating in Illinois' Engineers in Residence program on Sep 22nd and 23rd. The program is set up to allow established businesses and alumni to come back and talk to current students about their academic careers, and to answer any questions they may have about the transition from college life to the "real world" that is professional web development. 

Engineer in Residence at the University of Illinois

On Thursday, our team will give a talk and be available to answer questions, and on Friday, we will be hosting an office hours session from 10am to 3pm where any and all students will be able to interact with current Vodorians on a one-on-one basis. It should be a great time in Champaign, not only for the opportunity to visit Dos Reales again, but also for the chance to meet and interact with future Vodorians. We will be tweeting the event and answering questions with the hashtag #EIR2011, so make sure to follow us on Twitter (@Vodori) for the latest updates.


Share Article

Jesse Krantzler


MVC - Not Just Marvel vs Capcom

Jesse Krantzler // in Technology

One of the most important architecture patterns that we use here at Vodori is MVC, which stands for Model-View-Controller. In our case, we use Java to create this MVC architecture, and use the Spring framework specifically to enhance the process. The Model is the object or objects that hold the data for the application, the View controls the way the application will be seen and interacted with, in our case a JSP layer. Finally, the Controller handles interactions between the model and the view, including user input or business logic. The Controller layer contains the core of any business application’s logic and complexity.

Spring Controllers

The Spring framework makes implementing an MVC based application really easy. Using the @Controller annotation, we can designate a java class to be recognized by Spring as a controller, and using the @RequestMapping annotation, we can specify which requests the controller is supposed to intercept. Request mapping at Vodori is usually dependent on GET’s and POST’s, but there is also support for HEAD, PUT and TRACE, among others. Most requests are GET’s where the browser is simply trying to access a specified URL. In some situations, such as if a form is being submitted, the browser does a POST in order to send data to the controller along with the request. Adding the annotation:

@RequestMapping(value = "/testForm.htm", method = {RequestMethod.POST})

to a method in the controller provides a good example of a request mapping annotation that handles a form submission(we can tell by the “RequestMethod.POST”). It can validate the form, add attributes to the model, make functions calls, and determine the view to return.

By using the @ModelAttribute and the @RequestParam annotation, we can specify what specific data we want to explicitly pass into the controller for processing. For example,

public String registrationStep(HttpServletRequest request,
                               ModelMap model,
                               @RequestParam(value = "step", required = false)
                               String step,
                               @ModelAttribute("userProfileForm") UserProfileForm userProfileForm,
                               BindingResult result)
     //controller code


The @RequestParam allows us to send in a simple value that will be converted to the declared method argument type (String in this case) and assigned to a variable. The @ModelAttribute tag allows us to pass in a more complex object, which may consist of multiple request parameters. The model attribute can be specified with a variable name (“userProfileForm”) if there are multiple attributes, so that the method knows which instance to pull in. If the variable needs to be persisted throughout the session, the same variable will also need to be added as a session variable next to the @Controller annotation at the top of the controller class, e.g., @SessionAttributes({ "userProfileForm", "contactUsForm" }).

Controller/Service Layer Division

The next important thing to consider is the separation of controllers and services. Controllers are meant to handle specific user requests through their entire lifecycle from parsing the request through determining which view to return. We can separate out the common application functionality into services, which modify the model, write to databases, send emails, etc. This separation is not technically necessary, but it allows us to create code that can be reused or easily extended without much work. If we had to switch persistence frameworks and moved from Hibernate to OpenJPA using only the controller level, we would have to rewrite every controller and possibly add much more code, or duplicate code that we have already written. On the other hand, if we had all of our logic in the service layer, all we would need to do is update the logic there by modifying the method which interacts with the framework, meaning we can switch between frameworks with minimal, if any, changes to the controller.

By using a common application architecture such as MVC, we can be sure that if a new programmer or one of us Vodorians need to make an update in the future, we will be able to easily determine where to look for certain parts of code, without having to know anything about the code specifically.


Share Article