Lập trình hướng khía cạnh

Mẫu hình lập trình
  • x
  • t
  • s

Trong điện toán, lập trình hướng khía cạnh (tiếng Anh: aspect-oriented programming, viết tắt: AOP) là một mẫu hình lập trình nhằm tăng tính mô đun bằng cách cho phép phân tách những mối quan tâm xuyên suốt. Nó làm như vậy bằng cách thêm hành vi bổ sung vào mã đã tồn tại (một lời khuyên) mà không sửa đổi chính mã đó, thay vì xác định cụ thể mã nào được sửa đổi thông qua một đặc tả "điểm cắt" (pointcut), ví dụ như "lưu lại (log) tất cả lời gọi hàm khi tên hàm bắt đầu với từ 'set'". Điều này cho phép những hành vi không phải là trung tâm của logic nghiệp vụ (ví dụ như lưu lại) được thêm vào chương trình mà không làm rối lõi của mã đến các chức năng. AOP tạo cơ sở cho phát triển phần mềm hướng khía cạnh (aspect-oriented software development).

AOP bao gồm các phương thức và công cụ lập trình hỗ trợ cho mô đun hóa các mối quan tâm ở mức độ mã nguồn, trong khi "phát triển phần mềm hướng khía cạnh" dùng để chỉ đến toàn bộ một nguyên lý công nghệ.

AOP đòi hỏi chia nhỏ logic của chương trình thành các phần riêng biệt (gọi là mối quan tâm hay concern, là những khu vực liên kết các chức năng). Gần như các mẫu hình lập trình đều hỗ trợ các mức độ gom nhóm và đóng gói các mối quan tâm thành các thực thể riêng biệt và độc lập bằng cách cung cấp khả năng trừu tượng (ví dụ, các hàm, thủ tục, mô đun, lớp, phương thức) để có thể dùng cho hiện thực, trừu tượng và bố cục những mối quan tâm đó. Vài mối quan tâm "cắt xuyên qua" nhiều trừu tượng trong một chương trình, và gây khó khăn cho hiện thực - chúng được gọi là những mối quan tâm xuyên suốt (cross-cutting concern hay horizontal concern).

Hiện thực

Các ngôn ngữ lập trình sau có hiện thực AOP, trong ngôn ngữ đó, hay thông qua thư viện ngoài:

Xem thêm

