Archived

This topic is now archived and is closed to further replies.

Next generation programming style?

This topic is 5709 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In the beginning, there was unstructured code, and God didn''t see that it was good. Then, there was procedural programming, and God saw it was good. But then, there was Object Oriented Programming, and God saw that it was good... So, what do you guys think may be next? I don''t know what to call it besides programming style, but that doesn''t sound to descriptive. Do you guys know of anything that could be the next-gen thing? Or some theories? ... And then, there was ______, and God saw that it was damn good! -------------------------- Lucid code is an oxymoron! --------------------------

Share this post


Link to post
Share on other sites
Some of researchers in programming language theory back at my university strongly believe that the next "big thing" in language paradigms is so-called functional programming. This is available today through languages such as ML and Miranda og object oriented varients such as Objective CaML. Nice languages, but by todays standards they are still quite slow but they are certainly getting faster.

Another of my former teachers still thought that declarative programming would win in the end (language such as Prolog) - but in my opinion he is a jerk - Prolog is long past dead. The last class I attended with him we actually files an official complaint because we thought he was incompentent (not because he liked Prolog though)

Share this post


Link to post
Share on other sites
Prolog''s not dead, it''s just only really applicable to a small niche. There''s no other language quite so well suited to representing logic or some other AI concepts, even though C++ and Lisp have their uses.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files ]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
template meta programming. Imagine the power of functional programming but with none of the inherent suckiness.

Share this post


Link to post
Share on other sites
>> it''s just only really applicable to a small niche.

what I meant was that it was dead in the sense that nobody (well, almost nobody ) thinks it will be the next big thing. Many people thought that many years ago - but the hype has gone of it as it turned out only to have a niche use. And even to logic and AI I find it limited - I have written several projects in it and really dislike it - it claims to be so general but because it orders instructions (which logic should not) for the sake of speed, the language doesn''t work as well as it promises.

Share this post


Link to post
Share on other sites
I put it to you that you can write OOP code with a procedural compiler. It''s harder to be sure but it can be done. It''s more of a conceptual thing then a language. We write tools to add the concept. So what is a Useful concept thats hard to implement..

Self modifying code? -AI''s would rock.
Code that reads more like a book? - don''t know what the benifits would be.
Runtime defining of objects? - I know I''ve wantd this a couple of times.
Imadginary language? - as in imadginary numbers. {i = sqrt(-1)}

What would we like?


It is a good day to code.

Share this post


Link to post
Share on other sites
Felonius,

What is functional programming from someone who knows a little about OO programming?

Tim.

Share this post


Link to post
Share on other sites
Template meta-programming - the power of functional programming with the efficiency (and familiarity) of imperative programming.

See sig for template libraries - Loki is the most revolutionary and ''cutting edge''. The other libraries actually work on compilers that exist today. Loki currently compiles (and fails to compile) correctly on gcc & Comdaeu.

quote:
glJunkie
What is functional programming from someone who knows a little about OO programming?


Object Oriented programming is a subset of imperative programming (of which procedural & modular are also part of). It''s defining characteristic is that one statement follows another, and state information is retained from one statement to the next.
e.g. i = i + 1
The defining characteristic of functional programming is recursion - particularly recursive definitions - a trivial example is a factorial function. The key concept that is different, is that the function isn''t ''bound'' until you give it parameters - so the function can very well do completely different things given different parameters. It''s like textual substitution, except it''s smarter.

Functional languages such as ML or Lisp are interpreted and pure (that is they only do functional style constructs). Then there''s languages like Smalltalk (and Haskell?), that have a few functional constructs among many imperative ones - but are also interpreted.

Then there''s C++, that has the gauntlet of imperative constructs, and fledging functional ones - and compilers are available for native & JIT compilation. In effect, the template code is converted to machine (or byte) code during the compilation phase, instead of during run-time.

There’s talk of adding so-called generics to both Java and the .Net MSIL.


Magmai Kai Holmlor

"Oh, like you''ve never written buggy code" - Lee

