Post #141,157
2/11/04 12:26:23 PM
|
Readable code is your friend.
So is reading the requirements: """ Requirements: 1. I've got Sarah writing "I will not forget my homework" in her notebook. 2. I think I'll let her stop after 10 pages (note the word "after"). 3. Ahh, page 5 -- I switched it to "I will not forget my science homework". I think I'll change it to health on page 10. """ homework_type = u""\nfor page in range(1, 11):\n print u"Page: %d" % page\n if page == 5:\n homework_type = u"science "\n elif page == 10:\n homework_type = u"health "\n for line in range(60):\n print u"I will not forget my %shomework." % homework_type\n
I was one of the original authors of VB, and *I* wouldn't use VB for a text processing program. :-) Michael Geary, on comp.lang.python
|
Post #141,168
2/11/04 2:15:30 PM
|
Re: Readable code is your friend.
program homework;\r\n\r\nconst\r\n subj1 = 'science';\r\n subj2 = 'health';\r\n\r\nvar\r\n pagenum : integer;\r\n pagecnt : integer;\r\n linecnt : integer;\r\n i\t : integer;\r\n \r\nbegin\r\n pagecnt := 11;\r\n linecnt := 60;\r\n for pagenum := 1 to pagecnt do\r\n begin\r\n for i := 1 to linecnt do\r\n begin\r\n\t if pagenum < 5 then\r\n\t writeln('I will not forget my homework');\r\n\t if (pagenum > 5) AND (pagenum < 10) then\r\n\t begin\r\n\t write('I will not forget my ',subj1);\r\n\t writeln(' homework');\r\n\t end;\r\n\t if pagenum > 10 then\r\n\t begin\r\n\t write('I will not forget my ',subj2);\r\n\t writeln(' homework');\r\n\t end;\r\n end;\r\n end;\r\nend. \r\nI agree. Sometimes, the least l33t solution can be the best.
Peter [link|http://www.debian.org|Shill For Hire] [link|http://www.kuro5hin.org|There is no K5 Cabal] [link|http://guildenstern.dyndns.org|Home Page - Now with added Zing!]
|
Post #141,169
2/11/04 2:52:55 PM
|
Ugh!
Not only is it Pascal, it's Pascal with three-space indenting!
-YendorMike
[link|http://www.hope-ride.org/|http://www.hope-ride.org/]
|
Post #141,209
2/11/04 5:22:00 PM
|
I knew I'd seen that syntax somewhere before
Ah..Pascal.. brings back high-school memories.
/evil grin directed at CRC
|
Post #141,172
2/11/04 3:12:31 PM
|
Bad - pagecnt and linecnt should be constants, too. HTH! :-)
|
Post #141,187
2/11/04 3:52:17 PM
2/11/04 3:54:37 PM
|
Re: Bad - pagecnt and linecnt should be constants, too. HTH!
I thought about that.
However, if you define them as constants and then later alter the program to read those values in from a file or the user, you'd end up altering more program than if they're declared as variables.
Always plan for the future, and think very hard before declaring something to be constant.
Peter [link|http://www.debian.org|Shill For Hire] [link|http://www.kuro5hin.org|There is no K5 Cabal] [link|http://guildenstern.dyndns.org|Home Page - Now with added Zing!]
Edited by pwhysall
Feb. 11, 2004, 03:54:37 PM EST
|
Post #141,189
2/11/04 3:55:04 PM
|
Or, "all constants are variables!" :)
Alex
The mind is not a vessel to be filled but a fire to be kindled. -- Plutarch
|
Post #141,252
2/11/04 7:27:02 PM
|
Not very "XP" of you - "Always do the least you need to do".
Or, if you want to be REALLY evil, declare them as "assignable typed constants" -- Borland's oldancient concept of "constants" that weren't really constant at all, apparently as a hack(*) at introducing initialized variables to Pascal. (Yes, it's deprecated like all Hell, of course; but the option IS still there, even in Delphi 7.)
But, really, all this [link|http://martinfowler.com/articles/newMethodology.html|"agile methods"] blither is looking more and more convincing to me... Certainly you are agile enough to CHANGE the constants into variables, should the need ever arise? Especially since the change wouldn't be all that big in the first place; the mechanics of file opening and reading and so on would positively dwarf it anyway.
(*): Misguided and best forgotten -- nay, best chopped into microscopic slivers, then burned to cinders and the ashes incinerated AGAIN, then buried under a mile-thick shield of depleted uranium at the bottom of the Marianas trench, and THEN forgotten! -- but, alas, undead like some fucking mummy in a cheesy horror flick.
[link|mailto:MyUserId@MyISP.CountryCode|Christian R. Conrad] (I live in Finland, and my e-mail in-box is at the Saunalahti company.)
You know you're doing good work when you get flamed by an idiot. -- [link|http://www.theregister.co.uk/content/35/34218.html|Andrew Wittbrodt]
|
Post #141,333
2/12/04 3:05:25 AM
|
I'm not very XP, no.
And I compiled that code with fpc, which is available at:
[link|http://www.freepascal.org/|http://www.freepascal.org/]
I dunno what your strange Windows-things do; because they're not free or Free, so I can't obtain them.
Peter [link|http://www.debian.org|Shill For Hire] [link|http://www.kuro5hin.org|There is no K5 Cabal] [link|http://guildenstern.dyndns.org|Home Page - Now with added Zing!]
|
Post #141,337
2/12/04 3:13:13 AM
|
Bullshit, and you (ought to) know it.
PeeWee obstines: I dunno what your strange Windows-things do; because they're not free or Free, so I can't obtain them. Thought I'd mentioned [link|http://bdn.borland.com/museum/|this] often enough.
[link|mailto:MyUserId@MyISP.CountryCode|Christian R. Conrad] (I live in Finland, and my e-mail in-box is at the Saunalahti company.)
You know you're doing good work when you get flamed by an idiot. -- [link|http://www.theregister.co.uk/content/35/34218.html|Andrew Wittbrodt]
|
Post #141,338
2/12/04 3:14:28 AM
|
That's nifty.
Ta, I'll have a rummage.
Peter [link|http://www.debian.org|Shill For Hire] [link|http://www.kuro5hin.org|There is no K5 Cabal] [link|http://guildenstern.dyndns.org|Home Page - Now with added Zing!]
|
Post #141,340
2/12/04 3:18:39 AM
|
That is great!
A museum that insists on touching! Danke!
-drl
|
Post #141,341
2/12/04 3:23:47 AM
|
Sigh
10,000 lines per minute!
Look at the compile times vs. MSC 5.0 - how the hell did we let them win??
[image|http://bdn.borland.com/article/images/20297/turboc.jpg||||]
-drl
|
Post #141,345
2/12/04 3:41:36 AM
|
Heh, look at the magazine quote...
...by Peter Feldman, PC Week; in later days, Peter Coffee at PC Week -- now renamed e-Week -- has been very much gushing about Delphi.
Unless it's the same guy who changed his name, Borland has been very lucky with the Peters at that rag.
[link|mailto:MyUserId@MyISP.CountryCode|Christian R. Conrad] (I live in Finland, and my e-mail in-box is at the Saunalahti company.)
You know you're doing good work when you get flamed by an idiot. -- [link|http://www.theregister.co.uk/content/35/34218.html|Andrew Wittbrodt]
|
Post #141,378
2/12/04 9:41:18 AM
|
It was all about Windows
Borland completely bungled that move.
--
"...and pronounce all four E's in the word 'shit'"
|
Post #141,494
2/12/04 5:23:42 PM
|
Not bungled...
they were fucked by the Vole.
Go back into your history and read up on Shulman's Undocumented Windows. That will completely explain why Borland faltered.
jb4 shrub\ufffdbish (Am., from shrub + rubbish, after the derisive name for America's 43 president; 2003) n. 1. a form of nonsensical political doubletalk wherein the speaker attempts to defend the indefensible by lying, obfuscation, or otherwise misstating that facts; GIBBERISH. 2. any of a collection of utterances from America's putative 43rd president. cf. BULLSHIT
|
Post #141,495
2/12/04 5:27:50 PM
|
Including the use of Buck Forland in the credits.
Alex
The mind is not a vessel to be filled but a fire to be kindled. -- Plutarch
|
Post #141,352
2/12/04 4:48:08 AM
|
Obstines..HeeHee____Guess you obstreps, eh?
|
Post #141,241
2/11/04 6:18:52 PM
|
YYEWWW!
-drl
|