code-layout

How does the layout of a Python application look?

In most programming environments it's clear how the code is distributed into several parts and how everything interacts. In Python I seem to be completely lost. How should the layout of a Python application look? Currently I have: setup.py application_name/ __main__.py __init__.py views/ controllers/ model/ r...

Code Layout Rules for a Form

While moving some code around for investigation purposes, I came across a little feature of .NET that I was unaware of, which is that the form class must be the first class in a form module for the form designer to work. The following stops the designer from working: public class myClass { } public partial class Form1 : Form { pub...

Is there anything wrong with creating a helper function to display an AlertView?

I'm still learning Objective-c and Iphone Dev so I'm willing to take instruction. I was wondering if this is the best way to achive a helper function that displays an alertview. Obviously in my code there are various places (report errors, bad data etc) where I wish to display an alert to my user. Rather than create an AlertView objec...

In languages where you have a choice, is it better to put the main function/method/code at the top or bottom?

When you're writing a program that consists of a small bit of main logic that calls a bunch of supporting functions, you can choose either put the main logic at the top of the file or the bottom (Let's assume the language allows either.) Which is better? Should I put my main logic at the beginning of the file or the end, after all the su...