# Code Analysis for Project and Team Management
A problematic and two books lead me to the conclusion that code is not really well understood for a manager and even for team too.
The problematic is quite common to people coming in new team as manager. No clear vision of a product and a project, no already defined KPI, and an important lake of knowledge about the different deliverable.
The books I am talking about are "Your Code as Scene Crime" and "Software Design X-rays", both wrote by Adam Tornhill. Those books are talking about legacy code and data mining.
# Metrics and KPI
- Project Metrics
- Commits
- Line of codes
- Added/Removed Line of codes
- Test coverage
- Automation
- Time to staging
- Time to production
- Time to manage
- Temporal metrics
- Quantitative metrics
- Qualitative metrics
- Global performance (e.g. global benhmarking)
- Local performance (e.g. per behavior benchmarking)
- Precise performance (e.g. per function benchmarking)
- Business metrics
- Global cost
- Human cost
- Training cost
- Competitors
- Human metrics
- communication (e.g. meetings, synchronization...)
- require a way to extract data from Google Calendar
- require a way to extract data from Jira
- knowledge
- communication (e.g. meetings, synchronization...)
# Simplicity and Complexity
- How to measure simplicity?
- How to measure complexity?
- How to measure understanding?
# Mono and Multi Project Management
- per-project metrics (based on vision)
- multi-projet metrics (based on vision)
# Perception versus Fact
- Team survey
- Team retrospective
- one-to-one interview
# Knowledge Distribution
- Documentation
- Training
- Time to be autonomous
- Time to integrate
# Resources and References
- https://pragprog.com/titles/atevol/software-design-x-rays/
- https://pragprog.com/titles/atcrime/your-code-as-a-crime-scene/
- https://chaoss.community/
# Appendix A - Installing tools
This document assume that the user will have a ${HOME}/bin directory
containing all local binaries. All tools are installed from sources
and require to have git installed.
mkdir ${HOME}/bin
export PATH=${PATH}:${HOME}/bin
# Installing code-maat
Code-maat is the main tool used in "Your Code as a Crime Scene" and offers many helpers to dig into different kind of project. Furthermore, output can be configured and set to CSV, pretty useful to import information into classical spreadsheet.
git clone https://github.com/adamtornhill/code-maat
cd code-maat/src
lein uberjar
code-maat is using git log features. It could be a great idea to
create function or aliases to automatically extract information in
the right format
maat-git() {
git log --pretty=format:'[%h] %aN %ad %s' --date=short --numstat --after=YYYY-MM-DD ${*}
}
maat-git2() {
git log --all --numstat --date=short --pretty=format:'--%h--%ad--%aN' --no-renames --after=YYYY-MM-DD ${*}
}
And because it's a jar file, it could also be good
to create an alias or perhaps a function to permit
to execute this command more easily than using
java from the command line.
code-maat() {
java -jar ${CODE_MAAT_SRC}/target/code-maat-1.1-SNAPSHOT-standalone.jar ${*}
}
# Installing cloc
git clone https://github.com/AlDanial/cloc
cd cloc
ln -s ${PWD}/cloc ${HOME}/bin/cloc
# Installing tokei
git clone https://github.com/XAMPPRocky/tokei
cd tokei
cargo build
ln -s ${PWD}/target/debug/tokei ${HOME}/bin/tokei
# Installing scc
git clone https://github.com/boyter/scc
cd scc
go build
ln -s ${PWD}/scc ${HOME}/bin/scc
# Installing jiracli
git clone https://github.com/pycontribs/jira
cd jira
virtualenv venv
./venv/bin/python setup.py install
ln -s ${PWD}/venv/bin/jiracli ${HOME}/bin/jiracli
# Installing polyglot
- https://github.com/aboSamoor/polyglot
# Installing Augur
- https://github.com/chaoss/augur
- https://oss-augur.readthedocs.io
# Installing tap-jira
git clone https://github.com/singer-io/tap-jira
cd tap-jira
virtualenv venv
./venv/bin/python setup.py install
ln -s ${PWD}/venv/bin/tap-jira ${HOME}/bin/tap-jira
- https://github.com/singer-io/tap-jira
# Appendix B - Google Spreadsheet Notes
# Managing Dates
# Create Quarters
First, create 4 columns to check if the date
is present in Q1, Q2, Q3 or Q4. Those columns
will be updated automatically. Note that A2
case contains a date in format YYYY-MM-DD.
=AND(MONTH($A2)>=1; MONTH($A2)<4)
=AND(MONTH($A2)>=4; MONTH($A2)<7)
=AND(MONTH($A2)>=7; MONTH($A2)<10)
=AND(MONTH($A2)>=10; MONTH($A2)<13)
Secondly, another column could be created to print the quarter if one of the 4 previous columns are set.
I2case containsQ1boolean resultJ2case containsQ2boolean resultK2case containsQ3boolean resultL2case containsQ4boolean result
=IF(I2=TRUE; "q1"; IF(J2=TRUE; "q2"; IF(K2=TRUE; "q3"; IF(L2=True; "q4"))))
Finally, the date can be concatenated with the
quarter, where F2 case contain the year and M2
case contains the quarter as string, and previouly
defined.
=$F2 & "-" & $M2