Things I learned from IE9!(Still learning!)

What motivated me to write this post? Simple, huge amount of time I spent sitting in front of the PC and stare at screen and think “Why it isn’t working in IE9!“. And after lot of fiddling/wrestling with tags, I feel like “You kidding! Is this even fix? WTF!!!!!“. So, this is what made me do this.

So as I said, this post is all about Things I learned while making some site(s) work in IE9(Don’t ask me why IE9, it’s not like I love to, it is more like I had to. Duh!)

1. It isn’t just a browser. It is much more than that! I used to be so distracted, short-tempered and anger issues. But IE9 has made me a calm, zen like person. Yes, one minute you think you fixed everything. And once you add a tiny plugin in to your page, all hell break loose and you need to think like a child to fix it. Yes, remove from here, add here, remove this and add that! Oof! It’s working. But you must put an Note in your code to warn other devs not to add a plugin or anything of sort, else you are again going into medication.

2. It is strict. I mean real strict! More than your mom or your girlfriend. In fact, much stricter than strictest of the girlfriend! You make slightest of mistake in JS, other browsers just ignore it like your best friend, but not IE9! You missed a dot here, you missed something here. No excuses. If it had to be done, it has to be. It teaches you how to follow protocols and follow industry standards!

3. It is more of 90s kid, who yell at new kids on how they are ruined with the gadgets. In fact the founder of the gadgets(Ajax! Remember?) is none other than very own IE9! It sometimes struggles to understand what you are trying to send over Ajax! Are you trying to send a object with number, you convert it as string before sending it! When I see this, all I can imagine is, they forget to keep the Ajax documentation, so after a while, someone else wrote the documentation, which is not exactly what it is supposed to be. Weird! It teaches you to back up your documentation before you release your product.

4. It isn’t very fond of CSS. Oh! You meant rough edge, let’s give you nice clean edge! While other guys merrily decipher newer plugins, IE9, who is not much educated struggled to do things like their Yale/Harvard(I know, don’t ask!) competitors! So you have to tell exact steps and some time, you have to feed it in mouth so that it’ll understand! Which teaches us to always write your own, handmade CSS exclusively for IE9, and test them. If not, then don’t get shocked when your site got scrmbled in IE9 when you give demo to the client. Which taught me the valuable lesson of keeping seperate files for the task, even if it’s not the norm.

5. Even the most experienced can look like jack-ass while debugging in IE9. Because most of the time, debugging sucks and gives inappropriate messages like a most shitty stalker send filthy messages to a girl. Or the best, most of the time, it just hangs or won’t work! Which gives us the valuable lesson of always be content and polite, even if you are experienced. Because one bug in IE9, you are his bitch!

And a lot more are there, but seriously I don’t wanna give all the spoilers and rob the fun for you. Enjoy your time with IE9.

ie9-internet

Is AngularJS(1.x) ready for Enterprise Application Development?

Before I start, I know that we have tons and tons of posts on this topic, but this was based purely on my experience.

It all started with our new project kick start phase, where AngularJS was suggested out of blue to speed up the development due to the tight deadlines. I’m a J2EE guy, and I’m a not a big fan of JS Framework, but ever since words like Backbone.js, Node.js got around the web, it always fascinated me. Whenever a new one comes in the market, I will be start exploring the tech and get excited for couple of months, before the mainstream development get me involved! But this move, looked like I finally get a chance to use cutting edge, buzz word technology in a project at my workplace. Yay! This should be fun.

So the first few weeks has been excited, and I’m very eager to get the prototype up and running to showcase the team, that AngularJS is the right candidate for this project. The base code which we created for the project was so smooth, we felt that we can REALLY speed up the development, because it was so easy, where we spend 100s of lines of code, AngularJS did it in much fewer and simple way! But that excitement didn’t stay long with me.

