eg.
enum ButtonPress{Start, Stop, Pause};
void OnButtonPress(ButtonPress buttonPress) // <--- repetetive signature
It looks a bit ugly, and I know some programmers who would go ballistic at
the sight of this, but, in my experience, each of the three repetitions is
justified in itself, and overall, life is smoother if we just type it out,
and keep going without worrying about it.
btw. at the other end of the spectrum is the programmer who uses extreme
overloading. His approach would be...
void on(ButtonPress item); 5 1106
"Javaman59" <Ja*******@discussions.microsoft.com> wrote in message
news:35**********************************@microsof t.com... eg.
enum ButtonPress{Start, Stop, Pause};
void OnButtonPress(ButtonPress buttonPress) // <--- repetetive signature
If it works, and it's clear, retaining a sense of pragmatism is no bad
thing. The signature you've written seems perfectly readable. If it was a
small method, I'd be tempted to change it to
void OnButtonPress(ButtonPress bp)
It looks a bit ugly, and I know some programmers who would go ballistic at the sight of this, but, in my experience, each of the three repetitions is justified in itself, and overall, life is smoother if we just type it out, and keep going without worrying about it.
btw. at the other end of the spectrum is the programmer who uses extreme overloading. His approach would be...
void on(ButtonPress item);
There are only two things in life that I hate; people who are intolerant of
other people's programming styles, and people who use too much overloading.
;¬)
If your code is clear, there are usually bigger things to worry about.
--
Regards,
Tim Haughton
Agitek http://agitek.co.uk http://blogitek.com/timhaughton
Thanks Tim, that settles it for me. people who use too much overloading.
Yup! :))
- Stephen
Seems perfectly fine to me and perfectly readable.
Brian Delahunty
Ireland
"Javaman59" wrote: eg.
enum ButtonPress{Start, Stop, Pause};
void OnButtonPress(ButtonPress buttonPress) // <--- repetetive signature
It looks a bit ugly, and I know some programmers who would go ballistic at the sight of this, but, in my experience, each of the three repetitions is justified in itself, and overall, life is smoother if we just type it out, and keep going without worrying about it.
btw. at the other end of the spectrum is the programmer who uses extreme overloading. His approach would be...
void on(ButtonPress item);
according to MS's naming conventions you would have to name the class
"ButtonPressEventArgs".
"Javaman59" <Ja*******@discussions.microsoft.com> schrieb im Newsbeitrag
news:35**********************************@microsof t.com... eg.
enum ButtonPress{Start, Stop, Pause};
void OnButtonPress(ButtonPress buttonPress) // <--- repetetive signature
It looks a bit ugly, and I know some programmers who would go ballistic at the sight of this, but, in my experience, each of the three repetitions is justified in itself, and overall, life is smoother if we just type it out, and keep going without worrying about it.
btw. at the other end of the spectrum is the programmer who uses extreme overloading. His approach would be...
void on(ButtonPress item);
> thing. The signature you've written seems perfectly readable. If it was a small method, I'd be tempted to change it to
void OnButtonPress(ButtonPress bp)
I've kept this suggestion in mind for the last few days, and I'm starting to
think that I like it. I notice that the System.EventHandler delegate has the
signature...
public delegate void EventHandler(
object sender,
EventArgs e
);
I've just written a procedure with this signature...
void Parse(char ch)
So, perhaps I would lean towards using an abbreviation for the parameter
name when the purpose of the parameter is obvious, or if it overall makes the
code look a bit cleaner.
"Tim Haughton" wrote:
"Javaman59" <Ja*******@discussions.microsoft.com> wrote in message news:35**********************************@microsof t.com... eg.
enum ButtonPress{Start, Stop, Pause};
void OnButtonPress(ButtonPress buttonPress) // <--- repetetive signature
If it works, and it's clear, retaining a sense of pragmatism is no bad thing. The signature you've written seems perfectly readable. If it was a small method, I'd be tempted to change it to
void OnButtonPress(ButtonPress bp)
It looks a bit ugly, and I know some programmers who would go ballistic at the sight of this, but, in my experience, each of the three repetitions is justified in itself, and overall, life is smoother if we just type it out, and keep going without worrying about it.
btw. at the other end of the spectrum is the programmer who uses extreme overloading. His approach would be...
void on(ButtonPress item);
There are only two things in life that I hate; people who are intolerant of other people's programming styles, and people who use too much overloading. ;¬)
If your code is clear, there are usually bigger things to worry about.
-- Regards,
Tim Haughton
Agitek http://agitek.co.uk http://blogitek.com/timhaughton This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Xah Lee |
last post by:
What are OOP's Jargons and Complexities
Xah Lee, 20050128
The Rise of Classes, Methods, Objects
In computer languages, often a function definition looks like this:
subroutine f (x1, x2, ...)...
|
by: N.Davis |
last post by:
I am very new to Python, but have done plenty of development in C++ and
Java.
One thing I find weird about python is the idea of a module. Why is this
needed when there are already the ideas of...
|
by: Martin Høst Normark |
last post by:
Hi everyone
Has anyone got the least experience in integrating the Digital Signature
with an ASP.NET Web Application?
Here in Denmark, as I supose in many other countries, they're promoting...
|
by: Fernando Cacciola |
last post by:
I'm puzzled,
Why and how _exactly_ is this:
void Foo<T>(T v ) where T : Interface/Value/Class/class
any better than this
void Foo( Interface/Value/Class/object v )
|
by: tjb |
last post by:
I often see code like this:
/// <summary>
/// Removes a node.
/// </summary>
/// <param name="node">The node to remove.</param>
public void RemoveNode(Node node) {
<...>
}
| |
by: =?Utf-8?B?QUEyZTcyRQ==?= |
last post by:
Am I correct in thinking that the <signatureof a function is its <syntax>
i.e. the arguments and the order in which they are specified when calling the
function?
|
by: Jonathan Wood |
last post by:
I found the following class on the Web:
public class LoginRewriter : IHttpModule {
void IHttpModule.Dispose() { }
void IHttpModule.Init(HttpApplication app) {
app.AuthorizeRequest += new...
|
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,...
|
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |
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,...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |