Some of My Quora Answers/Posts

Table of contents

No heading

No headings in the article.

[June 12, 2016] What life lesson did you learn from your first job?

  • Here is what I learnt

    • More than money, find MEANING.

    • Be aggressive in finding the root cause of the problem.

    • If you don’t know how to solve the problem, atleast find out a quick dirty solution that would give you enough room to do some research for a long term solution.

    • Find passionate people and try to learn from them. Move with them. Have conversations with them frequently.

    • No cheatsheets. Your college time finished. Hence grow up and roll up your sleeves.


[April 2, 2016] Which web app framework should I learn that will help me in a long run, look good on my résumé, fetch me well paying job and has demand?

  • Thanks for the A2A.

    I would recommend any framework which is open-source, so that you can dig into internals and learn from it. Because end of the day implementations don't matter but concepts matter. For me it was Django. I used to be a JSP guy when I started my career. Moved into Python world because of a startup opportunity. Learnt a ton of internals of Django during my stint in that startup.

    But one thing to watch out for in the Python world is, you don't get too many examples of really good design patterns implemented while building web apps. Don't get me wrong! I have been using Python for building enterprise products since some time. I love it. I learnt about :

    • decorator pattern only when I saw Django's login_required decorator.

    • middlewares only when I bumped into Django's request processing steps.

    • Lazy Loading Views in Pyramid.

But if you were to ask me "What is the percentage of using good design patterns in your day-to-day python coding ?", I would say its 30%. Many would argue that its not because of the language in which you are coding. But I have a different experience. So choice of the framework/language matters. Java world is pretty mature regarding these implementations. (Mainly because its used by more enterprises than that of Python.) So long story short, the amount of deep learning you would get from a Java system would be more than from a Python system. But Python is quick to implement/prototype and iterate. Hence I would never ditch that. So my recommendation is try building a decent size web app in both languages/frameworks and you would see how they are worlds apart. And if a guy/girl can clearly articulate how one framework wins over the other, certainly (job) opportunities will come knocking your door. All the best :)


[March 17, 2016] I am currently in third year of Computer Science. What should I do to improve my resume and stand out from other coders and comp scientists?

  • Thanks for the A2A.

    Pick up your programming skills, just incase if you are not well-versed with all the basic stuff. HackerEarth and/or HackerRank should be your best friends. (The founders of those firms are even here on Quora.) Once you are done with the basics, as others said, start creating stuff. Could be a mobile app, Could be a website. But not one of your Library management systems project, or a website for your college. Everyone does that. Come up with something that differentiates you from the rest. Read a lot on technology blogs. Be a responsible person who would complete the task and not copy/buy it from others. All the best.


[November 15, 2015] What should I learn django or rails? Which of these has better career prospects in India for a fresher?

  • Anything should do. Most importantly try to understand the internals. Not cosmetic stuff. If somebody is going to ask you how does a typical request gets processed in Django/RoR, you should be able to confidently explain that. Thats the goal.

[October 28, 2015] Are there any good developers have bad memory and always forget what have learnt?

  • Lets not forget our Brain is one big muscle, just like other muscles. It needs enough exercise just like other muscles. If you dont exercise for say 1 year, will you be in the same shape like before ? Right! same is the case with our brains. They need workouts. And its absolutely OK to forget what we learnt every now and then. Because everytime there is a chance to solve it in a different way ;-) Ofcourse if you believe its waste of time, then I would say, touch it often.

[April 4, 2015] How can we efficiently use AngularJS?

  • Thanks for the A2A. I would start with understanding the concepts behind the real fanciness. Two way vs One way binding, Service vs Factory vs Provider, Events, Listeners, Directives etc.. Once we prepare a mental map of all these things, we can efficiently build any app. Infact building an app and using it to get better at understanding these concepts is also not a bad idea. There are a ton of articles on the web about performance optimizations etc... They would make sense only if you get the roots right!

