c# is a good way to learn c

  • Thread starter Thread starter Montrose...
  • Start date Start date
In comp.os.linux.advocacy, Linønut
<linø[email protected]>
wrote
Olaf Baeyens poked his little head through the XP firewall and said:


I believe in { coming on the next line. I solve the scrolling problem in
two ways:

1. Shorter functions.

2. Text so small it makes passers-by wonder why I'm not blind yet.

Heh. Join the club. :-)
Oh, there's a third way:

3. Ignore the IDE and just use a bunch of console windows.

I'll admit I'm of two minds about that, though at this point I've
not seen a good C++ IDE on Linux that has Visual Studio's
capability of autocompletion of function calls.

Not that I've really been looking, admittedly. KDevelop might but
I don't like it too much (I don't like Qt/KDE generally). Glade
is exclusively an interface builder, which makes some sense.
 
Lee said:
Guess what Jeff? I dont care either.

PLONK!

Good move. That's all the Relf troll deserves, the antisocial prick
that he is.

It never ceases to amaze, how more people are always coming-along to
feed the troll, to tell him his quoting sucks, to tell him that his
cross-posting sucks, to tell him his coding sucks, etc, as if they
think they're the first person to inform the troll that he sucks.
 
["Followup-To:" header set to comp.os.linux.advocacy.]
The Ghost In The Machine poked his little head through the XP firewall and said:
I'll admit I'm of two minds about that, though at this point I've
not seen a good C++ IDE on Linux that has Visual Studio's
capability of autocompletion of function calls.

Apparently, vim already has auto-completion, and this site purports to
provide Vim "Intellisense":

http://insenvim.sourceforge.net/

"Welcome to the website of Vim Intellisense. This site provides you the
information about the intellisense for Vim, documentation and on how to
enable intellisense for new languages.

Needless to say intellisense is very helpful while developing the
programs. While developing Java or in .NET (C#) it is not possible to
remember all the interfaces and its methods, APIs etc. The IDE or editor
should help in a way to build programs. Vim helps in so many ways, and
especially the auto-completion is provided by Vim, by default. But it
does not give the intellisense which is beyond auto-completion. I think
most of us know what is intellisense, which is provided by Visual Studio.
It is also called CodeInsight. Intellisense in a broad sense means more.
It can be listing methods, attributes, classes, interfaces, member
variables, local variables, etc, provide online help and may be inline
compilation. But we are not looking into building inline compilation."
 
Alex said:

My experience.
Other people's experience.
Seminars.
Conventions.
Industry magazines and newspapers.

Were you hoping for an URL? Too bad. Use your head, instead.

You can write object-oriented COBOL. You can write GUIs in COBOL.
You can communicate XML across the Internet in COBOL. You can
get COBOL for friggin' .NET! Do you really think businesses are
buying these products just to maintain 20-year-old legacy code?
 
5. One of those very, very smart gurus can write me up a business
The issue is the 'next time'. The c guy would find a way to abstract
and reuse his methods -- so he would constantly decrease his programming
turnaround time, and increase program speed and efficiency.
The VB would be static -- it will always take 2 hours and it will never
run any faster...

Your second statement is true. The VB programmer would always take 2
hours to build his application, and it would always be slow and
piggish.

Unfortunately, your first statement is a common fallacy of the C
programming world (in which I lived for 15 years, by the way). Building
a framework for efficient production of software requires two things: a
smart programmer (let's assume we already have that), and the ability
to anticipate the needs of the business, which means you have to be a
domain expert, too. This is what many C gurus forget: it's not enough
to be a programming whiz. In order to produce a sound architecture for
a system you must also be a business analysis whiz. If you get the
programming right but the business analysis wrong, you produce a
beautiful, elegant application that your users will hate (and
ultimately not use) because it's not what they want. It won't adapt to
future needs, either.

"Architecture is a risk." If you've never heard that phrase before, you
need to read "The Big Ball of Mud" by Foote and Yoder.

http://www.laputan.org/mud/mud.html

Unfortunately, the Big Ball of Mud was "academized" years back to
appeal more to the "powers that be" at the University of Illionois. At
least I assume so because I have a photocopy of the original version,
and it was much kinder to in-the-trenches business developers and much
more jarring to academic sensibilities. Nonetheless, it's still a good
read.

So, point #1 is that it's not enough to be a smart programmer. If
you're a C guru who works 5pm to 4am and doesn't like talking to people
then you're going to end up producing elegant crap that _doesn't_ stand
the test of time because you didn't understand the problem domain well
enough.

Point #2 is that the VB hack, for all of his faults, is standing on the
shoulders of giants, as it were. As dumb as it is,
drag-drop-point-click and he's integrated Windows drag-and-drop, export
to Excel, export to PDF, and myriad other bells and whistles into his
app. Yes, it's a bloated monster, but it allows his business users to
work seamlessly between his little (fat, bloated) app and the rest of
the system they know and understand. The C guy says, "Hey, I can do
that, too! Just give me 3 weeks of sleepless nights to write the 10,000
lines of code to add all of those features...."

As I said, I thank God for C gurus. particularly when I go into a
hospital and put myself inside a CAT scanner, or when I get on board a
fly-by-wire AirBus. However, I wouldn't hire one to write business
software; it's just not he same skill set.

As well, my real-time, picky-detail embedded programming background
makes me vaguely uncomfortable with the VB guy who really has no idea
what's going on under the hood. Nonetheless, I must grudgingly admit
that he can crank out business-ready software that _gets the job done_
and that _his users love_ far faster than I can. If I see him monkeying
with hospital equipment, though, I'm making a hasty exit.
 
As a further note on this topic, a war story from my past.

I spent four years working for a large company (that will remain
nameless), maintaining their billing system. The billing system was
written in C. It processed millions of records in minutes, not hours.
In other words, it ran like spit. Unfortunately, it was a bit difficult
to adapt it to new business requirements, but we were working on that.
While I was there I rewrote the accounting posting engines (also in C)
because the old versions had been written by one of those guys who sold
himself as a C guru but really had no clue (the ones I talked about in
a previous post).

It galled me that every time there was a new business problem, the VP
of systems would always choose the cheapest, nastiest solution to the
problem. The poor system, as creaky was it was, was gradually decaying
even further. "With a bit more manpower and some backing from
management, we could turn this into a really good system," I used to
say to anyone who would listen. The "powers that be" didn't pay the
least heed.

One year before I left they dumped the whole thing and bought a new
system. In effect, they did a radical technology shift.

The object lesson for me was that the VP's strategy was exactly right:
run the old system into the ground. By the time it was ready to fall
over and die, there would be something much newer and much better on
the market. Buy that and dump the old system.

It was a real eye-opener for me. I had never considered that writing
bad software (or badly maintaining software) could be a good idea.
Being a technician at heart, I always wanted to upgrade the existing
stuff to bring it up to current standards. Sometimes, however, "current
standards" race ahead faster than anyone can fix old systems. That's
when you let them tank and save up for a new one. Being a technician, I
had never imagined that there could be a meta-level of software
maintenance: the business management / asset management level, from
which things might look very different.

Now, as I said before, I wouldn't want a hospital running things like
that. ("We'll buy a new system when an unacceptable number of patients
start dying. In the mean time, just hack that sucker!") However, we
weren't in the life-and-death business.

So, there's more to software maintenance and development than simply
writing good code... in any language.
 
But I also found that no one here could produce anything half as
good.

How do you measure "good"?

"Fast"? Perhaps nobody else could produce anything half as fast. I
don't know, but I'll give you at least that much.
"Readable"? Your code is impenetrable. I know C; I'm not bad at C++;
I'm not bad at Java. Your code is hard to read, and therefore hard to
maintain. It's exactly the kind of stuff that I would toss out and
rewrite, not because it didn't work, but because nobody else could
maintain it, which makes it a business risk. Gone.
"Adaptable"? Again, not sure. However, if I can't hire someone who can
understand it after you're gone, it doesn't matter how good your design
was.

As far as speed goes, sometimes throwing hardware at a problem is the
right thing to do. However, (and this comes from my real-time, embedded
programming days) the _right_ way to tune a program for speed is to
design it well, then write it clearly, _then_ profile it and find out
where the problems are. Fix just those parts that are sucking memory
and CPU. Fix the SQL queries that take too long. Leave everything else
alone.

I've seen more programmers waste more time tweaking apps to death to
make them "faster" when in fact they're fixing O(k) code that doesn't
affect resource usage at all. (The worst example being someone who
tweaked program initialization code to "use less CPU" in an app that
spent 1% of its time in the CPU and 95% of its time waiting on database
queries. Talk about a waste of time.)

Again, your code may be great code for certain problem domains.
However, if you're the only one who knows how it works then that makes
it a risk, and I would replace it with slower, less efficient code that
anyone can understand. A bigger box to run it on costs me $10K. A bug
that takes my business down and that nobody can fix because the only
guy who understood the program left two years ago can cost me $1M. You
do the math.
 
Bruce said:
Again, your code may be great code for certain problem domains.
However, if you're the only one who knows how it works then that makes
it a risk, and I would replace it with slower, less efficient code that
anyone can understand. A bigger box to run it on costs me $10K. A bug
that takes my business down and that nobody can fix because the only
guy who understood the program left two years ago can cost me $1M. You
do the math.

Bruce,

This is where I thoroughly disagree with you.

If the cost of something is $1M, then the cost of something is $1M.

A solution that is not a solution that costs $10K is a waste of $10K.

Slow, buggy, cumbersome application servers, that can never be used to
create a production application, are worth $0 dollars, but IT Management
spends billions in the hopes of avoiding paying a programmer $1M.

This is the basic and most fundamental argument of the OSS community at
heart.

OSS is labor.

CSS is capital.

The CSS people will always want to write a centralized model to devalue
the programmer and give management more power.

The OSS people will always want to create a developer centric paradigm.

After 20 years of the Microsoft's, the Oracle's and BEAs' and all the
rest, I am more convinced then ever that the OSS model, which is people
dependent and which increases the value of the guru as well as the basic
application developer, is a /better/ model than the "throw hardware at
it", the "wait until Longhorn ships" model or the "hire a bunch of low
level guys and let them program VB model".

Yahoo! is written in c on BSD.

Google is written in c on linux.

Microsoft Office is built with it's own compiler -- not .NET, not VC++.

Even the companies that create these "platforms" don't use their own
stuff to create these platforms.
 
Hi Bruce_Wood, Re: How my Simple HTM_to_plain_text challenge went unmet,
with only my code producing anything of any quality,

You asked me: << How do you measure good ? >>

Although it would be nice if the code didn't continually free up
a buffer the size of the entire HTML file, like Kelsey's did,
thousands of times ( yes, this makes it slower than hell on ice )...

And it'd also be nice if it understood even the simplest HTML syntax,
it's unforgivable that Kelsey's code totally trashed my homepage.
....something that Firefox, IE, my code,
and any other code that understands HTML... would never do.

Further, Kelsey continually refuses, day after day,
to provide support for his claim that my HTM_TXT.EXE does not work:
http://www.Cotse.NET/users/jeffrelf/HTM_TXT.EXE
http://www.Cotse.NET/users/jeffrelf/HTM_TXT.CPP
http://www.Cotse.NET/users/jeffrelf/HTM_TXT.VCPROJ

No one else, none of the countless Experts here could produce
workable code... despite how trivial the conversion is.
HTM_TXT.CPP just demos a tiny portion of my hyper_custom newsreader, X.CPP .

You concluded: <<
Again, your code may be great code for certain problem domains.
However, if you're the only one who knows how it works then that makes
it a risk, and I would replace it with slower, less efficient code that
anyone can understand. A bigger box to run it on costs me $10K.
A bug that takes my business down and that nobody can fix
because the only guy who understood the program left two years ago
can cost me $1M. You do the math. >>

How many hours/days did you invest in learning my Trite_Tiny code ?

Ten minutes, you say ? Five ? And that's my fault ?

You obviously know nothing about what it takes to code.
 
Hi Spooky ( and Linønut, Olaf )

I used to use 128 colums when writing code and 64 columns when writing here,
all on a maximized window, of course
I now use 80 columns both places, so I don't have to rewrap code I post.
Like this:
http://www.Cotse.NET/users/jeffrelf/X_CPP.PNG

By the way, an IDE is, at it's heart, a debugger and an editor,
neither of which can be adequately addressed by the shell.

By the way,
Your love of auto_completion and auto_formatting makes me want to puke.

Whitespace should be hand_coded, I maintain,
and I don't want suggestions popping out at me while I'm writing.
 
[Snip]
By the way,
Your love of auto_completion and auto_formatting makes me want to puke.

Whitespace should be hand_coded, I maintain,
and I don't want suggestions popping out at me while I'm writing.

Since there is a large disparity between what you think is readable code and
what others think is readable, surely you can accept that there could be a
similar disparity between your concept of good IDE features? Your main aim
seems to be to tweak spaghetti code so that it runs incredibly fast (albeit
with a few bugs here and there), whilst others seem to have the main aim of
producing easily maintainable code in the shortest space of time. Thus auto
completion and auto formatting are not something you want, and are something
others want.

BTW, why have you not yet responded on the bug I found in your code?
 
Hi Sean_Hederman, Sorry about my late reply,
but there are only so many hours in a day, ya know.

The following code Should work in MS_CPP_7_1,
but it doesn't due to a ( ¿ unreported ) bug in MS_CPP_7_1:

typedef unsigned __int8 * uint_8_P ;
__int32 Swap_32 ( __int32 X ) { uint_8_P P = ( uint_8_P ) & X + 4 ;
return * -- P << 24 | * -- P << 16 | * -- P << 8 | * -- P ; }

As I said in another post,
the execution should go left to right but it doesn't
instead it does a P -= 4 first thing.

An interesting anomaly is how this works ( rv is an int ):
( rv = * -- P << 24 ) | ( rv = * -- P << 16 )
but this does not: ( * -- P << 24 ) | ( * -- P << 16 )

As for your:
int swapped = System.Net.IPAddress.NetworkToHostOrder( unswapped );

X.CPP does it like this:
Host_IP.sin_port = htons( Port = Serv->Port );

But that's not what I'd use to convert a .WAV file.
At any rate, it was just a trivial quiz.

By the way, you keep insisting that I care only about fast code,
and I keep insisting that I care only about results.
Code is what it does. Are you projecting ? I imagine so.

As for your claim that my examples aren't readable,
....I won't be blamed for your lack of effort.
 
Hi Bellow,
Re: Me telling Hederman that I prefer Loop() over for(;;),
#define Loop( N ) int J = - 1, LLL = N ; while ( ++ J < LLL )

You told me: << You're certainly winning this debate in my estimation.
The bottom line, after experimenting with Regex, is that the .Net
assemblies cannot be trusted -- as is.

What is .NET really about ?
It's really a business relationship. Microsoft must provide
the trust that a person can use the .Net assemblies and convert to c#
and still get all the speed that would be part of a lower level language.

And if they can't -- then I see no reason to convert !
For example, how can I possibly trust their "automatic garbage collection"
-- how do I know if it's doing the job ? Show us the facts ! >>

I like Loop() because of it's sheer elegance, flexibility and power,
....C# kiddies can't be trusted with power tools like that.

It's as you said, they don't trust You with memory management,
....Why, then, should you trust Them ! ?
 
Hi Back_Of_My_Hand ( and Tom )
Re: How much faster... and flexible... and readable,
my LoopTo(), LoopXx() macros are compared to RegEx,

You told Tom: << C'mon...let's not be sophomoric.
If Relf can write code that is faster than the built in Regex object in
.NET and Microsoft is offering the .Net system as an alternative to
c/c++ programming...then the whole exercise is ridiculous.

It condemns all code written in c# to being substandard.

How can I create a production site or app that uses Regex if I can't be
guaranteed of fast text search ?

And why should I trust any assembly ?
Do I have to vet each and every one of them
to make sure that they do not have defects or faults ?

At least with mono I can see the source
to know what text search algorithm they're using,
I can't even do that with .Net ! >>

Lower level code, like C++ macros, will always be more flexible/powerful.
....in a word... more disciplined.

C#'s dialog and forms editors don't scale well to different screens,
the fonts are sometimes too small or too large,
and the text often doesn't fit into the buttons and dialogs.

What about accessiblity... for people with handicaps ?
What about 30 inch Wide_Screen monitors ?
What about auto-wrapping that never works ?

What about the excessive use of Read_Only text ?

What about endlessly badgering pop-ups ( a.k.a. dialogs ) ?
What about 80 columns of monospaced fonts on a black background, maximized ?
What about dark on dark text ?

The solution is more intelligent, lower level coding,
but few are in a position to pay the price.

Those who do pay the price win my trust, those who don't should be ignored.
 
Hi Hederman, Sorry about the late reply,
Re: typedef unsigned __int8 * uint_8_P ;
__int32 Swap_32 ( __int32 X ) { uint_8_P P = ( uint_8_P ) & X + 4 ;
return * -- P << 24 | * -- P << 16 | * -- P << 8 | * -- P ; }

You wrote: << Ummm, actually it does nothing of the sort.
Swapping the high and low bytes of the number 32 gives me 536870912,
and your result is 538976288. >>

Ever heard of Hex ? 0x81828384 is a better test.
As I've since said in a later post to you,
the code above doesn't work because of a bug in MS_CPP_7_1.

Re: My comment that I've held the same job since mid 1993,
and if you're record was as good.

You replied: << Nope, been headhunted 4 times in that period though. >>

Hmmm... so that's it then, you don't code anything yourself,
you're just a salesman who takes credit for the work of others.

You wrote: << Coding is my sole means of support,
has been since I left varsity, and I live a very comfortable life,
if that's what you're asking. >>

What do you mean by coding ?
Pounding keys or pounding beers with clients ? I think the latter.

Re: #define LOOP while ( 1 )
#define Loop( N ) int J = - 1, LLL = N ; while ( ++ J < LLL )

You asked me: << Um, and having LOOP and Loop defined ?
You don't think that's a bad idea ?
Look, if you want to write BASIC, it's much easier just
to get a BASIC compiler than to try to #define C++ into it. >>

I have no problems differentiating between LOOP and Loop(),
LOOP in fact, does what it does in Modula-2, an early OOP language.

I never used Basic,
but Basic is what started MicroSoft, I'd never talk ill of it.

You asked me: << You honestly believe that drek is readable ?
No comments, spaghetti code,
#define abuse that should be criminal, and non-semantic variable names. >>

Yes, my code is the Most readible.

Learning anyone's code is hard, and few, especially you,
are willing to spend more than a few seconds to learn it,
so your opinions carry no weight.
 
Bruce Wood poked his little head through the XP firewall and said:
As well, my real-time, picky-detail embedded programming background
makes me vaguely uncomfortable with the VB guy who really has no idea
what's going on under the hood. Nonetheless, I must grudgingly admit
that he can crank out business-ready software that _gets the job done_
and that _his users love_ far faster than I can. If I see him monkeying
with hospital equipment, though, I'm making a hasty exit.

The problem with the VB guy is that he makes the pointy-haired bosses think
that all software should get written as fast. And, when it doesn't, they
start pressuring you to use things like VB or LabView.
 
Back By Demand poked his little head through the XP firewall and said:
Yahoo! is written in c on BSD.

Google is written in c on linux.

Microsoft Office is built with it's own compiler -- not .NET, not VC++.

Even the companies that create these "platforms" don't use their own
stuff to create these platforms.

I thought Jim McCarthy (MS C++ team leader years ago and author of "The
Dynamics of Software Development") said that Microsoft ate its own dog-food?

Is what you said about MS Office true about all of their software?
 
Hi Hederman, Re: What to do when C# fails you, You told me: <<
Report it as a bug and/or write your own high-level routine
using low-level C# ( i.e. unsafe code/interop/pinvoke )
just like you would in any programming language. >>

Ha, ha, ha ! ! Without #define ? Not a chance. I wouldn't do it.

Re: My comment that C#'s high level routines are compromises,
where people say: A-a-aw, hell, it's good enough, I'll just go with it.

You replied: << Really ?
Which of the developers of those libraries told you that ? >>

What ! ? You think I can't reject code that I didn't write ?

Re: My comment that C, with it's #define, has stood the test of time,
and will continue to do so long after C# is forgotten,

You told me: << I thought the quality of code was independent of the language.
I can write better code in VB.NET than many people can in C++.
The best language for the job depends on the job,
and frankly I've written business systems in many languages,
and I've found C# to be more than adequate for the job,
and it gives me more productivity than C++. >>

Are you overseeing the coders, or is it you there... twiddling the bits ?
I think it's the former.

I never said that VB.NET wasn't useful to many,
I'm just saying it's not the optimal solution, it's not a tool I'd ever use.

You asked me: << Please, do you really believe that
the more experienced you are the more you tie yourself to one solution ?
Are you trying to assert that
C# developers by definition have less experience than C++ developers ?
Keep in mind that many C# developers come from a C++ background.
I'd say that having a religious devotion to one programming language
is the surest sign of a developers immaturity,
not which language they happen to use. >>

Not being a craftsman yourself,
you don't understand the attachment he gets for his tools.
You don't tell Picasso what type of paint to use.
 
Hi Linonut, Re: Bailo's claim that MicroSoft doesn't use MS_CPP,
You told her: << I thought Jim McCarthy
( MS C++ team leader years ago and author of
" The Dynamics of Software Development " )
said that Microsoft ate its own dog-food ?

Is what you said about MS Office true about all of their software ? >>

Tom Shelton, who has more credibility than Bailo, I'm afraid,
said that the MS_Office team does use MS_CPP,
and, I for one, believe Tom, not Bailo.

There was a time when they didn't, maybe 10 years ago, when Bailo was there.

I know that Visual_Studio and Office, for example, have much code in common.

Using your previous compiler to create your next compiler is a bit weird,
I think, at some point a total rewrite in assembly would be in order,
I assume.
 
Jeff_Relf said:
Hi Hederman, Re: What to do when C# fails you, You told me: <<
Report it as a bug and/or write your own high-level routine
using low-level C# ( i.e. unsafe code/interop/pinvoke )
just like you would in any programming language. >>

Ha, ha, ha ! ! Without #define ? Not a chance. I wouldn't do it.

Just because *you* wouldn't do it, doesn't mean it can't be done.
Re: My comment that C#'s high level routines are compromises,
where people say: A-a-aw, hell, it's good enough, I'll just go with it.

You replied: << Really ?
Which of the developers of those libraries told you that ? >>

What ! ? You think I can't reject code that I didn't write ?

Huh? I'm not sure what you mean here.
Re: My comment that C, with it's #define, has stood the test of time,
and will continue to do so long after C# is forgotten,

You told me: << I thought the quality of code was independent of the
language.
I can write better code in VB.NET than many people can in C++.
The best language for the job depends on the job,
and frankly I've written business systems in many languages,
and I've found C# to be more than adequate for the job,
and it gives me more productivity than C++. >>

Are you overseeing the coders, or is it you there... twiddling the bits ?
I think it's the former.

Both actually.
I never said that VB.NET wasn't useful to many,
I'm just saying it's not the optimal solution, it's not a tool I'd ever
use.

You asked me: << Please, do you really believe that
the more experienced you are the more you tie yourself to one solution ?
Are you trying to assert that
C# developers by definition have less experience than C++ developers ?
Keep in mind that many C# developers come from a C++ background.
I'd say that having a religious devotion to one programming language
is the surest sign of a developers immaturity,
not which language they happen to use. >>

Not being a craftsman yourself,
you don't understand the attachment he gets for his tools.
You don't tell Picasso what type of paint to use.

I like this "Not being a craftsman yourself" business. I'm perfectly aware
of the attachment that a "craftsman" gets for his tools, and I wouldn't
presume to tell you to change yours. What I do object to is your assertion
that your tools are better. As I've pointed out before I've found your code
to be well-nigh unreadable (as have many others), completely abusing #define
in the most horriffic ways, and buggy.

Now you're welcome to do that on your projects, my point is that I doubt
many programmers would want your kind of code in their projects. Please, by
all means carry on programming the way you want, just stop trying to punt
that stuff as a better way of doing things. It's not. It *may* be better in
certain very limited edge cases, but definately not in most cases.
 
Back
Top