- Scala for Data Science
- Pascal Bugnion
- 200字
- 2021-07-23 14:33:10
Functional wrappers for JDBC
We now have a basic overview of the tools afforded by JDBC. All the objects that we have interacted with so far feel somewhat clunky and out of place in Scala. They do not encourage a functional style of programming.
Of course, elegance is not necessarily a goal in itself (or, at least, you will probably struggle to convince your CEO that he should delay the launch of a product because the code lacks elegance). However, it is usually a symptom: either the code is not extensible or too tightly coupled, or it is easy to introduce bugs. The latter is particularly the case for JDBC. Forgot to check wasNull
? That will come back to bite you. Forgot to close your connections? You'll get an "out of memory exception" (hopefully not in production).
In the next sections, we will look at patterns that we can use to wrap JDBC types in order to mitigate many of these risks. The patterns that we introduce here are used very commonly in Scala libraries and applications. Thus, besides writing robust classes to interact with JDBC, learning about these patterns will, I hope, give you greater understanding of Scala programming.
- 嵌入式軟件系統測試:基于形式化方法的自動化測試解決方案
- Learning C++ Functional Programming
- Scala Design Patterns
- Julia機器學習核心編程:人人可用的高性能科學計算
- Elastic Stack應用寶典
- Python數據分析(第2版)
- Instant Nancy Web Development
- Python機器學習算法: 原理、實現與案例
- 搞定J2EE:Struts+Spring+Hibernate整合詳解與典型案例
- Emgu CV Essentials
- Clean Code in C#
- 超好玩的Scratch 3.5少兒編程
- Python Social Media Analytics
- After Effects CC案例設計與經典插件(視頻教學版)
- Responsive Web Design with jQuery