Sunday, December 17, 2017

Rails vs Padrino or others

Starting writing in Ruby after touching all other languages is like finding manna as the life saver. Talking about Ruby, the one web framework that comes to mind is Rails. I will not talk about Padrino or others until a while. Let me try to put the reasons on why you should use rails

1. Large community base - building or adding features and bug fixes continuously gives it capability to have the latest web technologies be it like front end technology like sass, bootstrap and all.

2. ‎Automatated generators - almost every MVC part generation is automated, be it creating controllers, adding or updating models, creating views with ERB (try haml too) adding tests, rake tasks and much more, all from the command line. I recommend using Linux ( Manjaro ) with rbenv to manage ruby environments and of course VIM editor with tmux for ide like multitasking. I prefer solarized light theme for them 😀

3. ‎Rails console - gives the easy shell to check your variables, url params, perform database CRUD operation methods, session values, "string".classname to get inherited classes or modules and all

4. Github and Heroku deploy - Using one branch for each task and merging them to master once done is the way to go. Lastly the deployment is as easy as single command 'git push heroku' which pushes the master branch to Heroku. Heroku generates an url for your application. Also it supports postgres for now, so watch out for it when starting to build your app.

That's it, this is what it should take for you to get going with your loved programming language on the best automated web framework.

Roughly you would be adding the routes in the config/routes file. It's controller will be an ApplicationController class in app/controllers/name with methods or actions like index, create, show, delete or similar. Finally the render for views is in app/views/name as .ERB file for each controller (class) created. These can be further broken down using partials using underscores like _footer.erb or _ header.erb . One can further use HAML instead of ERB for minimal writing. Of course you can use SASS or SCSS and coffee script for JS.

I recommend reading or referring Michael Hartl's Rails book, it's a pretty good book for a first time web developer. The recommend chapters are static pages ....

If you read till now, I am pretty sure you will stick to rails for a while. Now let me talk about its competition. One I think of is Padrino which is built on top of Sinatra mini web framework.

Sinatra doesn't have a routes but instead have their routes defined in the controller class itself. Padrino has a lot of work in progress parts but shows off the light weight benefits.

Padrino imports lot of rails generator concepts for creating controllers, tests, models, views and all. The blog tutorial on its site uses sequel which I didn't want to start learning as I just learnt Activerecord which uses such easy methods like User.find_by_name("Ragavendra") to retrieve say user records and say .save , . create and .delete to fulfill CRUD.

 I assume Activerecord was created by the Rails team. There are a tonne more libraries contributed by the rails team to the Ruby community as gems or even to its core. Rails is what more or less made Ruby popular. Lot other modern web frameworks have inherited Ruby gem concepts as well for easier web development.

Spree is an ecommerce built on top of rails. Hanami seems easier and imports a lot of rails like commands, it has a lot of nitty gritty which feels like working on HTML for some reason. I am pretty sure you will want to fall back to rails like me if you walk through all the other web frameworks. The best part is the sane eco system it has to offer.

The tests part is one which I wouldn't recommend and DHH thinks the same too, it takes to much time and stresses real bad. Better to have a separate team write integration tests than those painful TDD or unit tests.

Wednesday, July 12, 2017

Are you technically apt - Software developer

You don't have to be technically apt to be able to achieve business needs or requirements. Often in interviews people try to test your coding knowledge to the point of knowing the perfect syntax. What would happen if you actually made coding mistakes when coding on a machine, you would actually see some interpreter or compiler warnings or errors. Now can't you fix this code now. Do interviewers question this? Actually Google is just a click away to precisely help to fix issues if in case we did not understand how to fix it. Are interviewers thinking that you are a compiler or an interpreter 😀 . A knowledgeable coder is one who can pick the best method or approach for a problem rather than one who knows everything like a poem and is not good in knowing the best solution. I often find that interviewers are trying to find the later ones for their teams. Did you just read poem, yes that's correct. I was one of the worst in memorizing poems in my class and that's why I moved to  Science. I always think Science is learning based on understanding. So should the other IT people be too, if not I am afraid of its future. I am ready to take a bet on it. Having almost learnt so many programming languages I have to admit that most was possible because the boss gave me an opportunity to do it rather than question me before giving it. Yes I had some very good considerate bosses in my career. In turn I did what was expected and won accolades too like the best performer award in the government project. I always never want to work for anyone who can't praise your success or even understand it and so should anyone. Eventually people will judge you based on rumors and it has never worked in your favor.


Browser background color or monitor brightness

Have you been in a situation where you are almost sitting the whole day in front of your browser and going through a document and find that ...