473,883 Members | 1,527 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I've Had Enough

I've had enough of C#. I've had enough of using parentheses for every
'if' statement. I've had enough of having to mix assignment of return
value of methods with flow control, making writing code that's both
readable and consistent, impossible.

C# is hindered by its predecessors and the Microsoft marketing
department. If Anders had his way, this language would be a one where
readable code isn't a near impossibility for non-trivial code; but no,
Microsoft marketing and C++/Java got in his way. The evidence is
blatently apparent in the language.

Microsoft, the company where money comes before technology, has struck
again. The repercussions affect us all.
Nov 16 '05
101 4020
Reginald Blue wrote:
[...]
Just promise us that you won't start coding in Cobol.NET.


Well, I've never touched Cobol, so I can't appreciate how horrible it
might be, but I can tell you for certain that I'd never remotely
consider using Fortran! :-)
Nov 16 '05 #41
C# Learner <cs****@learner .here> wrote in news:#g9rpoAHEH A.2576
@TK2MSFTNGP11.p hx.gbl:
I've had enough of C#. I've had enough of using parentheses for every
'if' statement. I've had enough of having to mix assignment of return
value of methods with flow control, making writing code that's both
readable and consistent, impossible.

C# is hindered by its predecessors and the Microsoft marketing
department. If Anders had his way, this language would be a one where
readable code isn't a near impossibility for non-trivial code; but no,
Microsoft marketing and C++/Java got in his way. The evidence is
blatently apparent in the language.

Microsoft, the company where money comes before technology, has struck
again. The repercussions affect us all.


You could always use VB.NET, if you like its constructs better. No-
one is forcing you to use just C#, as VB.NET can do what you want too.
(except a little operator overloading limitations here and there...)

FB
--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP
Nov 16 '05 #42
C# Learner wrote:

Julie wrote:
I'll take the language any day. It is their sucky, buggy, deficient IDE that
gets my goat, day after day.

So far, their IDE can handle "hello world" class projects, but not much more...


The IDE seems pretty solid to me; but I guess it could be a case of
different machines, different setups, etc.

How about a deal: you take the language and I take the IDE ;-P


Consider yourself lucky. Any commercial-scope project is way outside the
bounds of the IDE.

I'm currently working on one solution composed of maybe 30-40 projects of C#,
managed C++, and native C++, with multiple forms, controls, etc.

It is a battle to get through a day w/o numerous restarts due to the piece
getting hung up on itself. As we speak, the compiler can't build a project
because somewhere else the IDE has a file open (in this case, a debugging pdb
file). Closing all files, and even the project/solution doesn't solve the
problem, the only solution is to restart and rebuild.

A *major* piece of crap, but what should I expect, MS is run by a bunch of
snot-nosed adolescents that think they know everything.
Nov 16 '05 #43
C# Learner wrote:
For clarification, the difference with Delphi's returning mechanism is
that there's no need to declare the result variable, and no need to use
'return result;'.


So how then do you exit "early" from a function, if you have checked
input arguments and decided you already know the result without further
processing? Is your only choice to wrap the entire rest of the function
body inside an else block? If so, the code gets very unreadable very
quickly, especially if there multiple possible early exit points from
the function.
Nov 16 '05 #44
Kevin P. Fleming wrote:
C# Learner wrote:
For clarification, the difference with Delphi's returning mechanism is
that there's no need to declare the result variable, and no need to
use 'return result;'.


So how then do you exit "early" from a function, if you have checked
input arguments and decided you already know the result without further
processing? Is your only choice to wrap the entire rest of the function
body inside an else block? If so, the code gets very unreadable very
quickly, especially if there multiple possible early exit points from
the function.


One can exit early if one so chooses, using 'Exit'.

i.e.:

function Foo: Boolean;
begin
Result := True;
if FooBar then
Exit;
//...
end;

Personally, I don't like exiting before the end ever. If the routine is
so complicated that you need to return before the end to avoid a code
mess, I think it needs refactoring. Perhaps my opinion on this is
somewhat biased, though, due to this being a style I've practised for a
long time.
Nov 16 '05 #45

"Julie" <ju***@nospam.c om> wrote in message
news:40******** *******@nospam. com...
C# Learner wrote:

Julie wrote:
> I'll take the language any day. It is their sucky, buggy, deficient
> IDE that
> gets my goat, day after day.
>
> So far, their IDE can handle "hello world" class projects, but not much
> more...
The IDE seems pretty solid to me; but I guess it could be a case of
different machines, different setups, etc.

How about a deal: you take the language and I take the IDE ;-P


Consider yourself lucky. Any commercial-scope project is way outside the
bounds of the IDE.

I'm currently working on one solution composed of maybe 30-40 projects of
C#,
managed C++, and native C++, with multiple forms, controls, etc.

It is a battle to get through a day w/o numerous restarts due to the piece
getting hung up on itself. As we speak, the compiler can't build a
project
because somewhere else the IDE has a file open (in this case, a debugging
pdb
file). Closing all files, and even the project/solution doesn't solve the
problem, the only solution is to restart and rebuild.

Try closing the IDE and deleting the .suo file. This sounds like a known bug
that has been cropping up for quite some time(I seem to recall filing a bug
report myself), there is hope it will be fixed in whidbey, but I don't know
if there was any official word on that and considering how hard it is to
reproduce I couldn't test. Though I havn't run into it in about a year it
does happen and it will drive you nuts. It seems to crop up most commonly
with large C# or C++ projects and *may* be related to the size of an output
assembly. I imagine someone else here knows waht I'm talking about and
remembers more details that I do.
A *major* piece of crap, but what should I expect, MS is run by a bunch of
snot-nosed adolescents that think they know everything.

