|
-
Jun 19th, 2001, 06:07 PM
#1
Thread Starter
Addicted Member
Giving away code.....a drawback
Just an observation that I have seen over and over again.
Many advanced people on this forum will readily post complex code for people that can't even figure out the InStr function.
In some cases I think that is fine, but I also know, from experience, that if you are given the code to solve a difficult problem, and it works, you will probably not take the time to figure out why it works, or how it works, thereby not learning anything.
The code below is an example from my past, I had no clue what it did then, and I still don't, because it worked from day one and has never had a bug (except for commenting out the first If).
This code is very poorly written, so perhaps it's a bad example, but it is a good example of the point I am making.
Code:
Private Function RSEncode(NumRSSyms As Integer, TmpArray() As String, ParitySyms() As String) As Integer
'------------------------------------------------------------------
' This function accepts as inputs the number of input symbols, an
' array where the input symbols are stored and an output array
' where the resulting output symbols are stored.
'------------------------------------------------------------------
'Code supplied by AustraliaPost web site
'SSS 02/99 AU Mail update
Dim N As Integer
Dim i As Integer
Dim j As Integer
ReDim mult(0 To 63, 0 To 63) As Integer 'used for Reed Solomon error correction
ReDim gen(0 To 4) As Integer ' " " " " " "
ReDim temp(31) As Integer
'Static RSInited As Integer
ReDim ParitySyms(0 To 3) As String
'If Not RSInited Then
'RSInit needs to be called once at the start
'Code supplied by AustraliaPost web site
'I don't claim to understand it-SSS
Dim primpoly As Integer
Dim testv As Integer
Dim prevv As Integer
Dim nextv As Integer
'Dim i As Integer
'Dim j As Integer
primpoly = 67 ' a**6 + a + 1 where a (alpha) is 2
testv = 64
For i = 0 To 63
mult(0, i) = 0
mult(1, i) = i
Next i
prevv = 1
For i = 1 To 63
nextv = prevv * 2
If (nextv >= testv) Then
nextv = nextv Xor primpoly
End If
For j = 0 To 63
mult(nextv, j) = mult(prevv, j) * 2
If mult(nextv, j) >= testv Then
mult(nextv, j) = mult(nextv, j) Xor primpoly
End If
Next j
prevv = nextv
Next i
gen(0) = 48
gen(1) = 17
gen(2) = 29
gen(3) = 30
gen(4) = 1
'RSInited = True
'End If
On Error GoTo OOOps
N = NumRSSyms + 4
For i = 0 To 3
temp(i) = 0
Next i
For i = 4 To N - 1
temp(i) = Val(TmpArray(N - 1 - i)) 'Fill in reversed order
Next i
For i = NumRSSyms - 1 To 0 Step -1
For j = 0 To 4
temp(i + j) = temp(i + j) Xor mult(gen(j), temp(i + 4))
Next j
Next i
For i = 0 To 3 ' Fill in the resulting output array
ParitySyms(i) = Str(temp(i))
Next i
RSEncode = 0
On Error GoTo 0
Exit Function
OOOps:
RSEncode = 1
Exit Function
End Function
-
Jun 19th, 2001, 06:15 PM
#2
Registered User
Hmm, those who are really interested in vb will learn it anyway.
Those who aren't won't get too far. But hey, it's great too to examine difficult code and experiment with it. Learning by manipulating.
-
Jun 19th, 2001, 06:17 PM
#3
Hyperactive Member
I'm usually a nice person and would refrain from saying things like this but.........................
You, Sir, have an attitude problem.
My cubemate has answered many questions on this site and invariably you follow immediately afterward with practically the same code with a few variations and some nasty comment about how his code is sloppy code or how his code was much more complex than it needed to be and how does he expect people to learn with such examples or some such nonsense! According to your not very well informed opinion, it's a miracle he has a job if he is such a poor programmer!
I have worked with this man for three years and he is an excellent programmer and is very well paid for what he does. He is also a fine human being who takes his time to teach other people so..........stuff that in your ear!
-
Jun 19th, 2001, 06:19 PM
#4
Thread Starter
Addicted Member
I don't agree, people will learn what they NEED to learn. Especially, if they do it for a living.
Nice sign!
-
Jun 19th, 2001, 06:27 PM
#5
PowerPoster
Originally posted by barrk
I'm usually a nice person and would refrain from saying things like this but.........................
You, Sir, have an attitude problem.
My cubemate has answered many questions on this site and invariably you follow immediately afterward with practically the same code with a few variations and some nasty comment about how his code is sloppy code or how his code was much more complex than it needed to be and how does he expect people to learn with such examples or some such nonsense! According to your not very well informed opinion, it's a miracle he has a job if he is such a poor programmer!
I have worked with this man for three years and he is an excellent programmer and is very well paid for what he does. He is also a fine human being who takes his time to teach other people so..........stuff that in your ear!
Woah! Warpath Katie strikes again! Who is the cubemate?
-
Jun 19th, 2001, 06:30 PM
#6
Thread Starter
Addicted Member
barrk,
I do not have an attitude and I am not attacking anyone. You're reference to your cubemate refers to a very specific thread, and I remember it, overall you are completely incorrect.
Giving code away is NOT the best way to teach someone. The best way is to point them in the right the direction and force then to figure it out on their own, THAT is where retention comes from. Nothing is truely LEARNED until you no longer have to refer to someone elses code (or past code that someone gave you) in order to duplicate it.
I am sure your cubemate is very adept, could you survive without him?
I AM your cubemate in my job, and my cubemate relies on me for answers. I make him work for it, and he is a better programmer because of it.
-
Jun 19th, 2001, 06:35 PM
#7
Hyperactive Member
You don't have an attitude problem but "overall I'm completely incorrect"?????????
Yes, I could survive without my cubemate...he's a very talented young pup but a young pup none the less....and he still teaches me things and vice versa!
I bet you're just a joy to work with if you have that attitude toward your cubemate........the word mate is in there for a reason you know!
I do find it quite interesting that you assume that I am the junior member....could you also be the least bit sexist????
-
Jun 19th, 2001, 06:41 PM
#8
PowerPoster
@"£&^*#!!! You didn't answer!!
could you also be the least bit sexy
Yeah baby yeah, you know it!!!!
-
Jun 19th, 2001, 06:42 PM
#9
Thread Starter
Addicted Member
#1) I meant you were incorrect about me being critical of other peoples code.
#2) I didn't know you were female until that comment, I was typing mine when the last one was posted.
#3) The assumption was my mistake, sorry.
-
Jun 19th, 2001, 06:48 PM
#10
-
Jun 19th, 2001, 07:08 PM
#11
Thread Starter
Addicted Member
Olly,
I can accept that. In the process of replying you emphasized a previous point. If people on this forum are not enthusiastic about what they do, then why supply them with code that someone else has worked hard to develop? Make them expend at least a little effort, many people will come here before they even open a help file. I think that is pure laziness and they don't deserve an answer, in some cases.
I have been forced to learn most of what I know on my own, I know the resources are there.
Dig a little before you ask for help, and you'll be better off because of it.
For those people that don't have help/MSDN.....you're not that serious if you don't want to make the investment for a legal copy.
barrk,
Learn to have a discussion without getting defensive. As for whether or not I am a "joy to work with", coworkers do like me, but more importantly, they respect me. I am never derogitory, but I do make it obvious when someone asks me something that they could easily find on their own with a little effort.
-
Jun 19th, 2001, 07:19 PM
#12
Who is the ciubemate Katie.....another seppo we can indoctrinate into the aussie culture thing.
Olly
Er, your a wild looking dude.
stevess
You got a code snippet from Oz Post. You sick puppy, it was probably to do with the pay tv rollout.
Ok have been given a heap of complex code snippets from time to time here. And have then delved into them line by line to see what they are doing. Generally either ask the poster or some one in our office if can't work out what the hell they are doing.
Anyone that just pastes in 50 lines of code and doesn't bother analysing it, is not a good programmer and is not going to be a good programmer.
Have used both approaches when answering questions. Either posted wads of code, (if currently have it on line), or pointed out a function etc which solves the problem. Or even pointed to a web site where they can get the answer.
So is this a closet thing with you
This posting brought to you by "Forum Fights - another Parksie/Jethro joint venture".
-
Jun 19th, 2001, 07:27 PM
#13
Thread Starter
Addicted Member
Jethro,
Can't understand half of what you said, and don't don't know what point you're making with the other half.
The code I posted I have had had for 2 years and it is in use in the software I support, it is used for generating Australia Post barcodes.
Who is Oz? Never seen any posts by same.
-
Jun 19th, 2001, 07:27 PM
#14
PowerPoster
Originally posted by stevess
For those people that don't have help/MSDN.....you're not that serious if you don't want to make the investment for a legal copy
MSDN is available at support.microsoft.com and msdn.microsoft.com anyway!
Who is the ciubemate Katie
I already asked (see up a few), but she didn't answer, then left.
-
Jun 19th, 2001, 07:30 PM
#15
PowerPoster
Originally posted by stevess
Who is Oz? Never seen any posts by same.
ha ha "Oz" or "Aus" is slang for Australia!! Which planet do you come from?!?
-
Jun 19th, 2001, 07:32 PM
#16
Originally posted by stevess
Jethro,
Can't understand half of what you said, and don't don't know what point you're making with the other half.
The code I posted I have had had for 2 years and it is in use in the software I support, it is used for generating Australia Post barcodes.
Who is Oz? Never seen any posts by same.
Are you for really?
Clearly your powers of analysis leave something to be desired.
Australia = Oz.
Chris
Yeap noticed that, thought l might back you on that one. Currently am thinking it's Dennis...........which would be really weird.
-
Jun 19th, 2001, 07:37 PM
#17
PowerPoster
Yeap noticed that, thought l might back you on that one. Currently am thinking it's Dennis...........which would be really weird
Nah, Dennis is on the East side of the states, she is in Cali on the west, she keeps pointing that out for some reason.
I reckon it's someone we've never heard of that has almost no posts or something and has only just started appearing, or they don't both with General VB or Dbase/FF or CC and so don't see them.
-
Jun 19th, 2001, 07:40 PM
#18
Thread Starter
Addicted Member
Is that the typical code that comes out of "Oz"?
I can only assume that I am out of touch.
Not to brag, but I work on THE #1 software in the world for non-profit fundraising. GreenPeace, AU is one of our clients (and rather vocal), as well as American Red Cross, Unicef, Salvation Army, and 9900 others.
-
Jun 19th, 2001, 07:46 PM
#19
Thread Starter
Addicted Member
Jethro,
"Are you for really?"
Can you speakee English?
What makes you think that people should know that Oz = Aus?
I have worked on software that sells in Aus for 3 years and I have never heard the term.
-
Jun 19th, 2001, 07:48 PM
#20
Originally posted by stevess
Is that the typical code that comes out of "Oz"?
I can only assume that I am out of touch.
Not to brag, but I work on THE #1 software in the world for non-profit fundraising. GreenPeace, AU is one of our clients (and rather vocal), as well as American Red Cross, Unicef, Salvation Army, and 9900 others.
Well that explains things. No Australia Post do not do typical code.Hmmm.....probably why you missed some stuff in previous post, alot of Oz jokes included.
Chris
We just have to keep nagging her. Your probably right, though it could be some one we know who doesn't want to admit he knows katie in the flesh. Er, you know what l mean.
-
Jun 19th, 2001, 07:49 PM
#21
PowerPoster
Well it's a term used in Aus and Britain, so maybe you wouldn't have heard of it, but the aussies definately use it.
-
Jun 19th, 2001, 07:51 PM
#22
PowerPoster
-
Jun 19th, 2001, 07:51 PM
#23
Thread Starter
Addicted Member
I can tell you who she was talking about, give me a minute.
-
Jun 19th, 2001, 08:01 PM
#24
Thread Starter
Addicted Member
You guess who it is.
I can't seem to get this right.....
http://161.58.186.97/showthread.php?...ghlight=amazed
Last edited by stevess; Jun 19th, 2001 at 08:05 PM.
-
Jun 19th, 2001, 08:04 PM
#25
It's telling me the page can't be found.
Ok have given up on needling ya. Now all l need to find out is that your another seppo with a sense of humour.
-
Jun 19th, 2001, 08:06 PM
#26
Thread Starter
Addicted Member
It works now.
What's a seppo?
(More lack of exposure)
-
Jun 19th, 2001, 08:10 PM
#27
PowerPoster
seppo = American
pom or pommie = english
-
Jun 19th, 2001, 08:13 PM
#28
PowerPoster
It's got to be numtel, his location is CA (california) and that's where Katie lives.
-
Jun 19th, 2001, 08:17 PM
#29
Thread Starter
Addicted Member
lol
What is numtel?
I am in South Carolina.
Humbly, a stupid seppo.
-
Jun 19th, 2001, 08:26 PM
#30
Originally posted by stevess
lol
What is numtel?
I am in South Carolina.
Humbly, a stupid seppo.
Could also be Eer3 whose location is also CA.
Sorry Dude,
Oz slang
Spectic Tank -> Yank -> Seppo
Now for the 250,000 question
What is a Noah?
-
Jun 19th, 2001, 08:39 PM
#31
Thread Starter
Addicted Member
-
Jun 19th, 2001, 08:50 PM
#32
Oops spelling mistake...lets try that again
Septic Tank -> Yank -> Seppo.
Of course we are off the subject, and we haven't start on the smut yet
-
Jun 19th, 2001, 09:19 PM
#33
Hyperactive Member
Grumble Grumble.... typical, I miss all the good fights......
Personally, I learned to program from reading examples (there weren't any books available for the languages I was using (Hewlett Packard C and Basic back in 1978 odds... both very syntax specific), and it was very instructional. I always try to post code examples as I think it gives a cleaner answer. if the person wants ot learn they will try to find out why the code works the way it does.
Just my two pennies,
SD
"I'd rather have a full bottle in front of me than a full frontal lobotomy!"
-
Jun 20th, 2001, 08:00 AM
#34
Frenzied Member
Damn, I miss the good shows, too. Three points for Katie. Sorry, Steve, but have allegainces, besides, I disagree with you, and here is why.
I learned C++ in university. I learned assembly on the 68K. I've done real programming, I understand the logic and OO and memory management and clock cycles on a very good level. VB is not a very advanced language. It is not a very good language. I'm using VB, VBScript for ASP, and JavaScript. Of these three, I have the most respect for JavaScript, and that is shakey since it is hard to get cross the board compliance to standards.
Anyway... it is much faster for me now to reverse engineer any code that you may have. I already know how to program. I just need to know the syntax and functions particular to VB/VBScript.
Now, as to others... well... if they are using VB, I find it hard to believe they are truely in it to learn the subtle side of programming. VB is a very corse, messy way to do things, and it is grossly platform specific.
Now, give me a moment and I'll rewrite you code. We can all make it nice and pretty, and discuss why we are doing what we are doing. Those who want to learn can learn from that.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Jun 20th, 2001, 08:29 AM
#35
Hyperactive Member
Originally posted by CiberTHuG
VB is a very corse, messy way to do things,
Sounds like my sex life
"I'd rather have a full bottle in front of me than a full frontal lobotomy!"
-
Jun 20th, 2001, 08:39 AM
#36
Frenzied Member
Ah, those were the good old days.
Anticipated response from SD: What, you enjoyed my sex life?
Ah... having a sex life, those were the good old days.
So, SD, do you have a Mullet Hair Daemon?
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Jun 20th, 2001, 09:04 AM
#37
Frenzied Member
Okay, so I'm mulling through the code. Yes, it could look cleaner, and it could everything declared better, and it could have avoided the use of the label, but... what is it doing? The code is very messy simply because this particular algorithm requires the massive shuffling of array values. I'd hope there is a way to avoid that, but it would require knowledge of Reed Solomon encoding.
My biggest change would be to not ask for NumRSSyms. If I'm correct, NumRSSyms is just the UBound for TmpArray.
*shrug*
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Jun 20th, 2001, 09:53 AM
#38
Hyperactive Member
Originally posted by CiberTHuG
So, SD, do you have a Mullet Hair Daemon?
Yes! It's rather fetching isn't it! 
SD
"I'd rather have a full bottle in front of me than a full frontal lobotomy!"
-
Jun 20th, 2001, 12:36 PM
#39
Frenzied Member
I am Southern, I am not a Redneck.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Jun 20th, 2001, 12:37 PM
#40
Monday Morning Lunatic
Aha new friends of Katie's join the...party
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|