[Look for information | GDNet Start Here | GDNet Search Tool | GDNet FAQ | MSDN RTF[L] | SGI STL Docs | STFW | Asking Smart Questions ]

[Free C++ Libraries | Boost | ACE | Loki | MTL | Blitz++ | wxWindows]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:

What is functional programming from someone who knows a little about OO programming?



You can built objects on top of functions and functions on top of objects.

quote:

Then there''s languages like Smalltalk (and Haskell?), that have a few functional constructs among many imperative ones - but are also interpreted.



Any language for which there exists an interpreter can also be compiled. Suppose there exists instruction X that is implemented in an interpreter by a finite sequence of machine instructions, {S}. X can therefore be compiled to {S}. There exists compilers for Smalltalk, Haskell, Scheme, etc.

quote:

Template meta-programming - the power of functional programming with the efficiency (and familiarity) of imperative programming.



I agree that any language to implement this would be most useful. The template functionality in C++ is just a way to infer a type from how the objects are used. Taking OO to the extreme and having general Object-classes as in Java is useful as well, but it leads to a lot of casting (Correct me if I''m wrong, but one argument for the OO mechanisms in C++ were to prevent overuse of casting like that found in C with unions). Type inference is something that functional languages have been doing for quite awhile. Throw in anonymous-classes or make functions first-class and I''d code in it in a heart beat.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I forgot to finish my response to the first quote. I meant to say that someone familiar with OO programming will find little earth shattering if they switch to functional programming. The solution lies somewhere in the middle.

Share this post


Link to post
Share on other sites
tuxx, the word you are looking for is "paradigm".

/*=========================================*/
/* Chem0sh */
/* Lead Software Engineer & Tech Support */
/* http://www.eFaces.biz */
/*=========================================*/

Share this post


Link to post
Share on other sites
I see prolog type languages making a mini come back in the form of the great language Mercury. It is much more than prolog has 95% of C performance and recently gained a compiler to compile to the .NET platform.

gUd is another promising language if only the designer would finish it, I think that the features that this language has a lot to offer to future software development.

SLANG is another promising language, with fully paraterized naming constructs and flexibility that makes C look like Sanskrit while also retaining an inherent simplicity that makes it refreshing to program with. The addition of an auto directing semi-automatic garbage collector that in test show to have 4-5 time the performance of allocation with C and no possible memory leaks (eat that java) makes it a very promising language.

The previous three languages are also completely Object Orientated, not C++ or Java style. But not as disgusting as Smalltalk either.

Not a language but a concept that is held by the last two languages stated is Aspect Orientated programming. AO is an addition to the normal imperative style that is far superior to metaclass languages, and hyper-aspects gives unheard of flexibility that remains very simple to use.

Then again maybe we were all wrong and memory orientated machine programming is the way to go

--------------------------------------------------------------
Once upon a time I rulled the world, but that was only a game.

Share this post


Link to post
Share on other sites
It will be structured programming. That would be Version 2.0. Personally I think what the world needs most is a structured approach to object oriented programming

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
"I agree that any language to implement this would be most useful. The template functionality in C++ is just a way to infer a type from how the objects are used."

