MarshalChen's Blog

Founder of FlagshipSoft

Introduction of UltimateAndroid

| Comments

UltimateAndroid

Version:0.7.1

UltimateAndroid is a rapid development framework for developing apps

Android快速开发框架 UltimateAndroid

Master branch:Build Status

Dev branch:Build Status

English Introduction

中文简介

English Tutorials

中文详细教程

Ui Demo scrennshot

Try Demo

Update Ui for Material Design! Support Android Studio 1.0
You can see javadoc here
There is an awesome recyclerview which contains pulling to refresh, loading more, swiping to dismiss, draging and drop, animations ,showing or hiding toolbar and floating action button when scrolling and many other features,you can try it here UltimateRecyclerView.
Welcome to fork and pull request.

If you have some good idea about the framework,you can email to us or put your idea on the issue.My Email is cymcsg # gmail.com

Introduction


UltimateAndroid is a rapid development framework for developing apps.UltimateAndroid framework contains many features like View Injection,ORM,Asynchronous Networking and Image Loader,User scenario testing,over 100 Ui effects etc.And there are also many useful features like WebViewUtils,DaoUtils,Https Utils,CryptographyUtils,FileUploadUtils etc.The framework will be added more feature in the future.
The framework is like flask(a web development framework) which contains some other opensource project like Butter Knife,Asynchronous Http Client for Android, Universal Image Loader for Android and many other which I said at the end of Readme or in the updatelog.

Up to now,I have only write the demo of most parts of UI modules and View Injection.The demo is something boring,but you can see many kinds of UI modules.The DemoOfUi’s screenshots are below,and you can download the apk directly.

Demo of Ui’s screenshot is here.

New for 0.7.0:

UltimateAndroidUi project now has four separate ui projects:widget,component,animations and lollipop. So if you want to only use part of the ui project you can simply use the separate project. However if you want to use all of them, you can also use the UltimateAndroidUi project.

Update Log

Demo Manual

Quick Setup(Basic Usage)

  1. Gradle way(Recommended):

Core framework:

1
2
3
4
5
6
7
repositories {
        jcenter()
    }
dependencies {
    ...
    compile 'com.marshalchen.ultimateandroid:ultimateandroid:0.7.1'
}

Ui framework:

1
2
3
4
5
6
7
repositories {
        jcenter()
    }
dependencies {
    ...
    compile 'com.marshalchen.ultimateandroid:ultimateandroidui:0.7.0'
}

Separate Ui framework:

1
2
3
4
5
6
7
repositories {
        jcenter()
    }
dependencies {
    ...
    compile 'com.marshalchen.ultimateandroid:ultimateandroiduiwidget:0.7.0'
}
1
2
3
4
5
6
7
repositories {
        jcenter()
    }
dependencies {
    ...
    compile 'com.marshalchen.ultimateandroid:ultimateandroiduicomponent:0.7.0'
}
1
2
3
4
5
6
7
repositories {
        jcenter()
    }
dependencies {
    ...
    compile 'com.marshalchen.ultimateandroid:ultimateandroiduianimation:0.7.0'
}
1
2
3
4
5
6
7
repositories {
        jcenter()
    }
dependencies {
    ...
    compile 'com.marshalchen.ultimateandroid:ultimateandroiduilollipop:0.7.0'
}

UltimateAndroidUi project now has four separate ui projects:widget,component,animations and lollipop. So if you want to only use part of the ui project you can simply use the separate projects. However if you want to use all of them, you can also use the UltimateAndroidUi project(you can use four separate projects together either).

Normal way:

If you want to use the framework and edit it at the same time,you can use Import Project(need Android Studio version above 1.0) and choose the UltimateAndroidGradle folder.

If you want to use UltimateAndroid without the UIModules,you can just depend on UltimateAndroid and this will make the app more flexible.If you use normal way in eclipse,you can import the UltimateAndroidNormal folder and pay attention that UltimateAndroid depends on appcompat, UltimateAndroidUi depends on UltimateAndroid,and the DemoOfUi is depends on UltimateAndroidUi(Notice that the UltimateAndroidNormal project has been deprecated).

