473,287 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Re: Relationship between GUI and logic?

John Salerno <jo******@gmailNOSPAM.comwrote:
Basically, the question is this: can you write the logic behind a
program (whether it be a game, an email client, a text editor, etc.)
without having any idea of how you will implement the GUI?
You probably could, but it's best not to unless you're somehow forced
to.

In practice, the interface that you want your 'logic' layer to provide
to the GUI is likely to depend on some of the details of how the GUI
works.

If you did the lower levels first without having any idea at all of
what you were going to do with the GUI, it's quite likely that you'd
find you'd written a few functions which turned out not to be needed at
all, or that some functionality that the GUI needs to use very
frequently is rather slow to execute, or that some functionality that
you thought belonged to the 'logic' is really better done in the GUI
layer, and so on and so forth.

For example, if you were writing the 'logic' for a chess program you
might choose a way of modelling the board that can't represent a
position with more than one black king. And then when you got round to
doing the GUI you might find out that your users would like to be able
to have this temporarily when setting up a position.

-M-
Jun 27 '08 #1
2 1691
On 23 May 2008 18:23:04 +0100 (BST), Matthew Woodcraft
<ma******@chiark.greenend.org.ukwrote:
>John Salerno <jo******@gmailNOSPAM.comwrote:
>Basically, the question is this: can you write the logic behind a
program (whether it be a game, an email client, a text editor, etc.)
without having any idea of how you will implement the GUI?

You probably could, but it's best not to unless you're somehow forced
to.

In practice, the interface that you want your 'logic' layer to provide
to the GUI is likely to depend on some of the details of how the GUI
works.

If you did the lower levels first without having any idea at all of
what you were going to do with the GUI, it's quite likely that you'd
find you'd written a few functions which turned out not to be needed at
all, or that some functionality that the GUI needs to use very
frequently is rather slow to execute, or that some functionality that
you thought belonged to the 'logic' is really better done in the GUI
layer, and so on and so forth.

For example, if you were writing the 'logic' for a chess program you
might choose a way of modelling the board that can't represent a
position with more than one black king. And then when you got round to
doing the GUI you might find out that your users would like to be able
to have this temporarily when setting up a position.
What you say may be true, but this doesn't seem to me like a good
example. Not that I see _why_ the player would want to have
two kings temporarily, but if so I wouldn't have the view report
this state to the model, I'd have the view wait until the player had
decided on the final configuration betore saying anything to the
model. The model should only deal with legal positions.

(Could be that it's not until we start actually playing the game
through the GUI that we find the model can't deal with two
black queens. But that's not an example either, that would just
mean the model is wrong, not allowing every legal position.)
>-M-
David C. Ullrich
Jun 27 '08 #2
David C. Ullrich <du******@sprynet.comwrote:
Matthew Woodcraft <ma******@chiark.greenend.org.ukwrote:
>For example, if you were writing the 'logic' for a chess program you
might choose a way of modelling the board that can't represent a
position with more than one black king. And then when you got round
to doing the GUI you might find out that your users would like to be
able to have this temporarily when setting up a position.
What you say may be true, but this doesn't seem to me like a good
example. Not that I see _why_ the player would want to have two kings
temporarily, but if so I wouldn't have the view report this state to
the model, I'd have the view wait until the player had decided on the
final configuration betore saying anything to the model. The model
should only deal with legal positions.

Then you end up implementing a second model of the board state in the UI
layer. And if it turns out that you want to support things like 'save
current position' and 'clone current position to a new window' during
setup, you might well find yourself putting so much logic in the UI
layer that some of what you already wrote in the 'logic' layer ends up
unused.

As for why you might want illegal positions during setup, imagine a UI
where you can click on a square repeatedly and it cycles through the
possible pieces (dunno whether this would be good in practice, but I do
know that guessing whether a UI is good without trying it is rather
unreliable).

-M-
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Alcyone Oliveira | last post by:
------=_NextPart_000_000D_01C36572.F6480CE0 Content-Type: multipart/alternative; boundary="----=_NextPart_001_000E_01C36572.F6480CE0" ------=_NextPart_001_000E_01C36572.F6480CE0 Content-Type:...
0
by: Mike Sutton | last post by:
Please let me know what you think of this scheme I have come up with (not to imply that noone else has before me) for managing relationships. I have created an entities table with Individual and...
8
by: Andante.in.Blue | last post by:
Hello, I have just inherited a legacy Access 97 database. While going through it, I noticed something strange... its Relationships window (the one accessed by Tools --> Relationships) is almost...
2
by: Rararachel | last post by:
Hi All, (Have posted this elsewhere, so apologies to anyone who's seen this behemoth before!) I have a simple, but surprisingly complicated database requirement in that the database requires...
5
by: BrianDP | last post by:
This is a strange one-- I have an Access 2K database with a split front end/back end. There are two tables in the back end - RFile and RLine. There is a one to many relationship from...
1
by: BuckBaxter | last post by:
Recently had trouble creating a one-to-many relationship between Customer table and Order table. After drag & dropping the field CustomerNo (key) in Customer table to CustomerNo (foreign) in Order...
4
by: Ray | last post by:
in UML? I just found that UML is actually very class-based. It's difficult to depict the relationship between a constructor function, its prototype property, and objects that are created using that...
0
by: Marc 'BlackJack' Rintsch | last post by:
On Fri, 23 May 2008 07:14:08 -0400, inhahe wrote: The logic part has the rules how you may move the pieces. The GUI shouldn't have to know how a knight, bishop, or queen can move or what...
4
by: Phil Stanton | last post by:
Having spent ages sorting out the layout of my relationship window with about 60 tables and getting it all tidy and with enough of the tables visible to show the PK an FK relaionshipsOn a subseqent...
6
by: NicoleCartrette | last post by:
Going back to school is easier said than done.. This was posted to an older thread earlier but I don't think it got any attention. Your help is appreciated Professor requires we create a...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.