LoginSignup
6
2

More than 5 years have passed since last update.

FlutterとAndroidJavaで同じアプリを書いた時のコード量の違いが興味深い

Last updated at Posted at 2018-06-05

こちらの記事(英語)で、同じアプリをAndroidJavaとFlutterで書いて、違い(どんだけFlutterが素晴らしいか)がまとめてあります。

面白いと思ったのが、ファイル数とコード量(行数)の比較箇所。
(ページ内リンク見当たらず。。)

記事から引用すると、両方のアプリの情報(ファイル数など)を調べた上で、

To break this down, let’s compare the file count first:
Android: 179 (.java and .xml)
Flutter: 31 (.dart)
Wow! And concerning lines of code we have:
Android: 12176
Flutter: 1735

That’s crazy! I was expecting the Flutter app to have maybe half the amount of code of the Android app, but 85% less?

That’s crazy! と驚いていますね。
これをテーブルにすると以下になります。

フレームワーク ファイル数* コード行数*
AndroidJava 179 12,176
Flutter 31 1,735

*AndroidJavaでは.java.xmlファイルのみ、Flutterでは.dartのみで比較されています。

桁が違いますね!
ファイル数では約82%, コード量では約86%も減っていたそうです。

詳細は以下。

AndroidJavaで書かれたアプリの情報

http://cloc.sourceforge.net v 1.60  T=0.42 s (431.4 files/s, 37607.1 lines/s)
--------------------------------------------------------------------------------
Language                      files          blank        comment           code
--------------------------------------------------------------------------------
Java                             83           2405            512           8599
XML                              96            478             28           3577
Bourne Again Shell                1             19             20            121
DOS Batch                         1             24              2             64
IDL                               1              2              0             15
--------------------------------------------------------------------------------
SUM:                            182           2928            562          12376

Flutter/Dartで書かれたアプリの情報


Meta-Date for the Flutter app

http://cloc.sourceforge.net v 1.60  T=0.16 s (247.5 files/s, 14905.1 lines/s)
--------------------------------------------------------------------------------
Language                      files          blank        comment           code
--------------------------------------------------------------------------------
Dart                             31            263             39           1735
Bourne Again Shell                1             19             20            121
DOS Batch                         1             24              2             64
XML                               3              3             22             35
YAML                              1              9              9             17
Objective C                       2              4              1             16
C/C++ Header                      1              2              0              4
--------------------------------------------------------------------------------
SUM:                             40            324             93           1992
--------------------------------------------------------------------------------

私自身で比較したわけではなく、あくまでこの記事によれば、という点はご注意ください。

6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2