2.As the function of View Injection which uses ButterKnife,you should config your IDE before you can compile the project.Most of IDEs require additional configuration in order to enable annotation processing for Butter Knife, or you can see IntelliJ IDEA Configuration for Butter Knife or Eclipse Configuration for butter Knife.

Notice:The latest version of the framework needs Android Sdk of Version 21. If you use gradle project, you should use android studio which version should be 1.0.0+. If you use latest Android Studio ,you do not need set annotation processing

3.View Injection:

Example:

1
2
3
4
5
6
7
8
9
10
11
12
  class ExampleActivity extends Activity {
  @InjectView(R.id.title) TextView title;
  @InjectView(R.id.subtitle) TextView subtitle;
  @InjectView(R.id.footer) TextView footer;

  @Override public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.simple_activity);
    ButterKnife.inject(this);
    // TODO Use "injected" views...
  }
}

Another use is simplifying the view holder pattern inside of a list adapter.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public class MyAdapter extends BaseAdapter {
@Override public View getView(int position, View view, ViewGroup parent) {
    ViewHolder holder;
    if (view != null) {
      holder = (ViewHolder) view.getTag();
    } else {
      view = inflater.inflate(R.layout.whatever, parent, false);
      holder = new ViewHolder(view);
      view.setTag(holder);
    }
    holder.name.setText("John Doe");
    // etc...
    return view;
    }
    static class ViewHolder {
    @InjectView(R.id.title) TextView name;
    @InjectView(R.id.job_title) TextView jobTitle;
    public ViewHolder(View view) {
    ButterKnife.inject(this, view);
    }
    }
}

4.Asynchronous Network: Use asynchronous utils,you do not need to use an addtional Thread to visit network.It also contains file upload etc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
HttpUtilsAsync.get("http://www.google.com", new AsyncHttpResponseHandler() {

  @Override
  public void onStart() {
      // called before request is started
  }

  @Override
  public void onSuccess(int statusCode, Header[] headers, byte[] response) {
      // called when response HTTP status is "200 OK"
  }

  @Override
  public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Throwable e) {
      // called when response HTTP status is "4XX" (eg. 401, 403, 404)
  }

  @Override
  public void onRetry(int retryNo) {
      // called when request is retried
}
});

Post request:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
HttpUtilsAsync.post("http://www.google.com", params,new AsyncHttpResponseHandler() {

  @Override
  public void onStart() {
      // called before request is started
  }

  @Override
  public void onSuccess(int statusCode, Header[] headers, byte[] response) {
      // called when response HTTP status is "200 OK"
  }

  @Override
  public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Throwable e) {
      // called when response HTTP status is "4XX" (eg. 401, 403, 404)
  }

  @Override
  public void onRetry(int retryNo) {
      // called when request is retried
}
});

5.Display Images: If you have already use or extend CommonApplication,you can use like this: ImageLoader.getInstance().displayImage((imageUri, imageView));

Or for some advantage usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
imageLoader.displayImage(imageUri, imageView, displayOptions, new ImageLoadingListener()  {
    @Override
    public void onLoadingStarted(String imageUri, View view) {
        ...
    }
    @Override
    public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
        ...
    }
    @Override
    public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
    ...
    }
    @Override
    public void onLoadingCancelled(String imageUri, View view) {
     ...
     }
}, new ImageLoadingProgressListener() {
 @Override
 public void onProgressUpdate(String imageUri, View view, int current, int total) {
 ...
 }
});
1
2
3
4
5
6
7
8
  // Load image, decode it to Bitmap and return Bitmap to callback
  ImageSize targetSize = new ImageSize(120, 80); // result Bitmap will be fit to this size
  imageLoader.loadImage(imageUri, targetSize, displayOptions, new   SimpleImageLoadingListener() {
    @Override
    public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
        // Do whatever you want with Bitmap
    }
  });

