Tuesday, November 22, 2011

Go Xcode yourself

Got a new Macbook Air 13". It's a neat machine, and osx feels great, even for a windows fan like me.
Office for mac is cool, Webstorm is working, and now I'm brushing my unix skills (Installing mysql and activating the built in php and apache), and setting up my work environment.
The good ol' x40 will remain in the family, and go to my older brother.

Another thing I got a mac for was to begin learning iOS development.
Xcode is the official iOS IDE, and after a little bit of fiddling, I still haven't decided whether I really hate Objective-c, or really misunderstand the language.

The principal is supposed to be simple - Drag and drop stuff to the view, write the outlets (Bad name), write some code and then connect them (By doing lots of ctrl+clicking).

But the Objective-c language is, well, quite weird. And the whole concept is a little more complicated than windows phone IDE, FLEX, or even Android.

I will update more about what I've learned once I do some real programming (Some web request and more elaborate controls stuff) rather than just connecting a slider and button to a label...

In the meantime, I'm really, really enjoying the Air's form factor and great performance. Only minor disadvantage - 13" screen with 1440x900 display = Really really small fonts in some web sites.

Thursday, November 10, 2011

From MVC to MVP to...


MVC used to be the buzzword for client development.
Implement the model, bind it to the controller and the view, or get a framework to do that for you, and there you have it - A fast client, connected to the server, great way to deliver your application.

Or is it?
I have never seen 'clean', by the book, MVC implementation. The controller and view logic gets mixed and messed up after a couple of iterations, binding makes manipulation of data formats hard, view business logic gets implemented in controller, controller code gets implemented in the view (Sometimes because of binding), and after a while the whole code gets impossible to understand and maintain.

So what do you do?
Find a simpler paradigm, which would work!
MVP says a simple thing:
- The model stays the same. Handle data and communicate with the server/ container/ host/ whatever.
- The presenter does all the work. Business Logic, View Logic, Validation, string formatting, whatever the user does NOT do interact with.
- The view handles GUI. There's no relation between the view and the model, the presenter takes care of that.

Now let's take this a bit further, and create inheritance based MVP component:
The View extents the presenter, which extends the model, et voila!

Now you have a simpler paradigm which could actually work and expend, you can rewrite or use different views (Different devices, for example) and have your factory create the client class according to the device...

As for frameworks - There are a lot of frameworks which would do the trick, though most of them do not use the inheritance paradigm. And anyway, I like to program my own frameworks, and use 3rd party frameworks to simplify specific infrastructural tasks (Like jax-rs for REST servlet implementation, or jQuery for DOM manipulation).

So next time you hear MVC/ MVP - try to see if the inheritance model suits you. You might be surprised how simple things could get...

Wednesday, November 9, 2011

Bye bye flash.

In July, I published a comparison between FLEX and HTML5, and a quick follow up a week later, stating that Adobe is going HTML5.
Well, it seems like Adobe finally realized, that there is no way to make the Flash VM run over a mobile platform without either killing the machine's performance, or draining its battery.
The FLEX platform isn't dead though - Adobe is making its Air platform run as a VM for native applications, both in Android and iOS (And, of course, desktops). But as far as the web goes - Flash goes where Microsoft's Silverlight platform goes - Into the history books.

http://www.wired.com/gadgetlab/2011/11/adobe-kills-mobile-flash/

Wednesday, November 2, 2011

Open source support pays off!

I know JetBrains for a while now.
At Time To Know, it's the tool of choice for our leading development group. (The other one is using Flash Builder).
My team uses Eclipse and Aptana for web development, but it is far from being a good HTML/ JS/ CSS development tool - Even Developer Studio is much better than Eclipse.
Luckily, JetBrains has an open source program, that gives you a one year free license of their products for your project. I've tested PHPStorm, and it's a really, really cool tool for PHP and web development. Got my license, and liked it so much, that we're getting it for my whole team now.
Only problem - you need a strong PC to run it, but on the other hand, most IDEs these days are.
I'll be testing zend studio soon as well.

So thanks JetBrains. Open source support pays off.

Another small update about simple gallery management: A fifth site is in the works, plus we're over 100 downloads so far, which is relatively nice (I don't promote that project too much...).

Sunday, September 25, 2011

Back from NYC... Chart talk.

