SlideShare a Scribd company logo
C++ Development for OOo: Tricks of the Trade Thorsten Behrens StarOffice/OpenOffice.org Sun Microsystems
This Talk: this is about OOo core programming.  the core: that's where the vast majority of both code and functionality is located, and it's is where to know your way around when things go wrong (i.e. you need to fix a bug or you want to add a feature that affects core functionality).
What's the Matter With OOo? OOo is huge: ~ 5.2 MSLOC, 4.6 MSLOC C++ (89%),  ~23,000 C/C++ files (early 2.6 kernel: ~4.3 MSLOC) at its core, OOo is classic C++: classes & inheritance, spread across a lot of shared libraries. that gives us: a highly coupled beast, that takes a day to build from scratch
Coupled - In What Way? Separate compilation units ('cxx'-files) are highly dependent on other files:  e.g. header file vcl/window.hxx: 2552 (for 7127 of relevance) files that directly or indirectly depend on it about 1/3rd of OOo would need recompilation, when vcl/window.hxx changes.
So, What's the Matter Again? nobody seriously wants to wait 3 hours to recompile after a single change in contrast to the scholarly focus on encapsulation (which is about logical dependencies), a large C++ project like OOo also has to care about physical dependencies: transitive closure of OOo's dependency graph: 1,950,117 edges (from 7129 active compilation units), i.e.~274 mean dependent files per compilation unit
Break Dependencies, Brute-Force OOo is broken down into a bunch of modules, where each module ideally contains a delimited, cohesive area of functionality (e.g. VCL: GUI platform abstraction; SW: Writer) each module provides a public interface via "exported headers": during build time, each module "delivers" headers to the global solver directory, which makes those headers visible to other modules.
Break Dependencies (cont.) switching off dependencies on headers taken from solver (by undef-ing MKDEPENDSOLVER) leaves only intra-module dependencies: now only ~42 mean dependent files per compilation unit this leads to the notion of "compatible" vs. "incompatible" changes “compatible”: one does not need to recompile other modules (by hand) “incompatible”: some, or all of the higher modules need rebuilds
Break Dependencies, the C++ Way changing implementation should not require recompilation in other modules i.e. a class should be truly  insulated in a first step, reducing dependencies can be achieved via use forward decls instead of header inclusion wherever possible (ptr or reference to given type, return value) keep enums at the classes that use them (instead of putting them into a central enums.hxx) avoid default arguments - they need full definitions, not only forward declaration ...
Break Dependencies (cont.) aforementioned list helps, but still leaves class internals exposed to client code now, true insulation can be achieved by pimpl idiom (or handle-body idiom) abstract interface (protocol class) plus factory
What's a Pimpl, Anyway? class MyClass { public: someMethod(); someOtherMethod(); private: struct MyClassImpl; MyClassImpl* mpImpl; };
Pimpl Vs. Abstract Interface performance: pimpl is slightly faster than virtual functions calls on a protocol class pimpl provides concrete classes, from which one can derive and that can be freely constructed (even on the stack) protocol classes also remove link-time dependencies (see UNO) but for both:  overhead prohibitive, e.g. for low-level, frequently used classes with simple getter/setter methods when passing pimpled objects by value, consider to also COW (Copy-On-Write) them.
Also Bad (When Used Large Scale) non-local statics passing user-defined types (class, struct, union) by value COWed mass objects that need to be thread-safe short and float at interfaces automatic conversions code is not warning-free not being const as const can. using exception specifications ...
What's Out There to Help You? boost::scoped_ptr  for RAII boost::shared_ptr/boost::weak_ptr  for ref counting comphelper::servicedecl  for UNO lib boiler-plate avoidance o3tl::cow_wrapper , if you've pimpl already, and need COW on top rtl::Static  for providing on-demand created static objects
Gdb or When All Else Fails use most recent version (CVS)  hack unxlngi6.mk to define -ggdb instead of -g if gdb gives 'incomplete type' on classes that your code uses, try setting 'envcflags=-femit-class-debug-always'  and rebuild the file(s) in question. exercise the stuff you want to debug once, and only then attach gdb to the running office ('gdb soffice.bin $PID').  that way, you work-around gdb's current inability to reliably set deferred breakpoints in demand-loaded libs...
Development Tools (X)Emacs Vim NetBeans/Eclipse MSVC UML argo build for Emacs & vi:  wrappers Testing /testshl2 cppunit delta Code analysis cvsstat   gcc-xml oink sloccount   cpd   bonsai lxr   cscope   doxygen gcc  dump options sourcenav IFace design DialogDump
Recommended reading/links OOo's  list of literature Large-Scale C++ Software Design by John Lakos C++ Coding Standards by Herb Sutter and Andrei Alexandrescu Watch out for an update to OOo's coding guidelines
Q&A Thorsten Behrens [email_address]
Ad

