<p>i don't think you can find many Object Oriented Design Patterns in the btc-source-code. but there is one example i know:</p>

<p>the blockchain itself is like a composite pattern:
you have a general type called <code>Block</code>. two types inherits <code>Block</code>: <code>MinedBlock</code> inherits from <code>Block</code> and <code>GenesisBlock</code> inherits from <code>Block</code>. A <code>MinedBlock</code> has one attribute of the type <code>Block</code> called <code>PreviousBlock</code>. 
(here you can also find the <em>singleton</em> pattern: you need exactly one <code>GenesisBlock</code>-object.)</p>

CC BY-SA 3.0
2017-12-22T12:57:29.180Z
2017-12-22T12:57:29.180Z
anion
<p>I'm a Master Student in Computing Science and currently investigating the <a href="https://github.com/bitcoin/bitcoin" rel="nofollow noreferrer">Bitcoin source code</a> on the Software Patterns that are used. Part of the assignment is to ask the community to guide us.</p>

<p>I would like to ask you if you know any Software Pattern in the source code. In order to give you a view of our scope, below is a list of Patterns covered (Design Patterns and Architectural Patterns).</p>

<p>Thanks in advance,</p>

<p>Patrick</p>

<p>Object Oriented Design Patterns:</p>

<ul>
<li>Factory Pattern</li>
<li>Adapter Pattern</li>
<li>Composite Pattern</li>
<li>Facade Pattern</li>
<li>Proxy Pattern</li>
<li>Observer Pattern</li>
</ul>

<p>Architectural Patterns:</p>

<ul>
<li>Layered Decomposition Pattern</li>
<li>Pipes And Filters Pattern</li>
<li>Data Repository Pattern</li>
<li>Model View Controller Pattern</li>
<li>Client Server Pattern</li>
<li>Peer to Peer Pattern</li>
<li>Publish Subscribe Pattern</li>
<li>Broker Pattern</li>
<li>Message Queue Pattern</li>
</ul>

<bitcoin-core-development><architecture>
What Software Patterns does the Bitcoin source code use?
Patrick
# What Software Patterns does the Bitcoin source code use?

(Asked by: username_0 on 2017-12-22)

I'm a Master Student in Computing Science and currently investigating the [Bitcoin source code](https://github.com/bitcoin/bitcoin) on the Software Patterns that are used. Part of the assignment is to ask the community to guide us.

I would like to ask you if you know any Software Pattern in the source code. In order to give you a view of our scope, below is a list of Patterns covered (Design Patterns and Architectural Patterns).

Thanks in advance,

username_0

Object Oriented Design Patterns:

* Factory Pattern
* Adapter Pattern
* Composite Pattern
* Facade Pattern
* Proxy Pattern
* Observer Pattern

Architectural Patterns:

* Layered Decomposition Pattern
* Pipes And Filters Pattern
* Data Repository Pattern
* Model View Controller Pattern
* Client Server Pattern
* Peer to Peer Pattern
* Publish Subscribe Pattern
* Broker Pattern
* Message Queue Pattern

**Tags:** bitcoin-core-development, architecture


---

## 1 answers

### Answer by username_1 on 2017-12-22. Score: 2

i don't think you can find many Object Oriented Design Patterns in the btc-source-code. but there is one example i know:

the blockchain itself is like a composite pattern:
you have a general type called `Block`. two types inherits `Block`: `MinedBlock` inherits from `Block` and `GenesisBlock` inherits from `Block`. A `MinedBlock` has one attribute of the type `Block` called `PreviousBlock`.
(here you can also find the *singleton* pattern: you need exactly one `GenesisBlock`-object.)


---

