Developing Cross Platform Application using Qt, PyQt and PySide : Test Driven Development and Unit Testing - Part 3 of 5

Discipline, I say! - Mark Pilgrim in Dive Into Python 3

Discipline, I say! Smile - Mark Pilgrim in Dive Into Python 3

Throughout my articles in this site, this is the first article that started without a fancy image : I started it with a quote from Mark Pilgrim's book, Dive Into Python 3, Chapter 9 - Unit Testing. There are two things that drive the decision to include this quote:

  1. Although my bachelor's thesis was about Test Driven Development (TDD) in Extreme Programming using Java, in my professional career as a software developer, it's seldom that I really develop application using TDD in mind. Most of the time,  after the initial requirement gathering, I brutally jump to design the application GUI using current IDE being used. Not entirely a bad practice, as sometimes user really need to quickly presented with the application interface, even though  it's a dummy one. But if things are not that hectic, it's always a good idea to start with the test-first programming/TDD style, as follows:
    • Create unit test of application features about to be implemented,
    • Run it and see it fail (because the feature is not there yet!),
    • Implement the features to make the test pass,
    • Refactor it to have a cleaner code and repeat the process until all features were implemented.
    The beauty of this technique is that, the core of your application features will not get intertwined with the application GUI (imagine having a login that coded directly to the login button. What if we want the login method to be executed from behind a Web API?). A code that follow TDD best practices will be a highly isolated and independent code. Which is truly a great thing, because as the application GUI design undergo changes through out its development, the features were already safe and kept in isolation.
  2. A user in reddit, replied in my post about how to best teach kids in programming with an inspiring comment, "I think we started writing python when they were about 13. And we focused on writing code well - unit test harnesses, data validation, etc from the very beginning". Although I have this vague idea in mind, I never really come close to apply this principles in teaching kids how to code. Exploring unit testing technique in C++/Python will surely be an important skill in my passion of teaching kids how to code.

Before jumping to the topic on how to build the application GUI with Qt using Qt Designer and use the resultant *.ui file into a C++ or Python application, I would like to preface it with an important concept in software development methodology : Test Driven Development and Unit Testing using either C++ or Python. To streamlined the discussion, I have already summarized the principles of TDD in the above passage, and not about to dive any further (except by giving credit to Kent Beck who developed/rediscovered the technique). In the rest of the article we are about to have a practical hands-on in developing unit testing code using either C++ (or to be exact using QtTest) and Python.

Let's explore it!

 (More)



Developing Cross Platform Application using Qt, PyQt and PySide : First Iteration of The Overall Application Design and Hello World! - Part 2 of 5

First iteration application flow

Figure 1 - First iteration application flow

Special Note : I beg you pardon, that my subsequent Kivy article eventually must wait until after this Qt cross platform article being published. I found that, this Qt cross platform application to be somewhat challenging and interesting to discuss Smile

As the type of autodidact programmer who love to learn new programming language / framework / library by first thinking in global view of what my first application I would like to create, hereby I designed this tutorial with that principle in mind. The first application we are about to be build doesn't have to be a full blown application. But surely not a simple Hello World or an application whose its single purpose is to reflect the understanding of a one piece of this new things being learned. It should be complex enough to orchestrate many aspect of this new things, and by striving its completion, we will be in the right track of learning it fast. Surely we ought to start with the Hello World first, but while doing our Hello World application, we also have to have something rather complex application design in our mind. That's my two goals in this article : we are going to start with the overall application design and a guided Hello World application development for each of the technology : C++ Qt, PyQt and PySide.

 (More)



Developing Cross Platform Application using Qt, PyQt and PySide : Introduction - Part 1 of 5

The blend of Qt in Python

The blend of Qt in Python
(Image taken from PyQT Wikipedia article)

Before we even begin this new article series, I would like to emphasize one thing : I would love to make this blog as a great starting point for you to learn many tidbits in Python software development. For example, even though what we learn is somewhat an advance topic in Python application development, I will always start with the basic. This eventually create a vast array of article series : Flask, Django, ProgrammedMe, Kivy, etc. The reason is quite simple : if you are new to a Python topic, you can always refer to the first article in a series to be able to follow the rest of the articles. 

In this new article series, the target that I want to accomplished is to introduce you to the Python Android application development using either PySide or PyQt. Yes, previously you have been introduced to Kivy to develop Python application in Android. But, before going even further in Kivy, lets have a comparative experience on Python application development using another libray : PySide/PyQt. This come with a requirement : you must be introduced to and able to develop a PySide/PyQt application in its Desktop environment. Then, we move to its Android development.This is necessary, as differ with Kivy that directly support mobile application development in its first inception, Qt support in mobile development was gradually introduced.

Great. What are you waiting for? Lets go!

 (More)


Django KFIMember Tutorial Part IV - Using South to Manage Schema Migration

The future of Django Schema Migrations, but at the current release of 1.6.1, we still have to use South as Third Party Application

The future of Django Schema Migrations, but at the current release of 1.6.1, we still have to use South as a Third Party Application