More Related Content

What's hot (19)

Indic threads pune12-apache-crunch
Indic threads pune12-apache-crunchIndic threads pune12-apache-crunch
Indic threads pune12-apache-crunch
IndicThreads
 
Reactive streams, because parallelism matters
Reactive streams, because parallelism mattersReactive streams, because parallelism matters
Reactive streams, because parallelism matters
Humberto Streb
 
The Parenscript Common Lisp to JavaScript compiler
The Parenscript Common Lisp to JavaScript compilerThe Parenscript Common Lisp to JavaScript compiler
The Parenscript Common Lisp to JavaScript compiler
Vladimir Sedach
 
Parallelization using open mp
Parallelization using open mpParallelization using open mp
Parallelization using open mp
ranjit banshpal
 
OpenMP Tutorial for Beginners
OpenMP Tutorial for BeginnersOpenMP Tutorial for Beginners
OpenMP Tutorial for Beginners
Dhanashree Prasad
 
Intro to OpenMP
Intro to OpenMPIntro to OpenMP
Intro to OpenMP
jbp4444
 
GNU Compiler Collection - August 2005
GNU Compiler Collection - August 2005GNU Compiler Collection - August 2005
GNU Compiler Collection - August 2005
Saleem Ansari
 
MPI n OpenMP
MPI n OpenMPMPI n OpenMP
MPI n OpenMP
Surinder Kaur
 
Goroutine stack and local variable allocation in Go
Goroutine stack and local variable allocation in GoGoroutine stack and local variable allocation in Go
Goroutine stack and local variable allocation in Go
Yu-Shuan Hsieh
 
St Petersburg R user group meetup 2, Parallel R
St Petersburg R user group meetup 2, Parallel RSt Petersburg R user group meetup 2, Parallel R
St Petersburg R user group meetup 2, Parallel R
Andrew Bzikadze
 
The low level awesomeness of Go
The low level awesomeness of GoThe low level awesomeness of Go
The low level awesomeness of Go
Jean-Bernard Jansen
 
Open mp library functions and environment variables
Open mp library functions and environment variablesOpen mp library functions and environment variables
Open mp library functions and environment variables
Suveeksha
 
Open mp intro_01
Open mp intro_01Open mp intro_01
Open mp intro_01
Oleg Nazarevych
 
Gude for C++11 in Apache Traffic Server
Gude for C++11 in Apache Traffic ServerGude for C++11 in Apache Traffic Server
Gude for C++11 in Apache Traffic Server
Apache Traffic Server
 
.Net Core
.Net Core.Net Core
.Net Core
Vinícius Tonial Sossella
 
Trends of SW Platforms for Heterogeneous Multi-core systems and Open Source ...
Trends of SW Platforms for Heterogeneous Multi-core systems and  Open Source ...Trends of SW Platforms for Heterogeneous Multi-core systems and  Open Source ...
Trends of SW Platforms for Heterogeneous Multi-core systems and Open Source ...
Seunghwa Song
 
OpenMP
OpenMPOpenMP
OpenMP
Eric Cheng
 
Introduction to OpenMP
Introduction to OpenMPIntroduction to OpenMP
Introduction to OpenMP
Akhila Prabhakaran
 
Building Server Applications Using ObjectiveC And GNUstep
Building Server Applications Using ObjectiveC And GNUstepBuilding Server Applications Using ObjectiveC And GNUstep
Building Server Applications Using ObjectiveC And GNUstep
guest9efd1a1
 
Indic threads pune12-apache-crunch
Indic threads pune12-apache-crunchIndic threads pune12-apache-crunch
Indic threads pune12-apache-crunch
IndicThreads
 
Reactive streams, because parallelism matters
Reactive streams, because parallelism mattersReactive streams, because parallelism matters
Reactive streams, because parallelism matters
Humberto Streb
 
The Parenscript Common Lisp to JavaScript compiler
The Parenscript Common Lisp to JavaScript compilerThe Parenscript Common Lisp to JavaScript compiler
The Parenscript Common Lisp to JavaScript compiler
Vladimir Sedach
 
Parallelization using open mp
Parallelization using open mpParallelization using open mp
Parallelization using open mp
ranjit banshpal
 
OpenMP Tutorial for Beginners
OpenMP Tutorial for BeginnersOpenMP Tutorial for Beginners
OpenMP Tutorial for Beginners
Dhanashree Prasad
 
Intro to OpenMP
Intro to OpenMPIntro to OpenMP
Intro to OpenMP
jbp4444
 
GNU Compiler Collection - August 2005
GNU Compiler Collection - August 2005GNU Compiler Collection - August 2005
GNU Compiler Collection - August 2005
Saleem Ansari
 
Goroutine stack and local variable allocation in Go
Goroutine stack and local variable allocation in GoGoroutine stack and local variable allocation in Go
Goroutine stack and local variable allocation in Go
Yu-Shuan Hsieh
 
St Petersburg R user group meetup 2, Parallel R
St Petersburg R user group meetup 2, Parallel RSt Petersburg R user group meetup 2, Parallel R
St Petersburg R user group meetup 2, Parallel R
Andrew Bzikadze
 
Open mp library functions and environment variables
Open mp library functions and environment variablesOpen mp library functions and environment variables
Open mp library functions and environment variables
Suveeksha
 
Gude for C++11 in Apache Traffic Server
Gude for C++11 in Apache Traffic ServerGude for C++11 in Apache Traffic Server
Gude for C++11 in Apache Traffic Server
Apache Traffic Server
 
Trends of SW Platforms for Heterogeneous Multi-core systems and Open Source ...
Trends of SW Platforms for Heterogeneous Multi-core systems and  Open Source ...Trends of SW Platforms for Heterogeneous Multi-core systems and  Open Source ...
Trends of SW Platforms for Heterogeneous Multi-core systems and Open Source ...
Seunghwa Song
 
Building Server Applications Using ObjectiveC And GNUstep
Building Server Applications Using ObjectiveC And GNUstepBuilding Server Applications Using ObjectiveC And GNUstep
Building Server Applications Using ObjectiveC And GNUstep
guest9efd1a1
 

Similar to C++ development within OOo (20)

C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
Danielle780357
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
AnassElHousni
 
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
bhargavi804095
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...
bhargavi804095
 
Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptx
NEHARAJPUT239591
 
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
meharikiros2
 
Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008
guestd9065
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).doc
MayurWagh46
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
corehard_by
 
02 c++g3 d
02 c++g3 d02 c++g3 d
02 c++g3 d
mahago
 
Advanced Node.JS Meetup
Advanced Node.JS MeetupAdvanced Node.JS Meetup
Advanced Node.JS Meetup
LINAGORA
 
Debugging of (C)Python applications
Debugging of (C)Python applicationsDebugging of (C)Python applications
Debugging of (C)Python applications
Roman Podoliaka
 
C++ Boot Camp Part 2
C++ Boot Camp Part 2C++ Boot Camp Part 2
C++ Boot Camp Part 2
Jesse Talavera-Greenberg
 
A05
A05A05
A05
lksoo
 
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1
ReKruiTIn.com
 
cbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptxcbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptx
SRamadossbiher
 
cbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptxcbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptx
SRamadossbiher
 
Memory management in c++
Memory management in c++Memory management in c++
Memory management in c++
Syed Hassan Kazmi
 
Whats New in Visual Studio 2012 for C++ Developers
Whats New in Visual Studio 2012 for C++ DevelopersWhats New in Visual Studio 2012 for C++ Developers
Whats New in Visual Studio 2012 for C++ Developers
Rainer Stropek
 
Let's Take A Look At The Boost Libraries
Let's Take A Look At The Boost LibrariesLet's Take A Look At The Boost Libraries
Let's Take A Look At The Boost Libraries
Thomas Pollak
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
AnassElHousni
 
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
bhargavi804095
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...
bhargavi804095
 
Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptx
NEHARAJPUT239591
 
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
meharikiros2
 
Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008
guestd9065
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).doc
MayurWagh46
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
corehard_by
 
02 c++g3 d
02 c++g3 d02 c++g3 d
02 c++g3 d
mahago
 
Advanced Node.JS Meetup
Advanced Node.JS MeetupAdvanced Node.JS Meetup
Advanced Node.JS Meetup
LINAGORA
 
Debugging of (C)Python applications
Debugging of (C)Python applicationsDebugging of (C)Python applications
Debugging of (C)Python applications
Roman Podoliaka
 
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1
ReKruiTIn.com
 
cbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptxcbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptx
SRamadossbiher
 
cbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptxcbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptx
SRamadossbiher
 
