|
For one, there is never a wrong time to care about what you do, love, enjoy or your job.
For two, forget the place, it is just a statistic you obviously failed to grasp (reading the forum name helps)
"My issue" is just the right attitude that precisely led to much of the mess out there you're watching.. and will keep watching for some time, movie called: le mega-culling of overhead (Part 1- Falcon Returns)!
Btw, I only mail to myself
|
|
|
|
|
Chris Maunder wrote: but for the moment we're busy whining about the keywords
Darn, we got caught.
|
|
|
|
|
As an aside I was explaining the programming language I had written to one of the senior managers recently. I was explaining the use of logical operator such as And, Or, Not etc. when she suddenly looked inspired and asked me if the language could have a "But" operator.
|
|
|
|
|
Just curious, what would that "But" operator do?
|
|
|
|
|
|
a little bonus of less typing is IMHO nothing compared to subtle bugs you may enounter. Consider simple classes:
class A
{
public string Name;
public string foo();
}
class B
{
public string foo();
public void bar()
{
A a = new A();
with A
{
Name = foo();
}
}
}
now decorate above classes with bunch of other methods and properties and good luck finding very subtle bug. Especially if A.foo() and B.foo() are almost the same...
--
"My software never has bugs. It just develops random features."
|
|
|
|
|
Mariusz Wojsyk wrote: now decorate above classes with bunch of other methods and properties and good luck finding very subtle bug.
Actually, if you're used to a With construct it's not hard to figure out. I've used it for years when in classic VB and never once encountered this subtle bug when even using nested Withs without easily being able to recognize what goes where. Maybe if you spread them out ten miles long it would be harder to notice, but that's the fault of the programmer more so than the construct.
|
|
|
|
|
Actually, your usage of With (at least from a VB point of view) is incorrect. That example wouldn't compile, even under VB.
The key to using the With construct is that the members are prepended with a dot. eg:
with A
{
.Name = .foo()
}
Or
with A
{
.Name = foo()
}
Your example would receive a compiler error at "Name" because class B doesn't have a "Name" property.
Agreed that the initial problem still exists (i.e. ".foo()" and "foo()" are indeed rather similar looking), but as someone with a VB background I can assure you that as you use it more, you get real sensitive to missing dots in a With construct.
|
|
|
|
|
I dropped VB like a rotten [insert fruit] when Version 4 came out
and have not had time for anything but perfecting my C++ since.
Certainly no time for C Pound Sign, my API's don't work in it.
(Mayhap they do, but who has time to check?)
You are missing a default routine in your poll for the 'none of
the above' case. Only those who use both languages will both
understand the question and care about the answer. Surely even
a "Don't really care" and/or "What is that?" choice would have
actually added valid data points to your poll.
Did you know C++ .NET will still run on WinNT Version 4.0?
|
|
|
|
|
In c++ the default case isn't required unlike .NET languages.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
What default case? In a switch statement? Where is it required?
|
|
|
|
|
hey, it was funnier when I wrote it, however, I am not responsible for any posts I make after 8pm.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Seems unlikely. Consider yourself on double-secret probation.
|
|
|
|
|
NotUnique wrote: Surely even
a "Don't really care" and/or "What is that?" choice would have
actually added valid data points to your poll.
You're in .NET land though, so tread carefully.
NotUnique wrote: Did you know C++ .NET will still run on WinNT Version 4.0?
Well, I'm no .NET fan, but I do think it's time for an upgrade. lol Unless you have clients running it or something.
|
|
|
|
|
I write for AutoCAD using the ARX API. Users are Structural Engineers, not tending to be early adopters. They run from Win ME, WinNT and up, nine versions of AutoCAD from 2000 up.
I code a dll for AutoCAD 2000, 2000i, and 2002 in VS C++ 6.0 under Win2000 and test. 160 custom classes and 29 dialog boxes. There are also six satellite executables that are only compiled in 6.0 that are called by the dll as required.
I port the dll to .NET (or Version 7 C++ if you prefer) and recompile for AutoCAD 2004, 2005, and 2006. That runs for testing on Win NT 4.0 with 128 Meg of memory, just to make sure the program is lean enough.
Then I port to VS C++ 2005 in XP and recompile under UNICODE for 2007, 2008, 2009. The final install disk contains three installs, one for each grouping.
Then I get complaints from Engineers that the program won't run on AutoCAD R14, circa 1998.
|
|
|
|
|
Then you should refactor your code.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
If you need sub-function-level blocks...
---- You're right.
These facts that you've laid out totally contradict the wild ramblings that I pulled off the back of cornflakes packets .
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: Then you should refactor your code.
It's meant to save typing. Refactoring (design) has nothing to do with that unless by refactoring you intend to rename every class a single letter or something.
|
|
|
|
|
One of the fundamental principles of Object Oriented design is data hiding. If you are directly accessing members outside of a class then you are violating a philosophy and your code can be rewritten to be more maintainable. The reason with is so popular is the same reason MS is on the everything must be public tirade and both of which are poor design concepts IMHO.
The long and the short of it, is that if you want VB specific functionality use VB; don't alter C# until there is only one language. Furthermore, if saving typing concern is the primary concern of a Software Developer he or she is in the wrong field. While I have an excellent typing speed I spend 90% of my day thinking, not typing and the result is far better than if I had spent the entire day typing alone. No amount of feature that reduces the amount I have to type will save me work, save a complete layer generator.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: One of the fundamental principles of Object Oriented design is data hiding. If you are directly accessing members outside of a class then you are violating a philosophy and your code can be rewritten to be more maintainable.
Which has nothing to do with the point. You can and should access members inside the class or friend classes etc, unless you never access members at all except within the same class. In which case, there's no point even writing them as the class is virtually unusable. Furthermore, public members aren't all that bad they just shouldn't be abused. And lastly, you can use this on just more on a public member.
Sorry, but this is apples to oranges. It's a language construct meant as a shortcut to save typing. There's no reason the idea of refactoring should even come into play as a reason to not use it. Granted, you can write some horrid code by abusing it, but the again there's a lot of ways to do that in any environment.
|
|
|
|
|
If you are accessing members in a class you do not need with as you are already withing the namespace.
If you are accessing members outside of a class you have to ask yourself the question ... Can these operations be contained within this class rather than requiring my code to have intimate knowledge of the class, 9 times out of ten the answer is yes. In which case using the with keyword is more typing as it would only be one line of code to instruct the class to do it's operation.
Bottom line: In any case where someone is using a with there is a manner in which to write the code without the with that is better engineered.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: If you are accessing members in a class you do not need with as you are already withing the namespace.
Not if the class is a friend. Of course, I assume C# has that concept.
Ennis Ray Lynch, Jr. wrote: If you are accessing members outside of a class you have to ask yourself the question ... Can these operations be contained within this class rather than requiring my code to have intimate knowledge of the class, 9 times out of ten the answer is yes. In which case using the with keyword is more typing as it would only be one line of code to instruct the class to do it's operation.
Even with using 90% (which I doubt unless you only use crap code) that means one out of ten times you don't need to refactor it, and it might save you some typing.
Ennis Ray Lynch, Jr. wrote: Bottom line: In any case where someone is using a with there is a manner in which to write the code without the with that is better engineered.
Except in your 10% example.
I'm all for refactoring, but you cannot claim public or friend members will never be used otherwise it's a bad design. The fact is, they are there, and if some people can't design well it doesn't mean we shouldn't save typing when we need to access one.
It's also a quick and handy way to avoid a name space clash if you need something down and dirty real quick.
|
|
|
|
|
My claim is that in all cases you can write a better design without with than with with. To refute my claim I challenge you to come up with a scenario that shows otherwise.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Because you can't refactor someone else's code (say .NET BCL classes), and you may still need to populate multiple properties at once.
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: My claim is that in all cases you can write a better design without with than with with. To refute my claim I challenge you to come up with a scenario that shows otherwise.
I'll use a pseudocode since I don't do C#...
MyWindow.Title = "blah";
MyWindow.Width = 640;
MyWindow.Height = 480;
MyWindow.BackgroundColor = Green;
MyEmployee.DoAction(Fire);
MyEmployee.DoAction(TellEmployeHesNotFired);
MyEmployee.GetAction(EmployeePissedOff);
MyEmployee.DoAction(TellEmployeeToTakeAJoke);
Would you care to explain to me how you intend to refactor that to make the window and employee classes not need those public methods/properties it uses to interact with them? Or do you still contend that using any public method is a bad design? I don't, because I'm not sure how you could otherwise use a class outside of creating an object.
|
|
|
|