Before I get any further, this is not another AngularJS Bashing post, but rather a post to clear the mythical air that surround the front-end JS MVC framework. Let me get into the topic.

  1. Documentation : Most part of the development time was spent trying to understand how certain things worked. Because when I try to find them in official documentation, it isn’t there. For a guy like me, who read official documentation for all my doubts in a framework, this was a big blow. The documentation to getting started with was good, but once you are past that honeymoon period, it will be a tough time to find and understand certain aspects. I strongly feel official documentation should be the main place to dig anything and find solution, or learn a framework. Not in some forums. Infact, SFO helped me a lot with AngularJS than the official documentation!
  2. Learning Curve : One funny thing I noticed about AngularJS was, as much easier as it is to learn the basic, it will get tougher when you get going. I’ve done some learning curve graph for easy understanding.ang-learn-curveIt was exactly what happened. Initial excitement levels gave confidence that we can achieve anything but as we are into middle of the project, things get tough and it becomes a swirl-wind about to destroy the city! But after a lot of digging, it get’s down but after certain point of time, it feels like a landmine hidden somewhere safe, but we don’t know where it is. It is mainly attributed to my first point about Documentation. If it was any easier, it could have saved us a lot of time!
  3. Performance : Hey, I am not complaining, but it isn’t what we believed. Since it is an JS framework, things get uglier if we can’t look under the hood(code!). It’s a like a kid left unnoticed with dangerous toys! Hello world can be snappy but when the code base gets big, headache gets bigger! Of course, it is a developer’s responsibility to make sure to tune up the performance, but kind of added more work for us. As a J2EE guy, we were more into server side tweaking and even after bringing skinny data to client side, it took ages to render them! Why, because bloody watchers infested all over the page. Then it hit us, that now we are not only going to tweak server, but the front end tools too! It took us a while to figure out, but in the end we figured out stuff and moved on.
  4. Browser Rendering Engine : Before this, all we cared about was not how our app will perform in different browsers, because all the stuff will happen at back-end. But now, we need to be cautious about this. It adds one more layer of work. In fact, plain Vanilla AngularJS performed just fine, but with all added plugins and modules, it is pretty tough to make it work across all browsers. It is mainly attributed to the fact that we are newbie at JS framework, but still we never thought of this, because we never had this issue before. Although this might sound silly for many, but when it comes to Enterprise Development, things aren’t as glamorous as it’s with other industry. Client browser restrictions, extreme pressure, unnatural deadlines were just a recipe for stress, and this will put more pressure to already squeezed developers!

Conclusion :

All the points I’ve mentioned are just a few to go with, but in the end, instead of speeding up the development, it did slowed us done after the initial surge. Th main reasons were

  1. Lack of proper R&D. If it’s new and shiny, just pick it up mentality was the big mistake. It would’ve saved us hell a lot of time.
  2. Poor documentation should’ve have been taken into consideration.
  3. People’s general belief. If it’s front-end JS framework, work should be done fast. This is what made some guys go with this new techs, but in the end, without proper understanding about the underlying technology, it is quite opposite.

And there are lot more to say, but I feel you get what I am about to say. If you want to use something, take your sweet time to understand the in and out of the framework before you start churning 100s of lines of code. And if you are seriously tight on deadline, please don’t go with this new shiny thing. Because it can backfire you, if you don’t have the skill and the person.

Finally, after looking at AngularJS 2.0, I am quite confident that it can solve a lot of issues of v1 and the documentation looks a lot better. It sounds quite exciting(see, again I fell for this!) and I hope it will help a lot in enterprise application development.

Thanks for reading!

 

What is Grails. Why should a Spring developer use it?

When I first heard about Grails, I thought Rails finally visit Java. I like Groovy, as it is quite easy for me to pick up and an framework based on it will be fun. That’s what I thought. Does things look good? Will it worth your time to shift? Let’s see.

I never really had a chance to use Grails up until last year, for my pet project. Which I longingly desired to change it from very old Spring version to something new. It was done around 2008, without any annotations.

First thing you easily notice is, when you start with Grails, you get excited. Yes, configuration is none. Which as a Spring developer, I find a good one. Next, scaffolding. I had few CRUD part which I don’t need to do with Grails, which is again good thing, All I have to do is, create domain class, create controller, map them and slap them. Bam! CRUD page is ready! And gsp is sight for sore eyes, if you have only worked with JSP till today(which I heavily doubt apart from people who always stay in maintenance work). As I stopped working in JSP long ago, gsp never impressed me. But still much better than JSP, and it looks much similar to some template engines available for Node.js. And most important thing is, it sure reduced lot of boilerplate code. Even if I don’t use scaffolding, LoC is greatly reduced compared to Spring counterpart. That is something to be considered.