[September 25, 2014] In layman's terms, what is the classic use case for RabbitMQ?

  • RabbitMQ forms like a glue between two components which are totally disconnected. Inotherwords it becomes a communication bridge between those components. Think of it like this, you want to trigger a change in one system when a event occurs in a totally different system. Thats where message queuing systems in general are employed. Real world example: When some one places an order in a checkout cart, immediately an message/event gets logged to check the inventory. The inventory system can be a totally different system. Different stack etc.. And this RabbitMQ broker receives such message and might triggers a worker(or consumer) in Inventory system.

[September 26, 2013] From HTML5 slides to Github pages


[August 17, 2013] Introducing Python to College Graduates

  • As part of an initiative by Free Software Movement of India and Python Software Society I had to visit B.N.M. Institute of Technology to introduce Python to the college graduates. It turned out to be a pretty good visit. Here is my experience.

    Many Students were really smart to pickup something on their own: When I was talking about function/method arguments some of them thought ahead and asked me how do you do the command line arguments.

    Confusion related to how to run Python on Windows:

    All the computers were loaded with Windows XP and had Python IDLE installed as their primary platform to learn Python: This created confused for many people to realize what is the real environment like. Meaning, as every python guy knows, there are two ways to execute python code. One through the Python shell(>>> thingy) and the other through running the modules through the Python executable. On linux there isn't any problem. Both the ways look similar. But on windows they are different. For the curious this is how it is:

    on Windows:

    Start Menu >> Python >> Python IDLE. That gives you a black command prompt with >>>

    But to run modules(python files) you have to take a different path. Start Menu >> Run >> cmd. That gives you a similar black command prompt with the C:\Documents... etc... Over here one needs to enter a full python.exe path to execute the file.

    C:\Documents and Settings\User\> C:\Python2.7\python.exe hello_world.py

    Thats trickier for a guy who is new to Python. At-least thats what I have witnessed first hand. I had hoped that all the computers had at-least ubuntu/linux. Which was not the case and strange!

    Amazed to see what Python can do: Here is what I have witnessed first hand from the students. (exaggerating a bit!)

    • reversed_string = string[::-1]. Are you kidding me ? One line to reverse a string ? I am loving Python

    • string is a sequence ? You got be crazy.

    • Indentation is a necessity ? Can I marry Python ? Is it legal ?

    • No Braces for functions/methods ? Can I marry Python twice ?

    • No pointers, No prefix, postfix assignment ?

    • I take it from granted everything in Python is damn intuitive. Its pretty rare I have to check the docs. Wait what ? help(object) gives you access to the documentation right in the Python shell ? I feel I conquered the world!

Treating "Programming" as a tool to find a Job:

Just after I was done with half the slides and when we were about to enter the computer lab(to practice), some of the students were asking....

  1. Sir, Is this really a programming language ? I see that its really flexible and stupidly obvious to the eye. Programming languages are not supposed to be like that in our experience.

  2. Sir, Learning Python gets you THE JOB ?

  3. Sir, I heard Python is used for writing small scripts alone and not suited for writing big, complex applications. Is that true ?

  4. I heard Python is used for building Games! But you are saying it has a versatile usage. How is that possible ?

I had to explain to them what is the role of a programming language in general for solving problems. That its just "one of the means to a end.", "there is no such thing as Mastering X where X could be any programming language", "you had to solve the problem first and then code" and a few other things....

I don't blame the students. It just shows how disconnected colleges are, from the industry. And how the colleges are not encouraging them to see something from OUTSIDE. Even in cities like Bangalore which is otherwise known as Silicon Valley of India.

No Network Access in Lab: As part of the lab sessions, I wanted them to solve simple problems to start with. One of the problems was Printing the ASCII values of a-z,A-Z. Without network access I am not sure how they would be able to find ord() or chr(). This is the norm in almost all typical colleges as far I know. No Network Access. (May be fearing the mis-use of it. But I am sure its not a such a complex problem to solve.)

College Staff and FSMK volunteers were very supportive: Right from coming up with plans to arrange sessions to altogether a 100 students batch in various halls, to making sure the speakers are comfortable in giving the Talk, they did a pretty good job. I saw that a few of the FSMK volunteers were also helping the students in their Lab sessions.