Acceptable URIs examples:

1
2
3
4
5
String imageUri = "http://site.com/image.png"; // from Web
String imageUri = "file:///mnt/sdcard/image.png"; // from SD card
String imageUri = "content://media/external/audio/albumart/13"; // from content provider
String imageUri = "assets://image.png"; // from assets
String imageUri = "drawable://" + R.drawable.image; // from drawables (only images,   non-9patch)

NOTE: Use drawable:// only if you really need it! Always consider the native way to load drawables - ImageView.setImageResource(…) instead of using of ImageLoader.

6.ORM:

You can read the documents of GreenDao

UI Modules

  • Support animations for Android 2.3
  • EnhanceListView for listview which can swipe to dismiss the item
  • Shimmer and Titanic to let the textview more amazing
  • SmoothProgressBar to let the progress bar like Gmail or Google +
  • Flip View for implementing flipping between views as seen in the popular Flipboard application
  • PhotoView to help produce an easily usable implementation of a zooming Android ImageView
  • PagerSlidingTabStrip and ViewPagerIndicator to help customing View Pager more easily.
  • SwipeBackLayout to help you finish a activity by swipe the screen.
  • Material Design
  • And there are more than 100 UI modules which I do not mention here.

简介


框架目前主要包含的功能有View Injection,ORM,异步网络请求和图片加载,自动化脚本测试,磁盘LRU等功能.同时提供了类似于TripleDes、Webview快速设置、Cryptography处理、String处理,Https处理,文件上传等常用工具类,还有超过100多种UI控件效果。并且这些功能正在逐步增加中。

UltimateAndroid框架是如同flask框架(python)那样包含了许多其他的开源项目的框架,比如 Butter Knife,Asynchronous Http Client for Android, Universal Image Loader for Android 还有许多我在 Readme 或者 updatelog中提到的.

欢迎各种fork与提意见。

如果大家有需要的功能,欢迎随时提意见。

0.7.0新版本:

UltimateUI 项目分拆成widget,component,animations,lollipop 4个子项目,如果你只需要部分UI效果的话,你可以只依赖这些子项目.如果你想使用多个种类的UI项目的话,也可以简单的依赖UltimateAndroidUi项目(当然,你也可以依赖4个子项目)。

UI截图在这里

部分UI模块介绍(感谢arccode)

Welcome to fork.

QQ交流群:341970175(请注明Android开发)

Demo 使用方法

Demo依赖于appcompat 和 UltimateAndroid,你可以在IDE或者配置文件里面添加一下依赖。

快速入门(基础使用)

Gradle way(Recommend):

Main framework:

1
2
3
4
5
6
7
repositories {
        jcenter()
    }
dependencies {
    ...
    compile 'com.marshalchen.ultimateandroid:ultimateandroid:0.7.1'
}

Ui framework:

1
2
3
4
5
6
7
repositories {
        jcenter()
    }
dependencies {
    ...
    compile 'com.marshalchen.ultimateandroid:ultimateandroidui:0.7.0'
}

分离的UI项目:

1
2
3
4
5
6
7
repositories {
        jcenter()
    }
dependencies {
    ...
    compile 'com.marshalchen.ultimateandroid:ultimateandroiduiwidget:0.7.0'
}
1
2
3
4
5
6
7
repositories {
        jcenter()
    }
dependencies {
    ...
    compile 'com.marshalchen.ultimateandroid:ultimateandroiduicomponent:0.7.0'
}
1
2
3
4
5
6
7
repositories {
        jcenter()
    }
dependencies {
    ...
    compile 'com.marshalchen.ultimateandroid:ultimateandroiduilollipop:0.7.0'
}
1
2
3
4
5
6
7
repositories {
        jcenter()
    }
dependencies {
    ...
    compile 'com.marshalchen.ultimateandroid:ultimateandroiduianimation:0.7.0'
}
Normal way:

1.传统的library和gradle 的library在不同的文件夹中。如果你使用gradle方式,你可以拷贝 “ultimateandroid.aar” 到你的项目中 ,添加 compile(name:'ultimateandroid', ext:'aar')到gradle file中 .如果你使用gradle方式,并且想同时修改框架,可以用android studio的Import Studio Project(需要Android Studio1.0以上版本) 导入UltimateAndroidGradle文件夹。如果使用Eclipse的话,需要注意UltimateAndroid 依赖 appcompat.UltimateAndroidUi 依赖 UltimateAndroid.DemoOfUi 依赖 UltimateAndroidUi.如果你不需要使用UiModule的话,可以直接依赖UltimateAndroid,这样体积会更纤细。

2.Demo的Apk文件可以直接下载使用.由于框架使用了View Injection,大部分IDE需要开启annotation的编译(使用了Butter Knife),如果不清楚如何开启可以看一下IntelliJ IDEA Configuration for Butter Knife or Eclipse Configuration for butter Knife.

注意:UltimateAndroid框架需要API21版本的Android SDK来进行编译,如果使用了gradle的project,android studio的版本需要大于1.0.0如果你用的是最新版的Android Studio,你不需要显式的开启annotation processing了

3.视图注入:

Example:

1
2
3
4
5
6
7
8
9
10
11
12
class ExampleActivity extends Activity {
@InjectView(R.id.title) TextView title;
@InjectView(R.id.subtitle) TextView subtitle;
@InjectView(R.id.footer) TextView footer;

@Override public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.simple_activity);
  ButterKnife.inject(this);
  // TODO Use "injected" views...
  }
}

Another use is simplifying the view holder pattern inside of a list adapter.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public class MyAdapter extends BaseAdapter {
@Override public View getView(int position, View view, ViewGroup parent) {
    ViewHolder holder;
    if (view != null) {
      holder = (ViewHolder) view.getTag();
    } else {
      view = inflater.inflate(R.layout.whatever, parent, false);
      holder = new ViewHolder(view);
      view.setTag(holder);
    }
    holder.name.setText("John Doe");
    // etc...
    return view;
    }
    static class ViewHolder {
    @InjectView(R.id.title) TextView name;
    @InjectView(R.id.job_title) TextView jobTitle;
    public ViewHolder(View view) {
    ButterKnife.inject(this, view);
    }
    }
}

4.异步网络请求: 使用异步网络请求工具,你不需要在额外的声明Thread来进行网络请求。同时也包括文件上传等内容。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
HttpUtilsAsync.get("http://www.google.com", new AsyncHttpResponseHandler() {

  @Override
  public void onStart() {
      // called before request is started
  }

  @Override
  public void onSuccess(int statusCode, Header[] headers, byte[] response) {
      // called when response HTTP status is "200 OK"
  }

  @Override
  public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Throwable e) {
      // called when response HTTP status is "4XX" (eg. 401, 403, 404)
  }

  @Override
  public void onRetry(int retryNo) {
      // called when request is retried
}
});

Post request:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
HttpUtilsAsync.post("http://www.google.com", new AsyncHttpResponseHandler() {

  @Override
  public void onStart() {
      // called before request is started
  }

  @Override
  public void onSuccess(int statusCode, Header[] headers, byte[] response) {
      // called when response HTTP status is "200 OK"
  }

  @Override
  public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Throwable e) {
      // called when response HTTP status is "4XX" (eg. 401, 403, 404)
  }

  @Override
  public void onRetry(int retryNo) {
      // called when request is retried
}
});

5.显示图片: 如果你已经使用或继承了CommonApplication,你可以如下使用: ImageLoader.getInstance().displayImage((imageUri, imageView));

或者高级使用:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
imageLoader.displayImage(imageUri, imageView, displayOptions, new ImageLoadingListener()  {
    @Override
    public void onLoadingStarted(String imageUri, View view) {
        ...
    }
    @Override
    public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
        ...
    }
    @Override
    public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
    ...
    }
    @Override
    public void onLoadingCancelled(String imageUri, View view) {
     ...
     }
}, new ImageLoadingProgressListener() {
 @Override
 public void onProgressUpdate(String imageUri, View view, int current, int total) {
 ...
 }
});
1
2
3
4
5
6
7
8
// Load image, decode it to Bitmap and return Bitmap to callback
ImageSize targetSize = new ImageSize(120, 80); // result Bitmap will be fit to this size
imageLoader.loadImage(imageUri, targetSize, displayOptions, new   SimpleImageLoadingListener() {
  @Override
  public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
      // Do whatever you want with Bitmap
  }
});

可以使用的URI格式:

1
2
3
4
5
String imageUri = "http://site.com/image.png"; // from Web
String imageUri = "file:///mnt/sdcard/image.png"; // from SD card
String imageUri = "content://media/external/audio/albumart/13"; // from content provider
String imageUri = "assets://image.png"; // from assets
String imageUri = "drawable://" + R.drawable.image; // from drawables (only images,   non-9patch)

NOTE: Use drawable:// only if you really need it! Always consider the native way to load drawables - ImageView.setImageResource(…) instead of using of ImageLoader.

6.ORM:

可以查看Greendao的文档 :GreenDao

UI 模块

  • 支持Android2.3 上面的动画效果
  • Listview的滑动删除
  • 动态的textview
  • 类似Gmail和Google+的进度条
  • 类似FlipBoard的翻页效果
  • 放大缩写图片的模块
  • 影视效果的图片
  • 更方便的定制ViewPager
  • 滑动后退
  • Material Design

    还有超过100多种其他模块没有提到

Warning

Some stuff is just implemented to showcase its functionality and so they are not optimized for performance and they are not done with “best practice” in mind.

Screen Shot:

tutorials2

tutorials2

tutorials2

tutorials2

tutorials2

tutorials2

tutorials2

tutorials2

tutorials2

tutorials2

tutorials2

tutorials2

tutorials2

tutorials2


Sample

You can clone the project and compile it yourself (it includes a sample), or you can check it out already compiled at Google Play

Google Play

Download demo apk directly

Notice that it might not be the latest version

The UltimateAndroid use many opensource program and I am very grateful to the author of them. The opensource program which I use:

1.JakeWharton’s Butter Knife for View Injection.

2.loopj’s Asynchronous Http Client for Android.

3.nostra13’s Universal Image Loader for Android

4.greenrobot’s greenDAO

5.pardom’s ActiveAndroid

6.JakeWharton’s DiskLruCache

7.Issacw0ng’s SwipeBackLayout

8.google-gson

9.RobotiumTech’s robotium

10.JakeWharton’s NineOldAndroids

11.JakeWharton’s Android-ViewPagerIndicator

12.RippleEffect

13.Material Menu

14.FloatingActionButton
15.FloatingActionButtonWithListView

16.Android View Animations

17.android-common

18.ListviewAnimations

19.PagerSlidingTabStrip

20.Rebound

21.Titanic

22.FaceCrop

23.KenBurns

24.AndroidSwipeLayout

There are some other projects which I write in Update Log.

If there’s anything I forgot to mention,I would be very appreciated for helping me notice it.

License

Copyright 2014 Marshal Chen

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

JsonUtils Which Uses Gson