After initial phase of Wow, and Oooh is over, you have to face the fact. I wanted to use JPA as I wanna give it a try and see if it really get along with Grails,. Boy, it wasn’t as easy as I thought it would be. I had to do a lot of hoopla and dropped the idea, as it was taking much more time than I expected. Not worth the time, as it is for my pet project. GORM is decent enough, well, at least for me.

Now, for worst part, speed is awful. I know, but for dev, productivity is important and every time I make changes in Java, it hot-reloads and at same time, system started slowing down. At certain point, it feels like slideshow. So I had to kill few processes to get it back to life.

Plugins : Yes, there are plugins. Lots of plugins!! You want to do X, chances are you already have X plugin. Certain things were made real easy, which makes me cry in joy! But by looking at source/issues you can see, even most popular one’s are discarded by it’s author. Yeah, it is open source and we can do whatever we want, but honestly, that’s not something we want. As much as I love to work in OSS, making it work for our requirement is again an development hurdle in my opinion.

So, what the hell am I thinking? If it matters for you, I pretty much like Grails, and as a Spring developer, it is quite an interesting journey. But do I consider using it in my existing project? I don’t know. It is not worth it. May be if something new and small comes in my way, I might give it a try. Next time, I use it for some real small project and blog here, on how it went?

Python Web Framworks – From Spring Developers POV

I have started learning Python a while ago and so far used it in scripting in server side tasks. It was quite powerful, easy and fast for small tasks. And that’s all I know of Python. Then a year ago, I read few articles about how big names started using Python and that’s when I come to know of Django, Flask etc. I always wanted to use Python for my web applications, but since my company doesn’t allow it, I decided to give it a try.(Everything was tested in my local machine. Not hosted solutions.)

For those who don’t know, all my experiences so far is with Struts/Spring/EJB/CI(PHP)/Grails and trying out something like Python was breath of fresh air for me. I felt like WTF!! I know Python is expressive and all, but with Web, I never expected it to be this easy! I can write and run an web app under a minute!!(Of course, Hello World! What else do you think). So I thought I can use it for my pet project which I did in Spring. The project was mostly CRUD with some recursive functions to calculate some financial and sales data. It took me close to ~30 hrs to finish it with Spring 4+MySQL(Lack of Scaffolding is obvious here).

Main Idea was to try Python Web FW and do it as quick as I can. Tried Django, loved it’s “Batteries Included” approach. Setting up was quite easy, to my surprise. Got CRUD part up and running after lot of fiddling and what-not in under 4 hours.(Main culprit was finding MySQL driver and connecting it with ORM). Then started customizing to add my recursive functions and since logic is already written, all I had to do was re-write it. Code base reduced to less than half, and speed was good too.

So, after 10 hours, I was ready with my application up and running with my existing DB and I re-used HTMLs which was tedious, because I heavily relied on jQuery and now with django, I wanted to use templating for the sake of learning, which took me most of my time. I was pretty happy, that I can able to develop such simple projects in such short amount of time. Added few additional modules in the application for sake of testing features and it was good.

Here is my view on Python Frameworks : Awesome! Why? It’s ease of use, expressive and productivity. From now on, all my freelancing and pet projects will be in Python.Why? Those works are small-medium scale and as only developer, I find managing Python code base to be easy. No tedious configuration, LoC is heavily reduced, no boilerplate coding and all regular python advantages. I never thought pet projects can be so much fun. I am not saying Spring is boring, but to certain level yes.

Does it mean, I hate Spring? No, not at all. Both have it’s own usage and excels at different scenario. If I have a chance to sneak python into my [past] organization, I can use it for all cumbersome Spring modules into Python, and get best out of both worlds. But I know that is a long shot and for now,I try to use them for my pet projects to know more about it.

Grocery CRUD – A Life saver!

I was developing an back-office application for an manufacturing company. It started off as a small project, which is why I didn’t used any framework. But changes after changes, it turned into this huge monster, which has plain-old PHP codes which is not easy to maintain. So we planned to use a framework to reduce the development overhead we have. Picked CodeIgniter due to it’s very less learning curve and it turned out to be good. But what comes next, was not planned. When we started analyzing our old code base, all we had was CRUD!!! 80% CRUD pages, 20% Other functions. I was shocked because I know, it is painful to do CRUD and we have over 40+ tables! All I knew was, I was f’ed.

