:: Re: [DNG] Experiencing with GtkBuil…
Góra strony
Delete this message
Reply to this message
Autor: aitor_czr
Data:  
Dla: dng
Temat: Re: [DNG] Experiencing with GtkBuilder
Hi Steve,

I would argue that it's possible a "OOP" development without a OOP language.

The "OOP" development is in the mind of the developer.

Even the OOP languages make it easier, of course...

Cheers :-) ,

Aitor.


On 11/23/2015 04:56 PM, Steve Litt <slitt@???> wrote:
> I'd start out by saying that, in my opinion, OOP isn't the right
> paradigm for every situation.
>
> If you're talking about a picklist, where you display the picklist and
> the user picks the desired item, then I think OOP is a pretty good
> paradigm because it matches the data.
>
> In this case, the picklist object has either an array of item objects or
> a doubly linked list of item objects, as well as some metadata and a few
> methods (probably implemented as contained pointers to functions.) If
> you want the picklist sortable, the list must have a sort method. You
> might also want to have a text trimming method so the text doesn't walk
> off the end of the screen (a problem with CLI and Curses). The picklist
> must also have properties relating keystrokes to functionalities, the
> functionalities being "Choose", "Cancel", "Drill down", "Change",
> "Delete", "Add". Not all functionalities are necessary on every list.
>
> An item object contains the original data, a string representation
> suitable for display, a unique identifier, and a distinct way to pass
> back the unique ID of the chosen item. For instance, in some situations
> you'd just return the unique identifier, in other situations you'd want
> to print the to stdout. The conversion of the original item to a
> display string is a pointer to a function taking a void pointer as an
> argument, and returning a string, because the original data can be in
> any conceivable form.
>
> I'd*highly* suggest you do not have any user interface information
> within either the picklist class or the item class, for the same reason
> you don't like systemd. Your software becomes a lot less pure and easy
> to repair if you mix heavy lifting like the picklist with other,
> unrelated heavy lifting like user interface. If the picklist and item
> classes know nothing about the user interface, then you can use them
> with*any* user interface.
>
> Of course, you'll eventually need the user to interact with your
> picklist via a user interface. There are probably a million ways of
> doing this. One way might be via two callback routines called acquire()
> and display(), where acquire() acquires a piece of user input, and
> display() displays a piece of output. Given the fact that picklist and
> item should know nothing about the user interface, and the fact that C
> makes you completely declare all types, these two callback functions
> need to be declared pretty creatively to cover all scenarios.
>
> HTH,
>
> SteveT