| Comments

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
public class JsonUtil {
    public static <T> T getListFromJson(String jsonString, TypeToken typeToken) {
        Gson gson = new Gson();
        return gson.fromJson(jsonString, typeToken.getType());
    }
    public static <T> T getTFromJson(String jsonString, Class<T> t) {
        Gson gson = new Gson();
        return gson.fromJson(jsonString, t);
    }
    public static ArrayList getArrayListMapFromJson(String jsonString) {
        JsonParser jsonParser = new JsonParser();
        Gson gson = new Gson();
        JsonElement jsonElement = jsonParser.parse(jsonString);
        Logs.d(jsonElement.isJsonArray() + "   " + jsonElement.isJsonObject());
        ArrayList<HashMap<String, Object>> arrayList = new ArrayList<HashMap<String, Object>>();
        if (jsonElement.isJsonObject()) {
            arrayList.add(gson.fromJson(jsonElement, HashMap.class));
        } else if (jsonElement.isJsonArray()) {
            arrayList = getListFromJson(jsonString, new TypeToken<ArrayList<HashMap<String, Object>>>() {
            });
        }
        return arrayList;
    }
    public static ArrayList getArrayListFromJson(String jsonString) {
        JsonParser jsonParser = new JsonParser();
        Gson gson = new Gson();
        JsonElement jsonElement = jsonParser.parse(jsonString);
        Logs.d(jsonElement.isJsonArray() + "   " + jsonElement.isJsonObject());
        ArrayList arrayList = new ArrayList();
        if (jsonElement.isJsonObject()) {
            arrayList.add(gson.fromJson(jsonElement, HashMap.class));
        } else if (jsonElement.isJsonArray()) {
            arrayList = getListFromJson(jsonString, new TypeToken<ArrayList>() {
            });
        }
        return arrayList;
    }
    public static Object getObjectListFromJson(String jsonString) {
        Gson gson = new Gson();
        Object object = gson.fromJson(jsonString, new TypeToken<List<Object>>() {
        }.getType());
        return object;
    }
    public static Object getObjectFromJson(String jsonString) {
        Gson gson = new Gson();
        Object object = gson.fromJson(jsonString, Object.class);
        return object;
    }
    public static void iteratorArrayList(ArrayList arrayList) {
        Iterator it1 = arrayList.iterator();
        while (it1.hasNext()) {
            int i = 0;
            Iterator it = ((HashMap<String, String>) it1.next()).entrySet().iterator();
            while (it.hasNext()) {
                i++;
                Map.Entry entry = (Map.Entry) it.next();
                Object key = entry.getKey();
                Object value = entry.getValue();
                Logs.d("key--" + key + "  value   " + value + "\n");
            }
        }
    }
    public static void iteratorList(List inputList) {
        Iterator it1 = inputList.iterator();
        while (it1.hasNext()) {
            int i = 0;
            Iterator it = ((HashMap<String, String>) it1.next()).entrySet().iterator();
            while (it.hasNext()) {
                i++;
                Map.Entry entry = (Map.Entry) it.next();
                Object key = entry.getKey();
                Object value = entry.getValue();
                Logs.d("key--" + key + "  value   " + value + "\n");
            }
        }
    }
}

Hacker and Agile Development

| Comments

黑客和敏捷开发

前段时间读了一下Paul Graham的《黑客与画家》(Hackers and Painters: Big Ideas from the Computer Age),虽说这书已经出版良久了,但是读书往往是不讲究时间的,有收获就好。这本书是文集,相对内容比较散,针对的也并非是业内人士,所以不同人在不同角度可以把这本书看出千滋百味。但不管怎么说,我觉得绝大多数人,都可以从这本书中收获良多。本人是IT行业人士,仅从IT创业者角度谈谈自己的理解。

”如果观察那些做出伟大作品的人,你会发现他们的共同点就是工作的非常艰苦。如果你工作的不艰苦,你可能正在浪费时间。 并非所有的痛苦都是有益的。世界上有有益的痛苦,也有无益的痛苦。你需要的是咬牙向前冲刺的痛苦,而不是脚背钉子扎破的痛苦。解决难题的痛苦对设计师有好处,但是对付挑剔的客户的痛苦或者对付质量低劣的建材的痛苦就是另一回事了。“