I've just finished some work, requiring charts. After some research, I found that the only free 'complete' tool for html charts is the Google Charts API. A neat Javascript library, which enables you to create charts - Basically you create a data table structure, add some customization options, and the API generates the chart as SVG markup, and 'plants' it as an iframe inside the designated DOM element.
You can also hook some event handling, there are value tips, and lots of customization options.
Not to be confused with the Google Charts Image API, which is a little different:
The Chart Image API is generated via a GET/ POST URL request from Google servers, and is an image. It has more formatting options and better graphics, but is not interactive, and transfers your data via Google servers, something I am not too happy to do.

Though not everything is perfect with the Charts API, and there are few missing features (The ability to have 'zones' in a line graph, the ability to have more than one line in a combo chart etc.), it is good enough for most uses, and actually goes in line with the simpler look web applications are taking today.

So the next time you consider spending money on interactive charts, consider these tools. They will look better on your iPad, that I promise.

Tuesday, August 30, 2011

Of programming and expectations

We all have a lot to learn.
My first programming job was a 'lone' programmer in a group of testers, writing telephony test simulators.
The activity was successful, and after two years I found myself with two workers, making wonderful stuff happen, and changing the way my company works.
After trying, unsuccessfully, to be a beta program manager (Too early for a 25 year old kid...), I was given another programming job, this time under a guru.
The first two months were looking quite good. Re-brushed my c++ skills, got my confidence back, made some stuff happen.
Then came the evaluation talk.
And I got my ass handed over to me.
Seems that I wasn't quite that good, according to my boss. Messy, hard to control, over confident, lots of bugs etc.
I was quite angry after that conversation. Felt like kicking his ass. Luckily for me, I had the whole weekend to relax. And then I understood something. This was actually my first job programming. In the phase before that, I had no one to tutor me. I got great results, but I was the one setting the expectations, as there were none...
So instead of explaining how wonderful I actually am to my boss (Who obviously thinks a bit different), I need to give up my ego, and start learning from him. He was not the one they would fire if I'm not up to par with his expectations...
So I've asked him to accompany me in my next mission, step by step, and make sure I will not fail.
Break down my mission, set expectations and success criteria for each mission.
I know how to write code. I just need to align myself to his methods. And who knows, I might even learn something.
In that particular case, I've learned a whole lot. Both professionally and personally.
The past year I had to give up on a good programmer which chose the other way. After he got handed over to another group, he decided to quit, in the middle of a version.

There are many types of programmers. But the ones team leaders like the most, and are most likely to promote, are the effective ones: The ones who can make the biggest impact, not necessarily the most efficient ones, the hard working, or the more thorough ones. These are great qualities, but they are not enough.

I will elaborate more on how to be an effective programmer from both the manager and programmer perspective, in my next posts.

y.

Sunday, August 21, 2011

Tip: The JSP surgery

So, you've invested a whole lotta love and money in your java based web server.
And it's fine. Really.
But now it's time for an overhaul. The UI is dated, and you want to bring some fireworks back.
The problem - Your team has changed, it's been a while, and all your team has done so far were some bug fixes and some features. And the web layer is written in good ol' jsp - No one really knows how to rewrite it. Recently I've encountered a similar project - All the team left, the design was terrible, but I couldn't make changes to the back-end, only the jsp files.

What do you do?
My suggestion is to divide and conquer!

Here's a quick recipe on how to transform your server script code into a web service.

First off, see which data you need the server to really generate. Usually, it would be user details, a data table, plus some attributes.
After that, have your jsp code generate JSONs instead of html or javascript code.
This shouldn't be that hard.
Analyze all your code, and prepare new jsp files for each type of data needed. Use the current jsp function calls - There's no need to rewrite the java layer: All these files should do is write a JSON response. You can use Arrays.toString(), or a JSONArray, or you can generate the JSON explicitly from object attributes.


Then you can begin writing your client from scratch, and use these jsp as a web service. You may later write some Java servlets to replace them, or (Better off) use jax-rs to completely get rid of the jsp.
Step by step, you'll see your web application transform into something a lot more comfortable to use and maintain. A real web service, without rewriting your back-end. And when you do get the time to update your server, you'll be able to do it with only minor client modifications.

Have a good development week, and stay tuned for more!
y.