473,405 Members | 2,300 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,405 software developers and data experts.

The complexity of the design

I have made my own custom control. It looks like a single line textbox
with icons on the right hand side. It pretty much has the same
functionality as Microsoft Outlooks "To" field, where you can Alt-K to
complete things etc. Mine has a different purpose but is essentially
the same style.

Anyway the issue I have is managing the complexity of the box. the
user can interact by clicking buttons to open search windows, type
names directly into the text box or by setting it programatically (?)
using the exposed properties.

It leads to extremely complex code like this however:

public property ObjectID as Int32
....
set(value as Int32)
if (inMethod) then exit sub

inMethod = true

textbox.text = lookup(value)
icon = imageX
me.mObjectId = value

inMethod = false

end set
--
There is no said problem per say, but I need things like inMethod
booleans to stop a nightmare of redundant callbacks and invocations of
bad text. I don't feel I could centrallise this because each technique
works with different inputs. (i.e. Int32, or String, or result from
search window) etc.

Is there a good design pattern or common solution that makes working
with this kind of code easier?

Phillip Taylor

Sep 10 '07 #1
3 1112
Phillip,

If you keep in mind that a control gives you always back a string in the
text property. (It is entered by the keyboard) then your problem will become
probably easier.

If you add a value property to your box (or overide it), then you can set in
that the formulas to make from a string an integer or a datetime just as it
is needed. I would not go to far in that. A Value property is mostly
returning one type of value.

Cor

"Phillip Taylor" <Ph*****************@gmail.comschreef in bericht
news:11*********************@w3g2000hsg.googlegrou ps.com...
>I have made my own custom control. It looks like a single line textbox
with icons on the right hand side. It pretty much has the same
functionality as Microsoft Outlooks "To" field, where you can Alt-K to
complete things etc. Mine has a different purpose but is essentially
the same style.

Anyway the issue I have is managing the complexity of the box. the
user can interact by clicking buttons to open search windows, type
names directly into the text box or by setting it programatically (?)
using the exposed properties.

It leads to extremely complex code like this however:

public property ObjectID as Int32
...
set(value as Int32)
if (inMethod) then exit sub

inMethod = true

textbox.text = lookup(value)
icon = imageX
me.mObjectId = value

inMethod = false

end set
--
There is no said problem per say, but I need things like inMethod
booleans to stop a nightmare of redundant callbacks and invocations of
bad text. I don't feel I could centrallise this because each technique
works with different inputs. (i.e. Int32, or String, or result from
search window) etc.

Is there a good design pattern or common solution that makes working
with this kind of code easier?

Phillip Taylor
Sep 11 '07 #2
On 11 Sep, 04:34, "Cor Ligthert[MVP]" <notmyfirstn...@planet.nl>
wrote:
Phillip,

If you keep in mind that a control gives you always back a string in the
text property. (It is entered by the keyboard) then your problem will become
probably easier.
? Can explain what you mean here please? The application will set the
ObjectID property on my control, a user may type into an embedded text
field or a user may click on buttons to generate the result. There
isn't a single way to represent the internal state.
If you add a value property to your box (or overide it), then you can set in
that the formulas to make from a string an integer or a datetime just as it
is needed. I would not go to far in that. A Value property is mostly
returning one type of value.
It's not to do with accepting multiple types in a value field or using
method overloading, it's about three completely different events that
have different inputs. I wondered if they could be simplified.

Anyone?
>
Cor

"Phillip Taylor" <Phillip.Ross.Tay...@gmail.comschreef in berichtnews:11*********************@w3g2000hsg.goo glegroups.com...
I have made my own custom control. It looks like a single line textbox
with icons on the right hand side. It pretty much has the same
functionality as Microsoft Outlooks "To" field, where you can Alt-K to
complete things etc. Mine has a different purpose but is essentially
the same style.
Anyway the issue I have is managing the complexity of the box. the
user can interact by clicking buttons to open search windows, type
names directly into the text box or by setting it programatically (?)
using the exposed properties.
It leads to extremely complex code like this however:
public property ObjectID as Int32
...
set(value as Int32)
if (inMethod) then exit sub
inMethod = true
textbox.text = lookup(value)
icon = imageX
me.mObjectId = value
inMethod = false
end set
--
There is no said problem per say, but I need things like inMethod
booleans to stop a nightmare of redundant callbacks and invocations of
bad text. I don't feel I could centrallise this because each technique
works with different inputs. (i.e. Int32, or String, or result from
search window) etc.
Is there a good design pattern or common solution that makes working
with this kind of code easier?
Phillip Taylor

Sep 11 '07 #3
? Can explain what you mean here please?

Keep it simple then others beside you can understood it too. Therefore
follow the routes as they are normal done.

Cor

Sep 11 '07 #4

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

Similar topics

77
by: nospam | last post by:
Reasons for a 3-tier achitecture for the WEB? (NOTE: I said, WEB, NOT WINDOWS. DON'T shoot your mouth off if you don't understand the difference.) I hear only one reason and that's to switch a...
2
by: Brett | last post by:
This statement mentions that complexity kills but can it be avoided? "The kind of scalability I'm talking about is styem scale and compliexity. Anyone who has written large scale systems knows...
4
by: Generic Usenet Account | last post by:
Consider two entities A and B such that there is a 1:n association between them. I mean that associated with each instance of A there are up to n instances of B. Currently in our software we are...
5
by: junky_fellow | last post by:
How do we calculate the complexity of an algorithm? Am i right if i say the complexity of an algorithm is the number of comparisons done in that algorithm? thanx in advance .......
14
by: RL Stevenson | last post by:
What is a reasonable way to manage a complex form with 5 or so tabs with 100 or more controls bound to 5-10 tables in a database? Pasting all those controls, datasets, data adapters directly onto...
8
by: sam_cit | last post by:
Hi, I came to read this particular statement with respect to reducing the complexity of a code, The usage of functional maps matrices instead of switch statements should be considered. I...
4
by: raghu | last post by:
How to find the complexity of a C program? Can anyone explain it with an example... Thanks a lot.
26
by: Lionel B | last post by:
Hi, Anyone know if the Standard has anything to say about the time complexity of size() for std::set? I need to access a set's size (/not/ to know if it is empty!) heavily during an algorithm...
5
by: Joris van Lier | last post by:
Given two implementations of an algorithm how do I determine the relative computational complexity of each? Are there tools that can determine the relative performance of two algorithms or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.