C++ design patterns

Disponível somente no TrabalhosFeitos
  • Páginas : 86 (21324 palavras )
  • Download(s) : 0
  • Publicado : 20 de novembro de 2012
Ler documento completo
Amostra do texto
n This page intentionally left blank

C ++ DESIGN PATTERNS AND DERIVATIVES PRICING
2nd edition
Design patterns are the cutting-edge paradigm for programming in object-oriented languages. Here they are discussed in the context of implementing financial models in C++.
Assuming only a basic knowledge of C++ and mathematical finance, the reader is taught
how to produce well-designed,structured, reusable code via concrete examples.
This new edition includes several new chapters describing how to increase robustness
in the presence of exceptions, how to design a generic factory, how to interface C++
with EXCEL, and how to improve code design using the idea of decoupling. Complete
ANSI/ISO compatible C++ source code is hosted on an accompanying website for the
reader to study indetail, and reuse as they see fit.
A good understanding of C++ design is a necessity for working financial mathematician; this book provides a thorough introduction to the topic.

Mathematics, Finance and Risk
Editorial Board
Mark Broadie, Graduate School of Business, Columbia University
Sam Howison, Mathematical Institute, University of Oxford
Neil Johnson, Centre for Computational Finance,University of Oxford
George Papanicolaou, Department of Mathematics, Stanford University

C++ DESIGN PATTERNS AND
D E R I VA T I V E S P R I C I N G
M. S. J O S H I
University of Melbourne

CAMBRIDGE UNIVERSITY PRESS

Cambridge, New York, Melbourne, Madrid, Cape Town, Singapore, São Paulo
Cambridge University Press
The Edinburgh Building, Cambridge CB2 8RU, UK
Published in the UnitedStates of America by Cambridge University Press, New York
www.cambridge.org
Information on this title: www.cambridge.org/9780521721622
© M. S. Joshi 2008
This publication is in copyright. Subject to statutory exception and to the provision of
relevant collective licensing agreements, no reproduction of any part may take place
without the written permission of Cambridge University Press.First published in print format 2008

ISBN-13 978-0-511-39693-9

eBook (NetLibrary)

ISBN-13

paperback

978-0-521-72162-2

Cambridge University Press has no responsibility for the persistence or accuracy of urls
for external or third-party internet websites referred to in this publication, and does not
guarantee that any content on such websites is, or will remain, accurate orappropriate.

To Jane

Contents

Preface
Acknowledgements
1 A simple Monte Carlo model
1.1 Introduction
1.2 The theory
1.3 A simple implementation of a Monte Carlo call
option pricer
1.4 Critiquing the simple Monte Carlo routine
1.5 Identifying the classes
1.6 What will the classes buy us?
1.7 Why object-oriented programming?
1.8 Key points
1.9 Exercises
2 Encapsulation
2.1Implementing the pay-off class
2.2 Privacy
2.3 Using the pay-off class
2.4 Further extensibility defects
2.5 The open–closed principle
2.6 Key points
2.7 Exercises
3 Inheritance and virtual functions
3.1 ‘is a’
3.2 Coding inheritance
3.3 Virtual functions
3.4 Why we must pass the inherited object by reference
3.5 Not knowing the type and virtual destruction
3.6 Adding extra pay-offs withoutchanging files
vii

page xiii
xvi
1
1
1
2
7
9
10
11
11
12
13
13
15
16
19
20
21
22
23
23
24
24
29
30
34

viii

4

5

6

7

Contents

3.7 Key points
3.8 Exercises
Bridging with a virtual constructor
4.1 The problem
4.2 A first solution
4.3 Virtual construction
4.4 The rule of three
4.5 The bridge
4.6 Beware of new
4.7 A parameters class
4.8 Keypoints
4.9 Exercises
Strategies, decoration, and statistics
5.1 Differing outputs
5.2 Designing a statistics gatherer
5.3 Using the statistics gatherer
5.4 Templates and wrappers
5.5 A convergence table
5.6 Decoration
5.7 Key points
5.8 Exercises
A random numbers class
6.1 Why?
6.2 Design considerations
6.3 The base class
6.4 A linear congruential generator and the adapter pattern
6.5...
tracking img