Skip to Content
Principles of Quantitative Development
book

Principles of Quantitative Development

by Manoj Thulasidas
August 2010
Beginner
251 pages
7h 20m
English
Wiley
Content preview from Principles of Quantitative Development

5.3 OBJECT-ORIENTED LANGUAGES

In a traditional, non-object-oriented framework, we have a few options in implementing the price report in Figure 5.1, knowing that the trades in the set we are reporting on are of different types. We can examine the trade type in the loop and call the right pricing function depending on what kind of trade it is that we are handling. Alternatively, we could loop over each kind of trade separately, creating multiple loops, or we could call the same pricing function, which can examine the trade type and take the appropriate action. All of these options are far from elegant.

If we could associate the pricing function with the complex data structure that describes a trade, we will keep the same simple program flow in Figure 5.1, while accomplishing customized pricing for each trade type. This functionality of encapsulating and associating functions with data structures is provided by object-oriented programming (OOP) methodology. In OOP terminology, the functions are methods and structures are classes or objects. A class can be thought of as a data structure with associated functions specific to it and an object is an instantiation of a class. With a {trade} class defined, the declaration Trade t ; creates an object t of the trade class. In this sense, a class is like a type and an object is a variable of the class type.

The object-oriented paradigm originated out of the difficulty in maintaining large and complex programs in the conventional sequential ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Principles of Financial Engineering, 3rd Edition

Principles of Financial Engineering, 3rd Edition

Robert Kosowski, Salih N. Neftci
Quantitative Finance

Quantitative Finance

Maria C. Mariani, Ionut Florescu

Publisher Resources

ISBN: 9780470745700Purchase book