Sometimes people refers the number of Lines of Code (LOC) when comparing the size of an app.
There are several ways of counting how many lines of code you have in your app.
Which method of counting LOC makes most sense?
Sum of line count in every .elm file YOU wrote (excl. installed packages)
find src/ -type f -name '*.elm' | xargs cat | wc -l
Sum of line count in every .elm file (incl. installed packages)
find . -type f -name '*.elm' | xargs cat | wc -l
wc -l main.js
These three methods gives me very different results on one of my apps:
- ~65k lines (excl. packages)
- ~195k lines (incl. packages)
Factors that affects LOC:
- Counting .elm files counts comments and docs aswell.
- Your coding style can make a big difference when counting LOC in Elm files. I was writing quite compact code before I started using elm-format. LOC was probably increased with a factor of two.
- Including LOC count from installed packages will also count files not imported in your app.
- At least the above factors would be eliminated when counting the compiled js file, right?
- Is there any other way of counting that makes more sense?