45 2732
Dan Pop wrote: Ed Morton <mo************ ****@lucent.com > writes:
.... snip ... Only if you think that any of the following is true:
a) There's no cost associated with finding a bug, fixing it, and retesting. b) During developer-testing, every developer catches every bug they introduced. c) All software can be tested thoroughly in a cheap development environment (e.g. off the potentially expensive production hardware).
You're ignoring the punctual nature of the issue. There is no need to perform a full retesting of the application, only the correctness of the changes made needs to be tested, and this is, usually, far easier.
Anyone who changes the code and doesn't test his changes should be kicked out of this profession.
Such changes have been known to affect seemingly totally unrelated
functions. Which is why having a fully automated regression test
suite available is invaluable. Such a test suite should be
generated with the original application, but often is ignored.
--
Chuck F (cb********@yah oo.com) (cb********@wor ldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net> USE worldnet address!
In <3F************ ***@yahoo.com> CBFalconer <cb********@yah oo.com> writes: Dan Pop wrote: Ed Morton <mo************ ****@lucent.com > writes: ... snip ... > >Only if you think that any of the following is true: > >a) There's no cost associated with finding a bug, fixing it, and > retesting. >b) During developer-testing, every developer catches every bug > they introduced. >c) All software can be tested thoroughly in a cheap development > environment (e.g. off the potentially expensive production > hardware).
You're ignoring the punctual nature of the issue. There is no need to perform a full retesting of the application, only the correctness of the changes made needs to be tested, and this is, usually, far easier.
Anyone who changes the code and doesn't test his changes should be kicked out of this profession.
Such changes have been known to affect seemingly totally unrelated functions.
It doesn't matter. You simply test their impact on the program behaviour.
If they break something, it doesn't matter where that something is: you
track it and fix it.
Which is why having a fully automated regression test suite available is invaluable. Such a test suite should be generated with the original application, but often is ignored.
Especially when generating it is 10 times or more expensive than
developing the application. Which is often the case with complex
applications (e.g. compilers), so you use incomplete testing procedures.
However, when you make a punctual change, it is usually possible to
completely test its effects.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
James Dow Allen wrote: Ed Morton <mo************ ****@lucent.com > wrote in message news:<bq******* *@netnews.proxy .lucent.com>...
First: I did appreciate your words and your taking the time to rerun the program. Sorry if I sounded irritable.
Not at all. Likewise, I appologise if I was rude or sounded offended.
I've added an "OT" label to the subject as I'm about to talk about
algorithms rather than ANSI C:
I took another look at the code and, though I don't get the details, the
comments sound like you're (very roughly) attempting to deal the cards
until some predefined outcome, and backtracking when you hit dead-ends.
If so, did you consider using, say, bit-state-hashing with a depth-first
(recursive-descent) algorithm, e.g. something like this pseudo-code:
play() {
deal(); /* determine possible next states from the
* current state, e.g. card hand combinations.
*/
for (state in possibleStates) {
if (state == the_desired_res ult) {
return;
} else {
idx = hash(state);
if (hashTbl[idx] == 0) {
/* This is a new configuration
* so continue
*/
hashTbl[idx] = 1;
play();
}
/* else, we've seen this configuration
* before so move on or backtrack
*/
}
}
}
main() {
bool hashTbl[size] = { 0 };
play();
printState(stat e);
}
Regards,
Ed.
James Dow Allen wrote: Ed Morton <mo************ ****@lucent.com > wrote in message news:<bq******* *@netnews.proxy .lucent.com>...
First: I did appreciate your words and your taking the time to rerun the program. Sorry if I sounded irritable.
No. It was the loop termination condition that was the hardest to understand. I don't mean I can't read the C, I just don't know what the abstraction is for the C (i.e. what it "means"). The program does have a few comments, including one immediately before the for statement you snipped: /* Loop to play tricks forward until the outcome is conclusive */ for (tnum = won = success = 0; success ? ++won < need : won + ohsize >= need + tnum; tnum++, P++, success = IS_CONT(pwin)) {
I assumed an understanding of whist and game search -- the loop terminates when it is known either that contract will succeed or won't succeed (and "success" will tell you which.)
I was wrong, it doesn't hang. It does just take a few minutes.
To change the subject, I was pretty sure the program would run the 2nd input if it could run the 1st. Why? *Because it doesn't rely on anything.* Some programs have code like foogle_gark(Can onPrinter, DVI_Level17, REV14_3); /* remember to ask Tony if we need to change this for * Rev 14.4 (when line speed exceeds BAUDLIMIT_39) */ My program depended only on printf(), etc. which haven't changed since the Pleistocene. And even the cheapest cell phone today has enough memory to run it.
When someone demonstrates a working program almost as efficient and more readable than mine, I'll "eat my hat."
Well, if you decomposed what you have into a few small functions (with their own local variables ...)
Studying the program I believe you'll find that to be undoable. You'll either need lots of global variables, or unwieldy state- passing in both directions.
Until then, your words are just idle pedantry.
You can dismiss my comments if you like, but I wasn't pedantic about anything. I didn't say anything like "this code uses goto and therefore is bad" I said "This code is hard to read, and here's some examples of why".
I apologize. My point was very badly phrased and, anyway, directed more at another poster who over-generalized. I stand by my essential point: My 200-line program is harder to read than a 500-line program,
All other things being equal, this is almost never the case. Simply
by fact of the program having more stuff in it, it will be somewhat
harder to read. This a variaiton of Strunk and White's "Omit needless
words".
But this is stated in the absence of a lot of other information
that would be necessary to really evaluate a comparison between
the two. A factor of 2.5 is very significant.
but many programmers would construct a 2000-line solution if they could do it all. Let's wait till the alternative is on display before declaring it more readable.
James
--
Les Cargill
James Dow Allen wrote: Ed Morton <mo************ ****@lucent.com > wrote in message
First: I did appreciate your words and your taking the time to rerun the program. Sorry if I sounded irritable.
No. It was the loop termination condition that was the hardest to understand. I don't mean I can't read the C, I just don't know what the abstraction is for the C (i.e. what it "means").
.... snip ...
I too tried it out, and all seems correct after some repairs, such
as the appropriate #includes, and replacing 'index' with 'strchr'.
It is wanting in input checking. The use of scanf is fatal. I
especially discovered this when a typo in one input hand caused a
12 card hand, and the result announced success after 12 tricks!
My first attempt to feed it a hand used something like "S AKJ543"
etc. and resulted in segfaults. This is where functional
separation greatly eases improvement.
--
Chuck F (cb********@yah oo.com) (cb********@wor ldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net> USE worldnet address!
Dan Pop wrote: CBFalconer <cb********@yah oo.com> writes: ... snip ...
Which is why having a fully automated regression test suite available is invaluable. Such a test suite should be generated with the original application, but often is ignored.
Especially when generating it is 10 times or more expensive than developing the application. Which is often the case with complex applications (e.g. compilers), so you use incomplete testing procedures.
By the very nature of the beast tests are never complete. If they
were we could prove the absence of bugs.
IMO this is an outstandingly poor example of something hard to
regression test. A compiler has to deal with known syntax,
rejecting much, and the code snippets are relatively easy to
create. I know of no important compilers without such a suite.
However I have found no /reasonable/ way to regression test my
nmalloc package, since the pointers it returns depend on the state
of the rest of the machine.
--
Chuck F (cb********@yah oo.com) (cb********@wor ldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net> USE worldnet address!
Les Cargill <lc******@world net.att.net> wrote in message news:<3F******* ********@worldn et.att.net>... James Dow Allen wrote: ... I stand by my essential point: My 200-line program is harder to read than a 500-line program,
All other things being equal, this is almost never the case. Simply by fact of the program having more stuff in it, it will be somewhat harder to read. This a variaiton of Strunk and White's "Omit needless words".
Although your comment appears contrary to mine, I assume you
realize you are strongly taking my side in this debate.
No one has deigned to display any alternative program, but
if any of the posters have actually spent any effort towards that
goal I'm sure they will agree the "structured " alternative must have
many more keystrokes in it. ... And if posters claim otherwise,
but find it too difficult to modify this 200-liner, ... well
I'll avoid the term "idle pedantry" but just say that either their
love or skill for programming isn't enough.
* * * *
Addressing some other comments, I thought my discussion made it
*very clear* that the example program was deliberately streamlined
to demonstrate algorithmic simplicity and a unique control flow,
and was *not* intended as an "industrial strength" user-friendly
application. Hence, comments like "avoid scanf()" are at cross purpose.
James
Ed Morton <mo************ ****@lucent.com > wrote in message news:<bq******* *@netnews.proxy .lucent.com>... I took another look at the code and, though I don't get the details, the comments sound like you're (very roughly) attempting to deal the cards until some predefined outcome, and backtracking when you hit dead-ends. If so, did you consider using, say, bit-state-hashing with a depth-first (recursive-descent) algorithm, e.g. something like this pseudo-code:...
The program is one of several example programs at that site.
Unfortunately the webpage doesn't have an appropriate Back button or
you might have stumbled on further discussion and examples.
(I'll add such a Back link, but it didn't seem fully necessary:
you can rubout the last part of the URL and get the Index page for
that directory. The double-dummy program is introduced in Lesson 9.)
I've written other game-search programs, usually similar to your
description, and at least three other example programs at the website
fit that category, none similar to the Whist program.
FWIW, (drumroll), it was my program that first solved the game of
Connect-Four. (That program didn't happen to have "goto", BTW. :-)
BTW, typical games progress
Black, White, Black, White, Black, White, ...
but Whist progresses
N, E, S, W, determine_who_l eads, S, W, N, E, determine_who_l eads, etc.
This complication is a major reason that more traditional control
flow would become more complicated than the Favorite Goto(tm) does.
James
Debashish Chakravarty <de********@yah oo.com> wrote in message news:<3F******* *******@yahoo.c om>... K&R pg.66 describes two situations when using goto makes sense. Has anyone here come across situations where using goto provided the most elegant solution.
Breaking out of complex loops?? That's the O'Reilly example at any rate.
In <3F************ ***@yahoo.com> CBFalconer <cb********@yah oo.com> writes: Dan Pop wrote: CBFalconer <cb********@yah oo.com> writes: >> >... snip ... >Which is why having a fully automated regression test >suite available is invaluable. Such a test suite should be >generated with the original application, but often is ignored.
Especially when generating it is 10 times or more expensive than developing the application. Which is often the case with complex applications (e.g. compilers), so you use incomplete testing procedures.
By the very nature of the beast tests are never complete. If they were we could prove the absence of bugs.
Never is too strong. If the full set of inputs is reasonably small,
the brute force approach is doable. In some other cases, it is possible
to identify a problematic subset of inputs that need testing (if they
are correctly handled, it is possible to prove that anything else will
be correctly handled). But, often enough, NOTHING can replace the
testing (usually involuntarily) performed by the real world users of your
application.
IMO this is an outstandingly poor example of something hard to regression test. A compiler has to deal with known syntax, rejecting much, and the code snippets are relatively easy to create. I know of no important compilers without such a suite.
You forgot to engage your brain, again. I know of no important
compilers without such a suite, either, yet I know of no important
compiler which is bug free. Which makes it an outstandingly *good*
example of something hard to test.
However I have found no /reasonable/ way to regression test my nmalloc package, since the pointers it returns depend on the state of the rest of the machine.
If you have problems testing a malloc package, it's most likely due to its
extremely bad design.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: BOOGIEMAN |
last post by:
I've just finished reading Python turtorial for non-programmers
and I haven't found there anything about some usefull commands I used in
QBasic. First of all, what's Python command equivalent to QBasic's "goto" ?
Secondly, how do I clear screen (cls) from text and other content ?
And last, how do I put program to wait certain amount of seconds ?
If I remeber correctly I used to type "Wait 10" and QBasic waits
10 seconds before proceeding...
|
by: Michael |
last post by:
Hi,
I know I know its notoriously bad! I don't want to use it. I was wondering,
does it still exist? If it does, I really don't understand how!? like what
happens if you just goto halfway through a function (no objects properly
constructed!) , or a constructor itself??
Just intrigued!!
Mike
|
by: deko |
last post by:
I've heard it said that you only want to use a number (e.g. integer, long, etc.)
if you are going to do calculations or some kind of math with it. Is this true?
For example, I run a validate routine that checks an address entry - if
something's missing in the entry, the code does different things based on what
is missing, indicated my a 2 or a 3 - integer values. Should I use string data
types here? Does it matter?
Public Sub...
|
by: WindAndWaves |
last post by:
Can anyone tell me what is wrong with the goto command. I noticed it is one
of those NEVER USE.
I can understand that it may lead to confusing code, but I often use it like
this:
is this wrong?????
Function x
select case z
|
by: Mike Hofer |
last post by:
While I'd toyed with C, C++, and Java over the last 20 years or so, my
principal language has been BASIC, QBASIC, then Visual Basic, and
finally Visual Basic .NET. But lately, I've been using C# and I
absolutely *love* it. It makes me think more about what I'm doing it
before I just spew code into the editor. I'm writing better code than
ever.
The only thing so far that I don't like about it is the switch
construct. I can't do this:
| |
by: M.B |
last post by:
Guys,
Need some of your opinion on an oft beaten track
We have an option of using "goto" in C language, but most testbooks
(even K&R) advice against use of it.
My personal experience was that goto sometimes makes program some more
cleaner and easy to understand and also quite useful (in error handling
cases).
So why goto is outlawed from civilized c programmers community.
is there any technical inefficiency in that.
|
by: cat |
last post by:
I had a long and heated discussion with other developers on my team on when
it makes sense to throw an exception and when to use an alternate solution.
The .NET documentation recommends that an exception should be thrown only in
exceptional situations. It turned out that each of my colleagues had their
own interpretation about what an "exceptional situation" may actually be.
First of all, myself I’m against using exceptions extensively,...
|
by: electrician |
last post by:
Perl has it, Basic has it, Fortran has it. What is so difficult about
creating a goto command for JavaScript. Just set up a label and say go
to it.
|
by: raashid bhatt |
last post by:
why are GOTO's not used they just a simple JMP instructions what's bad
about them
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |