lhartikk / naivechain

A blockchain implementation in 200 lines of code
Apache License 2.0
5.28k stars 1.15k forks source link

Feature/refactor #3

Closed antony closed 7 years ago

antony commented 7 years ago

I've separated out the core components of the project for readability and understandability.

and also separated out their individual components.

I've also refactored the code a bit for readability, such as removing nested ifs, and nested functions, and introduced linting in order to spot errors and possible bugs.

I'd probably like to start retrofitting tests if this PR gets approved.

Cheers, Antony

p0o commented 7 years ago

I actually don't like this approach because the original code is written with a clean Functional Programming approach for learning purposes. If you wanted to improve the previous code you should have embraced the same approach with Higher Order Functions, currying, composing, etc. Putting everything inside classes like a Java code doesn't make it necessarily better.

lhartikk commented 7 years ago

As I described in more detail in #2 , I intend to leave the main version of naivechain as a single 200 lines of code file.