Whats New in Visual Studio 2012 for C++ Developers
Whats New in Visual Studio 2012 for C++ DevelopersWhats New in Visual Studio 2012 for C++ Developers
Whats New in Visual Studio 2012 for C++ Developers
Rainer Stropek
 
Let's Take A Look At The Boost Libraries
Let's Take A Look At The Boost LibrariesLet's Take A Look At The Boost Libraries
Let's Take A Look At The Boost Libraries
Thomas Pollak
 
Ad

More from Alexandro Colorado (20)

Bitcuners revolucion blockchain
Bitcuners revolucion blockchainBitcuners revolucion blockchain
Bitcuners revolucion blockchain
Alexandro Colorado
 
Presentacion Krita
Presentacion KritaPresentacion Krita
Presentacion Krita
Alexandro Colorado
 
Bitcuners porque bitcoins
Bitcuners porque bitcoinsBitcuners porque bitcoins
Bitcuners porque bitcoins
Alexandro Colorado
 
ChamiloCon Enseñando con Tecnología
ChamiloCon Enseñando con TecnologíaChamiloCon Enseñando con Tecnología
ChamiloCon Enseñando con Tecnología
Alexandro Colorado
 
Curso de desarrollo web para principiantes
Curso de desarrollo web para principiantesCurso de desarrollo web para principiantes
Curso de desarrollo web para principiantes
Alexandro Colorado
 
ChamiloCon: Recursos de Software Libre
ChamiloCon: Recursos de Software Libre ChamiloCon: Recursos de Software Libre
ChamiloCon: Recursos de Software Libre
Alexandro Colorado
 
Krita - Tu tambien puedes pintar un arbol Feliz
Krita - Tu tambien puedes pintar un arbol FelizKrita - Tu tambien puedes pintar un arbol Feliz
Krita - Tu tambien puedes pintar un arbol Feliz
Alexandro Colorado
 
Gobernancia y particionacion en comunidades de Software Libre v2
Gobernancia y particionacion en comunidades de Software Libre v2Gobernancia y particionacion en comunidades de Software Libre v2
Gobernancia y particionacion en comunidades de Software Libre v2
Alexandro Colorado
 
gcloud
gcloudgcloud
gcloud
Alexandro Colorado
 
Blender - FLISOL Cancun 2014
Blender - FLISOL Cancun 2014Blender - FLISOL Cancun 2014
Blender - FLISOL Cancun 2014
Alexandro Colorado
 
The Hitchhicker's Guide to Opensource
The Hitchhicker's Guide to OpensourceThe Hitchhicker's Guide to Opensource
The Hitchhicker's Guide to Opensource
Alexandro Colorado
 
OpenERP: El ecosistema de negocios
OpenERP: El ecosistema de negociosOpenERP: El ecosistema de negocios
OpenERP: El ecosistema de negocios
Alexandro Colorado
 
Aprendiendo GnuPG
Aprendiendo GnuPGAprendiendo GnuPG
Aprendiendo GnuPG
Alexandro Colorado
 
Catalogo decursos
Catalogo decursosCatalogo decursos
Catalogo decursos
Alexandro Colorado
 
Practicas virtuales v2.2
Practicas virtuales v2.2Practicas virtuales v2.2
Practicas virtuales v2.2
Alexandro Colorado
 
Introducción al curso de Extensiones de OpenOffice
Introducción al curso de Extensiones de OpenOfficeIntroducción al curso de Extensiones de OpenOffice
Introducción al curso de Extensiones de OpenOffice
Alexandro Colorado
 
Comunidades software libre
Comunidades software libreComunidades software libre
Comunidades software libre
Alexandro Colorado
 
Practicas virtuales v2
Practicas virtuales v2Practicas virtuales v2
Practicas virtuales v2
Alexandro Colorado
 
Practicas virtuales
Practicas virtualesPracticas virtuales
Practicas virtuales
Alexandro Colorado
 
Economia digital
Economia digitalEconomia digital
Economia digital
Alexandro Colorado
 
Bitcuners revolucion blockchain
Bitcuners revolucion blockchainBitcuners revolucion blockchain
Bitcuners revolucion blockchain
Alexandro Colorado
 
ChamiloCon Enseñando con Tecnología
ChamiloCon Enseñando con TecnologíaChamiloCon Enseñando con Tecnología
ChamiloCon Enseñando con Tecnología
Alexandro Colorado
 
Curso de desarrollo web para principiantes
Curso de desarrollo web para principiantesCurso de desarrollo web para principiantes
Curso de desarrollo web para principiantes
Alexandro Colorado
 
