Tag Archives: methods

Don’t lose the ability to be surprised


Any fair-experienced CSS developers know that, if we want to be sure that a parent-div truly contains a child-element, we should put “overflow:hidden” in the parent div.

I was told that, too.

Ok, that solved the problem. And we continue going without truly knowing the reason “WHY”?

“Don’t fix what ain’t break” – people say.

In fact, I’m type of people who don’t like to invest time into things that aren’t useful. So I accept that trick as it is. Until today.

I was surprised (or remember that I was surprised) – like the first time I heard the trick. It took no more than 10 minutes to find an answer… but the question is that WHY I didn’t ask that question any sooner. How can I let the “magic” slip without wondering???

I suddenly remember a lot of other things that I take for granted. When I first come to this field, everything is new and shiny. After a while, things get normal bit by bit. And gradually I forgot my ability to wonder.

I remember the time when I was assigned to do OAuth 2.0 for a Facebook application. Instead using a library, I “silly” re-wrote the whole authentication process by Servlet/ HttpRequest & Response. By now I’m nearly sure that there must be pre-built library to do that thing somewhere. Whatever, I don’t regret. The time I put in studying how OAuth 2.0 works let me confidently say that I fully understand it, and I can (and did) manually write authenticate process for both Twitter & FB… They are all HTTP requests, basically.

What’s the way of your choice: learn just enough to do things – or learn intensely to truly understand how things work?

P/s: I have some ideas about “Key Concepts” (to overflow:hidden, it’s Document flow). But this post’s long enough.

Finding key issues of the framework

Website System

1. How to learn a framework fast?

2. To learn a framework, you should grasp the “key” issues. But how to know what is a key issue?

Those two questions are pinned in my head somehow.

Not long ago, I’m investigating MVC model in Spring Framework 3.0. Most of the concept is fine, but I have problems doing the work with Spring 3 annotation config. It just seems all the book out there mention about Spring 2.x syntax, which is “xml configuration”. It’s easy to understand because that Spring 3 just appear and it will take a relative time to make a book available. So my habit about following book guides was discarded aside. I must try to find another source.

According the advice of my seniors, I go to the Spring document & find most of the thing is already here. Enough details, though a bit complex to a not-quite-familiar-with-java coder. I struggle with those concept a bit. But by comparing the document to several examples, finally I got some “working things”, which is great.

But here comes the most complicated part: integrating between frameworks. In one of my projects, I should use Spring combined with Freemarker. I investigate, and luckily enough, find this page which tell me how to use Freemarker macro to perform bindings (it’s not an easy luck).

But WTH, I can’t find a way to use the formCheckboxes! I found no working sample, and I’m not alone.

Dozens people out there can’t find a way to use that macro.

And the solution?

Well, I write my own macros.

It took me quite a time before I relize that simple solution, and curse how stupid I am. Since the end results of freemarker is HTML, who cares if it was rendered by supported macro or customed macro?

When you know what actually happens inside that big system, the answer seems to be natural.

Still remember 2 questions at the beginning of this post?

I must says the truth, that I don’t know the best answer. But I have something that seems to work:

The solution depends on the needs. If you just use the surface of the libraries API as the common “players”, some popular tutorials might be enough. Parsing XML maybe a good example for this issue. With the same reason, I think with beginner, Grails (instead of Spring) is a good start, cause it requires little work to make a full-fledge simple application.

If you want to create a customized & not-so-popular web application, it requires more tons of work. And a solid background is preferable.

Every tool has its cost


For such a fairly long time I haven’t written anything. Not because I don’t have anything to write, but it’s hard to pull complex things out of my head. But now it seems to be time for a warm-up :)

One of my senior, Mr An, has a favorite sayings: “Until you don’t depends on tools, you are not truly a developer.”

Truthfully, I don’t think I have fully understand what he means. A developer with more than 10 years in this industry may have a different view to a young one like me. But to some extent, it seems to be a good idea.

For a certain amount of time I have tackled Maven, Spring Framework, Java Serverpage, Freemarker… I end up spending most of the time trying to fix bugs, caused not only by the framework, but also by mis-configuring Eclipse & its plugins. To be honest, it’s annoying

Actually, Eclipse is such a good tool: nearly everything you think that a good IDE should have, it exists in this free solution: refactoring, navigation, source-control-supported, Maven-tools… Such many functions integrated in a single program. Pretty handy, isn’t it?

But here a problem arise: when you have too much utilities, it will be hard to have a meaningful organization. It make me frustrated when right-click in Eclipse and have a 20-items context menu pop up. Still, navigating through that menu isn’t as hard as understand why and how to use the Eclipse view, explorer, hot key, configuring it to auto-compiling… Those are also the things you need to know to speed the work up. As far as I know, there’s no simple coherent way to do all the tasks.

The same semaphore also applies to any of our developer tools, no matter if it’s an IDE, framework, libraries… or even, methods. In my view, the best tool is a tool with few familiar functions, so that we can easily master and get the best results with minimal efforts. But the fact is that, as long as people want to stuff their tools out to fit everyone needs, that goal is hard to meet.

You must master a tool before you can make it work for you, so there’s a hidden cost. Imagine, if a tool doesn’t allow you work 2 times faster, do you spend 2 weeks to master it, just for use in a 1-month project?

Let’s choose and use tools wisely.