|
Actually, that's the reason why I'm no more than OK with most languages: they look far too much like C to ever love them.
That syntactical similarity not only invites mistakes if you have to develop in more than one language, but C-style syntax is "produce code fast, read and understand other people's code slowly". The latter counts just as well for code you yourself wrote more than a couple of months ago.
Formatting/layout rules -- often wrongly referred to as "coding style", something they have absolutely nothing to do with -- were invented to help increase readability, but a programming language that wants to call itself human readable shouldn't NEED such rules.
There are of course plenty of languages that score far worse on human readability than a C-style syntax. APL comes to mind.
|
|
|
|
|
Luc VdV WGG wrote: Formatting/layout rules -- often wrongly referred to as "coding style", something they have absolutely nothing to do with -- were invented to help increase readability, but a programming language that wants to call itself human readable shouldn't NEED such rules. Here, I will disagree. The rules for the language syntax are there for the compiler, not for people. People can arrange it any way they wish.
It can be well done. It can be stupid. Just like, in any language, the code logic, itself.
Just like some people (or even 'shops') insist on Hungarian notation - I hate it - never use it, yet it's supposed to improve readability. I evolved to camel-case, and make the declared names of symbols very descriptive. That's a readability concept in any language: and has nothing to do with the ubiquitous C-style syntax.
The syntax is popular because it relies totally on what the users types - that is to say, if you wish to set off a code block use curly braces. If you wish to end a statement, use a semi-colon (including the statements within a for(...). Compare this to my first language, FORTRAN, and some others that exist today: relying on position and indentation to set off code blocks. A rather unstable concept as far as I've experienced it.
// The way to make code readable is to comment it !
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Because, regularly I use quite multiple languages for various purposes, such as
- C#
- C++
- Shell (on Linux of course)
And I kind of love all of them, there are some other languages, but they are not programming ones (XAML, for instance). But overall, I love what I have and I have what I love.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
And it's moving into mobile as well via Xamarin, which can only be good.
Powerful, flexible, and it makes it easy to write maintainable software (but not impossible to write total rubbish unfortunately).
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
if I serve her well she doing everything me - else she gets a cats with parlous claws
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Misbehave and you'll get a good spanking?
Ah, I see you have the machine that goes ping. This is my favorite. You see we lease it back from the company we sold it to and that way it comes under the monthly current budget and not the capital account.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
...and a phallic object stuck just there!
DURA LEX, SED LEX
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
|
|
|
|
|
It's hard not to love it!
DURA LEX, SED LEX
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
|
|
|
|
|
Been using C# for over a decade (amongst other languages) and still loving it. The language is constantly evolving and bringing out new features.
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
Home | LinkedIn | Google+ | Twitter
|
|
|
|
|
same here.
|
|
|
|
|
Yep! I really love C#. Trouble is my boss insists on using VB.net.
We're philosophical about power outages here. A.C. come, A.C. go.
|
|
|
|
|
C# being in the "C group" of languages, there are a few things that we have to bear over with. Such as why the ... do you have write all condions in parentheses? The "Algol group", such as Pascal, managed without the parentheses, and you never use them in plain writing. ("If (you're cold), then put on a sweater").
And: Why isn't a single statement a block? In some contexts, I can use either a single statement or a block, but not in other contexts (such as exception handlers).
And the extremely ugly 'try - catch' syntax! Compare to, say, CHILL: Any block follwed by an exception handler (indicated by an ON <exception> keyword) before the semicolon is sufiicient - no need for the try "pre-warning", it is implied by the presence of a handler. No need for (yet) another level of {} ...
But after 30+ years with C-class programming, we have learned to live with it.
C# is the best of the crowd, but still I miss a couple of elements from Pascal: First and foremost array dimensioning and indexing. You cannot make an array indexed from 1950 to 2020, as simple and straightforward as we did in Pascal. You cannot index an array by a non-integer value - enums in particular. Enums are not a fully recognized, distinct type as it was in Pascal; it is really not much more than the old #define spring 0; #define summer 1; ... They still have a lot of "integer properties". But they are not integers, either: You cannot declare an array of four elements indexed by the 'season' enumeration type. It is a pity that when enums where included, that they didn't fully copy the Pascal enum concept.
We can manage with the integer/enum bastard concept, and we have learned to live with numbering elements from zero, but they must be mentioned in a "would have been nice to have" list.
I have a couple more "nice to have": In CHILL, a label doesn't name a point, but a block. A function name is a label on the block implementing the function, but you may label any block in the same way. This allows a clean way of, say, exiting through several nested levels of looping: An OuterLoop: ... which contains a MiddleLoop: ... which in turn contains an InnerLoop:... : The inner loop code can EXIT MiddleLoop; directly without setting flags to be tested etc.
Another flow control mechanism in the "nice to have" list: If you prematurely exit a loop, it ususally represents a different situation from running the loop to the end, and neds a different treatment. So a loop may have two exit paths, distinguishing between these two. One proprietary language providing this ("PLANC") had FOR-loops with such a mechanism:
FOR <iteration specification=""> DO
. ... <loop body="" statements="">
. .... WHILE <condition>; // can we skip out now, is the job done?
. ... <more loop="" body="" statements="">
EXITFOR
. ... <handling of="" loop="" exhaustion="">
EXITWHILE
. ... <handling of="" premature="" exit="">
ENDFOR
No need to set flags, no need to test flags, and the two different exits is semantically witin the loop, with access to e.g. loop local variables.
The only way to understand the great value of these nice-to-have things is to work with them and see how useful they are in large, complex code. Any three-line example is always met with replies "But why couldn't you simply do so-and-so?" - yes, for the super-simple illustration, but not for the complex situations where you really benefit from them.
I guess there is no hope of getting any such mechamisms into neither C# nor any other languages in the C group. I have considered, for my private programming, making a preprocessor that would allow me to use both Pascal type indexing, proper enum handling, labeled blocks and handling of premature loop exits, translating it to dirty gotos to generated labels. For my private use, I could do that, but my employer would never tolerate that kind of "private extensions", even with a preprocessor translating it to plain C#.
|
|
|
|
|
Maybe you should try get a job on the C# compiler team
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
Home | LinkedIn | Google+ | Twitter
|
|
|
|
|
I try to do as much C# as I can, but SSIS keeps pulling me back in. (It's not a language.)
|
|
|
|
|
PIEBALDconsult wrote: It's not a language
Yes, it is a sentence.
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
But doesn't SSIS let you do C# now instead of forcing you to do VB?
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Yes, in Script Tasks you can choose to use C# or VB, but a Script Task should be a last resort; they're nasty. (I write a lot of them anyway.)
|
|
|
|
|