But still things has to move on, so slowly started migrating from plain old PHP to CodeIgniter, although CI is exceptionally well, doing CRUD in any language is painful. It was repetetive, boring and monotonous. After 2 months of work(and I still didn’t figure out scaffolding because it was a freelancing project), we hardly crossed 30% of project, and we planned to do whole migration in 4 months. It was far cry. I knew that even if I push myself to extreme, I couldn’t finish it. I was browsing myself, thinking if there is an scaffolding tool for CI, it will be great.(I know Yii is an option, but again, that has high learning curve and a new framework. So searching for a plugin is good option)
And then got a lot, but groceryCRUD caught my attention due to its sheer ease of use, and almost no-learning-curve.

After minutes of excitement, decided to give it a try. Started with couple of tables and bam! It was done. What I did in 2 days, G-CRUD did it in few minutes! I decided to go with G-CRUD and whatever 30% of CRUD work I did in 2 months, it did within in a couple of days(Design wasn’t our 1st priority). Yes, for simple Back-Office / Admin application, this is perfect fit. You get power CI on one hand, and scaffolding ability on other hand with G-CRUD. If it wasn’t for G-CRUD,I will still be doing the project with hours and hours of frustration and anger.

I love Grocery CRUD, for it’s simplicity it brings! Ease of use, how it manages relationship between tables and UI, is simply awesome. “Yii” is awesome but it wasn’t easy to setup and start working with, unlike CodeIgniter and going for a new framework is again big PITA. G-CRUD saved my day and I intend to use it for all small-medium BO/Admin projects! G-CRUD make scaffolding nice and easy.

What Grails(Groovy on Rails) did to my PC?

You might have seen Tesla S reaching 0-100 in 3.2 secs, but with Grails under the hood, my PC can go from 0-100 in few milliseconds. Yes, it is that fast! Only difference is, with Tesla S doing that, you will be like WTF!!! This is amazing and with Grails, it will be like WTF!!! This is bullshit.

Yes, my PC has been serving me well for past 5 years and even though it is C2D, 4GB with HD4850 under the hood, it helped me play GTA 4, FC3 and many other modern games and I am pretty happy with it. Felt my PC was laggy once every 3 months, but then again it was my fault as I always overload system with lot of applications loaded. Even with Crysis 3, I never felt my PC is aging. But Grails changed my perspective.

Started my PC, and bootup time is always close to 1 minute as I don’t have any big clog-y startup programs. Then I opened command line and typed >grails create-app sample.System seems like slideshow for a cuple of minute, then fine.

Finish up all work, then type >grails run-app, Bam!! CPU Usage is 100% till it compiles and build the project. I hardly see this happening, and even the resource hungry GTA 4 did good in my PC, but Grails, simply put the PC to shame! I guess it is time to upgrade my PC. Finally want to say one word to Grails Developers, WHY!!!!!!

Why hate Java/C/Python/$language_name

For a long time, It’s been a lazy trend to yell at Java or C or Python or what ever languages. But lately it’s becoming mainstream. Of course comments in those post’s made my day, but deep down I always wonder why people do that. It’s like they compare onion with f’ing banana. They both meant for different purpose. Eating an onion and saying it is not sweet is totally retarded. And same applies when someone compare Language A v B.

We are programmers. We do programs. No matter whatever language it is. If you look at big names technology stack you may understand this. They try to use proper tools for jobs and as long as it is working fine it is all it matters. Instead of sitting at your desk and wimp like kid, and telling some you hate X so you wouldn’t code sounds real bad. And what’s worse than that is, blogging about it. Apart from those funny comments at those posts, those articles never had any purpose in my view.

Why hate X? If you don’t know the true potential of X, where to use and how to use, it’s your mistake.Not X’s. Some idiot did some unoptimized pathetic excuse of code and made a mess out of it and it is not the language’s mistake. Instead of bitching about it, start analyze and fix the problem. Not make fun or yell at X.

After looking at guys who implement plethora of technology in their stack, I started following their footpath and it worked well so far. I love Java, but never hesitated to learn something new. As a result of this, now I know a handful of languages which I use together depends on situation to get the best result.

I can hear you all saying “What the hell he is trying to say? “. Well, all I am saying is, try to learn as many as possible, implement them based on needs and stop complaining about an onion not being like an banana.