read Modern C++ Design: Generic Programming and Design Patterns Applied by Andrei Alexandrescu, you will see that templates are far, far, far, more than you thought they were. Every page is amazing, you will never see templates the same way again.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Templates are weak, being compile time exclusive. Unfortunatley they are the best form of generics in current main stream languages.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
[quote
read Modern C++ Design: Generic Programming and Design Patterns Applied by Andrei Alexandrescu, you will see that templates are far, far, far, more than you thought they were. Every page is amazing, you will never see templates the same way again.


I have, and I still stand by what I said.

Share this post


Link to post
Share on other sites
quote:
Original post by tuxx
So, what do you guys think may be next?

There is something called Greenspun''s Tenth Rule of Programming which might give a hint as to which direction programming languages are headed in. An updated version of this rule would say ""Any sufficiently complicated program contains an ad-hoc, informally-specified bug-ridden slow implementation of half of Common Lisp."

If you consider that each step in programming language evolution codifies commonly accepted "good" practice into language structures, and that these turn out to be things that Lisp has been capable of for years, that might provide some food for thought. Design Patterns, for example, describe ways of turning oneself into a human Lisp compiler.
quote:

I don''t know what to call it besides programming style, but that doesn''t sound to descriptive.

The word you''re looking for is "bandwagon". Each bandwagon purports to give the world something new and innovative, which is often untrue. In some respects, what we think of as innovation is not a good basis for survival or evolution in the world. You only have to look at MS''s wildly successful business strategy to see that in practice.

If it''s bandwagons you''re looking for, then you might like to look at Aspect-Oriented Programming, Generative Programming and Extreme Programming. They all have their niches, but doubtless some folk will misappropriate them as the next silver bullet. The most interesting of them, IMO, is XP. Quite simply, XP is an approach to programming which is in touch with what actually happens in the real-world. It''s a recognition that the promises of reuse never delivered, and that the traditionally accepted s/w engineering time-cost curve can be flattened.

Finally, for a touch of down-to-earth realism, STW for the paper "No Silver Bullet" by Fred Brooks.

Share this post


Link to post
Share on other sites
As for template meta programming I think this is already well underway to become the next big thing - but further into the future who knows?

>> What is functional programming from someone who knows a little about OO programming?

In functional programming everything is functions. There is no assignment statements in that you cannot change the value of a variable after it is set. Things are not executed in the order they are written like you know from from imperative programming languages where you list the statements you want executed. This way functional programming is closer to math than imperative (=regular) programming languages.

The general idea is that a function has no side effects and the execution of the program occurs by evaluating the function and returning the result. This is then combined with many nice properties such as:
* currying and higher-order functions
* pattern-matching, e.g. to get a returned point and extract the values you just write like this:
(x, y, z) = normalize(v)
This enforces a strict bottom up structure on the program and thereby eases debugging and correctness proofs a lot.

personally I don't think these will win in the end but that is a matter of belief.

Personally I think that in the end the winner will be a multi-paradigm langauge - i.e. one where the programmer can choose what approach to use. C++ is such as language already in that it is both procedural and object oriented at the programmers choiece. This is important since the best paradigm often depends on the problem at hand. Template meta programming allows many other paradigms/features to be made. For instance, currying can be done with templates.

[edited by - felonius on May 30, 2002 6:16:57 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Magmai Kai Holmlor
Functional languages such as ML or Lisp are interpreted and pure (that is they only do functional style constructs). Then there''s languages like Smalltalk (and Haskell?), that have a few functional constructs among many imperative ones - but are also interpreted.



Haskell is mostly functional with a few imperative constructs (like it''s got console output functions). We did it for a semester at school. It''s not that bad, actually. I wouldn''t use it for other than academic reasons, though


codeka.com - Just click it.

Share this post


Link to post
Share on other sites
On these forum''s I once read something about aspect oriented programming, however I don''t have a clue wat it is. I believe there researching it at universities. Anybody can give a brief explanation about it ?

Share this post


Link to post
Share on other sites
quote:
Original post by George2
On these forum''s I once read something about aspect oriented programming, however I don''t have a clue wat it is. I believe there researching it at universities. Anybody can give a brief explanation about it ?

Any nonsense gets researched at universities, particularly in the computing departments. Not that I think AOP is nonsense, just that it''s not an indicator a technology has any real-world value. AOP is now beginning to be used in the real-world - I use ApectJ in a limited capacity for my work. I suggest you check out the AspectJ website to find out more.

Share this post


Link to post
Share on other sites
Wow! Lotsa posts in one day! I think that''s very interesting with all of those different languages. I thought that XP was just a way to organize a software development company (two people to a computer doesn''t seem to fit into programming paragdims), but hell, I just read the first 5 pages of XP Explained. Keep the posts coming in!

--------------------------
Lucid code is an oxymoron!
--------------------------

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
Any language for which there exists an interpreter can also be compiled. Suppose there exists instruction X that is implemented in an interpreter by a finite sequence of machine instructions, {S}. X can therefore be compiled to {S}. There exists compilers for Smalltalk, Haskell, Scheme, etc.


Those are assembly emitting compilers for Smalltalk, Haskell, etc...? Do they implement the entire language? I was under the impression that smalltalk was interpretted. What about Lisp or ML?
And you can cheat it, like VB1/2/3/4/5 where they pack byte-code into the exe, and launch the interpretor from the exe. But I wouldn''t consider that native compilation.

quote:

Template meta-programming - the power of functional programming with the efficiency (and familiarity) of imperative programming.



I agree that any language to implement this would be most useful. The template functionality in C++ is just a way to infer a type from how the objects are used.

quote:

Type inference is something that functional languages have been doing for quite awhile. Throw in anonymous-classes or make functions first-class and I''d code in it in a heart beat.


Loki’s Generalized Functor allows one to create invokable objects* that have Full Value Semantics . The implication being, generalized Functors are invokable First Class Citizens[b]. It’s here, in C++, today! (on good compilers anyway )
"Modern C++" by Andrei Alexandrescu, see sig for dl
It''s not quite the flexibility you have with LISP, and I''ll grant you it seems like your fighting the language and compiler sometimes, but I think that''s mostly due to the utter lack of experience anyone has using it. I''m practically and expert on Loki, and I can''t even compile the whole thing

And remember C++ isn''t set in stone, there''s something called ''concepts'' that will likely be part of the language one day. It''s like an interface definition for template policy classes.

*(from functions, methods, function pointers, method pointers, or other functors)

I''m, not sure how anonymous functions would benefit C++ - it''s a decidely script-like feature (e.g. very useful in scripting/script-like languages, not very useful in compiled ones).


heheh Aspect based programming sounds alot like Mutliple Inheritence, but without using those dirty words. They refer to it by it''s alias, "mixin-inheritence" - I see how it does a more though. reverse inheritence.... that is interesting. I can see how that would be useful - and can see how it''s buildable in Java. (I can''t help but think ComeFrom though =))


Magmai Kai Holmlor

"Oh, like you''ve never written buggy code" - Lee

[Look for information | GDNet Start Here | GDNet Search Tool | GDNet FAQ | MSDN RTF[L] | SGI STL Docs | STFW | Asking Smart Questions ]

[Free C++ Libraries | Boost | ACE | Loki | MTL | Blitz++ | wxWindows]

Share this post


Link to post
Share on other sites
quote:
Original post by Magmai Kai Holmlor
I agree that any language to implement this would be most useful. The template functionality in C++ is just a way to infer a type from how the objects are used.

The C++ compiler facilities are Turing complete but have to be programmed in a functional style. This is why C++ is known as a "two-level language".
quote:

And remember C++ isn''t set in stone, there''s something called ''concepts'' that will likely be part of the language one day. It''s like an interface definition for template policy classes.

I was at a presentation that Gabriel dos Reis gave of his concept additions, and it didn''t seem well-enough considered for inclusion into the standard. Certainly, Stroustrup was very skeptical. I suspect a library facility would be the preferred route.
quote:

Aspect based programming sounds alot like Mutliple Inheritence, but without using those dirty words.

No, AOP should be non-intrusive, else it defeats the point of "separation of concerns".

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:

Those are assembly emitting compilers for Smalltalk, Haskell, etc...? Do they implement the entire language? I was under the impression that smalltalk was interpretted. What about Lisp or ML?
And you can cheat it, like VB1/2/3/4/5 where they pack byte-code into the exe, and launch the interpretor from the exe. But I wouldn''t consider that native compilation.



A google search for "<insert language here> compiler" will answer the first question. As for whether or not they implement the entire language, I do not know for sure. If not there isn''t any fundamental reason aside from lack of time. I''ve written a compiler (x86 asm) for a subset of Scheme myself , so I know it can be done in practice. As for Lisp, there even exists specialized hardware to execute code. See http://www.cs.rice.edu/~shriram/LispM/. My favorite picture is the one that reads "Will recur for samosas".

Share this post


Link to post
Share on other sites