To be honest, I believe this article will have a short life. Why? It's simply because migrations is a moving target in Django. As of Django 1.6.x, we still don't have migrations feature built-in. But the good news is, Andrew Godwin, the author of South, is currently working on Kickstarter funded project, to bring migrations feature into the core of Django itself. You can read about it usage here, but you must be aware that it's targeted for Django 1.7. As of now, we still have to use South as a third party Django application. And this is what I try to introduce in this articl.

 (More)



Django KFIMember Tutorial Part III - Configure Inital PostgreSQL Database Locally and Remotely in Openshift

Configuring PostgreSQL on Openshift

Configuring PostgreSQL on Openshift

ARTICLE UPDATE : As I have unresolved problem when using Python 3.3 combined with Django 1.6 and PostgrerSQL 9.2 in Openshift, I dropped Python 3.3 requirement and rework this application using Python 2.7 instead.

In Part II of this article we have already have an initial working application using Django and also import it into PTVS project. That's a good start. But the application still lack a fundamental requirement for any web database application : database support. In this article we are going to configure the initial Django database and improve it even further by using database migration feature using South. One important note about this article though, it first focused itself for Windows user.  Afterward, we are going to have a look on how it's done for *nix user, especially Ubuntu.

 (More)



ProgrammedMe : Python Teaching Aid for Kids Part 1 - Using Panda3D to Create Working POC

 

From this starting Panda Tutorial, we can create a great Python teaching aid for the kids!

Figure 1 - From this Panda Tutorial, we can create an attractive Python teaching aid for the kids

To be honest, I failed in my first CoderDojo opening. Sigh.. that's the sad truth.

Yeah, the kids got excited about seeing that they can calculate area of triangle and print the result. Yeiy! But.. what's next? I kinda feeling dumb trying to explain those marvelous Python concept using just a plain black BASH console. I know I really love console (or DOS Prompt to be exact). But as I remember it, at that time of my early introduction to computer programming (circa '95) , there are not much left to explore other than console application. Thinking it further,  it's not the console actually that get me excited. But its the game! I love programming because I love seeing I can programmed .. Digger using QuickBasic.

 (More)



Django KFIMember Tutorial Part II - Creating Initial Application

 
Django online on Openshift!

Figure I-1 Our Django 1.6 application online on Openshift!

ARTICLE UPDATE : As I have unresolved problem when using Python 3.3 combined with Django 1.6 and PostgrerSQL 9.2 in Openshift, I dropped Python 3.3 requirement and rework this application using Python 2.7 instead.

Previously I had laid out the foundations of what Django application we are about to be build. Have a quick read again on what are those foundations. For now, let start with creating our application from scratch.

We will start by creating a Python 3.3 project on Openshift, prepare local Windows environment for it and then import it into a new Python Tools for Visual Studio (PTVS) project. Lastly, we will also prepare our local environment for Linux user, so that for those who prefer to use *nix environment will be able to follow along this tutorial series.

 (More)



Django KFIMember Tutorial Part I - Deciding Application Scope, Production and Technology Stacks

If this is your first encounter with PTVS, I bet you haven't imagine this kind of screenshot, even in your wildest dreams.

If this is your first encounter with PTVS, I bet you haven't imagine this kind of screenshot, even in your wildest dreams... Cool

ARTICLE UPDATE : As I have unresolved problem when using Python 3.3 combined with Django 1.6 and PostgrerSQL 9.2 in Openshift, I dropped Python 3.3 requirement and rework this application using Python 2.7 instead.

Yes, I know. I haven't finished my Flask Biography Tutorial yet. But I thought I would like to start an initial post of what my next tutorial series would be like. I have several ideas actually, popping from my head of what Python topic (library or framework to be exact) I would like to explore more, which are:

  1. Django : "The Web framework for perfectionists with deadlines". I am pretty much sure, no software developers were not intrigued by that tagline! Before diving into Python, I evaluate Ruby on Rails previously. And I got the sense that Django is Python answer to RoR, which is not that untrue.
  2. Pyramid, mainly because previously I got offered for Pyramid based remote job.
  3. Isometric traffic control simulation game build using (probably) XNA + Python for scripting. Why? Because in one occasion where I explained to my 6 years old daughter of what is an Isometric image (after I saw her to be so enthusiast looking at an isometric pixel-art image), she and also her 3 years old brother seems to be interested on it.

    It's so addicted!
    It's so addicted! Try to find Batman in that beautiful pixel art image taken from nasc

  4. Twisted, to be able to develop a large scale of network event-driven application. It may be just a chat server for the aforementioned Isometric traffic control simulation game, or a more complex multiplayer server for it.

Eventually, as I also have been offered a job to develop membership website for our Koperasi Freelancer Indonesia (KFI), I thought the timing is perfect if I blog my experience in developing it as my next tutorial series in this blog. With one interesting twist of plot : we are going to add another development platform, Python Tools for Visual Studio + Windows Azure. But still not forgetting those  who use *nix. In this series, we are going to see how well Windows Azure match up with Openshift in context of deploying Python web application.

Hence, welcome to the first installment of Pythonthusiast's Django Tutorial!

 (More)




Copyright(c) 2014 - PythonBlogs.com
By using this website, you signify your acceptance of Terms and Conditions and Privacy Policy
All rights reserved