Serving the Quantitative Finance Community

 
User avatar
Y0da
Topic Author
Posts: 0
Joined: August 7th, 2007, 4:48 pm

Less complex languages than C++ suitable for finance?

February 13th, 2009, 7:07 pm

How suitable are less complex languages than C++, for examplelanguages that are weakly typed such as PHP or Objective-C,for financial applications?I ask because authors such as Mark Joshi focus on using C++and using it to create a big and somewhat complex class structure,and seem to be focusing a lot on C++'s ability of being stronglytyped.My question is in general, why use C++? Is it mostly becauseit is strongly typed? Are there more reasons?
 
User avatar
Cuchulainn
Posts: 22932
Joined: July 16th, 2004, 7:38 am

Less complex languages than C++ suitable for finance?

February 13th, 2009, 8:20 pm

I think this question has been discussed ad nauseum here.Instead of C++, C# is very good and easier to program. Learn it. Class hierarchies are and always were dangerous beasts in my 20 years of C++. Things are moving (back) to modular programming, interfacees and generics in my experience.C++ is great for doing numerical analysis.hth//Objective-C, you're kidding, yes? It's an 80's language. I use PHP to write my forum www.datasimfinancial.com
Last edited by Cuchulainn on February 12th, 2009, 11:00 pm, edited 1 time in total.
 
User avatar
ThomasJ
Posts: 1
Joined: October 9th, 2007, 2:39 am

Less complex languages than C++ suitable for finance?

February 13th, 2009, 10:35 pm

I've started using Python for rapid prototyping on the advice of some of the folks here and I have to say that it's a pretty nice language, especially when you can use the emacs python-mode to keep all your indenting correct (Python is whitespace-delimited). I do like the interfaces concept in C#, although I find that templates in C++ provide much of the same functionality. I haven't looked at Joshi's code (I assume you mean the code in his Derivatives Pricing book) but from the TOC I can see how it might be intimidating if you haven't studied design patterns at all. I might recommend starting with the classic book "Design Patterns" by Gamma et al.Also, frankly, regardless of its usability as an 'office' OS, Linux is a better platform for writing code and even with Mono there's not a strong C# Linux community so C/C++ is the default language for performance-sensitive code.PHP is nice for websites and very, very lightweight apps. Who uses Objective-C? Isn't that what the iPhone API is based on?
 
User avatar
mj
Posts: 12
Joined: December 20th, 2001, 12:32 pm

Less complex languages than C++ suitable for finance?

February 14th, 2009, 5:17 am

Well, my book is on C++ because that is what a lot of quants use and even more were using at the time.Actually, my book is pretty low level C++ and I think it is a lot easier to read than the classic Design Patterns book -- it should be viewed as an intro to harder books such as the Design Patterns book. The class structures in my book are fairly simple. Why is C++ the big language in quant? i think it's mainly historical accident: simple compatibility with C and the ability to use both low and high level language features. As computers get faster there will inevitably be a shift towards higher level languages but the amount of legacy code and legacy quants will slow the change... Personally, i prefer strongly typed languages -- it's easier to pick up problems at compile time.
 
User avatar
lballabio
Posts: 0
Joined: January 19th, 2004, 12:34 pm

Less complex languages than C++ suitable for finance?

February 14th, 2009, 8:01 am

QuoteOriginally posted by: CuchulainnObjective-C, you're kidding, yes? It's an 80's language.And it's what most of the Mac OS X APIs are written in. Sometimes they come back...
 
User avatar
lballabio
Posts: 0
Joined: January 19th, 2004, 12:34 pm

Less complex languages than C++ suitable for finance?

February 14th, 2009, 8:03 am

QuoteOriginally posted by: mjPersonally, i prefer strongly typed languages -- it's easier to pick up problems at compile time.Type inference is even better. Too bad it's only available in functional languages at this time...
 
User avatar
Cuchulainn
Posts: 22932
Joined: July 16th, 2004, 7:38 am

Less complex languages than C++ suitable for finance?

February 14th, 2009, 9:37 am

