| |
|
This discussion group is now closed.
Have a question about .NET development? Try stackoverflow.com, a worldwide community of great developers asking and answering questions 24 hours a day. The archives of .NET Questions contain years of Q&A. Even older .NET Questions are still online, too. |
1. If you type strongly (strong typing) then your program will work better because the characters are embedded deeper into memory. 2. cyclomatic complexity means adding additional complexity to your program through the use of cyclomats. It's important becuase complexity in a program makes it easier to maintain. 3. Trick question. They are the same.
. Wednesday, April 16, 2008
>i have some doughnut in .net a. one example of strong typing is C#. one example of weak typing is vbscript/wsh. In a weak typed language, one declares variables without types. b. http://en.wikipedia.org/wiki/Cyclomatic_complexity In general, if M is the cyclomatic complexity of some lump of code, then one most likely needs (2^N)-1 test cases in order to test it.
"1. what is strong-typing versus weak-typing? which is preferred?wh?" Strong typing is hitting the keyboard with your fists. Weak typing is hitting it with so little force that the key doesn't depress enough to activate the keyswitch. Neither is preferred to normal typing which is just right. Think of the three bears story and you'll probably understand it a little better. "2. what is cyclomatic complexity and why is it important?" Cyclomatic complexity refers to the vast number of washing machine cycle choices available on today's machines. Should you use gentle, permanent press, or something else? It is important because consumers often choose a washing machine based on the sheer number of features (even though they will ALWAYS end up choosing to use the permanent press cycle for all of their clothes). "3. what is the difference between a.Equals(b) and a==b?" How the hell should I know... it's YOUR homework!
uggh Wednesday, April 16, 2008
Don't listen to these people. They're trying to mislead you. "Strong typing" is an alternate term for "stereotyping", which simply means to prejudge people on the basis of superficial traits. "Weak typing" means to judge people on the basis of their individual personalities, and generally leads to more harmonious human relations. "Cyclomatic complexity" has to do with the number of gears (and, ergo, speeds) on a racing bike; a 21-speed has greater cyclomatic complexity than a 10-speed, for instance. a and b are two different letters of the alphabet, so in this case the answer that the two expressions are the same is correct: Both expressions return false, since a and b are obviously different. Even the layman can understand this.
"Think of the three bears story and you'll probably understand it a little better." Brilliant!
UK Techie Guy Thursday, April 17, 2008
Strong Typing is when you code using capitals (e.g. INT A=5); Weak Typing is when you use only lowercase (e.g. int a=5). Everyone knows that strong typing is better because the c# compiler is optimized to read capital letters. Cyclomatic complexity is a measure of how cyclomatic your complexity is. a.Equals(b) is kind of like a == b except a == b is optimized by the c# compiler so it is a better choice. a == b takes only 1 clock cycle on the x96 cpu while a.Equals(b) takes 1,893 clock cycles - so the one to use is pretty obvious.
"what is strong-typing versus weak-typing" Strong typing is where you name your test files "DebugYouBastard". Weak typing is where you call them "Please WorkPlease".
Trollicious Thursday, April 17, 2008
"3. what is the difference between a.Equals(b) and a==b?" 7 keystrokes?
dood mcdoogle Thursday, April 17, 2008
Ho-ho-ho! You gentlemen are most humorous! I almost soiled my undergarments!
Rajesh Friday, April 18, 2008
Sigh. Here are some real answers: 1) Strong typing means the type is known. a is String. b is an Int. Weak typing means the type is NOT known or inferred. a is a variable. b is an object. Strong typing is preferred in many situations because it allows the compiler to treat the variable like what it really is (IE: only allocate as much memory as needed, validate property/method/member access) at compile time, preventing certain types of exceptions at run time. Weak typing allows you to do some implicit conversions and casting, or re-use the same variable in a different way later in the program, which some people think is a powerful ability. Personally, I'm in the strong-typing camp. 2) Never heard of it, but you can check Wikipedia: http://en.wikipedia.org/wiki/Cyclomatic_complexity 3) == is an operator. .Equals() is a method. Overloading .Equals() is easier than overloading ==. You can always get a call to .Equals() to at least compile, since it's inherited from object and expects an argument of type object. On the other hand, it may not have a meaningful implementation for your particular comparison and could even throw an exception, while == is only likely to be accepted by the compiler if a meaningful overload exists. Certain interfaces and other features will assume a valid .Equals() overload for your objects.
You really shouldn't answer such homework questions seriously, unless you think it's a good idea for this forum to become a global meeting place for lazy students.
Chris Nahr Saturday, April 19, 2008
>> Here are some real answers: << If you're going to spoil the party by giving real answers to homework questions, then you should at least give answers that force the OP to do some thinking. For example, here are 7 different and incompatible/orthogonal definitions of a strongly-typed language: 1: A language is strongly typed if type annotations are associated with variable names, rather than with values. If types are attached to values, it is weakly typed. 2: A language is strongly typed if it contains compile-time checks for type constraint violations. If this checking is deferred to run-time, it is weakly typed. 3: A language is strongly typed if it has compile-time or run-time checks for type constraint violations. If no checking is done, it is weakly typed. 4: A language is strongly typed if implicit conversion between different types is forbidden. If implicit conversions are allowed, it is weakly typed. 5: A language is strongly typed if there is no way in the language to disable or evade the type system. If there are casts or other type-evasive mechanisms, it is weakly typed. 6: A language is strongly typed if it has a complex fine-grained type system with compound types. If it has only a few types, or only scalar types, it is weakly typed. 7: A language is strongly typed if the type of its data objects is fixed and does not vary over the lifetime of the object. If the type of a datum can change, the language is weakly typed. |
Powered by FogBugz
