Khác biệt giữa bản sửa đổi của “Đóng gói (lập trình máy tính)”

Nội dung được xóa Nội dung được thêm vào
Dịch từ bài viết Anh
 
Dòng 4:
|1 =
}}
Trong'''Đóng gói''' ([[tiếng Anh]]: ''encapsulation'') trong [[ngôn ngữ lập trình]], <!-- [[object-oriented programming language]]--> <!-- and related fields, like [[OODMBS]],--> '''đóng gói'''thuật (tiếng Anh: ''encapsulation'') đượcngữ dùng để chỉ một trong hai khái niệm liênkhác quannhau nhưng khác biệt,liên hoặcquan với nhau, đôi khi còn chỉ sự kết hợp của hai khái niệm này.<ref>Michael Lee Scott, ''Programming language pragmatics'', Edition 2, Morgan Kaufmann, 2006, ISBN 0-12-633951-1, p. 481: "Encapsulation mechanisms enable the programme<sup></sup>r to group data and the subroutines that operate on them together in one place, and to hide irrelevant details from the users of an abstraction."</ref><ref name=Dale>Nell B. Dale, Chip Weems, ''Programming and problem solving with Java'', Edition 2, Jones & Bartlett Publishers, 2007, ISBN 0-7637-3402-0, p. 396</ref>. Khái niệm thứ nhất: cơ chế ngôn ngữ dùng để hạn chế truy cập trực tiếp vào một số thành phần của một [[đối tượng (khoa học máy tính)|đối tượng]].<ref>[[John C. Mitchell]], ''Concepts in programming languages'', Cambridge University Press, 2003, ISBN 0-521-78098-5, p.522</ref><ref name=Pierce>{{cite book|last=Pierce|first=Benjamin|authorlink=Benjamin C. Pierce|title=[[Types and Programming Languages]]|publisher=MIT Press|year=2002|isbn=0-262-16209-1}} p. 266</ref>. Khái niệm thứ hai: cấu trúc ngôn ngữ tạo điều kiện để bó dữ liệu với các [[Phương thức (lập trình máy tính)|phương thức]] (method) <!-- I object to the word method being used here because in lisp languages programmers cannot distinguish methods from normal functions at the call site. Behavior equivalent to methods may be implemented as normal functions. encapsulation is not dependent on implementation but on behavior--> hay các hàm (function) khác hoạt động trên dữ liệu đó.<ref>Wm. Paul Rogers, [http://www.javaworld.com/javaworld/jw-05-2001/jw-0518-encapsulation.html?page=9 ''Encapsulation is not information hiding''], JavaWorld.com, 05/18/01</ref><ref>Thomas M. Connolly, Carolyn E. Begg, ''Database systems: a practical approach to design, implementation, and management'', Edition 4, Pearson Education, 2005, ISBN 0-321-21025-5, Chapter 25, "Introduction to Object DMBS", section "Object-oriented concepts", p. 814</ref>
 
* Một cơ chế ngôn ngữ để hạn chế truy cập trực tiếp vào một số thành phần của [[đối tượng (khoa học máy tính)|đối tượng]]'s components.<ref>[[John C. Mitchell]], ''Concepts in programming languages'', Cambridge University Press, 2003, ISBN 0-521-78098-5, p.522</ref><ref name=Pierce>{{cite book|last=Pierce|first=Benjamin|authorlink=Benjamin C. Pierce|title=[[Types and Programming Languages]]|publisher=MIT Press|year=2002|isbn=0-262-16209-1}} p. 266</ref>
* Một cấu trúc ngôn ngữ tạo điều kiện để đóng gói dữ liệu với các [[Phương thức (lập trình máy tính)|phương thức]] <!-- I object to the word method being used here because in lisp languages programmers cannot distinguish methods from normal functions at the call site. Behavior equivalent to methods may be implemented as normal functions. encapsulation is not dependent on implementation but on behavior--> (hay các hàm khác) hoạt động trên dữ liệu đó.<ref>Wm. Paul Rogers, [http://www.javaworld.com/javaworld/jw-05-2001/jw-0518-encapsulation.html?page=9 ''Encapsulation is not information hiding''], JavaWorld.com, 05/18/01</ref><ref>Thomas M. Connolly, Carolyn E. Begg, ''Database systems: a practical approach to design, implementation, and management'', Edition 4, Pearson Education, 2005, ISBN 0-321-21025-5, Chapter 25, "Introduction to Object DMBS", section "Object-oriented concepts", p. 814</ref>
 
Một số nhà nghiên cứu ngôn ngữ lập trình và học giả sử dụng chỉ ý nghĩa đầu tiên hay kết hợp với ý nghĩa thứ hai như là một tính năng phân biệt của [[lập trình hướng đối tượng]].