ChamiloCon: Recursos de Software Libre
ChamiloCon: Recursos de Software Libre ChamiloCon: Recursos de Software Libre
ChamiloCon: Recursos de Software Libre
Alexandro Colorado
 
Krita - Tu tambien puedes pintar un arbol Feliz
Krita - Tu tambien puedes pintar un arbol FelizKrita - Tu tambien puedes pintar un arbol Feliz
Krita - Tu tambien puedes pintar un arbol Feliz
Alexandro Colorado
 
Gobernancia y particionacion en comunidades de Software Libre v2
Gobernancia y particionacion en comunidades de Software Libre v2Gobernancia y particionacion en comunidades de Software Libre v2
Gobernancia y particionacion en comunidades de Software Libre v2
Alexandro Colorado
 
The Hitchhicker's Guide to Opensource
The Hitchhicker's Guide to OpensourceThe Hitchhicker's Guide to Opensource
The Hitchhicker's Guide to Opensource
Alexandro Colorado
 
OpenERP: El ecosistema de negocios
OpenERP: El ecosistema de negociosOpenERP: El ecosistema de negocios
OpenERP: El ecosistema de negocios
Alexandro Colorado
 
Introducción al curso de Extensiones de OpenOffice
Introducción al curso de Extensiones de OpenOfficeIntroducción al curso de Extensiones de OpenOffice
Introducción al curso de Extensiones de OpenOffice
Alexandro Colorado
 
Ad

Recently uploaded (20)

China's influence in Peru and Latin American.pptx
China's influence in Peru and Latin American.pptxChina's influence in Peru and Latin American.pptx
China's influence in Peru and Latin American.pptx
Carlos Alberto Aquino Rodriguez
 
GCF - Master Presentation Buyside - UK - 0525 - GCF.pdf
GCF - Master Presentation Buyside - UK - 0525 - GCF.pdfGCF - Master Presentation Buyside - UK - 0525 - GCF.pdf
GCF - Master Presentation Buyside - UK - 0525 - GCF.pdf
hkmd5mqzjb
 
How i get hook up with a wealthy sugar mummy is Malaysia in Kuala Lumpur
How i get hook up with a wealthy sugar mummy is Malaysia in Kuala LumpurHow i get hook up with a wealthy sugar mummy is Malaysia in Kuala Lumpur
How i get hook up with a wealthy sugar mummy is Malaysia in Kuala Lumpur
aziziaziziooo430
 
Monthly Economic Monitoring of Ukraine No. 244 May 2025
Monthly Economic Monitoring of Ukraine No. 244 May 2025Monthly Economic Monitoring of Ukraine No. 244 May 2025
Monthly Economic Monitoring of Ukraine No. 244 May 2025
Інститут економічних досліджень та політичних консультацій
 
Mastering Crypto Security: How GXCYPX Solutions Help Prevent Social Engineeri...
Mastering Crypto Security: How GXCYPX Solutions Help Prevent Social Engineeri...Mastering Crypto Security: How GXCYPX Solutions Help Prevent Social Engineeri...
Mastering Crypto Security: How GXCYPX Solutions Help Prevent Social Engineeri...
gxcypx
 
Abhay Bhutada Success Built with Purpose and Action
Abhay Bhutada Success Built with Purpose and ActionAbhay Bhutada Success Built with Purpose and Action
Abhay Bhutada Success Built with Purpose and Action
Harsh Mishra
 
GCF - Master Presentation - UK GCF - 0525 .pdf
GCF - Master Presentation - UK GCF - 0525 .pdfGCF - Master Presentation - UK GCF - 0525 .pdf
GCF - Master Presentation - UK GCF - 0525 .pdf
hkmd5mqzjb
 
Buying a Telegram account is a punishable offense.
Buying a Telegram account is a punishable offense.Buying a Telegram account is a punishable offense.
Buying a Telegram account is a punishable offense.
hjhfrhj88
 
Group-1 Manufacturing Growth and Structural Transformation.pptx
Group-1 Manufacturing Growth and Structural Transformation.pptxGroup-1 Manufacturing Growth and Structural Transformation.pptx
Group-1 Manufacturing Growth and Structural Transformation.pptx
nowrinmorshed207
 
GCF - Our added value in Medical & Health sector 0525.pdf
GCF - Our added value in  Medical & Health sector 0525.pdfGCF - Our added value in  Medical & Health sector 0525.pdf
GCF - Our added value in Medical & Health sector 0525.pdf
hkmd5mqzjb
 
