Categories
Education Technology

Django Flowchart

Based on my current understanding of Django, this is how a user request is responded to.

Django Flowchart

  1. User requests a page
  2. Request reaches Request Middlewares, which could manipulate or answer the request
  3. The URLConffinds the related View using urls.py
  4. View Middlewares are called, which could manipulate or answer the request
  5. The view function is invoked
  6. The view could optionally access data through models
  7. All model-to-DB interactions are done via a manager
  8. Views could use a special context if needed
  9. The context is passed to the Template for rendering
  1. Template uses Filters and Tags to render the output
  2. Output is returned to the view
  3. HTTPResponse is sent to the Response Middlerwares
  4. Any of the response middlewares can enrich the response or return a completely new response
  5. The response is sent to the user’s browser.

Please leave a comment if I have got something wrong.

Categories
Education Technology

Week with python & Django

Spent the last week picking up Python and Django. Notes to self and anyone else who wants a quick start on Python/Django on Windows. Most Linux flavours already come with most tools needed for python development.

Requirements:

  • Installed ActivePython 2.6
  • Installed Komodo Edit
  • Installed Python Win32 Extensions (not sure why, but was recommended in some blog post and the project itself does not say much of what it does. Stuff like this gives me the heebie-jeebies.)
  • Installed Pinax, which in turn installed Django.
  • Installed PyQt4
  • Installed Eric4 (uninstalled after using it for 10 minutes)

Problems faced:

  • Pinax installation was a bit flawed, it could not install all dependencies. Worked around by manually installing (pip install else easy_install)
  • Windows 7 was not passing command line arguments to .py scripts. Had to hack registry and add %* to the end to make it work. See the Key and value below.

Registry screenshot

Getting started:

Python: Like everyone else, I followed and recommend ‘Dive Into Python’. But more importantly, this page of titbits is amazing extract from the book and quickly brings a Java dev up to speed. I should blog about ‘Python for Java developers’. Time spent 4 hrs.

Pinax: Stopped at the installation step. Will delve further after understanding Django better.

Django: Followed the tutorial, then the Django Book, and finally the Django Docs for a deep dive. Time spent 8 hrs.

Django is surely one on the best documented project and also very straight forward. It suits my style of writing code and I did not feel like giving up in few hours, like the experience I had with RoR. Will surely blog about Django more.

Categories
Education Technology

What they don’t teach you at Engineering school

This is an experimental post. If it doesn’t render correctly, leave a comment.

I was brainstorming on the skills a software developer does not learn at school, which are essential for work and some which are needed for career growth.

Below is an embedded mind map, followed by an embedded public wave. Please feel free to contribute to the wave. If you do not have a wave account, here is the static version.

You can pan / zoom / expand / collapse the map below to get a better understanding.

Categories
Education Technology

Boo gotchas for beginners

Unlike what I mentioned in my previous post, I ended up trying Boo first. I will delve on the reason in another post. The objective of this post is to document the problems I had getting used to Boo syntax. None of the problems were big, just some missing punctuations 🙂 And I did not face any issues with the significant space.

Empty array vs. Empty list

An empty list is

[]

and an empty map is

{}

And empty array is

(,)

as it would cause ambiguity with a function / closure.

Categories
Education Technology

The great runtime shootout

It is becoming more and more obvious that there are just two runtimes left to execute code, the Java Virtual Machine (JVM) and the Common Language Infrastructure (CLI). So, I decided to see how they stack up. Looks like both environments have something for everyone.

Here is a list of programming languages available on these runtimes.

JVM vs CLI

  1. Can run on CLI using IKVM.NET
  2. Can run on JVM using Mainsoft solution
  3. Not yet usable
  4. Can run on CLR, but is behind the JVM implementation

The main reason for the research was to identify a new language I should pick-up. I looked at Python and Ruby, but both have some sore thumbs that I just can’t stand. I really liked Boo and Groovy; they are similar to C#/Java in syntax and incorporate the good things from Python. Although I like Boo’s syntax and approach more than Groovy, Groovy has a more mature implementation and ecosystem. I will try to use Groovy for some hobby project and get a feel to things.

Categories
Education Technology

Rock SOLID software construction

SOLID - Software Developement is not a game of Janga
Software Developement is not a game of Janga

I spent last two weeks deep diving into code written by our contractors and writing some test against the same. This was a pleasant break from my regular duties of an architect. As an architect I am always trying to ensure the code follows pragmatic design principle and I really dig SOLID and TDD.

<aside>

S.O.L.I.D. (a.k.a. S.O.L.D.I.)

The charm of Uncle Bob is, he can give a concrete shape to abstract ideas. I have been following the principles laid out by SOLID for some time, but he makes them fit together and remove ambiguity.

So, what is SOLID principle?