Time for a new programming language paradigm
-
The bug was embedded deep within an error recovery routine that got invoked maybe once every 2-3 weeks with the result that the system would crash with little evidence as to why. It had been written by a programmer who had moved on to the next project.
Sorry. I was harsh. However, a decent language such as my current favorite, C#, almost always catches such things. Eg,
int i = 9;
int j = 10; // or 9, or 8 or whatever
if (i = j)
{
DoSomething();
}... won't compile. I've been writing code since '81. I cannot find anything to complain about with C#. EVERY other language I've used, not so.
-
Just spent the better part of two weeks trying to find a bug in a Linux bash script (missing ".") and I'm tired of looking for things like a missing equal sign in the middle of an C if statement, missing period in a PHP script, lower case variable name mixed with an upper case variable name, missing brace in a C++ object, undelared function or operator overloading....get my drift?...in other people's code. (Being the perfect programmer, I never make those kinds of mistakes! And I have swamp property if you're interested.) All too many programming errors are occurring because programming languages, like C, C++, java, etc., trace their origins back to the days when terseness was a desirable quality. Printing a program listing on an ASR 33 teletype at 10 CPS on a single threaded machine made using braces in C if statements instead of a clear if-then-else-endif highly desirable. (Remember the origins of C?) Those extra 9 characters took TIME to read in and to print out. And then there's issues of language diversity. C, C++, PHP, Java, Javascript, HTML, CSS, SQL, and other languages--what works where? So, here's a few of my thoughts: (And please don't be too anal about my examples--I really want to hear how programming languages could be advanced so that I can be more productive.) Among other things, a New Programming Language should: 1) Be clear and obvious in describing the functionality of the module. The resulting code should almost be language like. A sentence like "If (A equals 10) then print B as "xx.xx" else B = 0 end". But, that statement might also be written in a more mathematical syntax (like Fortran) as "If (A = 10) then....". Note the "=" in the second statement does NOT have the implied assignment and resulting TRUE logical decision (Spent 6 months chasing THAT bug!). 2) The language should be portable. The language should be executable as an interpreted, compiled, scripted or shell'ed running under most commonly available OS's and browsers. Perhaps Interpreted for testing, Compiled for execution speed, scripted for portability or shell'ed for utility work. Take features from scripting languages like Powershell, bash, incorporate execution speed of C, objectivity of Java or C++ and put them under one roof. Write a module that runs under IE, Firefox, Chrome, Opera, Windows, Linux, BSD, OS X, or anything else. 3) The code should be almost self-documenting. Nothing I hate worse than to have to go looking for the a type declaration, a
rjmoses wrote:
trace their origins back to the days when terseness was a desirable quality.
First, compilers (of which interpreters are just a subset) have deterministic requirements that cannot and should not be circumvented. Thus certain language constructs exist to insure that there is no ambiguity. And this is a feature of compilers (specifically compiler theory) and not just some misunderstanding by the author of the language. Second, terseness serves another need in that communications requires one to transfers thoughts to the computer. Increasing the verbosity would decrease the rate at which that can occur. Third one must be aware that no language can be perfect and no user of that language can be perfect either thus the compiler must strive to report errors to the best of its ability. At least in my experience doing that is one of the hardest parts of writing a compiler. Fourth languages are meant to serve different purposes and no one language can meet the needs of all possible uses without adding complexity that circumvents the original desire for simplicity.
rjmoses wrote:
Among other things, a New Programming Language should:
There are a large number new programming languages created every year and presumably many start with the idea that they are going to be 'better' than what already exists. Many, many, fail to achieve that goal. So many that one can bet that not even one language introduced within one year will ever achieve anymore than a very, very small niche (even that is due to promotion by the author rather than acceptance.) But you could venture forth into that realm yourself. However, if you haven't ever done so or haven't done so recently, you might want to learn a little about compiler theory first. It helps.
-
I just did my 29th update to Firefox the other day. It took me about 3 hours to get it back to where it was. Windows 7 keeps bugging about "New updates are ready to install". And Adobe Acrobat keeps crashing.... My point is: How can the programming process be improved? Such that we don't have 29 versions of FF? Or weekly updates ready to be installed. Or "Should a crash report be sent..."?
rjmoses wrote:
How can the programming process be improved?
First you identify whether you're attacking the right thing; it's not due to the language that Acrobat behaves the way it does.
rjmoses wrote:
How can the programming process be improved?
Seriously?
- Start educating people. No, don't send them to an expensive 5-day course where they learn to parrot the most used words, but educate them.
- Kick marketing and sales out of the IT-room.
- Drop agile ad hoc methods.
- Force the boss to use the product on a daily base just as an end-user would use it.
- Care about your product.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
I think the crux of the problem is that we need Service Pack 1 on the Human OS, but this runs the risk of breaking 'being human'. The alternative is the embedded artificial intelligence into all machines so they know to do what we 'meant', not what we 'said'.
Sould note that when Programming (talking to) humans is much education between Chemists and physicists. Agree we need a pretty good AI to take over the details of creating a program and avoiding the failures of precision (as in missing commas etc.)but the AI needs to be able to learn how we think. And we write math using integer to real and back quite often and only occasionally blow the wad. Think about translating the gibs free energy - from chemistry - to the conservation of energy as in all else. Confuse those two and the barn goes up in a hot one. One damn smart computer to follow us into our thousands of specialties.:cool:
-
Just spent the better part of two weeks trying to find a bug in a Linux bash script (missing ".") and I'm tired of looking for things like a missing equal sign in the middle of an C if statement, missing period in a PHP script, lower case variable name mixed with an upper case variable name, missing brace in a C++ object, undelared function or operator overloading....get my drift?...in other people's code. (Being the perfect programmer, I never make those kinds of mistakes! And I have swamp property if you're interested.) All too many programming errors are occurring because programming languages, like C, C++, java, etc., trace their origins back to the days when terseness was a desirable quality. Printing a program listing on an ASR 33 teletype at 10 CPS on a single threaded machine made using braces in C if statements instead of a clear if-then-else-endif highly desirable. (Remember the origins of C?) Those extra 9 characters took TIME to read in and to print out. And then there's issues of language diversity. C, C++, PHP, Java, Javascript, HTML, CSS, SQL, and other languages--what works where? So, here's a few of my thoughts: (And please don't be too anal about my examples--I really want to hear how programming languages could be advanced so that I can be more productive.) Among other things, a New Programming Language should: 1) Be clear and obvious in describing the functionality of the module. The resulting code should almost be language like. A sentence like "If (A equals 10) then print B as "xx.xx" else B = 0 end". But, that statement might also be written in a more mathematical syntax (like Fortran) as "If (A = 10) then....". Note the "=" in the second statement does NOT have the implied assignment and resulting TRUE logical decision (Spent 6 months chasing THAT bug!). 2) The language should be portable. The language should be executable as an interpreted, compiled, scripted or shell'ed running under most commonly available OS's and browsers. Perhaps Interpreted for testing, Compiled for execution speed, scripted for portability or shell'ed for utility work. Take features from scripting languages like Powershell, bash, incorporate execution speed of C, objectivity of Java or C++ and put them under one roof. Write a module that runs under IE, Firefox, Chrome, Opera, Windows, Linux, BSD, OS X, or anything else. 3) The code should be almost self-documenting. Nothing I hate worse than to have to go looking for the a type declaration, a
It's time to scratch all other languages and just leave C++ alone. Honestly, I used to write in many diff languages - about 18 of them. And you know what? I got tired. Every few months there is new, "latest and greatest" mumbo-jumbo that employers jump onto - hey, look, new buzzword. And poor programmers have to "learn", i.e. stuff into their heads that "new" APIs, new language things - just to have them to disappear in another few months for another mumbo-jumbo. Enough for me. I don't want to waste my life permanently studing things that will gone few months down the road. And, even if they stay - sorry, no. I chose C++, get great at it, and keep it that way.
-
Colborne_Greg wrote:
All of my code is self documenting enough that maintenance well never happens because it was written clear and concise to begin with.
Okay, here's my challenge: Find the error(s) in your above statement.
I failed English, I started programming before I started highschool, its like I think in code, then have to translate to English
-
I failed English, I started programming before I started highschool, its like I think in code, then have to translate to English
-
After two decades of cobol I am ready to chuck it out the window
After three decades of COBOL and more languages than I have fingers and toes, COBOL still is the language that comes the closest to the ideal that rjmoses described.
-
So... what you want is a common business oriented language? COBOL it is!
COBOL was the first thing that came to my mind. After working through all of the fancy toy languages from Lisp to C#, it still remains the most readable and "natural" in my experience.
-
Not to be a smart-a$$, but if you failed English, how can I as a user/buyer/customer/manager of your software be reasonably assured that you understood the requirements well-enough to implement them accurately?
I've only met one project managers, one client, and two senior developers capable of giving concise requirements. If a client say "this needs to be for each item", when really they mean "this needs to be shared by all items", then no understanding of English will help. Only an understanding on the clients business will help, that way you can understand what they mean even though it's not what they said.
-
After three decades of COBOL and more languages than I have fingers and toes, COBOL still is the language that comes the closest to the ideal that rjmoses described.
in your opinion
-
Not to be a smart-a$$, but if you failed English, how can I as a user/buyer/customer/manager of your software be reasonably assured that you understood the requirements well-enough to implement them accurately?
As a owner of two companies I don't see your point, and if I was stupid enough not to have someone go over my work before trying to sell an app well it wont make money will it. Grade 12 math ability in grade 2... English is for communications, it means nothing to the end result, unless English is the only way possible for you to understand something, then I would be worried more about you.
-
Smalltalk?
Indeed, SmallTalk ! I suspect many of the newly-minted prophets-with-visions on this thread would gasp if they knew what SmallTalk was capable of in 1968, and what software development tools were like at Xerox PARC at that time. Of course, the expen$ive hardware needed to run SmallTalk was not available to mere mortals.
“I'm an artist: it's self evident that word implies looking for something all the time without ever finding it in full. It is the opposite of saying : ‘I know all about it. I've already found it.’ As far as I'm concerned, the word means: ‘I am looking. I am hunting for it. I am deeply involved.’” Vincent Van Gogh
-
rjmoses wrote:
trace their origins back to the days when terseness was a desirable quality.
First, compilers (of which interpreters are just a subset) have deterministic requirements that cannot and should not be circumvented. Thus certain language constructs exist to insure that there is no ambiguity. And this is a feature of compilers (specifically compiler theory) and not just some misunderstanding by the author of the language. Second, terseness serves another need in that communications requires one to transfers thoughts to the computer. Increasing the verbosity would decrease the rate at which that can occur. Third one must be aware that no language can be perfect and no user of that language can be perfect either thus the compiler must strive to report errors to the best of its ability. At least in my experience doing that is one of the hardest parts of writing a compiler. Fourth languages are meant to serve different purposes and no one language can meet the needs of all possible uses without adding complexity that circumvents the original desire for simplicity.
rjmoses wrote:
Among other things, a New Programming Language should:
There are a large number new programming languages created every year and presumably many start with the idea that they are going to be 'better' than what already exists. Many, many, fail to achieve that goal. So many that one can bet that not even one language introduced within one year will ever achieve anymore than a very, very small niche (even that is due to promotion by the author rather than acceptance.) But you could venture forth into that realm yourself. However, if you haven't ever done so or haven't done so recently, you might want to learn a little about compiler theory first. It helps.
Very eloquently said, Sir !
“I'm an artist: it's self evident that word implies looking for something all the time without ever finding it in full. It is the opposite of saying : ‘I know all about it. I've already found it.’ As far as I'm concerned, the word means: ‘I am looking. I am hunting for it. I am deeply involved.’” Vincent Van Gogh
-
Just spent the better part of two weeks trying to find a bug in a Linux bash script (missing ".") and I'm tired of looking for things like a missing equal sign in the middle of an C if statement, missing period in a PHP script, lower case variable name mixed with an upper case variable name, missing brace in a C++ object, undelared function or operator overloading....get my drift?...in other people's code. (Being the perfect programmer, I never make those kinds of mistakes! And I have swamp property if you're interested.) All too many programming errors are occurring because programming languages, like C, C++, java, etc., trace their origins back to the days when terseness was a desirable quality. Printing a program listing on an ASR 33 teletype at 10 CPS on a single threaded machine made using braces in C if statements instead of a clear if-then-else-endif highly desirable. (Remember the origins of C?) Those extra 9 characters took TIME to read in and to print out. And then there's issues of language diversity. C, C++, PHP, Java, Javascript, HTML, CSS, SQL, and other languages--what works where? So, here's a few of my thoughts: (And please don't be too anal about my examples--I really want to hear how programming languages could be advanced so that I can be more productive.) Among other things, a New Programming Language should: 1) Be clear and obvious in describing the functionality of the module. The resulting code should almost be language like. A sentence like "If (A equals 10) then print B as "xx.xx" else B = 0 end". But, that statement might also be written in a more mathematical syntax (like Fortran) as "If (A = 10) then....". Note the "=" in the second statement does NOT have the implied assignment and resulting TRUE logical decision (Spent 6 months chasing THAT bug!). 2) The language should be portable. The language should be executable as an interpreted, compiled, scripted or shell'ed running under most commonly available OS's and browsers. Perhaps Interpreted for testing, Compiled for execution speed, scripted for portability or shell'ed for utility work. Take features from scripting languages like Powershell, bash, incorporate execution speed of C, objectivity of Java or C++ and put them under one roof. Write a module that runs under IE, Firefox, Chrome, Opera, Windows, Linux, BSD, OS X, or anything else. 3) The code should be almost self-documenting. Nothing I hate worse than to have to go looking for the a type declaration, a
I agree wholeheartedly with your sentiment about perversely curt languages. 1) Your 'FORTRAN' = example is highly flawed. It would read: IF (X.EQ.Y) ... No assignment confusion at all. 2) VB.NET is the answer to most of your woes. Not C#, as it suffers far too much from the legacy of the dreadful C & C++ abortions.
-
My thoughts exactly, except portability part. I work in VB.NET, have weak typing, good descriptive code etc... And recently I had a discussion with a colleague who prefers C# who espouses "real" programming, symbols instead of words for start/end of function etc...until we got to code review and I got to see: while () { ... ... if () { ... ... break; } // end if ... } // end while :-\ I didn't call him on it, really :cool:
I intend to live forever. Or die trying.
The brace matching of Visual Assist is good enough that I usually don't need to do this. However, I often comment the else node in larger if constructs to keep track of the conditions needed to get there. Something like this:
if (a > 0)
{
if (b > 0)
{
...
}
else // a > 0 && b <= 0
{
...
}
}
else // a <= 0, b not tested
{
...
}The good thing about pessimism is, that you are always either right or pleasently surprised.
-
BobJanova wrote:
if(a == 5) { DoSomeStuff(); }
Take away one '=' in the if statement, put it in a seldom used error recovery routine and you have the bug I spent six months chasing. The mental skills required to spot the difference between '=' and '==' is difficult overcome when you are under pressure. I also chased a bug where a statement was inserted between the closing parenthesis and the opening brace, thus changing the entire program flow. (if (a == b) dosomethingnew; { dosomething }; What I want is to be able to look at a piece of code and accurately comprehend the meaning, intention and function of what the original programmer was trying to convey. "if a is 5..." can be a lot clearer than "if (a=5)..." in many cases. And, I'm not suggesting allowing mixed language constructs that do the same thing, although that is not out of the picture. And, as you stated so well, the machine requires precision. I agree! The question I'm raising is: How can we design a programming language that is easier, more accurate, less error prone, easier to modify, etc.?
Well, the weak typing you suggest probably isn't less error-prone. Consider this for example.
S = 12; // no type specified -> int
.
.
.
S += 34; // arithmetic operation
.
.
.
print S; // writes: 46Now someone else comes and hijacks the variable in between.
S = 12; // no type specified -> int
.
.
.
String tmp = S; // save the variable
S = "Test";
...
S = tmp; // restore it, but S is "12" now
.
.
.
S += 34; // oops, now a concatanation
.
.
.
print S; // writes: 1234How long will it take you to find this?
The good thing about pessimism is, that you are always either right or pleasently surprised.
-
20 years of programming in Cobol, C++, and html The language that meets your requirements is Visual Basic 2013. Everything that C++ can do Visual Basic 2013 can do. Here is an example of code, with no documentation, lets see if you can figure out what it does.
Public Interface iArray(Of someType)
Event ItemAdded(ByRef Item As someType)Sub AddRange(Range() As someType) Function Clear() As someType() Property Collected() As someType() Function Count() As Int64 Property Item(Index As Int64) As someType WriteOnly Property NewItem() As someType WriteOnly Property NewItems As someType() Property Populated As Boolean Function LastIndex() As Int64
End Interface
<Serializable>
Partial Public Class Array(Of SomeType)
Implements iArray(Of SomeType)Private mCollected() As SomeType Private mPopulated As Boolean Public Event ItemAdded(ByRef Item As SomeType) Implements iArray(Of SomeType).ItemAdded Public Property Collected() As SomeType() Implements iArray(Of SomeType).Collected Get If mCollected Is Nothing Then mCollected = New SomeType() {} Return mCollected End Get Set(value As SomeType()) mCollected = value End Set End Property Public Sub AddRange(Range() As SomeType) Implements iArray(Of SomeType).AddRange Allocate(Collected, Range) Populated = True End Sub Public Shared Function Allocate(ByRef TheArray() As SomeType, ByVal Value As SomeType) As SomeType() Return Allocate(TheArray, Value, LastIndexOf(TheArray)) End Function Public Shared Function Allocate(ByRef TheArray() As SomeType, ByVal Values() As SomeType) As SomeType() Return Allocate(TheArray, Values, LastIndexOf(TheArray)) End Function Public Shared Function Allocate(ByRef TheArray() As SomeType, ByVal Values() As SomeType, ByRef Index As Int64) As SomeType() Try For Current As Int64 = 0 To Values.Length - 1 Allocate(TheArray, Values(Current), Index + Current) Next Catch End Try Return TheArray End Function Public Shared Function Allocate(ByRef TheArray() As SomeType, ByVal Value As SomeType, ByRef Index As Int64) As SomeType() Try TheArray(Index) = Value Catch ReDim Preserve TheArray(Index) TheArray(Index) = Value End Try Return TheArray
Colborne_Greg wrote:
Here is an example of code, with no documentation, lets see if you can figure out what it does.
The fallacy in that statement is that it presumes that the reader only needs to know what the code does. However to maintain code one also needs to know 'why' code is doing what it it does. For example, in your code example 'why' is "Nothing" acceptable? Is the caller expecting that as a valid condition or is the caller going to error on that? Or perhaps it is up to the caller to decide that themselves? Additionally how does that work for a caller who wants to use the code but does not care how it is implemented? Where is the contract for the code defined? How can the caller be sure that even if the implementation changes that the contract will not? How will the maintainer be sure that they can make a modification to that code without breaking that code?
-
Colborne_Greg wrote:
Here is an example of code, with no documentation, lets see if you can figure out what it does.
The fallacy in that statement is that it presumes that the reader only needs to know what the code does. However to maintain code one also needs to know 'why' code is doing what it it does. For example, in your code example 'why' is "Nothing" acceptable? Is the caller expecting that as a valid condition or is the caller going to error on that? Or perhaps it is up to the caller to decide that themselves? Additionally how does that work for a caller who wants to use the code but does not care how it is implemented? Where is the contract for the code defined? How can the caller be sure that even if the implementation changes that the contract will not? How will the maintainer be sure that they can make a modification to that code without breaking that code?
In generic programming there is no why. As a programmer of 25 years, we in the field usually did not comment code or even tried to make the code readable, job security... That is retired code, otherwise I would not allow anyone else to see my work, as the concepts are experimental and solve just about every problem known in computing. Also if a programmer I hire creates a piece of code that was not well thought out in the first place, and it comes down to that code needing to be maintained that person is gone. Then I go over the code myself and make it generic to last the ages. See I believe that if you can't understand code just by reading it, you need more experience, the readability should just be what gets the job done faster.
-
Just spent the better part of two weeks trying to find a bug in a Linux bash script (missing ".") and I'm tired of looking for things like a missing equal sign in the middle of an C if statement, missing period in a PHP script, lower case variable name mixed with an upper case variable name, missing brace in a C++ object, undelared function or operator overloading....get my drift?...in other people's code. (Being the perfect programmer, I never make those kinds of mistakes! And I have swamp property if you're interested.) All too many programming errors are occurring because programming languages, like C, C++, java, etc., trace their origins back to the days when terseness was a desirable quality. Printing a program listing on an ASR 33 teletype at 10 CPS on a single threaded machine made using braces in C if statements instead of a clear if-then-else-endif highly desirable. (Remember the origins of C?) Those extra 9 characters took TIME to read in and to print out. And then there's issues of language diversity. C, C++, PHP, Java, Javascript, HTML, CSS, SQL, and other languages--what works where? So, here's a few of my thoughts: (And please don't be too anal about my examples--I really want to hear how programming languages could be advanced so that I can be more productive.) Among other things, a New Programming Language should: 1) Be clear and obvious in describing the functionality of the module. The resulting code should almost be language like. A sentence like "If (A equals 10) then print B as "xx.xx" else B = 0 end". But, that statement might also be written in a more mathematical syntax (like Fortran) as "If (A = 10) then....". Note the "=" in the second statement does NOT have the implied assignment and resulting TRUE logical decision (Spent 6 months chasing THAT bug!). 2) The language should be portable. The language should be executable as an interpreted, compiled, scripted or shell'ed running under most commonly available OS's and browsers. Perhaps Interpreted for testing, Compiled for execution speed, scripted for portability or shell'ed for utility work. Take features from scripting languages like Powershell, bash, incorporate execution speed of C, objectivity of Java or C++ and put them under one roof. Write a module that runs under IE, Firefox, Chrome, Opera, Windows, Linux, BSD, OS X, or anything else. 3) The code should be almost self-documenting. Nothing I hate worse than to have to go looking for the a type declaration, a
Sounds like you want something like VB for the dynamic if you want and begin/end instead of curlies. Or perhaps Ada - though it's a lot similar to Pascal - only much more pedantic. The trouble with the is/as/whatever "words" instead of operators - they can be very ambiguous. Especially when used as an equality comparer. About the == for equality and = for assignment ... I'm with you. I think that might have been the worst choice in C bar none. In this case I prefer the Pascal-like := assignment and the = for equality, only slightly better. But there are languages which figure out that = is used inside a condition and thus uses its equality override, while in other cases it's an assignment. So obviously it must be possible - just that C (and its progeny) has effectively removed that possibility from their syntax. Personally though, I don't mind characters too much. As long as they're as consistent as possible I'm fine with having a decent editor which matches them for me (indents / auto-close / etc.). It's when the "vocabulary" of these punctuation marks becomes huge with various "grammatical" rules where it becomes a pain in the @$$. Actually I hated having to type out the begin/end every single time when working in Pascal/Delphi, at least with VB some of it's automaticaly done from the IDE. But I still prefer the absolute consistency of Lisp over all other languages - everything is simply a function call, and you type it in that way too (no need to learn all sorts of different combinations for different aspects).