SlideShare a Scribd company logo
1 of 27
Julia小程式到專案發布之旅
JULIA TAIWAN 發起人 杜岳華
Outline
 專案的長相
 如何組織一個專案
 寫測試
 用julia套件管理系統測試
 上github
 註冊
專案的長相
 <project name>/
 src/: source code
 test/: test code
 appveyor.yml
 LICENSE.md
 README.md
 REQUIRE: the requirement modules, including the Julia version (necessary)
如何產生一個專案
 自動產生一個專案
julia> PkgDev.generate("FooBar","MIT")
安裝PkgDev
julia> Pkg.add("PkgDev")
julia> using PkgDev
一些命名規則
 別用術語
 別用`Julia`
 提供新型別的套件,請用複數,`DataFrames`套件提供
`DataFrame`型別
 偏好明確而長的套件名稱,而不是短而模糊
一些命名規則
 使用非系統性的命名來提供更多樣的實作
 在Julia中沒有提供一個固定的繪圖套件,Gadfly、PyPlot、Winston就
提供了多樣的繪圖套件實作
 相對,SortingAlgorithms提供了一致性的介面跟全面性的實作
 如果是包裝外部的library,請以該套件名稱命名
 MATLAB.jl提供了Julia呼叫MATLAB engine的介面
你可以在哪裡找到他
 Linux
 /home/$USER/.julia/v0.5/Foo
 Windows
 C:Users%username%.juliav0.5Foo
 Mac
 ?
 <家目錄>/.julia/<版本>/<套件>
Source code
 src/
 Foo.jl
 bar1.jl
 bar2.jl
 …
__precompile__()
module Foo
using ……
import ……
export <lots of functionalities>
include(“bar1.jl")
include(“bar2.jl")
end
Test code
 test/
 runtests.jl
 bar1.jl
 bar2.jl
 …
using Foo
using Base.Test
tests = [“bar1",
“bar2"]
println("Running tests:")
for t in tests
println(" * $(t)")
include("$(t).jl")
end
在開始commit之前
 設定git
 申請github帳號
$ git config --global user.name "FULL NAME"
$ git config --global user.email "EMAIL"
$ git config --global github.user "USERNAME"
小技巧
 在Julia REPL中按`;`
Coding……
 按照不同功能分別開成不同的bar1.jl、bar2.jl
 除了套件名稱大寫以外,其餘的都小寫
 最好可以將功能拆解成
 一個型別 (或物件)一個檔案
 太多的檔案可以用folder區隔開來
Best practice
Example
#
# Subject
#
immutable Subject <: Functor
value
end
function get(subject::Subject)
return subject.value
end
function init_task(f::Function, args::Vararg)
x = @task f(args...)
consume(x)
return x
end
記得export
__precompile__()
module Foo
using ……
import ……
export Subject, get, init_task
include(“bar1.jl")
include(“bar2.jl")
end
寫測試
#
# Subject
#
a = Subject(10)
b = Subject(30)
@test get(a) == 10
@test _map(a, x -> x + 2) == Subject(12)
@test _filter(a, x -> x > 2) == a
@test _filter(a, x -> x > 20) == Subject(nothing)
@test _reduce(a, b, (x, y) -> (x + y)/2) == Subject(20.0)
跑測試
Pkg.test(“Foo")
Debug……
 目前我還沒碰到比較複雜的邏輯錯誤
 比較多是syntax error或是exception
 這些都比較好解決
Profiling……
 比較好的開發方法都會要求要測效能
 我也才剛開專案沒多久
 比較沒有效能問題
版本控制
 Julia的專案是預設用git
$ git add xxxxxxx
$ git commit –m “xxxxxxxxxxx"
在Github上建立專案
 官方的作法
 我的作法
julia> Pkg.clone("git://github.com/StefanKarpinski/FooBar.jl.git")
$ cd <project directory>
$ git remote add origin git://………
註冊
julia> PkgDev.config()
julia> PkgDev.register("FooBar")
INFO: Registering FooBar at
git://github.com/StefanKarpinski/FooBar.jl.git
INFO: Committing METADATA for FooBar
Add tags
julia> PkgDev.tag("FooBar")
INFO: Tagging FooBar v0.0.1
INFO: Committing METADATA for FooBar
Publish
julia> PkgDev.publish()
INFO: Validating METADATA
INFO: No new package versions to publish
INFO: Submitting METADATA changes
INFO: Forking JuliaLang/METADATA.jl to StefanKarpinski
INFO: Pushing changes as branch pull-request/ef45f54b
INFO: To create a pull-request open:
https://github.com/StefanKarpinski/METADATA.jl/compare/pull-
request/ef45f54b
CI
 Already generated files:
 `.travis.yml` for Travis
 `appveyor.yml` for AppVeyor
Thank you for attention
Q & A

More Related Content

Viewers also liked

20170317 functional programming in julia
20170317 functional programming in julia20170317 functional programming in julia
20170317 functional programming in julia岳華 杜
 
20170113 julia’s type system and multiple dispatch
20170113 julia’s type system and multiple dispatch20170113 julia’s type system and multiple dispatch
20170113 julia’s type system and multiple dispatch岳華 杜
 
手把手Julia及簡易IDE安裝
手把手Julia及簡易IDE安裝手把手Julia及簡易IDE安裝
手把手Julia及簡易IDE安裝岳華 杜
 
20161209-Julia Taiwan first meetup-julia語言入門
20161209-Julia Taiwan first meetup-julia語言入門20161209-Julia Taiwan first meetup-julia語言入門
20161209-Julia Taiwan first meetup-julia語言入門岳華 杜
 
ONTAP - Recording Equipment
ONTAP - Recording EquipmentONTAP - Recording Equipment
ONTAP - Recording EquipmentWRDSB
 
7th March 2017 - Signs of the End times
7th March 2017  - Signs of the End times7th March 2017  - Signs of the End times
7th March 2017 - Signs of the End timesThorn Group Pvt Ltd
 
Sociedad del conocimiento
Sociedad del conocimientoSociedad del conocimiento
Sociedad del conocimientoZaira5
 
Eko kalendar 2012
Eko kalendar 2012Eko kalendar 2012
Eko kalendar 2012knowhowngo
 
unusual accidents, personal injury
unusual accidents, personal injuryunusual accidents, personal injury
unusual accidents, personal injuryStephen Gowland
 
KEEPING THE HISTORICAL HERITAGE ALIVE: Methodology and pre-assessment tool fo...
KEEPING THE HISTORICAL HERITAGE ALIVE: Methodology and pre-assessment tool fo...KEEPING THE HISTORICAL HERITAGE ALIVE: Methodology and pre-assessment tool fo...
KEEPING THE HISTORICAL HERITAGE ALIVE: Methodology and pre-assessment tool fo...DS2BE
 

Viewers also liked (12)

20170317 functional programming in julia
20170317 functional programming in julia20170317 functional programming in julia
20170317 functional programming in julia
 
20170113 julia’s type system and multiple dispatch
20170113 julia’s type system and multiple dispatch20170113 julia’s type system and multiple dispatch
20170113 julia’s type system and multiple dispatch
 
手把手Julia及簡易IDE安裝
手把手Julia及簡易IDE安裝手把手Julia及簡易IDE安裝
手把手Julia及簡易IDE安裝
 
20161209-Julia Taiwan first meetup-julia語言入門
20161209-Julia Taiwan first meetup-julia語言入門20161209-Julia Taiwan first meetup-julia語言入門
20161209-Julia Taiwan first meetup-julia語言入門
 
ONTAP - Recording Equipment
ONTAP - Recording EquipmentONTAP - Recording Equipment
ONTAP - Recording Equipment
 
Promotional package
Promotional packagePromotional package
Promotional package
 
7th March 2017 - Signs of the End times
7th March 2017  - Signs of the End times7th March 2017  - Signs of the End times
7th March 2017 - Signs of the End times
 
Sociedad del conocimiento
Sociedad del conocimientoSociedad del conocimiento
Sociedad del conocimiento
 
Eko kalendar 2012
Eko kalendar 2012Eko kalendar 2012
Eko kalendar 2012
 
unusual accidents, personal injury
unusual accidents, personal injuryunusual accidents, personal injury
unusual accidents, personal injury
 
KEEPING THE HISTORICAL HERITAGE ALIVE: Methodology and pre-assessment tool fo...
KEEPING THE HISTORICAL HERITAGE ALIVE: Methodology and pre-assessment tool fo...KEEPING THE HISTORICAL HERITAGE ALIVE: Methodology and pre-assessment tool fo...
KEEPING THE HISTORICAL HERITAGE ALIVE: Methodology and pre-assessment tool fo...
 
Sumit Sanyal - SD
Sumit Sanyal - SDSumit Sanyal - SD
Sumit Sanyal - SD
 

Similar to 20170217 julia小程式到專案發布之旅

在雲端上啜飲爪哇
在雲端上啜飲爪哇在雲端上啜飲爪哇
在雲端上啜飲爪哇建興 王
 
Web testing automation
Web testing automationWeb testing automation
Web testing automationkuozui
 
Android 2.2 手機應用程式設計:第四章 第一個程式
Android 2.2 手機應用程式設計:第四章 第一個程式Android 2.2 手機應用程式設計:第四章 第一個程式
Android 2.2 手機應用程式設計:第四章 第一個程式Robert Chi
 
Kissy design
Kissy designKissy design
Kissy designyiming he
 
如何在實務上使用TDD來開發 twmvc#12
如何在實務上使用TDD來開發 twmvc#12如何在實務上使用TDD來開發 twmvc#12
如何在實務上使用TDD來開發 twmvc#12twMVC
 
twMVC#12 | 如何在實務上使用 TDD 來開發
twMVC#12 | 如何在實務上使用 TDD 來開發twMVC#12 | 如何在實務上使用 TDD 來開發
twMVC#12 | 如何在實務上使用 TDD 來開發twMVC
 
Kissy模块化实践
Kissy模块化实践Kissy模块化实践
Kissy模块化实践yiming he
 
嵌入式測試驅動開發
嵌入式測試驅動開發嵌入式測試驅動開發
嵌入式測試驅動開發hugo lu
 
用 Drone 打造 輕量級容器持續交付平台
用 Drone 打造輕量級容器持續交付平台用 Drone 打造輕量級容器持續交付平台
用 Drone 打造 輕量級容器持續交付平台Bo-Yi Wu
 
淺談 Groovy 與 Gradle
淺談 Groovy 與 Gradle淺談 Groovy 與 Gradle
淺談 Groovy 與 GradleJustin Lin
 
2023-netconf-deploy-azure-function-with-KEDA-on-aks
2023-netconf-deploy-azure-function-with-KEDA-on-aks2023-netconf-deploy-azure-function-with-KEDA-on-aks
2023-netconf-deploy-azure-function-with-KEDA-on-aksRoberson Liou
 
Introduction to MVC of CodeIgniter 2.1.x
Introduction to MVC of CodeIgniter 2.1.xIntroduction to MVC of CodeIgniter 2.1.x
Introduction to MVC of CodeIgniter 2.1.xBo-Yi Wu
 
Uliweb设计分享
Uliweb设计分享Uliweb设计分享
Uliweb设计分享modou li
 
twMVC#04 | ASP.NET MVC 4 新功能介紹(快速上手)
twMVC#04 | ASP.NET MVC 4 新功能介紹(快速上手)twMVC#04 | ASP.NET MVC 4 新功能介紹(快速上手)
twMVC#04 | ASP.NET MVC 4 新功能介紹(快速上手)twMVC
 
ASP.NET MVC 4 新功能介紹(快速上手) -twMVC#4
ASP.NET MVC 4 新功能介紹(快速上手) -twMVC#4ASP.NET MVC 4 新功能介紹(快速上手) -twMVC#4
ASP.NET MVC 4 新功能介紹(快速上手) -twMVC#4twMVC
 
.Net 快速開發與 Nuget 企業應用
.Net 快速開發與 Nuget 企業應用.Net 快速開發與 Nuget 企業應用
.Net 快速開發與 Nuget 企業應用leeju lee
 
GDG Taichung - Flutter and Firebase.pdf
GDG Taichung - Flutter and Firebase.pdfGDG Taichung - Flutter and Firebase.pdf
GDG Taichung - Flutter and Firebase.pdfDuran Hsieh
 

Similar to 20170217 julia小程式到專案發布之旅 (20)

在雲端上啜飲爪哇
在雲端上啜飲爪哇在雲端上啜飲爪哇
在雲端上啜飲爪哇
 
Web testing automation
Web testing automationWeb testing automation
Web testing automation
 
Android 2.2 手機應用程式設計:第四章 第一個程式
Android 2.2 手機應用程式設計:第四章 第一個程式Android 2.2 手機應用程式設計:第四章 第一個程式
Android 2.2 手機應用程式設計:第四章 第一個程式
 
Kissy design
Kissy designKissy design
Kissy design
 
如何在實務上使用TDD來開發 twmvc#12
如何在實務上使用TDD來開發 twmvc#12如何在實務上使用TDD來開發 twmvc#12
如何在實務上使用TDD來開發 twmvc#12
 
twMVC#12 | 如何在實務上使用 TDD 來開發
twMVC#12 | 如何在實務上使用 TDD 來開發twMVC#12 | 如何在實務上使用 TDD 來開發
twMVC#12 | 如何在實務上使用 TDD 來開發
 
Kissy模块化实践
Kissy模块化实践Kissy模块化实践
Kissy模块化实践
 
嵌入式測試驅動開發
嵌入式測試驅動開發嵌入式測試驅動開發
嵌入式測試驅動開發
 
A
AA
A
 
A
AA
A
 
用 Drone 打造 輕量級容器持續交付平台
用 Drone 打造輕量級容器持續交付平台用 Drone 打造輕量級容器持續交付平台
用 Drone 打造 輕量級容器持續交付平台
 
淺談 Groovy 與 Gradle
淺談 Groovy 與 Gradle淺談 Groovy 與 Gradle
淺談 Groovy 與 Gradle
 
2023-netconf-deploy-azure-function-with-KEDA-on-aks
2023-netconf-deploy-azure-function-with-KEDA-on-aks2023-netconf-deploy-azure-function-with-KEDA-on-aks
2023-netconf-deploy-azure-function-with-KEDA-on-aks
 
Introduction to MVC of CodeIgniter 2.1.x
Introduction to MVC of CodeIgniter 2.1.xIntroduction to MVC of CodeIgniter 2.1.x
Introduction to MVC of CodeIgniter 2.1.x
 
Uliweb设计分享
Uliweb设计分享Uliweb设计分享
Uliweb设计分享
 
twMVC#04 | ASP.NET MVC 4 新功能介紹(快速上手)
twMVC#04 | ASP.NET MVC 4 新功能介紹(快速上手)twMVC#04 | ASP.NET MVC 4 新功能介紹(快速上手)
twMVC#04 | ASP.NET MVC 4 新功能介紹(快速上手)
 
ASP.NET MVC 4 新功能介紹(快速上手) -twMVC#4
ASP.NET MVC 4 新功能介紹(快速上手) -twMVC#4ASP.NET MVC 4 新功能介紹(快速上手) -twMVC#4
ASP.NET MVC 4 新功能介紹(快速上手) -twMVC#4
 
.Net 快速開發與 Nuget 企業應用
.Net 快速開發與 Nuget 企業應用.Net 快速開發與 Nuget 企業應用
.Net 快速開發與 Nuget 企業應用
 
PHP 单元测试
PHP 单元测试PHP 单元测试
PHP 单元测试
 
GDG Taichung - Flutter and Firebase.pdf
GDG Taichung - Flutter and Firebase.pdfGDG Taichung - Flutter and Firebase.pdf
GDG Taichung - Flutter and Firebase.pdf
 

More from 岳華 杜

[COSCUP 2023] 我的Julia軟體架構演進之旅
[COSCUP 2023] 我的Julia軟體架構演進之旅[COSCUP 2023] 我的Julia軟體架構演進之旅
[COSCUP 2023] 我的Julia軟體架構演進之旅岳華 杜
 
Julia: The language for future
Julia: The language for futureJulia: The language for future
Julia: The language for future岳華 杜
 
The Language for future-julia
The Language for future-juliaThe Language for future-julia
The Language for future-julia岳華 杜
 
20190907 Julia the language for future
20190907 Julia the language for future20190907 Julia the language for future
20190907 Julia the language for future岳華 杜
 
Metaprogramming in julia
Metaprogramming in juliaMetaprogramming in julia
Metaprogramming in julia岳華 杜
 
Introduction to julia
Introduction to juliaIntroduction to julia
Introduction to julia岳華 杜
 
自然語言處理概覽
自然語言處理概覽自然語言處理概覽
自然語言處理概覽岳華 杜
 
Introduction to machine learning
Introduction to machine learningIntroduction to machine learning
Introduction to machine learning岳華 杜
 
Semantic Segmentation - Fully Convolutional Networks for Semantic Segmentation
Semantic Segmentation - Fully Convolutional Networks for Semantic SegmentationSemantic Segmentation - Fully Convolutional Networks for Semantic Segmentation
Semantic Segmentation - Fully Convolutional Networks for Semantic Segmentation岳華 杜
 
Batch normalization 與他愉快的小伙伴
Batch normalization 與他愉快的小伙伴Batch normalization 與他愉快的小伙伴
Batch normalization 與他愉快的小伙伴岳華 杜
 
從 VAE 走向深度學習新理論
從 VAE 走向深度學習新理論從 VAE 走向深度學習新理論
從 VAE 走向深度學習新理論岳華 杜
 
COSCUP: Foreign Function Call in Julia
COSCUP: Foreign Function Call in JuliaCOSCUP: Foreign Function Call in Julia
COSCUP: Foreign Function Call in Julia岳華 杜
 
COSCUP: Metaprogramming in Julia
COSCUP: Metaprogramming in JuliaCOSCUP: Metaprogramming in Julia
COSCUP: Metaprogramming in Julia岳華 杜
 
COSCUP: Introduction to Julia
COSCUP: Introduction to JuliaCOSCUP: Introduction to Julia
COSCUP: Introduction to Julia岳華 杜
 
Introduction to Julia
Introduction to JuliaIntroduction to Julia
Introduction to Julia岳華 杜
 
20180506 Introduction to machine learning
20180506 Introduction to machine learning20180506 Introduction to machine learning
20180506 Introduction to machine learning岳華 杜
 
20171127 當julia遇上資料科學
20171127 當julia遇上資料科學20171127 當julia遇上資料科學
20171127 當julia遇上資料科學岳華 杜
 
20171117 oop and design patterns in julia
20171117 oop and design patterns in julia20171117 oop and design patterns in julia
20171117 oop and design patterns in julia岳華 杜
 
20171014 tips for manipulating filesystem in julia
20171014 tips for manipulating filesystem in julia20171014 tips for manipulating filesystem in julia
20171014 tips for manipulating filesystem in julia岳華 杜
 
20170807 julia的簡單而高效資料處理
20170807 julia的簡單而高效資料處理20170807 julia的簡單而高效資料處理
20170807 julia的簡單而高效資料處理岳華 杜
 

More from 岳華 杜 (20)

[COSCUP 2023] 我的Julia軟體架構演進之旅
[COSCUP 2023] 我的Julia軟體架構演進之旅[COSCUP 2023] 我的Julia軟體架構演進之旅
[COSCUP 2023] 我的Julia軟體架構演進之旅
 
Julia: The language for future
Julia: The language for futureJulia: The language for future
Julia: The language for future
 
The Language for future-julia
The Language for future-juliaThe Language for future-julia
The Language for future-julia
 
20190907 Julia the language for future
20190907 Julia the language for future20190907 Julia the language for future
20190907 Julia the language for future
 
Metaprogramming in julia
Metaprogramming in juliaMetaprogramming in julia
Metaprogramming in julia
 
Introduction to julia
Introduction to juliaIntroduction to julia
Introduction to julia
 
自然語言處理概覽
自然語言處理概覽自然語言處理概覽
自然語言處理概覽
 
Introduction to machine learning
Introduction to machine learningIntroduction to machine learning
Introduction to machine learning
 
Semantic Segmentation - Fully Convolutional Networks for Semantic Segmentation
Semantic Segmentation - Fully Convolutional Networks for Semantic SegmentationSemantic Segmentation - Fully Convolutional Networks for Semantic Segmentation
Semantic Segmentation - Fully Convolutional Networks for Semantic Segmentation
 
Batch normalization 與他愉快的小伙伴
Batch normalization 與他愉快的小伙伴Batch normalization 與他愉快的小伙伴
Batch normalization 與他愉快的小伙伴
 
從 VAE 走向深度學習新理論
從 VAE 走向深度學習新理論從 VAE 走向深度學習新理論
從 VAE 走向深度學習新理論
 
COSCUP: Foreign Function Call in Julia
COSCUP: Foreign Function Call in JuliaCOSCUP: Foreign Function Call in Julia
COSCUP: Foreign Function Call in Julia
 
COSCUP: Metaprogramming in Julia
COSCUP: Metaprogramming in JuliaCOSCUP: Metaprogramming in Julia
COSCUP: Metaprogramming in Julia
 
COSCUP: Introduction to Julia
COSCUP: Introduction to JuliaCOSCUP: Introduction to Julia
COSCUP: Introduction to Julia
 
Introduction to Julia
Introduction to JuliaIntroduction to Julia
Introduction to Julia
 
20180506 Introduction to machine learning
20180506 Introduction to machine learning20180506 Introduction to machine learning
20180506 Introduction to machine learning
 
20171127 當julia遇上資料科學
20171127 當julia遇上資料科學20171127 當julia遇上資料科學
20171127 當julia遇上資料科學
 
20171117 oop and design patterns in julia
20171117 oop and design patterns in julia20171117 oop and design patterns in julia
20171117 oop and design patterns in julia
 
20171014 tips for manipulating filesystem in julia
20171014 tips for manipulating filesystem in julia20171014 tips for manipulating filesystem in julia
20171014 tips for manipulating filesystem in julia
 
20170807 julia的簡單而高效資料處理
20170807 julia的簡單而高效資料處理20170807 julia的簡單而高效資料處理
20170807 julia的簡單而高效資料處理
 

20170217 julia小程式到專案發布之旅