José Mota — Web engineer & architect

Latest blog posts

1

Sacrilege: a rather lousy rant on Java for the web

February 10th, 2012

Let me start out saying I’m glad I never had to make web apps in Java. Boostrapping the crap out of a Maven + Struts archetype is insane. I honestly don’t know what to feel for Java programmers.

It’s been an hour and a half since I’ve started reading the Apache Struts 2 Web Application Development book and I’m going nuts. I’ve dealt with more XML in this hour and a half than most of the time in my degree.

Story told short:

  1. I’ve installed Netbeans and an Apache Tomcat 7 server.
  2. I’ve created a new Maven Web application.
  3. I’ve copied a struts routing example, along with the respective action POJO.
  4. Tried to reach the URL; no luck.
  5. Looked up for a web.xml example, in order to correctly load Struts.
  6. Project won’t deploy. FML.

At an hour and a half, reading and typing, I could have done so much more in Rails or Sinatra. Sorry.

I don’t care what people think about me comparing Java to Ruby at such an early stage in trying to learn. But hey, it’s 2012, software ought to be easier to accomplish. Why does it have to be so difficult to understand how a simple controller is executed? Why is the Java way so convoluted?

I’ll update this post when I can create a Struts action properly, perhaps with an interceptor. If I can make it to apply some TDD along the way, I pat myself in the back. Until then, I stay with the attitude.

1

A perspective on the state of education (of the Web)

December 26th, 2011

This is a challenge by Molly Holzschlag concerning how the Web is taught around here. Even though I tend to be opinionated, things have been happening that I consider important to a better future.

Learning the craft of the Web has always been hard. It has taken a lot of blog posts, trial and error, inspiration, books, etc. to slowly progress; all of this… after hours.

You must get things done at daytime. Innovation costs time that doesn’t exist. At least that’s what most companies believe around here in the last 5 years. Money is all leaders see, there’s not the time nor the money to delve into a better process or a better performance. Why bother if the pay is low and things are steady? This is a cultural issue and that might just be the hardest impediment that our people has to clear.

Read the rest of this entry »

0

Same class associations in Rails 3

December 9th, 2011

[TL;DR] Even though the selected events conceptually belong to a record, the latter has the foreign keys to former. So technically, has_one is to be changed to belongs_to.


This is the first time I’ve ran into something like this and it was interesting to realize what it actually means when developing a business logic in Rails.

Context

In this app I’m building, I have Students that have a Record per year. Each record has several Events. These records also have two specific events: a test and an audition, registered in the schema as id‘s in the record’s table.

So what did technically happen?

I wasn’t able to access those specific events through the associations specified in the model. Given r = Record.first, when I tried to access the audition, by using r.test, Rails would use a SQL query that would correspond to r.events.first instead.

After acknowledging that, I turned to @varandas and we both thought it might be a bug in the Rails framework. Turns out it wasn’t; all I had to do was switch from has_one to belongs_to (thanks @drogus!). The reason for that is the foreign key is on the records table. From the framework’s perspective, it looks like the record actually belongs to the event, when in practice it’s not.

Code sample

0

Piscean programming

November 12th, 2011

For those who don’t care about astrology, try to follow along; the principle is pretty practical.

TL;DR – Being bossed around compromises inovation, creativity and it destroys one’s true sense of purpose. Don’t let that destroy you.

Read the rest of this entry »

6

Going for JRuby

October 20th, 2011

The company I work for uses Java for all of its projects. Based on that, I have been considering looking into JRuby and giving it a try. Every piece of advice is greatly appreciated.

Read the rest of this entry »

Older Entries