Tagged Questions
1
vote
4answers
232 views
How to elegantly work with a lot of print functions?
I'm working on a Python project that is executed on a terminal (or console) for which I am planning to implement a GUI.
I did not major in CS so I really have no idea how to effectively design a ...
3
votes
1answer
276 views
How to design a composite pattern in Python?
The concept
I'm programming an interface over pygame as a personal project, to make the creation of games easier for me.
So far I managed to design an architecture that behaves like this :
Objects ...
4
votes
1answer
251 views
How should I architect a personal schedule manager that runs 24/7? [closed]
I've developed an ADHD management system for myself that's attempting to change multiple habits at once. I know this is counter to conventional wisdom, but I've tried the conventional for years & ...
6
votes
1answer
295 views
Object oriented vs vector based programming
I am torn between object oriented and vector based design. I love the abilities, structure and safety that objects give to the whole architecture. But at the same time, speed is very important to me, ...
0
votes
3answers
232 views
Object design where hard-coded values are used to instantiate objects?
I'm creating the design for a browser bookmark merging program and I've ran into a design problem that I've seen before yet I've never come up with a good solution for it. So lets say I have a ...
4
votes
4answers
414 views
How to create different paths for users to take through the pages in my site?
I have a website where users are directed to go through a sequence of pages to perform a sequence of work tasks (transcribe a paragraph, answer a survey, interact with another user, etc). For short, ...
5
votes
4answers
289 views
Returning a boolean when success or failure is the sole concern
I often find myself returning a boolean from a method, that's used in multiple locations, in order to contain all the logic around that method in a single place. All the (internal) calling method ...
0
votes
1answer
202 views
Python web application frontend for equipment diagnostics and interaction
My goal is to have a Python application that runs a web server which hosts the user interface, and based on interactions from a user in their browser, long running tasks get kicked off and through ...
3
votes
1answer
312 views
Python, magic and objects that add attributes to its owner
Let me start with a disclaimer: I'm not the best programmer out there. I do however study I.T. and learnt a bit of Java and C.
I'm getting stuck into Python and Django + Mongoengine, I'm not going to ...
4
votes
2answers
176 views
Designing a function with many optional components
I'm trying to figure out a good practice for designing a function with (many) optional components.
For a specific example, say I am interested in designing a feature extractor function that takes as ...
2
votes
2answers
149 views
Changing __class__ in a factory?
I'm parsing a set of XML files of different kinds (these kinds are known in advance).
These are my requirements:
I want an object to represent each XML document (object-xml mapping)
I'd rather ...
1
vote
3answers
271 views
Hacking Python “Requests” library.. How to start as an intermediate pythonista?
My question is conceptual, yet extremely vital for me.
I'm an intermediate Python developer. I know fair enough about it, and actually use it on a daily basis. Now, I would like to transform my ...
3
votes
4answers
259 views
Representing complex object dependencies
I have several classes with a reasonably complex (but acyclic) dependency graph. All the dependencies are of the form: class X instance contains an attribute of class Y. All such attributes are set ...
2
votes
2answers
494 views
Caching factory design
I have a factory class XFactory that creates objects of class X. Instances of X are very large, so the main purpose of the factory is to cache them, as transparently to the client code as possible. ...
56
votes
8answers
8k views
Are there any design patterns that are unnecessary in dynamic languages like Python?
I've started reading the design pattern book by the GoF. Some patterns seem very similar with only minor conceptual differences.
Do you think out of the many patterns some are unnecessary in a ...
3
votes
4answers
1k views
What is the simplest human readable configuration file format?
Current configuration file is as follows:
mainwindow.title = 'test'
mainwindow.position.x = 100
mainwindow.position.y = 200
mainwindow.button.label = 'apply'
mainwindow.button.size.x = 100
...
3
votes
4answers
374 views
What is the proper name for this design pattern in Python?
In Python, is the proper name for the PersonXXX class below PersonProxy, PersonInterface, etc?
import rest
class PersonXXX(object):
def __init__(self,db_url):
self.resource = ...
6
votes
2answers
2k views
Python programming patterns and practices?
What are the best python programming patterns and practices you are using every day?
I don't mean only design patterns (there are lot of OO design patterns that can be used in python), I mean pure ...