aboutsummaryrefslogtreecommitdiff
path: root/documentation/content/zh-tw/books/developers-handbook/introduction/chapter.adoc
blob: 61ee4970a55ad8d8cfd0361176cdf7100cbf653b (plain) (blame)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
---
title: 章 1. 簡介
authors:
  - author: Murray Stokely
  - author: Jeroen Ruigrok van der Werven
prev: books/developers-handbook/
next: books/developers-handbook/tools
---

[[introduction]]
= 簡介
:doctype: book
:toc: macro
:toclevels: 1
:icons: font
:sectnums:
:sectnumlevels: 6
:sectnumoffset: 1
:partnums:
:source-highlighter: rouge
:experimental:
:images-path: books/developers-handbook/

ifdef::env-beastie[]
ifdef::backend-html5[]
:imagesdir: ../../../../images/{images-path}
endif::[]
ifndef::book[]
include::shared/authors.adoc[]
include::shared/mirrors.adoc[]
include::shared/releases.adoc[]
include::shared/attributes/attributes-{{% lang %}}.adoc[]
include::shared/{{% lang %}}/teams.adoc[]
include::shared/{{% lang %}}/mailing-lists.adoc[]
include::shared/{{% lang %}}/urls.adoc[]
toc::[]
endif::[]
ifdef::backend-pdf,backend-epub3[]
include::../../../../../shared/asciidoctor.adoc[]
endif::[]
endif::[]

ifndef::env-beastie[]
toc::[]
include::../../../../../shared/asciidoctor.adoc[]
endif::[]

[[introduction-devel]]
== 在 FreeBSD 開發程式

好了我們開始吧!我想你的 FreeBSD 已經安裝好了,而且已經準備好要用它寫點程式了吧? 但是要從哪裡開始呢? 有提供寫程式的程式或環境嗎? 身為 programer 的我可以做什麼呢?

本章試著回答你一些問題,當然,單就 programming 程度來說可分很多種層次, 有的人只是單純當興趣,有的則是他的專業, 本章主要內容是針對程式初學者, 當然,對於那些不熟 的程式開發者而言,本文件內容也是十分實用的。

[[introduction-bsdvision]]
== The BSD Vision

為了讓你寫出來的程式在 like系統上具有良好的使用性、效能和穩定性, 我們必須跟你介紹一些程式概念(original software tools ideology)。 

[[introduction-archguide]]
== 程式架構指南

我們想介紹的概念如下

* 在整個程式還沒寫完前,不要增加新的功能。
* 另外一個重點就是,讓你自己選擇你的程式將會具有何種功能, 而不是讓別人決定,不想要去滿足全世界的需求,除非你想讓你的程式具有擴充性或相容性。
* 千萬記住:在沒有相關經驗時,參考範例程式碼所寫出來的程式, 會比自己憑空寫出來的好。
* 當你寫的程式沒辦法完全解決問題時,最好的方法就是不要試著要去解決它。
* 若用 10% 的心力就能輕鬆完成 90% 的工作份量,就用這個簡單法子吧。
* 盡可能地簡化問題的複雜。
* 提供機制(mechanism),而非原則(policy)。 比方說,把使用者介面選擇權交由使用者來決定。

以上摘自 Scheifler Gettys 的 "X Window System" 論文

[[introduction-layout]]
== [.filename]#/usr/src# 的架構

完整的 FreeBSD 原始碼都在公開的 CVS repository 中。 通常 FreeBSD 原始碼都會裝在 [.filename]#/usr/src#, 而且包含下列子目錄:

[.informaltable]
[cols="1,1", frame="none", options="header"]
|===
| Directory
| Description

|[.filename]#bin/#
|Source for files in [.filename]#/bin#

|[.filename]#contrib/#
|Source for files from contributed software.

|[.filename]#crypto/#
|Cryptographical sources

|[.filename]#etc/#
|Source for files in [.filename]#/etc#

|[.filename]#games/#
|Source for files in [.filename]#/usr/games#

|[.filename]#gnu/#
|Utilities covered by the GNU Public License

|[.filename]#include/#
|Source for files in [.filename]#/usr/include#

|[.filename]#kerberos5/#
|Source for Kerberos version 5

|[.filename]#lib/#
|Source for files in [.filename]#/usr/lib#

|[.filename]#libexec/#
|Source for files in [.filename]#/usr/libexec#

|[.filename]#release/#
|Files required to produce a FreeBSD release

|[.filename]#rescue/#
|Build system for the [.filename]#/rescue# utilities

|[.filename]#sbin/#
|Source for files in [.filename]#/sbin#

|[.filename]#secure/#
|FreeSec sources

|[.filename]#share/#
|Source for files in [.filename]#/usr/share#

|[.filename]#sys/#
|Kernel source files

|[.filename]#tools/#
|Tools used for maintenance and testing of FreeBSD

|[.filename]#usr.bin/#
|Source for files in [.filename]#/usr/bin#

|[.filename]#usr.sbin/#
|Source for files in [.filename]#/usr/sbin#
|===