Learnt about FSMK here: This is the first time I heard specifically about how FSMK works. Although I guessed some things, but the initiatives FSMK takes, which I heard from one of their volunteers, were pretty great. Like meeting the Parliament people and discussing the online Freedom, privacy and few other related things. Their reach is pretty good and the kind of problems they are trying to solve are very good.

Learning to design HTML5 slides: This is the first time I designed my presentation in HTML5, so that its playable in any HTML5 supported browser(like Chrome for example). Its based on Google I/O 2013 slide deck template(io-2013-slides - HTML5 Slides for Google I/O 2013 - Google Project Hosting). I loved showing code in the presentation slides. This is the first time I got the code working with excellent syntax highlighting, indenting based on language the code belongs to INSIDE A SLIDE. You can check my slides here in this github repo : python_101. Open template.html in the browser and you are set. For any future presentations which involve code, I am not gonna go to some other tools.

End of the Day I got exhausted, but it brought back many nostalgic moments to me and I felt happy in making BNMIT students lives a bit better. I am sure they are gonna use Python for sure in their career, irrespective of the domain,job they are in. And appreciate Python as a language based on their passion to build things and Python helping them to achieve that, not BECAUSE THEIR JOB DEMANDS A LANGUAGE NAMED AFTER A SNAKE.


[May 31, 2011] Why does Django still not have support for multiple joins?

  • I have tried this myself by comparing Django ORM and SQLAlchemy and these are the results.

    Lets take Quora question page as an example. A typical Quora page will pull information like,

    1. Question Title

    2. Question Description

    3. Question Comments count

    4. All Answers descriptions

    5. All Answer comments

    6. Answer author names

    7. Assuming I have a hover action on the Author Link, which displays information like: Followers count, Mentions count, Reputation Score

So now if I want to fire a single query to render every required detail in that Question page, I can write a simple sql query like:

    select 
    question.title, 
    question.description,  
    --count(questioncomment.id) as question_comments_count, coalesce(questioncomment.id,0) as question_comments_count, answer.description, 
    answercomment.description, 
    auth_user.username as name,  
    --count(follower.user_id) as followers_count,  
    coalesce(follower.user_id,0) as followers_count,  
    reputation.points as rep_score 
    from question  
    left outer join questioncomment on question.id = questioncomment.question_id left outer join answer on answer.question_id = question.id  
    left outer join answercomment on answercomment.answer_id = answer.id  
    inner join auth_user on question.raised_by_id = auth_user.id  
    left outer join follower on follower.following_id = auth_user.id  
    left outer join mention on mention.user_id = auth_user.id  
    inner join reputation on reputation.user_id = auth_user.id  
    where question.id = 1 ;

Notice that, there are altogether 5 left outer joins and 2 inner joins and I have not used any GROUP BY(which I think is required). Certainly sql could be fixed/improved, but the point I want to make is that we can have a sql with a mix of joins.

You can always fire SQLAlchemy ORM query which is similar to the above sql, like:

    session.query(question.title, 
    question.description, 
    count(question_comment) as question_comments_count 
    answer.description, 
    answer_comment.description, 
    count(question_comment) as question_comments_count 
    author.name). 
    outerjoin(comment, question.id == question_comment.question_id). 
    outerjoin(answer, answer.question_id == question.id). 
    outerjoin(comment, answer_comment.answer_id == answer.id). 
    join(author , question.author.id == author.id).all()

The above ORM query almost mimics the actual sql syntax, but the point is ORM supports those functions like outerjoin, count etc... So it avoids maintaing a extra sql in my codebase.

But with Django ORM:

    sql_query = <the sql defined above> 
    required_question_information = Question.objects.raw(sql_query)

I feel that we are not "completely" using ORM here. The way we are using is, something similar to connection.execute(sql). No big difference IMHO. I didn't find a pure python/django equivalent of the above sqlalchemy query. Any thoughts ?


[August 24, 2010] As first time entrepreneurs, what part of the process are people often completely blind to?

  • I was completely blind to the Money part. I thought lets first focus on making Meaning and then making Money. The business did make meaning, but it failed in the money part.