Ghi chú và tham khảo

  1. ^ Numerous: Afterthought, LOOM.NET, Enterprise Library 3.0 Policy Injection Application Block, AspectDNG, DynamicProxy, Compose* Lưu trữ 2009-01-13 tại Wayback Machine, PostSharp, Seasar.NET, DotSpect (.SPECT) Lưu trữ 2006-03-31 tại Wayback Machine, Spring.NET (as part of its functionality), Wicca and Phx.Morph, SetPoint Lưu trữ 2008-10-07 tại Wayback Machine
  2. ^ “as3-commons-bytecode”. Bản gốc lưu trữ ngày 3 tháng 10 năm 2014. Truy cập ngày 22 tháng 5 năm 2017.
  3. ^ Ada2012 Rationale
  4. ^ “Function Hooks”. Bản gốc lưu trữ ngày 17 tháng 1 năm 2013. Truy cập ngày 22 tháng 5 năm 2017.
  5. ^ Several: AspectC++, FeatureC++, AspectC, AspeCt-oriented C Lưu trữ 2008-11-20 tại Wayback Machine, Aspicere Lưu trữ 2012-07-21 tại Archive.today
  6. ^ Cobble[liên kết hỏng]
  7. ^ “AspectCocoa”. Bản gốc lưu trữ ngày 26 tháng 10 năm 2007. Truy cập ngày 22 tháng 5 năm 2017.
  8. ^ “ColdSpring”. Bản gốc lưu trữ ngày 3 tháng 8 năm 2012. Truy cập ngày 22 tháng 5 năm 2017.
  9. ^ “Closer Project: AspectL”. Truy cập ngày 11 tháng 8 năm 2015.
  10. ^ “infra - Frameworks Integrados para Delphi - Google Project Hosting”. Truy cập ngày 11 tháng 8 năm 2015.
  11. ^ “meaop - MeSDK: MeObjects, MeRTTI, MeAOP - Delphi AOP(Aspect Oriented Programming), MeRemote, MeService... - Google Project Hosting”. Truy cập ngày 11 tháng 8 năm 2015.
  12. ^ “Google Project Hosting”. Truy cập ngày 11 tháng 8 năm 2015.
  13. ^ “RemObjects Cirrus”. Bản gốc lưu trữ ngày 23 tháng 1 năm 2012. Truy cập ngày 22 tháng 5 năm 2017.
  14. ^ Emacs Advice Functions
  15. ^ monad (functional programming) (“Monads As a theoretical basis for AOP”. CiteSeerX 10.1.1.25.8262. Chú thích journal cần |journal= (trợ giúp)) and Aspect-oriented programming with type classes. A Typed Monadic Embedding of Aspects
  16. ^ Numerous others: CaesarJ, Compose* Lưu trữ 2009-01-13 tại Wayback Machine, Dynaop, JAC Lưu trữ 2004-06-19 tại Wayback Machine, Google Guice (as part of its functionality), Javassist Lưu trữ 2004-09-01 tại Wayback Machine, JAsCo (and AWED), JAML Lưu trữ 2005-04-15 tại Wayback Machine, JBoss AOP Lưu trữ 2006-10-17 tại Wayback Machine, LogicAJ Lưu trữ 2006-05-04 tại Wayback Machine, Object Teams, PROSE, The AspectBench Compiler for AspectJ (abc) Lưu trữ 2014-12-16 tại Wayback Machine, Spring framework (as part of its functionality), Seasar, The JMangler Project Lưu trữ 2005-10-28 tại Wayback Machine, InjectJ, GluonJ Lưu trữ 2007-02-06 tại Wayback Machine, Steamloom Lưu trữ 2007-08-18 tại Wayback Machine
  17. ^ Many: Advisable Lưu trữ 2008-07-04 tại Wayback Machine, Ajaxpect, jQuery AOP Plugin Lưu trữ 2008-01-13 tại Wayback Machine, Aspectes Lưu trữ 2006-05-05 tại Wayback Machine, AspectJS, Cerny.js Lưu trữ 2007-06-27 tại Wayback Machine, Dojo Toolkit, Humax Web Framework, Joose, Prototype - Prototype Function#wrap, YUI 3 (Y.Do) Lưu trữ 2011-01-25 tại Wayback Machine
  18. ^ Using built-in support for categories (which allows the encapsulation of aspect code) and event-driven programming (which allows the definition of before and after event handlers).
  19. ^ “AspectLua”. Bản gốc lưu trữ ngày 17 tháng 7 năm 2015. Truy cập ngày 11 tháng 8 năm 2015.
  20. ^ “MAKAO, re(verse)-engineering build systems”. Bản gốc lưu trữ ngày 24 tháng 7 năm 2012. Truy cập ngày 11 tháng 8 năm 2015.
  21. ^ “McLab”. Truy cập ngày 11 tháng 8 năm 2015.
  22. ^ “AspectML - Aspect-oriented Functional Programming Language Research”. Truy cập ngày 11 tháng 8 năm 2015.
  23. ^ Adam Kennedy. “Aspect - Aspect-Oriented Programming (AOP) for Perl - metacpan.org”. Truy cập ngày 11 tháng 8 năm 2015.
  24. ^ Several: PHP-AOP (AOP.io), Go! AOP framework, PHPaspect, Seasar.PHP, PHP-AOP Lưu trữ 2012-07-12 tại Archive.today, TYPO3 Flow Lưu trữ 2017-07-17 tại Wayback Machine, AOP PECL Extension
  25. ^ "Whirl"”. Bản gốc lưu trữ ngày 20 tháng 4 năm 2016. Truy cập ngày 22 tháng 5 năm 2017.
  26. ^ Several: PEAK, Aspyct AOP Lưu trữ 2011-06-09 tại Wayback Machine, Lightweight Python AOP Lưu trữ 2004-10-09 tại Wayback Machine, Logilab's aspect module Lưu trữ 2005-03-09 tại Wayback Machine, Pythius, Spring Python's AOP module Lưu trữ 2016-03-04 tại Wayback Machine, Pytilities' AOP module, aspectlib
  27. ^ “PLaneT Package Repository: PLaneT > dutchyn > aspectscheme.plt”. Truy cập ngày 11 tháng 8 năm 2015.
  28. ^ “AspectR - Simple aspect-oriented programming in Ruby”. Truy cập ngày 11 tháng 8 năm 2015.
  29. ^ Dean Wampler. “Home”. Bản gốc lưu trữ ngày 26 tháng 10 năm 2007. Truy cập ngày 11 tháng 8 năm 2015.
  30. ^ “gcao/aspector”. GitHub. Truy cập ngày 11 tháng 8 năm 2015.
  31. ^ “AspectS”. Bản gốc lưu trữ ngày 6 tháng 1 năm 2006. Truy cập ngày 22 tháng 5 năm 2017.
  32. ^ “MetaclassTalk: Reflection and Meta-Programming in Smalltalk”. Bản gốc lưu trữ ngày 29 tháng 7 năm 2015. Truy cập ngày 11 tháng 8 năm 2015.
  33. ^ WEAVR
  34. ^ “aspectxml - An Aspect-Oriented XML Weaving Engine (AXLE) - Google Project Hosting”. Truy cập ngày 11 tháng 8 năm 2015.