CLUB DEAL - UK - GEREJECORPORATEFINANCE.pdf
CLUB DEAL - UK - GEREJECORPORATEFINANCE.pdfCLUB DEAL - UK - GEREJECORPORATEFINANCE.pdf
CLUB DEAL - UK - GEREJECORPORATEFINANCE.pdf
hkmd5mqzjb
 
DeFi Revolution: How JQRBT Players Can Benefit from Aave's Record-Breaking $4...
DeFi Revolution: How JQRBT Players Can Benefit from Aave's Record-Breaking $4...DeFi Revolution: How JQRBT Players Can Benefit from Aave's Record-Breaking $4...
DeFi Revolution: How JQRBT Players Can Benefit from Aave's Record-Breaking $4...
jqrbt
 
GCF - Master Presentation Sellside - UK - 0525.pdf
GCF - Master Presentation Sellside - UK - 0525.pdfGCF - Master Presentation Sellside - UK - 0525.pdf
GCF - Master Presentation Sellside - UK - 0525.pdf
hkmd5mqzjb
 
GCF - Our added value in Media, Culture & Entertainment sector 0525.pdf
GCF - Our added value in Media, Culture & Entertainment sector 0525.pdfGCF - Our added value in Media, Culture & Entertainment sector 0525.pdf
GCF - Our added value in Media, Culture & Entertainment sector 0525.pdf
dianepioux1
 
The Economy of United States, GDP, AND Development
The Economy of United States, GDP, AND DevelopmentThe Economy of United States, GDP, AND Development
The Economy of United States, GDP, AND Development
bebibamlaku
 
GCF- our added value in the industry sector 052025.pdf
GCF- our added value in the industry sector 052025.pdfGCF- our added value in the industry sector 052025.pdf
GCF- our added value in the industry sector 052025.pdf
dianepioux1
 
Poonawalla Fincorp Merging AI and Ethics in Debt Recovery.pdf
Poonawalla Fincorp Merging AI and Ethics in Debt Recovery.pdfPoonawalla Fincorp Merging AI and Ethics in Debt Recovery.pdf
Poonawalla Fincorp Merging AI and Ethics in Debt Recovery.pdf
Vighnesh Shashtri
 
20250514-assessing-the-uk-retirement-income-market-vfm.pdf
20250514-assessing-the-uk-retirement-income-market-vfm.pdf20250514-assessing-the-uk-retirement-income-market-vfm.pdf
20250514-assessing-the-uk-retirement-income-market-vfm.pdf
Henry Tapper
 
New Monthly Enterprises Survey. Issue 34. (02.2025) Ukrainian Business in War...
New Monthly Enterprises Survey. Issue 34. (02.2025) Ukrainian Business in War...New Monthly Enterprises Survey. Issue 34. (02.2025) Ukrainian Business in War...
New Monthly Enterprises Survey. Issue 34. (02.2025) Ukrainian Business in War...
Інститут економічних досліджень та політичних консультацій
 
OAT_RI_Ep31 WeighingTheRisks_Apr25_Financials.pptx
OAT_RI_Ep31 WeighingTheRisks_Apr25_Financials.pptxOAT_RI_Ep31 WeighingTheRisks_Apr25_Financials.pptx
OAT_RI_Ep31 WeighingTheRisks_Apr25_Financials.pptx
hiddenlevers
 
GCF - Master Presentation Buyside - UK - 0525 - GCF.pdf
GCF - Master Presentation Buyside - UK - 0525 - GCF.pdfGCF - Master Presentation Buyside - UK - 0525 - GCF.pdf
GCF - Master Presentation Buyside - UK - 0525 - GCF.pdf
hkmd5mqzjb
 
How i get hook up with a wealthy sugar mummy is Malaysia in Kuala Lumpur
How i get hook up with a wealthy sugar mummy is Malaysia in Kuala LumpurHow i get hook up with a wealthy sugar mummy is Malaysia in Kuala Lumpur
How i get hook up with a wealthy sugar mummy is Malaysia in Kuala Lumpur
aziziaziziooo430
 
Mastering Crypto Security: How GXCYPX Solutions Help Prevent Social Engineeri...
Mastering Crypto Security: How GXCYPX Solutions Help Prevent Social Engineeri...Mastering Crypto Security: How GXCYPX Solutions Help Prevent Social Engineeri...
Mastering Crypto Security: How GXCYPX Solutions Help Prevent Social Engineeri...
gxcypx
 
Abhay Bhutada Success Built with Purpose and Action
Abhay Bhutada Success Built with Purpose and ActionAbhay Bhutada Success Built with Purpose and Action
Abhay Bhutada Success Built with Purpose and Action
Harsh Mishra
 