创业的辛苦是必然,但是绝不是随随便便的辛苦就能成功的。辛苦要用在往目标冲刺当中,与对手博弈之中,而不是无谓的的消费。而这也跟Hacker们所一贯追求的相符(本文中的Hacker与书中的Hacker所指一致,均是指有追求的Geekers)。对于创业过程来说,在搭好了开展事业所需要的基本的条件之后,就专心致志于自己的主业吧。而在主业中,也需要集中在一两个点重点突破,而不要总被别的事情所分散。

那么具体到这一个过程,又有哪些可以注意的地方呢?

首先,我们需要明白,"创业一直有一个潜规则: 一旦创业了,很多事情是不由你的。创业前, 你只想努力2-3倍,从而得到相应的回报。 但真正创业后,你的竞争对手决定了你到底要有多辛苦。 而他们做出的决定都是一样的: 你能吃多少苦,我们就能吃多少苦,所以创业者才会很苦逼。这种情况下,你应该超越出来,从层次上高于你所在的环境。否则你势必将做得异常累。"那么,我们需要做的,就是要用超出对手的层次与境界与对手竞争。而这个竞争过程又分为战略和战术两个层次,两者相互配合,缺一不可。战略上要从产品本身,定位,核心功能等方面入手,要站的比对手高,看的比对手远。而要做到这点,有两个方面需要注意:一是确立好需要解决问题的初衷而不是为了Show技术,二是不要盲目的认为自己就是比别人想的远,而是要通过大量的验证来调整,而为了支持不断大量的调整,敏捷思想必不可少。在战术上,就要考虑到每一个细节的实现是否得当。而具体到IT创业的话,这个战术跟写程式就密不可分了。而写程式的相关内容,我们下面再说。

第二,我们还需要明白,“人们真正注意到你的时候,不是第一眼看到你站在那里,而是发现过了这么久你居然还在那里。” 有的时候不是你不美,而是你的美丽没有绽放太久就中道崩殂了。坚持的重要性无需多言,但是把握好坚持与变通的临界,这是一门艺术活。

第三,在创业这个问题上,“致富的最好办法是创造财富(而不是掠夺)”。只要能够创造财富,就能获得财富。而掠夺财富的话,财富的持久性是值得怀疑的。“要更好的创造财富,你做的事情需要两点保证:可测量性,可放大性。硅谷的诀窍,可测量性来自小团队,可放大性来自开发新技术。”而针对小团队的测量创造财富的能力,和开发新技术来真正创造财富,无疑是小团队们的核心竞争力。

现在再回到创业战术的问题上来,针对IT创业的话,具体的战术跟写程式十分密切。而为了能在战术上比对手快速而高效,选择非常敏捷的语言是个好主意。在书中为了能高效的写程式,作者对Lisp十分推崇。对此,我持部分赞同意见。对于Lisp语言的思想,无疑是现在程序设计语言的典范。但是针对具体的开发过程,直接使用Lisp未必真能非常高效。 第一,目前已经掌握Lisp语言的程序员相对小众,如果你本来没有掌握Lisp,为了Lisp而Lisp,没有几年的积累,很可能成为“只有宝剑而没有对应剑术”,所以是否使用Lisp得视情况而定。第二,不可否认,目前Lisp的库相对不够丰富,但是对此也有解决方法,就是使用支持Java类库Clojure。这也是我认为Clojure优于Common Lisp和Scheme的重要原因。第三点就是由于Lisp程序员由于太小众了,确实在想扩张的时候容易捉襟见肘。即使是Clojure在国内也丰富不到哪去,对此我的观点是,为什么不试试Ruby呢?当然本文并非语言之争,上述观点也只是鄙人浅见,是鄙人针对目前情况的看法而已,如果读者不认同,还请批评指正。

应该来说,《黑客与画家》还是非常值得一读之书,相信你读了之后,也会有新的理解和体会。最后,我想用《黑客与画家》中的一句话结束文章:“画作永远没有完工的一天,你只是不再画下去而已。 ” 我们的生命,就是作画。