QuoteOriginally posted by: lballabioQuoteOriginally posted by: CuchulainnObjective-C, you're kidding, yes? It's an 80's language.And it's what most of the Mac OS X APIs are written in. Sometimes they come back...I did not know that, it's amazing. In the late 80's "brash" Brad Cox and Bjarne S would have many heated discussions on what the best language was. It is like a mix of C and Smalltalk, I believe and those I know who use it really love it because of its run-time flexibility. Languages never die, they just fade away..
Last edited by Cuchulainn on February 13th, 2009, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 22932
Joined: July 16th, 2004, 7:38 am

Less complex languages than C++ suitable for finance?

February 14th, 2009, 9:43 am

QuoteOriginally posted by: lballabioQuoteOriginally posted by: mjPersonally, i prefer strongly typed languages -- it's easier to pick up problems at compile time.Type inference is even better. Too bad it's only available in functional languages at this time...C# has Reflection API whereby you can ask the type and find/run its methods and other information. Is that the same? It's not something you need everyday but it's useful.A work around could be boost Spirit? At least, the regular expressions are fairly flexible and you can define PDLs with it.//A remark on the first GOF book on Patterns; the code is incomplete which slows down the learning process. People learn the patterns best in my experience by running C++ examples.And the patterns are based on *pure* OO programming style which makes some of the patterns seem artificial and inflexible(too much of, and the wrong ISA hierarchy?). As mentioned, GOF is difficult reading, but it is rather complete, especially the hints and guidelines sections.
Last edited by Cuchulainn on February 13th, 2009, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 22932
Joined: July 16th, 2004, 7:38 am

Less complex languages than C++ suitable for finance?

February 14th, 2009, 4:39 pm

QuoteAs computers get faster there will inevitably be a shift towards higher level languages but the amount of legacy code and legacy quants will slow the change... Maybe.In my experience products must be 1) easy to learn 2) get critical mass asap.Once a niche language, always a niche language in my opinion. The most used language in the world is BASIC
 
User avatar
madmax
Posts: 0
Joined: October 31st, 2003, 9:56 am

Less complex languages than C++ suitable for finance?

February 15th, 2009, 8:02 am

QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: lballabioQuoteOriginally posted by: mjPersonally, i prefer strongly typed languages -- it's easier to pick up problems at compile time.Type inference is even better. Too bad it's only available in functional languages at this time...C# has Reflection API whereby you can ask the type and find/run its methods and other information. Is that the same? It's not something you need everyday but it's useful.A work around could be boost Spirit? At least, the regular expressions are fairly flexible and you can define PDLs with it.//A remark on the first GOF book on Patterns; the code is incomplete which slows down the learning process. People learn the patterns best in my experience by running C++ examples.And the patterns are based on *pure* OO programming style which makes some of the patterns seem artificial and inflexible(too much of, and the wrong ISA hierarchy?). As mentioned, GOF is difficult reading, but it is rather complete, especially the hints and guidelines sections.No, you don't need to specify the type at all unless the interpreter cannot infer it from the context of use. For example F# has this functionality.
 
User avatar
ThomasJ
Posts: 1
Joined: October 9th, 2007, 2:39 am

Less complex languages than C++ suitable for finance?

February 15th, 2009, 8:14 am

In all fairness, a lot of people would say that strong typing is a feature, not a bug. And I think C/C++ is popular based much more on the "critical mass" than the "easy to learn". I've been coding in C++ for quite a long time and I'm still learning new things you can do with the language. For instance, some template metaprogramming techniques and a lot of the stuff the Boost guys do is simply amazing.
 
User avatar
DominicConnor
Posts: 41
Joined: July 14th, 2002, 3:00 am

Less complex languages than C++ suitable for finance?

February 15th, 2009, 1:52 pm