Not to sound harsh, but you pretty much sound like a know-it-all in all of
your posts. Considering the content of said posts I'd say you have a long
way to go before that attitude is anywhere near correct.
Nov 16 '05 #46
C# Learner wrote:
Personally, I don't like exiting before the end ever. If the routine is
so complicated that you need to return before the end to avoid a code
mess, I think it needs refactoring. Perhaps my opinion on this is
somewhat biased, though, due to this being a style I've practised for a
long time.


Everyone has their own opinions, but think of a simple situation: you're
writing some sort of text parser, and you need a function to take a
token parsed from the file and turn it into an integer value for use
elsewhere in the program. There are many different tokens, of varying
lengths, but they are all known at compile time.

int ParseToken(stri ng token)
{
if (token.Length == 0)
return 0;

switch (token)
{
case "A":
return 1;
case "B":
return 2;
default:
break;
}

if (token.Length < 2)
return 0;

switch (token)
{
case "M1":
return 23;
case "M2":
return 25;
default:
break;
}

etc.
}

Without early returns, this code becomes extremely difficult to read due
to many levels of indentation and extra blocks. Breaking it up into
multiple functions to avoid that would be silly, as it's so simple.
Avoiding the early returns as a matter of "style" causes the code to be
less efficient, as it will continue trying to compare the token against
strings it could never match (granted the compiler may be smart enough
to help out here, or it may not).
Nov 16 '05 #47
Kevin P. Fleming wrote:
[...]

Without early returns, this code becomes extremely difficult to read due
to many levels of indentation and extra blocks. Breaking it up into
multiple functions to avoid that would be silly, as it's so simple.


To be honest, I find the following slight modification which doesn't
return early, much easier to read:

int ParseToken(stri ng token)
{
int result = 0;

if (token.Length > 0)
{
if (token.Length == 1)
{
switch (token)
{
case "A":
result = 1;
case "B":
result = 2;
default:
break;
}
}
else
{
switch (token)
{
case "M1":
result = 23;
case "M2":
result = 25;
default:
break;
}
}
}

etc.

return result;
}

Again, this may just be due to what *I* am used to doing.

<snip>

Regards
Nov 16 '05 #48
C# Learner <cs****@learner .here> wrote:

<snip>
So one can choose either readability or consistency, but not both.
I don't believe that's true.
Here's the above slightly changed to show a more Delphi-like returning
construct:

FontTagElement GetFontTagEleme nt()
{
//...

if (length == SingleElementPa rtCount) {
if (arr[FirstIndex] == FontNameSpecifi er) {
string name = arr[FirstIndex];
result = new FontTagElement( name);
} else {
int size = TryStringToInt( arr[FirstIndex]);
result = new FontTagElement( size);
}
} else if (length == DualElementPart Count) {
string name = arr[FirstIndex];
int size = TryStringToInt( arr[SecondIndex]);

result = new FontTagElement( name, size);
} else {
result = null;
}
}

Voilà -- no loss of readability and no inconsistency!


Actually, I find that less readable than the straight returns, myself.
With returns in the middle of the method, I know that that's the end of
the useful path of that method. However, you can easily make C# behave
like Delphi in that respect, to a large extent. Just declare:

FontTagElement result;
at the top of the method

and

return result;

at the end.

Personally the first thing I'd ditch from the above is the K&R
bracing...

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #49
It's hard to find anyone that knows how to write Threading code without
wrapping themselves in knots. Given that, I find the C/C++ programmers are
much more likely to have a clue on how to write working code in a Threaded
environment. I also find that most VB programmers don't understand the
windows messaging architecture, whereas most C/C++ programmers do
understand.

Of course, there are dud C/C++ programmers, but understanding the foundation
of the windows architecture is important for complex programs. So, as lead
engineer and architect at the company I work for, pointy haired boss and
all, I prefer people with C/C++ experience.

Chris A.R.

"microsoft.publ ic.dotnet.langu ages.csharp"
<an*******@disc ussions.microso ft.com> wrote in message
news:A3******** *************** ***********@mic rosoft.com...
I also disagree with the industry. Many places are going VB.NET because of > the number of VB and ASP developers they are retraining.


terrible. generally speaking, I'd have more faith in Java & C

developers than VB and ASP people. having experienced frustration of
working with these VB and ASP people.
Nov 16 '05 #50

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

123
4029
by: C# Learner | last post by:
I've had enough of C#. I've had enough of using parentheses for every 'if' statement. I've had enough of having to mix assignment of return value of methods with flow control, making writing code that's both readable and consistent, impossible. C# is hindered by its predecessors and the Microsoft marketing department. If Anders had his way, this language would be a one where readable code isn't a near impossibility for non-trivial...
8
270
by: Simon | last post by:
I've had enough of C# Learner. I've had enough of his complaining about using parentheses for every 'if' statement. I've had enough of his complaining about having to mix assignment of return value of methods with flow control, making writing code that's both readable and consistent, impossible. C# Learner is hindered by his complainging about C# being hindered by its predecessors and the Microsoft marketing department. If C# Learner...
0
9932
marktang
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...
0
9777
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,...
0
11109
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10728
jinu1996
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...
1
10833
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10405
tracyyun
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...
0
9558
agi2029
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...
0
5980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3227
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.