GCF - Master Presentation - UK GCF - 0525 .pdf
GCF - Master Presentation - UK GCF - 0525 .pdfGCF - Master Presentation - UK GCF - 0525 .pdf
GCF - Master Presentation - UK GCF - 0525 .pdf
hkmd5mqzjb
 
Buying a Telegram account is a punishable offense.
Buying a Telegram account is a punishable offense.Buying a Telegram account is a punishable offense.
Buying a Telegram account is a punishable offense.
hjhfrhj88
 
Group-1 Manufacturing Growth and Structural Transformation.pptx
Group-1 Manufacturing Growth and Structural Transformation.pptxGroup-1 Manufacturing Growth and Structural Transformation.pptx
Group-1 Manufacturing Growth and Structural Transformation.pptx
nowrinmorshed207
 
GCF - Our added value in Medical & Health sector 0525.pdf
GCF - Our added value in  Medical & Health sector 0525.pdfGCF - Our added value in  Medical & Health sector 0525.pdf
GCF - Our added value in Medical & Health sector 0525.pdf
hkmd5mqzjb
 
CLUB DEAL - UK - GEREJECORPORATEFINANCE.pdf
CLUB DEAL - UK - GEREJECORPORATEFINANCE.pdfCLUB DEAL - UK - GEREJECORPORATEFINANCE.pdf
CLUB DEAL - UK - GEREJECORPORATEFINANCE.pdf
hkmd5mqzjb
 
DeFi Revolution: How JQRBT Players Can Benefit from Aave's Record-Breaking $4...
DeFi Revolution: How JQRBT Players Can Benefit from Aave's Record-Breaking $4...DeFi Revolution: How JQRBT Players Can Benefit from Aave's Record-Breaking $4...
DeFi Revolution: How JQRBT Players Can Benefit from Aave's Record-Breaking $4...
jqrbt
 
GCF - Master Presentation Sellside - UK - 0525.pdf
GCF - Master Presentation Sellside - UK - 0525.pdfGCF - Master Presentation Sellside - UK - 0525.pdf
GCF - Master Presentation Sellside - UK - 0525.pdf
hkmd5mqzjb
 
GCF - Our added value in Media, Culture & Entertainment sector 0525.pdf
GCF - Our added value in Media, Culture & Entertainment sector 0525.pdfGCF - Our added value in Media, Culture & Entertainment sector 0525.pdf
GCF - Our added value in Media, Culture & Entertainment sector 0525.pdf
dianepioux1
 
The Economy of United States, GDP, AND Development
The Economy of United States, GDP, AND DevelopmentThe Economy of United States, GDP, AND Development
The Economy of United States, GDP, AND Development
bebibamlaku
 
GCF- our added value in the industry sector 052025.pdf
GCF- our added value in the industry sector 052025.pdfGCF- our added value in the industry sector 052025.pdf
GCF- our added value in the industry sector 052025.pdf
dianepioux1
 
Poonawalla Fincorp Merging AI and Ethics in Debt Recovery.pdf
Poonawalla Fincorp Merging AI and Ethics in Debt Recovery.pdfPoonawalla Fincorp Merging AI and Ethics in Debt Recovery.pdf
Poonawalla Fincorp Merging AI and Ethics in Debt Recovery.pdf
Vighnesh Shashtri
 
20250514-assessing-the-uk-retirement-income-market-vfm.pdf
20250514-assessing-the-uk-retirement-income-market-vfm.pdf20250514-assessing-the-uk-retirement-income-market-vfm.pdf
20250514-assessing-the-uk-retirement-income-market-vfm.pdf
Henry Tapper
 
OAT_RI_Ep31 WeighingTheRisks_Apr25_Financials.pptx
OAT_RI_Ep31 WeighingTheRisks_Apr25_Financials.pptxOAT_RI_Ep31 WeighingTheRisks_Apr25_Financials.pptx
OAT_RI_Ep31 WeighingTheRisks_Apr25_Financials.pptx
hiddenlevers
 

