Developing Cross Platform Application using Qt, PyQt and PySide : Database Support - Part 4 of 5

Successful PyUnit testing of login feature from within PyCharm IDE

Successful PyUnit testing of login feature from within PyCharm IDE

Let me be honest about one thing : I don't have any draft outline for contents written in this blog. All of these articles were written in the spirit of improvisation and freedom to think/write/speech. For example, although I have been one of Qt fans since it was still owned by Trolltech, I have not the slightest idea that there will be a Qt series here. Even though I knew that Qt is supported in Python through PyQt, I am not that curious to start writing articles about it here. Only after I wrote this article, which lead me to Kivy that I began to experience something thrilling : doing Android development using pure Python! While I work on Kivy though, I also explore were there any alternatives to Android development using Python? Or in general, "Can we develop Android application without the use of Java?". The answer to this question bring me to (amongst other things) : Qt in Android. In which in Qt Project website itself, Python is listed as the most prominence third party programming language binding having Qt support! That was such a great news... Hence, our Qt series articles was born..

Another example is an answer around this question, "In this Qt series, what is the application that we are going to build?". Plain answer? No idea. Well, not that completely blind for sure. I just know that it must be a data aware application. And in the process of its development, it must be prefaced with a practical introduction to Test Driven Development(TDD). Combining both requirements, bring us to this current article : database support in either C++ Qt or PySide/PyQt. To keep things interesting, in this article we will officially use two IDEs : QtCreator for cross platform C++ Qt development and PyCharm for its Python counterpart.

Now that I have your attention ladies and gentlemen, lets drill on this cool talk about database support in Qt using either C++ or Python! Enjoy your time and .. happy reading! Laughing

 (More)



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)




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