Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

upd docs

  • Loading branch information...
commit 68bd6c3c7285736756d4468606385d274bfdaa30 1 parent bee26f1
@alexeypetrushin authored
View
BIN  docs/.DS_Store → .DS_Store
Binary file not shown
View
2  .gitignore
@@ -1,5 +1,5 @@
*~
-.DS_Store
+**/.DS_Store
.require_paths
Thumbs.db
projects_statistics.html
View
BIN  docs/power-law.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  docs/power-law.svg
Binary file not shown
View
BIN  docs/rad-sbs-pareto.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  docs/rad-sbs-pareto.thumb.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
20,421 docs/rad-sbs.html
20,421 additions, 0 deletions not shown
View
BIN  docs/rad-sbs.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  docs/rad-sbs.thumb.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
20,256 docs/rad-vs-rails.html
20,256 additions, 0 deletions not shown
View
BIN  docs/rad-vs-rails.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  docs/rad-vs-rails.thumb.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2  my/analyze.rb
@@ -20,7 +20,7 @@
# Rails
paths = "/Users/alex/other_projects/z-libs/rails".to_dir.dirs.collect{|dir| dir.path}.select{|dir| dir =~ /\/acti|\/railti/}
-# paths << "/Users/alex/projects/core"
+paths << "/Users/alex/projects/core"
CodeStats.analyze_and_report(*(paths << {except: :JavaScript}))
View
12 readme.md
@@ -1,12 +1,14 @@
-# Code Stats
+# CodeStats
+
+Source code statistics and metrics.
[![rails-thumb]][rails-img] [![some-os-projects-thumb]][some-os-projects-img] [![mongoid-vs-mongomapper-thumb]][mongoid-vs-mongomapper-img]
-Screenshots are showing us: Complexity of [Rails libraries][rails-img], comparison of [some Open Source projects][some-os-projects-img] and [MongoMapper vs Mongoid][mongoid-vs-mongomapper-img] (You can see actual .html report files in [docs][docs]).
+Screenshots showing us: Complexity of [Rails libraries][rails-img], comparison of [some Open Source projects][some-os-projects-img] and [MongoMapper vs Mongoid][mongoid-vs-mongomapper-img] (You can see actual .html report files in [docs][docs]).
# Installation & Usage
-This tool is language-agnostic, but it itself is made with Ruby, so You need Ruby installed to use it. Next, just install it as a gem:
+This tool is language-agnostic, but it itself is made with Ruby, so You need Ruby installed to use it, to install it type:
``` bash
gem install code_stats2
@@ -19,9 +21,7 @@ code_stats /projects/wordpress
code_stats /projects/* except: JavaScript
```
-Also You can easily customize it, sources of Code Stats is small and simple as an egg.
-
-
+Also You can easily customize it, sources are small and simple as an egg.
Copyright (c) Alexey Petrushin http://petrush.in, released under the MIT license.
View
69 todo.md
@@ -1,16 +1,71 @@
- Add html, json, jade
+# Article stub:
-# Docs
+# Why may You need such numbers and graphs?
-Power law, efficiency and decision making
+I developed this tool and made it language agnostic because:
-[TODO about the [Power law][power_law] (also known as the Pareto principle and the 80-20 rule) and it's fundamental nature]
+- I wanted to find simple open source game project to examine and play with. There are lots of such projects and because I have very little free time I need a way to measure how big and complex they are and select a simple one. So this tool can be useful to roughly **estimate tons of unknown projects** in different languages.
+You can also **estimate how healthy they are** by looking at the code / specs ratio.
-[TODO about my causes to write such strange tool: why it's so simple and why language-agnostic is important: find simple game project, compare my own projects with other, find big places in my sources, see spec/code ratio to evaluate helth of project]
+- I also was curious how my own projects are compared to other well know projects. How big the source code are, how well is it covered with specs.
-[TODO about decition makin: right now there's tons and tons and tons of tools, projects and all stuff, it's hard to navigate, examine and score them]
+- I wanted a way to find most heavy and most useful parts of code in my projects, in order to try to eliminate the first and pay more attention to the second (see next section).
-[TODO efficiency: what code parts is most important]
+# Power law, efficiency and decision making
-[TODO I deliberately choose the Red color for the sources (and the Blue for specs / tests) because the less code - the better (in general, with other things been equal).]
+You probably noticed that if You compare multiple projects the graph almost always looks like this ![power-law-img]. The code distribution is uneven, this distribution is known as the [Power law][power-law] (it also known as the Pareto principle and the 80-20 rule).
+
+Why is this interesting and important? Because it affects Your efficiency - the source code of Your projects fall under the [Power law][power-law], with the following consequence: **20% of code responsible for 80% of app value**, other 80% of code are responsible only for 20% of value.
+
+How can we use this? I would like to use a detached sample to better illustrate this - sales also fall under this law - 80% of income are come from 20% of clients. And one of the salesperson's rule of effectiveness:
+
+1. analyze sales and find those 20% of clients
+2. pay more attention to them and less to other 80%
+
+The same are valid for the code, and You can use this tool to analyze it find those important 20% of code and pay more attention to it and less to the other.
+
+There's also the second consequence: **80% of code are produced by 20% of application's modules**. Note: these 20% - it's the different code, not the same as the "important 20% part".
+
+Also would like to illustrate this with sales example - there are 20% of clients that causes 80% of troubles, and if You want to be efficient - You need to pay attention to the quality of the client base and sometimes drop those clients that produce more troubles than the money.
+Back to code - **try to cut fat parts**, this tool help You to find it.
+
+And, the last consequence, a philosophical one - no matter what You do the project's code always will comply to Power law, and there always will be 20/80 ratio :).
+
+# Sample analysis of rad_sbs
+
+Here's sample analysis of my project [rad_sbs][rad_sbs], it's a very simple solution for small businesses (site, forum, e-commerce, organizer). It builded as a lots of cooperated modules, let's look at it's code statistics (see first image):
+
+``` bash
+code_stats ~/projects/* except: JavaScript
+```
+
+[![rad-sbs-thumb]][rad-sbs-img] [![rad-sbs-pareto-thumb]][rad-sbs-pareto-img]
+
+How to find those important 20%? I don't know, but I belive that in general application code is more important than code of support libraries. Let's divide app and support libraries (see second image): green tick - actual app logic, red cross - framework libraries, strikethrough - some other libraries, ignored. Totals: libs: 283 000 vs app: 114 000.
+
+What to do next? Also don't know, but believe it would be good to do following:
+
+- for the app: try to even more distill app logic and move code to support libraries
+- for libraries: try to replace our own custom libraries with public libraries supported by other developers
+
+# Sample analysis Rad vs Rails
+
+I created the [Rad][rad] framework and was curious - how it's sources are compared to Rails?
+
+[![rad-vs-rails-thumb]][rad-vs-rails]
+
+See? It's small! Taken into account that it has about 90% of Rails features - not bad huh?
+
+[rad]: https://github.com/alexeypetrushin/rad_core
+
+[power-law]: http://en.wikipedia.org/wiki/Power_law
+
+[power-law-img]: https://github.com/alexeypetrushin/code_stats/raw/master/docs/power-law.png
+[rad_sbs]: https://github.com/alexeypetrushin/rad_sbs
+[rad-sbs-pareto-img]: https://github.com/alexeypetrushin/code_stats/raw/master/docs/rad-sbs-pareto.png
+
+[rad]: https://github.com/alexeypetrushin/rad_core
+[rad-vs-rails]: https://github.com/alexeypetrushin/code_stats/raw/master/docs/rad-sbs-pareto.png
+[rad-vs-rails-thumb]: https://github.com/alexeypetrushin/code_stats/raw/master/docs/rad-sbs-pareto.png
Please sign in to comment.
Something went wrong with that request. Please try again.