C++ development within OOo

  • 1. C++ Development for OOo: Tricks of the Trade Thorsten Behrens StarOffice/OpenOffice.org Sun Microsystems
  • 2. This Talk: this is about OOo core programming. the core: that's where the vast majority of both code and functionality is located, and it's is where to know your way around when things go wrong (i.e. you need to fix a bug or you want to add a feature that affects core functionality).
  • 3. What's the Matter With OOo? OOo is huge: ~ 5.2 MSLOC, 4.6 MSLOC C++ (89%), ~23,000 C/C++ files (early 2.6 kernel: ~4.3 MSLOC) at its core, OOo is classic C++: classes & inheritance, spread across a lot of shared libraries. that gives us: a highly coupled beast, that takes a day to build from scratch
  • 4. Coupled - In What Way? Separate compilation units ('cxx'-files) are highly dependent on other files: e.g. header file vcl/window.hxx: 2552 (for 7127 of relevance) files that directly or indirectly depend on it about 1/3rd of OOo would need recompilation, when vcl/window.hxx changes.
  • 5. So, What's the Matter Again? nobody seriously wants to wait 3 hours to recompile after a single change in contrast to the scholarly focus on encapsulation (which is about logical dependencies), a large C++ project like OOo also has to care about physical dependencies: transitive closure of OOo's dependency graph: 1,950,117 edges (from 7129 active compilation units), i.e.~274 mean dependent files per compilation unit
  • 6. Break Dependencies, Brute-Force OOo is broken down into a bunch of modules, where each module ideally contains a delimited, cohesive area of functionality (e.g. VCL: GUI platform abstraction; SW: Writer) each module provides a public interface via "exported headers": during build time, each module "delivers" headers to the global solver directory, which makes those headers visible to other modules.
  • 7. Break Dependencies (cont.) switching off dependencies on headers taken from solver (by undef-ing MKDEPENDSOLVER) leaves only intra-module dependencies: now only ~42 mean dependent files per compilation unit this leads to the notion of "compatible" vs. "incompatible" changes “compatible”: one does not need to recompile other modules (by hand) “incompatible”: some, or all of the higher modules need rebuilds
  • 8. Break Dependencies, the C++ Way changing implementation should not require recompilation in other modules i.e. a class should be truly insulated in a first step, reducing dependencies can be achieved via use forward decls instead of header inclusion wherever possible (ptr or reference to given type, return value) keep enums at the classes that use them (instead of putting them into a central enums.hxx) avoid default arguments - they need full definitions, not only forward declaration ...
  • 9. Break Dependencies (cont.) aforementioned list helps, but still leaves class internals exposed to client code now, true insulation can be achieved by pimpl idiom (or handle-body idiom) abstract interface (protocol class) plus factory
  • 10. What's a Pimpl, Anyway? class MyClass { public: someMethod(); someOtherMethod(); private: struct MyClassImpl; MyClassImpl* mpImpl; };
  • 11. Pimpl Vs. Abstract Interface performance: pimpl is slightly faster than virtual functions calls on a protocol class pimpl provides concrete classes, from which one can derive and that can be freely constructed (even on the stack) protocol classes also remove link-time dependencies (see UNO) but for both: overhead prohibitive, e.g. for low-level, frequently used classes with simple getter/setter methods when passing pimpled objects by value, consider to also COW (Copy-On-Write) them.
  • 12. Also Bad (When Used Large Scale) non-local statics passing user-defined types (class, struct, union) by value COWed mass objects that need to be thread-safe short and float at interfaces automatic conversions code is not warning-free not being const as const can. using exception specifications ...
  • 13. What's Out There to Help You? boost::scoped_ptr for RAII boost::shared_ptr/boost::weak_ptr for ref counting comphelper::servicedecl for UNO lib boiler-plate avoidance o3tl::cow_wrapper , if you've pimpl already, and need COW on top rtl::Static for providing on-demand created static objects
  • 14. Gdb or When All Else Fails use most recent version (CVS) hack unxlngi6.mk to define -ggdb instead of -g if gdb gives 'incomplete type' on classes that your code uses, try setting 'envcflags=-femit-class-debug-always' and rebuild the file(s) in question. exercise the stuff you want to debug once, and only then attach gdb to the running office ('gdb soffice.bin $PID'). that way, you work-around gdb's current inability to reliably set deferred breakpoints in demand-loaded libs...
  • 15. Development Tools (X)Emacs Vim NetBeans/Eclipse MSVC UML argo build for Emacs & vi: wrappers Testing /testshl2 cppunit delta Code analysis cvsstat gcc-xml oink sloccount cpd bonsai lxr cscope doxygen gcc dump options sourcenav IFace design DialogDump
  • 16. Recommended reading/links OOo's list of literature Large-Scale C++ Software Design by John Lakos C++ Coding Standards by Herb Sutter and Andrei Alexandrescu Watch out for an update to OOo's coding guidelines
  • 17. Q&A Thorsten Behrens [email_address]
  翻译: