Re: Modularization



MEA-MikeFriedrichs wrote:
[...]
I can see an application becoming very large in one module. So I would like to break the program into modules, where each module can be managed and compiled independently and finally link all the modules together. But I don't see any divisions because of inter dependency where separate modules can be applied. Is this true or am I missing something?

Ofcourse you can and "should" (tm) split your code into logical
pieces, what does your code do ?

If your UI is relatively small (i.e. a main window with some dialogs)
than it would be completely normal to have all your callbacks &
g_signal_connect() code in one file, but I wouldnt put any functionality
in those callbacks; i.e. your typical callback would look like:

void
on_adress_search_button_clicked (GtkButton *button, AdressBook *book)
{
        adress_book_search (book);
        return;
}

You can further clean-up your code by removing those hundreds of
monotonous/redundant lines of code that build your UI and replace
that whole thing with:

xml = glade_xml_new (gladefile, ...);

If you have a very large & complex UI, like a kiosk point-of-sales
unit that typicly runs without a window manager, then you could
split up your UI code into logical sub-interfaces, i.e.:

    - intro_screen.c
    - product_selection.c
    - credit_card_ui.c
    - etc...

Cheers,
                                   -Tristan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]