Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

I have a Django application and a PyQt application that share a lot of code. A big chunk of the PyQt application are copied verbatim from the Django application's views. As this is a game, I have already an engine.py module that I'm sharing among the two applications, but I was wondering how to restructure the middle layer (what in Django corresponds to the largest part of the views minus the return HttpResponse part) into its own component.

In the web application the components are those of a classic Django application (with the only exception that I don't make any use of models):

  • the game engine
  • the url dispatcher
  • the template
  • the views

My PyQt application is divided into:

  • the game engine
  • the UI definition where I declare the UI components and react to the events (basically this takes the place of the template and the url dispatcher in the Django app)
  • the controller where I instantiate the window object and reproduce the methods that map the views in the Django app
share|improve this question

closed as too broad by durron597, MichaelT, Snowman, gnat, GlenH7 Jul 11 at 12:37

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs. If this question can be reworded to fit the rules in the help center, please edit the question.

    
Cheers superM Patters / Patterns was a good catch! :) –  Lorenzo Oct 31 '12 at 16:25

1 Answer 1

You have divided your code into modules. It is more important to define the interfaces between the models. The rest will fall into place.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.