Đọc thêm

  • Kiczales, G.; Lamping, J.; Mendhekar, A.; Maeda, C.; Lopes, C.; Loingtier, J. M.; Irwin, J. (1997). Aspect-oriented programming (PDF). ECOOP'97. Proceedings of the 11th European Conference on Object-Oriented Programming. LNCS. 1241. tr. 220–242. CiteSeerX 10.1.1.115.8660. doi:10.1007/BFb0053381. ISBN 3-540-63089-9. The paper generally considered to be the authoritative reference for AOP.
  • Andreas Holzinger; M. Brugger; W. Slany (2011). Applying Aspect Oriented Programming (AOP) in Usability Engineering processes: On the example of Tracking Usage Information for Remote Usability Testing. Proceedings of the 8th International Conference on electronic Business and Telecommunications. Sevilla. D. A. Marca, B. Shishkov and M. v. Sinderen (editors). tr. 53–56.
  • Robert E. Filman; Tzilla Elrad; Siobhán Clarke; Mehmet Aksit (2004). Aspect-Oriented Software Development. ISBN 0-321-21976-7.
  • Renaud Pawlak, Lionel Seinturier & Jean-Philippe Retaillé (2005). Foundations of AOP for J2EE Development. ISBN 1-59059-507-6.
  • Laddad, Ramnivas (2003). AspectJ in Action: Practical Aspect-Oriented Programming. ISBN 1-930110-93-6.
  • Jacobson, Ivar; Pan-Wei Ng (2005). Aspect-Oriented Software Development with Use Cases. ISBN 0-321-26888-1.
  • Aspect-oriented Software Development and PHP, Dmitry Sheiko, 2006
  • Siobhán Clarke & Elisa Baniassad (2005). Aspect-Oriented Analysis and Design: The Theme Approach. ISBN 0-321-24674-8.
  • Raghu Yedduladoddi (2009). Aspect Oriented Software Development: An Approach to Composing UML Design Models. ISBN 3-639-12084-1.
  • "Adaptive Object-Oriented Programming Using Graph-Based Customization" – Lieberherr, Silva-Lepe, et al. - 1994
  • Zambrano Polo y La Borda, Arturo Federico (ngày 5 tháng 6 năm 2013). “Addressing aspect interactions in an industrial setting: experiences, problems and solutions”: 159. Truy cập ngày 30 tháng 5 năm 2014. Chú thích journal cần |journal= (trợ giúp)
  • Wijesuriya, Viraj Brian (2016-08-30) Aspect Oriented Development, Lecture Notes, University of Colombo School of Computing, Sri Lanka

Liên kết ngoài

  • Eric Bodden's list of AOP tools in.net framework
  • Programming Styles: Procedural, OOP, and AOP
  • Programming Forum: Procedural, OOP, and AOP Lưu trữ 2011-10-24 tại Wayback Machine
  • Aspect-Oriented Software Development, annual conference on AOP
  • AOSD Wiki, Wiki on aspect-oriented software development
  • AspectJ Programming Guide
  • The AspectBench Compiler for AspectJ Lưu trữ 2014-12-16 tại Wayback Machine, another Java implementation
  • Series of IBM developerWorks articles on AOP
  • A detailed series of articles on basics of aspect-oriented programming and AspectJ Lưu trữ 2013-07-26 tại Wayback Machine
  • What is Aspect-Oriented Programming? Lưu trữ 2009-08-21 tại Wayback Machine, introduction with RemObjects Taco
  • Constraint-Specification Aspect Weaver
  • Aspect- vs. Object-Oriented Programming: Which Technique, When? Lưu trữ 2021-04-15 tại Wayback Machine
  • Gregor Kiczales, Professor of Computer Science, explaining AOP, video 57 min.
  • Aspect Oriented Programming in COBOL Lưu trữ 2008-12-17 tại Wayback Machine
  • Aspect-Oriented Programming in Java with Spring Framework
  • Wiki dedicated to AOP methods on.NET
  • Early Aspects for Business Process Modeling (An Aspect Oriented Language for BPMN)
  • Spring AOP and AspectJ Introduction
  • AOSD Graduate Course at Bilkent University
  • Introduction to AOP - Software Engineering Radio Podcast Episode 106
  • An Objective-C implementation of AOP by Szilveszter Molnar Lưu trữ 2012-08-01 tại Wayback Machine
  • Aspect-Oriented programming for iOS and OS X by Manuel Gebele
  • Java Method Logging with AOP and Annotations by Yegor Bugayenko
  • DevExpress MVVM Framework. Introduction to POCO ViewModels
  • x
  • t
  • s
Khái niệm
Ngôn ngữ
  • AspectC++
  • AspectJ
  • AspectWerkz
  • x
  • t
  • s
Paradigm
Cấp độ
Có liên quan
  • Ngôn ngữ lập trình không dựa trên tiếng Anh
  • Off-side rule
  • Ngôn ngữ lập trình trực quan
Tiêu đề chuẩn Sửa dữ liệu tại Wikidata
  • BNF: cb14544142k (data)
  • GND: 4724728-9
  • LCCN: sh2005004988