The most used language in the world is BASIC VB is the most common programming tool, but depening on how you do the numbers it is one of the C++ family of languages, and in practice C/C++ is sort of nearly one language.Basics otrher than the VB family are now uncommon, and VB itself is in serious relative declien since the dreadful mistakes made with VB.NETJava comes first or second depending upon whether you count C and C++ as distinct languages.Strong typing is indeed a benefit of C++, C# and Java, but "benefit" in this context requires that you know what it is you want.Sometimes it is convenient to have collections of things that are of different types, and C++ can make this unnecesarily complex.But by warning you that putting the result of dividing two floating point numbers into an integer you may be buying trouble, strong typing is good.I am always worried by people who say "language X is better than Y"To me that is like saying "a hammer is better than a screwdriver".You can of course use each for all the purposes of the other, but it will be clumsy and more effort.You should pick the language that expresses best your understanding of the problem, and what you want the computer to do about it.Functional languages like Haskell or F# often express mathematical ideas more eloquently than procedural languages of the C++, C#, Java, VB/Fortran style.C++ gives you finer control over what happens, at the price that you must control more things.That's not good or bad, just a point on the power vs easy curveI've driven Excel through every form of documented MS interface, and one undocumented one, and still go for VBA first because they work well together.VB.NET and Excel I hate, a lot.Also, a grave but common defect in the programming technique of most quants, is that they "think" in one language.That's very limiting, you would not call someone a competent or useful quant if all he knew was PDEs, not matter how well he knew that body of maths.The procedural languages are shit whenever you want to express things of the form "for all X...".Yes, they can do it, mostly, but it is less cleanly expressed, and occasionally vastly less efficient, even with their advantage of machine code compilation.Thus I encourage people to learn more than one language, even if they are only going to be Excel VBA jockeys or C++ geeks.When I write VBA, I''m thinking in a mix of other more complex languages, and that is the way you should be thinking.
 
User avatar
DominicConnor
Posts: 41
Joined: July 14th, 2002, 3:00 am

Less complex languages than C++ suitable for finance?

February 15th, 2009, 1:52 pm

The most used language in the world is BASIC VB is the most common programming tool, but depening on how you do the numbers it is one of the C++ family of languages, and in practice C/C++ is sort of nearly one language.Basics otrher than the VB family are now uncommon, and VB itself is in serious relative declien since the dreadful mistakes made with VB.NETJava comes first or second depending upon whether you count C and C++ as distinct languages.Strong typing is indeed a benefit of C++, C# and Java, but "benefit" in this context requires that you know what it is you want.Sometimes it is convenient to have collections of things that are of different types, and C++ can make this unnecesarily complex.But by warning you that putting the result of dividing two floating point numbers into an integer you may be buying trouble, strong typing is good.I am always worried by people who say "language X is better than Y"To me that is like saying "a hammer is better than a screwdriver".You can of course use each for all the purposes of the other, but it will be clumsy and more effort.You should pick the language that expresses best your understanding of the problem, and what you want the computer to do about it.Functional languages like Haskell or F# often express mathematical ideas more eloquently than procedural languages of the C++, C#, Java, VB/Fortran style.C++ gives you finer control over what happens, at the price that you must control more things.That's not good or bad, just a point on the power vs easy curveI've driven Excel through every form of documented MS interface, and one undocumented one, and still go for VBA first because they work well together.VB.NET and Excel I hate, a lot.Also, a grave but common defect in the programming technique of most quants, is that they "think" in one language.That's very limiting, you would not call someone a competent or useful quant if all he knew was PDEs, not matter how well he knew that body of maths.The procedural languages are shit whenever you want to express things of the form "for all X...".Yes, they can do it, mostly, but it is less cleanly expressed, and occasionally vastly less efficient, even with their advantage of machine code compilation.Thus I encourage people to learn more than one language, even if they are only going to be Excel VBA jockeys or C++ geeks.When I write VBA, I''m thinking in a mix of other more complex languages, and that is the way you should be thinking.
 
User avatar
fermin
Posts: 0
Joined: October 18th, 2005, 12:41 pm

Less complex languages than C++ suitable for finance?

February 17th, 2009, 10:31 am

QuoteOriginally posted by: DominicConnorStrong typing is indeed a benefit of C++, C# and JavaC/C++ are not stronlgy typed. C#/Java are. At least if you use a reasonable definition of strongly typed (or type safe). For instance the one in "Types and Programming Languages" (Pierce 2002). If your definition of strong typing is one where C++ and Java are allowed in the same category, it's a poor definition, IMHO.
 
User avatar
lballabio
Posts: 0
Joined: January 19th, 2004, 12:34 pm

Less complex languages than C++ suitable for finance?

February 17th, 2009, 10:54 am

QuoteOriginally posted by: ferminC/C++ are not strongly typed.True. Please runsed -e "s/strongly/statically/g"on the whole thread.