My presentation at Ireland Oracle User Group conference, 4 April 2019.
Slideshare no longer allows uploads of new revisions, so uploaded v2 separately, with small changes around treatment of nesting ->
https://www.slideshare.net/brendanfurey7/clean-coding-in-plsql-and-sql-v2-220657522
This document provides an agenda and slides for a presentation titled "Clean Coding in PL/SQL and SQL" given by Brendan Furey at the Ireland Oracle User Group on April 4-5, 2019. The presentation covers various topics related to clean coding practices in PL/SQL and SQL, including general programming design concepts, design principles, use of object types and collections, API design examples, and SQL modularity. The agenda outlines sections on programming paradigms, package and subprogram structure, object types and collections, API design with examples, integrating Oracle with other languages, Oracle's object-orientation features, and applying modular design to SQL.
The document discusses architectural design and various architectural concepts. It covers topics like architectural design decisions, architectural views using different models, common architectural patterns like MVC and layered architectures, application architectures, and how architectural design is concerned with organizing a software system and identifying its main structural components and relationships.
The document discusses chapter 7 of a software engineering textbook which covers design and implementation. It begins by outlining the topics to be covered, including object-oriented design using UML, design patterns, and implementation issues. It then discusses the software design and implementation process, considerations around building versus buying systems, and approaches to object-oriented design using UML.
DDD - 1 - A gentle introduction to Domain Driven Design.pdfEleonora Ciceri
An introduction to Domain Driven Design, including definitions of domain experts, ubiquitous language, domains and subdomains, models, bounded contexts and context maps
- DDD is designed around an onion architecture for loose coupling between domains, applications, and infrastructure
- Event storming helps gather structured information to understand the business domain and requirements
- Entities have unique IDs and are mutable while value objects describe entities and are immutable
- Aggregates group related entities and value objects together, with the root entity accessible from outside
- Invariants, anti-corruption layers, and domain events help model the business logic and handle changes
This document discusses the adapter pattern in object-oriented programming. The adapter pattern allows classes with incompatible interfaces to work together by converting the interface of one class into another interface that clients expect. An adapter acts as a bridge between two incompatible interfaces. It adapts the interface of an existing class (the adaptee) so that its interface conforms to what the client expects (the target interface). An example is provided where a class that sorts lists is adapted to sort arrays by converting between the list and array interfaces.
This document provides an overview of component-based software engineering (CBSE). It discusses CBSE processes, component models, composition, and issues related to developing and reusing components. Specifically, it covers CBSE for reuse, which focuses on developing reusable components, and CBSE with reuse, which is the process of developing new applications using existing components. Component identification, validation, and resolving interface incompatibilities during composition are also addressed.
This document provides an agenda and slides for a presentation titled "Clean Coding in PL/SQL and SQL" given by Brendan Furey at the Ireland Oracle User Group on April 4-5, 2019. The presentation covers various topics related to clean coding practices in PL/SQL and SQL, including general programming design concepts, design principles, use of object types and collections, API design examples, and SQL modularity. The agenda outlines sections on programming paradigms, package and subprogram structure, object types and collections, API design with examples, integrating Oracle with other languages, Oracle's object-orientation features, and applying modular design to SQL.
The document discusses architectural design and various architectural concepts. It covers topics like architectural design decisions, architectural views using different models, common architectural patterns like MVC and layered architectures, application architectures, and how architectural design is concerned with organizing a software system and identifying its main structural components and relationships.
The document discusses chapter 7 of a software engineering textbook which covers design and implementation. It begins by outlining the topics to be covered, including object-oriented design using UML, design patterns, and implementation issues. It then discusses the software design and implementation process, considerations around building versus buying systems, and approaches to object-oriented design using UML.
DDD - 1 - A gentle introduction to Domain Driven Design.pdfEleonora Ciceri
An introduction to Domain Driven Design, including definitions of domain experts, ubiquitous language, domains and subdomains, models, bounded contexts and context maps
- DDD is designed around an onion architecture for loose coupling between domains, applications, and infrastructure
- Event storming helps gather structured information to understand the business domain and requirements
- Entities have unique IDs and are mutable while value objects describe entities and are immutable
- Aggregates group related entities and value objects together, with the root entity accessible from outside
- Invariants, anti-corruption layers, and domain events help model the business logic and handle changes
This document discusses the adapter pattern in object-oriented programming. The adapter pattern allows classes with incompatible interfaces to work together by converting the interface of one class into another interface that clients expect. An adapter acts as a bridge between two incompatible interfaces. It adapts the interface of an existing class (the adaptee) so that its interface conforms to what the client expects (the target interface). An example is provided where a class that sorts lists is adapted to sort arrays by converting between the list and array interfaces.
This document provides an overview of component-based software engineering (CBSE). It discusses CBSE processes, component models, composition, and issues related to developing and reusing components. Specifically, it covers CBSE for reuse, which focuses on developing reusable components, and CBSE with reuse, which is the process of developing new applications using existing components. Component identification, validation, and resolving interface incompatibilities during composition are also addressed.
Design patterns are optimized, reusable solutions to the programming problems that we encounter every day. A design pattern is not a class or a library that we can simply plug into our system; it's much more than that. It is a template that has to be implemented in the correct situation. It's not language-specific either. A good design pattern should be implementable in most—if not all—languages, depending on the capabilities of the language. Most importantly, any design pattern can be a double-edged sword— if implemented in the wrong place, it can be disastrous and create many problems for you. However, implemented in the right place, at the right time, it can be your savior.
The document discusses software architecture, where it comes from, and what it is. Architectures are influenced by system stakeholders and their requirements, the developing organization, and the architects' experience. An architecture defines elements, their relationships, and properties. It is important because it represents early design decisions, dictates implementation, organizational structure, and quality attributes. Architectural patterns, reference models, and reference architectures capture common architectural elements but are not full architectures themselves.
This document provides an overview of conducting reviews in IBM Rational DOORS Next Generation. It describes preparing for a review by creating either a formal or informal review from a collection or individual artifacts. It outlines the review lifecycle and roles. Participants can complete a review by approving, disapproving, or abstaining from artifacts. Once all participants are finished, the review creator can finalize the review. The goal of reviews is to catch errors early and reduce rework through collaboration and feedback on requirements.
This document provides an overview and introduction to design patterns. It discusses creational, structural, and behavioral patterns. For each category it briefly introduces and describes the intent and use of some common patterns, including Factory Method, Singleton, Decorator, Facade, Command, Iterator, and Observer. It also includes diagrams to illustrate the relationships between objects in sample implementations.
Jetpack Compose is a modern toolkit for building native Android user interfaces that simplifies and accelerates development with less code. It uses composable functions to define the UI programmatically based on data dependencies rather than focusing on the construction process. Jetpack Compose provides Material Design elements out of the box and uses a hierarchical layout system to compose functions within other functions to build the UI. It also supports features like lists, grids, animations and modifiers to customize the UI.
Agile integration architecture in relation to APIs and messagingKim Clark
This document discusses agile integration architecture from three perspectives: application integration, APIs, and messaging. It outlines how traditional centralized integration approaches are moving to more decentralized models with fine-grained deployments, application autonomy, and cloud-native implementations. APIs are shifting from system-centric to consumer-centric exposure, while messaging is evolving from self-managed to platform-managed infrastructure. Microservices require both asynchronous communications via events and synchronous APIs to fully decouple components. Agile integration architecture enables independent, scalable, and resilient digital applications and services.
The document discusses Domain Driven Design (DDD), a software development approach that focuses on building an object-oriented model of the domain that software needs to represent. It emphasizes modeling the domain closely after the structure and language of the problem domain. Key aspects of DDD discussed include ubiquitous language, bounded contexts, entities, value objects, aggregate roots, repositories, specifications, domain services, modules, domain events, and command query separation. DDD is best suited for projects with a significant domain complexity where closely modeling the problem domain can help manage that complexity.
Model-Driven Development for Safety-Critical Softwaregjuljo
Presentation given at the IBM Systems Engineering Symposium, in 2012, about Model-Driven Development for Safety-Critical Software.
With special focus on the usage of Rational Rhapsody for C++ in real-time and safety-critical software development.
The document discusses the key building blocks of Angular applications including architecture, bootstrapping, modules, components, services, templates, decorators, dependency injection, and routing; it provides an overview of each concept and how they work together to create the structure of an Angular application; the presentation concludes with a demo of these concepts in action.
This chapter discusses system modeling and different types of models used, including:
- Context models which illustrate the operational context of a system.
- Interaction models which model interactions between a system and its environment.
- Structural models which display the organization of a system's components.
- Behavioral models which model a system's dynamic behavior in response to events or data.
- Model-driven engineering is discussed as an approach where models rather than code are the primary outputs.
This document provides an overview of key topics from Chapter 11 on security and dependability, including:
- The principal dependability properties of availability, reliability, safety, and security.
- Dependability covers attributes like maintainability, repairability, survivability, and error tolerance.
- Dependability is important because system failures can have widespread effects and undependable systems may be rejected.
- Dependability is achieved through techniques like fault avoidance, detection and removal, and building in fault tolerance.
UML component diagrams describe the structure of software systems by showing components, their interfaces, and dependencies between components. A component represents a modular part of a system that encapsulates its contents and exposes its functionality through interfaces. Component diagrams show the organization and dependencies of components through their interfaces and ports using elements like components, interfaces, ports, and connectors. They allow modeling large and complex software systems in a modular way.
O documento apresenta uma aula sobre arquitetura de software. Discutem-se conceitos como arquitetura, projeto de software e padrões de projeto. Apresenta-se também exemplos de arquitetura em camadas e estados de um contrato de software.
O documento discute o padrão arquitetural Microkernel. Ele separa as funções principais do sistema das funcionalidades estendidas, permitindo que o sistema seja adaptável a novas mudanças. O padrão Reflexão também é discutido como mecanismo para permitir mudanças dinâmicas na estrutura e comportamento do sistema.
Architectural design involves identifying major system components and their communications. Architectural views provide different perspectives of the system, such as conceptual, logical, process, and development views. Common architectural patterns include model-view-controller, layered, client-server, and pipe-and-filter architectures. Application architectures define common structures for transaction processing, information, and language processing systems.
This document provides an overview of Angular and AngularJS, including their features, pros, and cons. Angular is a TypeScript-based framework developed by Google, while AngularJS is an older JavaScript-based framework. Key differences include Angular using TypeScript for type safety while AngularJS uses plain JavaScript, and Angular being better suited for large applications while AngularJS focuses on client-side single page apps. Both frameworks allow component-based development and routing functionality.
Domain-driven design (DDD) is an approach to software development that focuses on modeling a domain and implementing software that matches the complexity of that domain. It aims to tackle complexity in enterprise software by focusing design efforts on the core domain. Some key principles of DDD include building a ubiquitous language within a bounded context, using entities and value objects to model the domain, separating domain logic from application and presentation logic, and ensuring persistence ignorance. DDD can help improve understanding of the problem domain, create a shared language between technical and domain experts, and lead to a model-driven design rather than one driven by tools or databases.
O documento descreve o padrão MVC, dividindo-o nas camadas Model, View e Controller. O Model é responsável pelos dados, a View pela interface do usuário e o Controller intermediando as duas. O MVC surgiu em 1979 para facilitar o desenvolvimento e manutenção de aplicações.
This document provides an introduction to object-oriented programming concepts in Objective-C, including classes, inheritance, polymorphism, encapsulation, and dynamism. It discusses why Objective-C was chosen as the development language for Apple's Cocoa frameworks, noting that it is an object-oriented extension of C that allows for both procedural and object-oriented programming. The document is organized into chapters covering object-oriented programming fundamentals, the Objective-C object model, structuring programs, and structuring programming tasks.
This document provides an overview of object-oriented programming concepts in Objective-C, including:
1) It introduces object-oriented programming and some key concepts like data combined with operations, interfaces, implementations, classes, inheritance, polymorphism, and dynamism.
2) It describes the Objective-C object model including classes, inheritance hierarchies, subclass definitions, and how objects can send messages to each other.
3) It discusses how to structure Objective-C programs using concepts like outlets, intrinsic and extrinsic connections between objects, frameworks, aggregation, and decomposition.
Design patterns are optimized, reusable solutions to the programming problems that we encounter every day. A design pattern is not a class or a library that we can simply plug into our system; it's much more than that. It is a template that has to be implemented in the correct situation. It's not language-specific either. A good design pattern should be implementable in most—if not all—languages, depending on the capabilities of the language. Most importantly, any design pattern can be a double-edged sword— if implemented in the wrong place, it can be disastrous and create many problems for you. However, implemented in the right place, at the right time, it can be your savior.
The document discusses software architecture, where it comes from, and what it is. Architectures are influenced by system stakeholders and their requirements, the developing organization, and the architects' experience. An architecture defines elements, their relationships, and properties. It is important because it represents early design decisions, dictates implementation, organizational structure, and quality attributes. Architectural patterns, reference models, and reference architectures capture common architectural elements but are not full architectures themselves.
This document provides an overview of conducting reviews in IBM Rational DOORS Next Generation. It describes preparing for a review by creating either a formal or informal review from a collection or individual artifacts. It outlines the review lifecycle and roles. Participants can complete a review by approving, disapproving, or abstaining from artifacts. Once all participants are finished, the review creator can finalize the review. The goal of reviews is to catch errors early and reduce rework through collaboration and feedback on requirements.
This document provides an overview and introduction to design patterns. It discusses creational, structural, and behavioral patterns. For each category it briefly introduces and describes the intent and use of some common patterns, including Factory Method, Singleton, Decorator, Facade, Command, Iterator, and Observer. It also includes diagrams to illustrate the relationships between objects in sample implementations.
Jetpack Compose is a modern toolkit for building native Android user interfaces that simplifies and accelerates development with less code. It uses composable functions to define the UI programmatically based on data dependencies rather than focusing on the construction process. Jetpack Compose provides Material Design elements out of the box and uses a hierarchical layout system to compose functions within other functions to build the UI. It also supports features like lists, grids, animations and modifiers to customize the UI.
Agile integration architecture in relation to APIs and messagingKim Clark
This document discusses agile integration architecture from three perspectives: application integration, APIs, and messaging. It outlines how traditional centralized integration approaches are moving to more decentralized models with fine-grained deployments, application autonomy, and cloud-native implementations. APIs are shifting from system-centric to consumer-centric exposure, while messaging is evolving from self-managed to platform-managed infrastructure. Microservices require both asynchronous communications via events and synchronous APIs to fully decouple components. Agile integration architecture enables independent, scalable, and resilient digital applications and services.
The document discusses Domain Driven Design (DDD), a software development approach that focuses on building an object-oriented model of the domain that software needs to represent. It emphasizes modeling the domain closely after the structure and language of the problem domain. Key aspects of DDD discussed include ubiquitous language, bounded contexts, entities, value objects, aggregate roots, repositories, specifications, domain services, modules, domain events, and command query separation. DDD is best suited for projects with a significant domain complexity where closely modeling the problem domain can help manage that complexity.
Model-Driven Development for Safety-Critical Softwaregjuljo
Presentation given at the IBM Systems Engineering Symposium, in 2012, about Model-Driven Development for Safety-Critical Software.
With special focus on the usage of Rational Rhapsody for C++ in real-time and safety-critical software development.
The document discusses the key building blocks of Angular applications including architecture, bootstrapping, modules, components, services, templates, decorators, dependency injection, and routing; it provides an overview of each concept and how they work together to create the structure of an Angular application; the presentation concludes with a demo of these concepts in action.
This chapter discusses system modeling and different types of models used, including:
- Context models which illustrate the operational context of a system.
- Interaction models which model interactions between a system and its environment.
- Structural models which display the organization of a system's components.
- Behavioral models which model a system's dynamic behavior in response to events or data.
- Model-driven engineering is discussed as an approach where models rather than code are the primary outputs.
This document provides an overview of key topics from Chapter 11 on security and dependability, including:
- The principal dependability properties of availability, reliability, safety, and security.
- Dependability covers attributes like maintainability, repairability, survivability, and error tolerance.
- Dependability is important because system failures can have widespread effects and undependable systems may be rejected.
- Dependability is achieved through techniques like fault avoidance, detection and removal, and building in fault tolerance.
UML component diagrams describe the structure of software systems by showing components, their interfaces, and dependencies between components. A component represents a modular part of a system that encapsulates its contents and exposes its functionality through interfaces. Component diagrams show the organization and dependencies of components through their interfaces and ports using elements like components, interfaces, ports, and connectors. They allow modeling large and complex software systems in a modular way.
O documento apresenta uma aula sobre arquitetura de software. Discutem-se conceitos como arquitetura, projeto de software e padrões de projeto. Apresenta-se também exemplos de arquitetura em camadas e estados de um contrato de software.
O documento discute o padrão arquitetural Microkernel. Ele separa as funções principais do sistema das funcionalidades estendidas, permitindo que o sistema seja adaptável a novas mudanças. O padrão Reflexão também é discutido como mecanismo para permitir mudanças dinâmicas na estrutura e comportamento do sistema.
Architectural design involves identifying major system components and their communications. Architectural views provide different perspectives of the system, such as conceptual, logical, process, and development views. Common architectural patterns include model-view-controller, layered, client-server, and pipe-and-filter architectures. Application architectures define common structures for transaction processing, information, and language processing systems.
This document provides an overview of Angular and AngularJS, including their features, pros, and cons. Angular is a TypeScript-based framework developed by Google, while AngularJS is an older JavaScript-based framework. Key differences include Angular using TypeScript for type safety while AngularJS uses plain JavaScript, and Angular being better suited for large applications while AngularJS focuses on client-side single page apps. Both frameworks allow component-based development and routing functionality.
Domain-driven design (DDD) is an approach to software development that focuses on modeling a domain and implementing software that matches the complexity of that domain. It aims to tackle complexity in enterprise software by focusing design efforts on the core domain. Some key principles of DDD include building a ubiquitous language within a bounded context, using entities and value objects to model the domain, separating domain logic from application and presentation logic, and ensuring persistence ignorance. DDD can help improve understanding of the problem domain, create a shared language between technical and domain experts, and lead to a model-driven design rather than one driven by tools or databases.
O documento descreve o padrão MVC, dividindo-o nas camadas Model, View e Controller. O Model é responsável pelos dados, a View pela interface do usuário e o Controller intermediando as duas. O MVC surgiu em 1979 para facilitar o desenvolvimento e manutenção de aplicações.
This document provides an introduction to object-oriented programming concepts in Objective-C, including classes, inheritance, polymorphism, encapsulation, and dynamism. It discusses why Objective-C was chosen as the development language for Apple's Cocoa frameworks, noting that it is an object-oriented extension of C that allows for both procedural and object-oriented programming. The document is organized into chapters covering object-oriented programming fundamentals, the Objective-C object model, structuring programs, and structuring programming tasks.
This document provides an overview of object-oriented programming concepts in Objective-C, including:
1) It introduces object-oriented programming and some key concepts like data combined with operations, interfaces, implementations, classes, inheritance, polymorphism, and dynamism.
2) It describes the Objective-C object model including classes, inheritance hierarchies, subclass definitions, and how objects can send messages to each other.
3) It discusses how to structure Objective-C programs using concepts like outlets, intrinsic and extrinsic connections between objects, frameworks, aggregation, and decomposition.
Introduction to object oriented languagefarhan amjad
This document discusses object-oriented programming (OOP) and its advantages over procedural programming. It defines some key OOP concepts like objects, classes, encapsulation, and inheritance. It explains that in OOP, programs are designed as collections of these discrete objects that combine data and behaviors. This reduces complexity and promotes reusability, flexibility, and maintainability. OOP also gives data more importance and provides mechanisms to hide data that procedural languages lack.
The document discusses object-oriented programming (OOP) and its basic concepts. It states that OOP combines data and functions that operate on that data into a single unit called an object. Classes are templates that represent groups of objects that share common properties and relationships. The key characteristics of OOP include objects, classes, data abstraction, encapsulation, inheritance, polymorphism, and dynamic binding. Procedural programming focuses on processing instructions, while OOP follows a bottom-up design and emphasizes data over procedures.
Here are the key types of programming languages:
- Machine languages: Low-level languages that use binary numbers to directly interface with computer hardware. Only understood by computers.
- Assembly languages: Low-level languages that use mnemonics to represent machine code instructions. Easier for humans to read than machine code.
- High-level languages: Languages like C, C++, Java, Python etc. that are easier for humans to read and write. Require compilation or interpretation to run.
- Scripting languages: Languages like JavaScript, PHP, Python etc. Often interpreted and used for web development or system scripting tasks.
- Domain-specific languages: Languages designed for a specific application domain like genetics
The document provides a checklist of topics for a code quality training agenda, including: TDD/automated tests, continuous delivery, refactoring, design patterns, emergent design, SOLID principles, SOA, paired programming, UML/object modeling, and miscellaneous code craftsmanship best practices. It notes that the list is not comprehensive and the goal is to help organizations determine which topics would be most valuable for their teams. Descriptions are provided for some of the highlighted topics.
In this session you will learn about
- Introduction of Languages
- Difference between POP and OOP
- What is OOP?
- Object-Oriented Programming
- Advantages of OOP
- Object-Oriented Programming Paradigm
- Features of OOP
- Applications of Object Oriented Programming
- Benefits of Object Oriented Programming
This document discusses various programming concepts including structured and unstructured programming, object-oriented programming, characteristics of good programs, and programming paradigms. Structured programming involves dividing code into smaller modular pieces, while unstructured programming executes code sequentially. Object-oriented programming models software around objects that contain both data and behaviors. A good program is portable, readable, efficient, flexible, general, and well-documented.
This document discusses the evolution of the object model in programming. It describes how programming languages have evolved from procedural to object-oriented over several generations, with each generation incorporating new features like data abstraction, modularity, and object-oriented concepts. The core elements of the object model are explained as abstraction, encapsulation, hierarchy, and modularity. Minor elements like typing, concurrency, and persistence are also discussed. Examples are given throughout to illustrate object-oriented concepts.
Domain-driven design (DDD) is an approach that involves using a shared domain model and ubiquitous language to support complex domains and ensure alignment between software design and business needs. It emphasizes basing the software design on an evolving model that shares common concepts with domain experts. DDD uses patterns like entities, value objects, aggregates and repositories to structure the software around domain concepts and separate domain logic from data access and external interfaces.
PROGRAMMING REQUESTS/RESPONSES WITH GREATFREE IN THE CLOUD ENVIRONMENTijdpsjournal
Programming request with GreatFree is an efficient programming technique to implement distributed polling in the cloud computing environment. GreatFree is a distributed programming environment through which diverse distributed systems can be established through programming rather than configuring or scripting. GreatFree emphasizes the importance of programming since it offers developers the opportunities to leverage their distributed knowledge and programming skills. Additionally, programming is the unique way to construct creative, adaptive and flexible systems to accommodate various distributed computing environments. With the support of GreatFree code-level Distributed Infrastructure Patterns,
Distributed Operation Patterns and APIs, the difficult procedure is accomplished in a programmable, rapid and highly-patterned manner, i.e., the programming behaviors are simplified as the repeatable operation of Copy-Paste-Replace. Since distributed polling is one of the fundamental techniques to construct distributed systems, GreatFree provides developers with relevant APIs and patterns to program requests/responses in the novel programming environment.
PROGRAMMING REQUESTS/RESPONSES WITH GREATFREE IN THE CLOUD ENVIRONMENTijdpsjournal
Programming request with GreatFree is an efficient programming technique to implement distributed polling in the cloud computing environment. GreatFree is a distributed programming environment through which diverse distributed systems can be established through programming rather than configuring or scripting. GreatFree emphasizes the importance of programming since it offers developers the opportunities to leverage their distributed knowledge and programming skills. Additionally, programming is the unique way to construct creative, adaptive and flexible systems to accommodate various distributed computing environments. With the support of GreatFree code-level Distributed Infrastructure Patterns, Distributed Operation Patterns and APIs, the difficult procedure is accomplished in a programmable, rapid and highly-patterned manner, i.e., the programming behaviors are simplified as the repeatable operation of Copy-Paste-Replace. Since distributed polling is one of the fundamental techniques to construct distributed systems, GreatFree provides developers with relevant APIs and patterns to program requests/responses in the novel programming environment.
PROGRAMMING REQUESTS/RESPONSES WITH GREATFREE IN THE CLOUD ENVIRONMENTijdpsjournal
Programming request with GreatFree is an efficient programming technique to implement distributed
polling in the cloud computing environment. GreatFree is a distributed programming environment through
which diverse distributed systems can be established through programming rather than configuring or
scripting. GreatFree emphasizes the importance of programming since it offers developers the
opportunities to leverage their distributed knowledge and programming skills. Additionally, programming
is the unique way to construct creative, adaptive and flexible systems to accommodate various distributed
computing environments. With the support of GreatFree code-level Distributed Infrastructure Patterns,
Distributed Operation Patterns and APIs, the difficult procedure is accomplished in a programmable,
rapid and highly-patterned manner, i.e., the programming behaviors are simplified as the repeatable
operation of Copy-Paste-Replace. Since distributed polling is one of the fundamental techniques to
construct distributed systems, GreatFree provides developers with relevant APIs and patterns to program
requests/responses in the novel programming environment.
This document discusses object-oriented programming (OOP) and its advantages over other programming paradigms. It begins with an introduction to programming paradigms including procedural, object-based, and object-oriented. The key concepts of OOP are then defined, including abstraction, encapsulation, modularity, inheritance, and polymorphism. Advantages of OOP include code reusability, ease of understanding and maintenance. Disadvantages include potential overgeneralization of classes and difficulty of proper planning and design.
FRAMEWORKS BETWEEN COMPONENTS AND OBJECTSacijjournal
Before the emergence of Component-Based Frameworks, similar issues have been addressed by other
software development paradigms including e.g. Object-Oriented Programming (OOP), ComponentBased Development (CBD), and Object-Oriented Framework. In this study, these approaches especially
object-oriented Frameworks are compared to Component-Based Frameworks and their relationship are
discussed. Different software reuse methods impacts on architectural patterns and support for
application extensions and versioning. It is concluded that many of the mechanisms provided by
Component-Based Framework can be enabled by software elements at the lower level. The main
contribution of Component-Based Framework is the focus on Component development. All of them can be
built on each other in layered manner by adopting suitable design patterns. Still some things such as
which method to develop and upgrade existing application to other approach.
This document introduces object-oriented programming (OOP). It discusses the software crisis and need for new approaches like OOP. The key concepts of OOP like objects, classes, encapsulation, inheritance and polymorphism are explained. Benefits of OOP like reusability, extensibility and managing complexity are outlined. Real-time systems, simulation, databases and AI are examples of promising applications of OOP. The document was presented by Prof. Dipak R Raut at International Institute of Information Technology, Pune.
Programming involves writing computer programs and algorithms using programming languages. There are different types of programming languages from low-level machine languages close to hardware to high-level languages that are more abstract. Popular programming paradigms have evolved over time like structured programming, modular programming, object-oriented programming, and declarative programming to help manage complex programs. The most commonly used programming languages today include Java, Python, and JavaScript.
This document discusses various programming paradigms and concepts including structured programming, unstructured programming, object oriented programming, and the characteristics of a good computer program. It provides examples of different types of programming languages and explains concepts like program translation, compilers, interpreters, and linkers. Structured programming is defined as breaking programs into smaller modular pieces like functions, while unstructured programming executes instructions sequentially. Object oriented programming uses concepts like objects, classes, inheritance, encapsulation, and polymorphism. The key characteristics of a good computer program are defined as portability, readability, efficiency, flexibility, generality, and documentation.
The document provides an overview of Java programming basics. It discusses object-oriented programming concepts like classes, objects, inheritance, polymorphism and encapsulation. It also covers Java features like platform independence, security, simplicity. The document then describes Java programming basics like variables, data types, operators, expressions. It provides examples to explain concepts like declaring variables, assigning values, scope of variables.
This document provides an introduction to object-oriented programming and Java. It discusses the basics of OOP concepts like classes, objects, encapsulation, inheritance, polymorphism and dynamic binding. It explains the benefits of OOP like modularity, code reuse and information hiding. The document also outlines some key features of the Java programming language like platform independence, security, simplicity and performance. It positions Java as a pure object-oriented language suitable for developing both standalone applications and web applets.
How Can Hiring A Mobile App Development Company Help Your Business Grow?ToXSL Technologies
ToXSL Technologies is an award-winning Mobile App Development Company in Dubai that helps businesses reshape their digital possibilities with custom app services. As a top app development company in Dubai, we offer highly engaging iOS & Android app solutions. https://rb.gy/necdnt
Most important New features of Oracle 23c for DBAs and Developers. You can get more idea from my youtube channel video from https://youtu.be/XvL5WtaC20A
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...XfilesPro
Wondering how X-Sign gained popularity in a quick time span? This eSign functionality of XfilesPro DocuPrime has many advancements to offer for Salesforce users. Explore them now!
Microservice Teams - How the cloud changes the way we workSven Peters
A lot of technical challenges and complexity come with building a cloud-native and distributed architecture. The way we develop backend software has fundamentally changed in the last ten years. Managing a microservices architecture demands a lot of us to ensure observability and operational resiliency. But did you also change the way you run your development teams?
Sven will talk about Atlassian’s journey from a monolith to a multi-tenanted architecture and how it affected the way the engineering teams work. You will learn how we shifted to service ownership, moved to more autonomous teams (and its challenges), and established platform and enablement teams.
Odoo releases a new update every year. The latest version, Odoo 17, came out in October 2023. It brought many improvements to the user interface and user experience, along with new features in modules like accounting, marketing, manufacturing, websites, and more.
The Odoo 17 update has been a hot topic among startups, mid-sized businesses, large enterprises, and Odoo developers aiming to grow their businesses. Since it is now already the first quarter of 2024, you must have a clear idea of what Odoo 17 entails and what it can offer your business if you are still not aware of it.
This blog covers the features and functionalities. Explore the entire blog and get in touch with expert Odoo ERP consultants to leverage Odoo 17 and its features for your business too.
An Overview of Odoo ERP
Odoo ERP was first released as OpenERP software in February 2005. It is a suite of business applications used for ERP, CRM, eCommerce, websites, and project management. Ten years ago, the Odoo Enterprise edition was launched to help fund the Odoo Community version.
When you compare Odoo Community and Enterprise, the Enterprise edition offers exclusive features like mobile app access, Odoo Studio customisation, Odoo hosting, and unlimited functional support.
Today, Odoo is a well-known name used by companies of all sizes across various industries, including manufacturing, retail, accounting, marketing, healthcare, IT consulting, and R&D.
The latest version, Odoo 17, has been available since October 2023. Key highlights of this update include:
Enhanced user experience with improvements to the command bar, faster backend page loading, and multiple dashboard views.
Instant report generation, credit limit alerts for sales and invoices, separate OCR settings for invoice creation, and an auto-complete feature for forms in the accounting module.
Improved image handling and global attribute changes for mailing lists in email marketing.
A default auto-signature option and a refuse-to-sign option in HR modules.
Options to divide and merge manufacturing orders, track the status of manufacturing orders, and more in the MRP module.
Dark mode in Odoo 17.
Now that the Odoo 17 announcement is official, let’s look at what’s new in Odoo 17!
What is Odoo ERP 17?
Odoo 17 is the latest version of one of the world’s leading open-source enterprise ERPs. This version has come up with significant improvements explained here in this blog. Also, this new version aims to introduce features that enhance time-saving, efficiency, and productivity for users across various organisations.
Odoo 17, released at the Odoo Experience 2023, brought notable improvements to the user interface and added new functionalities with enhancements in performance, accessibility, data analysis, and management, further expanding its reach in the market.
Measures in SQL (SIGMOD 2024, Santiago, Chile)Julian Hyde
SQL has attained widespread adoption, but Business Intelligence tools still use their own higher level languages based upon a multidimensional paradigm. Composable calculations are what is missing from SQL, and we propose a new kind of column, called a measure, that attaches a calculation to a table. Like regular tables, tables with measures are composable and closed when used in queries.
SQL-with-measures has the power, conciseness and reusability of multidimensional languages but retains SQL semantics. Measure invocations can be expanded in place to simple, clear SQL.
To define the evaluation semantics for measures, we introduce context-sensitive expressions (a way to evaluate multidimensional expressions that is consistent with existing SQL semantics), a concept called evaluation context, and several operations for setting and modifying the evaluation context.
A talk at SIGMOD, June 9–15, 2024, Santiago, Chile
Authors: Julian Hyde (Google) and John Fremlin (Google)
https://doi.org/10.1145/3626246.3653374
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesQuickdice ERP
Explore the seamless transition to e-invoicing with this comprehensive guide tailored for Saudi Arabian businesses. Navigate the process effortlessly with step-by-step instructions designed to streamline implementation and enhance efficiency.
WWDC 2024 Keynote Review: For CocoaCoders AustinPatrick Weigel
Overview of WWDC 2024 Keynote Address.
Covers: Apple Intelligence, iOS18, macOS Sequoia, iPadOS, watchOS, visionOS, and Apple TV+.
Understandable dialogue on Apple TV+
On-device app controlling AI.
Access to ChatGPT with a guest appearance by Chief Data Thief Sam Altman!
App Locking! iPhone Mirroring! And a Calculator!!
8 Best Automated Android App Testing Tool and Framework in 2024.pdfkalichargn70th171
Regarding mobile operating systems, two major players dominate our thoughts: Android and iPhone. With Android leading the market, software development companies are focused on delivering apps compatible with this OS. Ensuring an app's functionality across various Android devices, OS versions, and hardware specifications is critical, making Android app testing essential.
Using Query Store in Azure PostgreSQL to Understand Query PerformanceGrant Fritchey
Microsoft has added an excellent new extension in PostgreSQL on their Azure Platform. This session, presented at Posette 2024, covers what Query Store is and the types of information you can get out of it.
Project Management: The Role of Project Dashboards.pdfKarya Keeper
Project management is a crucial aspect of any organization, ensuring that projects are completed efficiently and effectively. One of the key tools used in project management is the project dashboard, which provides a comprehensive view of project progress and performance. In this article, we will explore the role of project dashboards in project management, highlighting their key features and benefits.
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemPeter Muessig
Learn about the latest innovations in and around OpenUI5/SAPUI5: UI5 Tooling, UI5 linter, UI5 Web Components, Web Components Integration, UI5 2.x, UI5 GenAI.
Recording:
https://www.youtube.com/live/MSdGLG2zLy8?si=INxBHTqkwHhxV5Ta&t=0
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISTier1 app
Are you ready to unlock the secrets hidden within Java thread dumps? Join us for a hands-on session where we'll delve into effective troubleshooting patterns to swiftly identify the root causes of production problems. Discover the right tools, techniques, and best practices while exploring *real-world case studies of major outages* in Fortune 500 enterprises. Engage in interactive lab exercises where you'll have the opportunity to troubleshoot thread dumps and uncover performance issues firsthand. Join us and become a master of Java thread dump analysis!
Consistent toolbox talks are critical for maintaining workplace safety, as they provide regular opportunities to address specific hazards and reinforce safe practices.
These brief, focused sessions ensure that safety is a continual conversation rather than a one-time event, which helps keep safety protocols fresh in employees' minds. Studies have shown that shorter, more frequent training sessions are more effective for retention and behavior change compared to longer, infrequent sessions.
Engaging workers regularly, toolbox talks promote a culture of safety, empower employees to voice concerns, and ultimately reduce the likelihood of accidents and injuries on site.
The traditional method of conducting safety talks with paper documents and lengthy meetings is not only time-consuming but also less effective. Manual tracking of attendance and compliance is prone to errors and inconsistencies, leading to gaps in safety communication and potential non-compliance with OSHA regulations. Switching to a digital solution like Safelyio offers significant advantages.
Safelyio automates the delivery and documentation of safety talks, ensuring consistency and accessibility. The microlearning approach breaks down complex safety protocols into manageable, bite-sized pieces, making it easier for employees to absorb and retain information.
This method minimizes disruptions to work schedules, eliminates the hassle of paperwork, and ensures that all safety communications are tracked and recorded accurately. Ultimately, using a digital platform like Safelyio enhances engagement, compliance, and overall safety performance on site. https://safelyio.com/
Malibou Pitch Deck For Its €3M Seed Roundsjcobrien
French start-up Malibou raised a €3 million Seed Round to develop its payroll and human resources
management platform for VSEs and SMEs. The financing round was led by investors Breega, Y Combinator, and FCVC.
1. Clean Coding in PL/SQL and SQL
Brendan Furey, April 2019
A Programmer Writes… (Brendan's Blog)
Ireland Oracle User Group, April 4-5, 2019
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 1
2. whoami
Freelance Oracle developer and blogger
Keen interest in programming concepts
Started career as a Fortran programmer at British Gas
Dublin-based Europhile
25 years Oracle experience, currently working in Finance
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 2
3. Agenda
General Programming Design Concepts (8 slides)
Outlining basic concepts behind programming design, and programming paradigms
Design Principles and Program Modules (6 slides)
Noting important design principles, and their application to package and subprogram
structure
Object Types and Collections (6 slides)
Showing how object and record types and collections may be used to write cleaner code
API Design with Examples (6 slides)
Explaining how to design APIs for both usability and internal structure, with examples of
external design and internal refactoring
Oracle and Other Languages (3 slides)
Concerning the integration of PL/SQL programs with other languages
Oracle's Object Orientation (5 slides)
Discussing appropriate use of Oracle’s object-oriented features
SQL and Modularity (4 slides)
Discussing application of modular design concepts in relation to SQL
Conclusion (2 slides)
Recommendations around Oracle program design
Brendan Furey, 2019 3Clean Coding in PL/SQL and SQL
4. General Programming Design Concepts
Brendan Furey, 2019 4
General Programming Design Concepts
Outlining basic concepts behind programming design, and
programming paradigms
Clean Coding in PL/SQL and SQL
5. Modularity
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 5
Modularity
“The concept of modularity is used primarily to reduce complexity by breaking a system into parts
of varying degrees of interdependence and independence and "hide the complexity of each part
behind an abstraction and interface.“
Many ways to decompose, but aim for:
High Cohesion within components
Low Coupling between components
Different programming paradigms
decompose in different ways…
OCR Computing A-Level Revision
7. Imperative and Declarative Approaches
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 7
Two main approaches to programming
Imperative programming
Focuses on how to execute, defines control flow as statements that change a program
state
Declarative programming
Focuses on what to execute, defines program logic, but not detailed control flow
SQL and PL/SQL
SQL is a declarative programming language based on mathematical set theory
Database-centred, Structured Query Language
Not regarded as a functional programming language, but closer than to other paradigms
PL/SQL is an imperative, block-structured programming language based on ADA
Core language procedural, but…
Embedded SQL
Object-oriented features from v8 (1997); object types widely used, OO features such as
inheritance and type bodies hardly ever used (why? to be discussed)
How do we most effectively use the two languages together?...
8. Prefer Declarative to Imperative
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 8
Declarative programming reduces the amount of code developer writes
Use of local variables, iteration etc. removed, detailed logic handled internally by language
Reduces scope for bugs, and enables faster development
SQL Query
Returns data set from database tables based on declarative logic…
Specified table joins
Transformation rules, including aggregation, analytics etc.
…with some procedural features also possible, such as:
Subquery factor sequencing and recursion
Query projection originally flat, now may use object-relational mappings to return hierarchical
data sets
SQL and Modularity
Complex SQL may need to be designed with modularity in mind, to be discussed later
9. Thick Database Paradigm - Diagram
Brendan Furey, 2018 Database API as Mathematical Function: Insights into Testing 9
10. SQL and PL/SQL Packages
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 10
Prefer SQL to PL/SQL
Database APIs form a layer between external or internal clients and the database
The API procedure is ideally just a simple wrapper around (for example):
An SQL query (‘getter’ method for report or web service)
SQL Inserts/Updates/Deletes (IUD) (‘setter’ method for batch program or web service)
More Complex PL/SQL
Setter methods that involve multiple table IUDs
Unit test programs that require test data setup and teardown for repeatability
Instrumentation such as code timing and information and error logging
PL/SQL and Modularity
Consider how best to write more complex PL/SQL in a clean, modular way
Take note of advantages various programming paradigms may have…
11. Programming Paradigms: Definitions
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 11
Main programming paradigms / Overview of the four main programming paradigms
[Definitions below come from the two links above]
Procedural programming
Specifies the steps a program must take to reach a desired state
First do this and next do that
Object-oriented programming
Organizes programs as objects: data structures consisting of datafields and methods
together with their interactions
Send messages between objects to simulate the temporal evolution of a set of real world
phenomena
Functional programming
Treats programs as evaluating mathematical functions and avoids state and mutable data
Evaluate an expression and use the resulting value for something
Logic programming – from second link only
Answer a question via search for a solution
Seems less natural in the more general areas of computation
12. Design Principles and Program Modules
Brendan Furey, 2019 12
Design Principles and Program Modules
Noting important design principles, and their application to package
and subprogram structure
Clean Coding in PL/SQL and SQL
13. General Design Principles
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 13
DRY: Don't repeat yourself
“Every piece of knowledge must have a single, unambiguous, authoritative representation within a
system“…They (Andy Hunt and Dave Thomas) apply it quite broadly to include "database schemas,
test plans, the build system, even documentation“
WET = "write everything twice", "we enjoy typing"
Coupling versus cohesion
“Coupling refers to the interdependencies between modules, while cohesion describes how related
the functions within a single module are"
Functional design
“A functional design assures that each modular part of a device has only one responsibility and
performs that responsibility with the minimum of side effects on other parts"
Aim for low coupling and high cohesion, which can be facilitated by…
Obvious case in re-usable functions in programming languages
Relational databases apply DRY to data by normalization
Use of object types and records can push DRY to field level (to be discussed)
How can we apply this in PL/SQL packages? (to be discussed)
14. Information Hiding and Subprogram Nesting
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 14
information hiding
“In programming, the process of hiding details of an object or function. Information hiding is a
powerful programming technique because it reduces complexity. ... In a sense, the entire hierarchy
of programming languages, from machine languages to high-level languages, can be seen as a form
of information hiding.
Information hiding is also used to prevent programmers from intentionally or unintentionally changing
parts of a program” - Vangie Beal in Webopeida
Nesting in Ada Programs is for the Birds (Clarke, Wileden & Wolf, 1980)
“…a tree structure is seldom a natural representation of a program…
We have proposed a style for programming in Ada that precludes the use of nesting and thereby
avoids nesting's negative impact on program organization and readability.“
PL/SQL based on Ada and has similar package structure, and nesting capabilities
Nesting blocks or subprograms makes information from higher levels accessible
Reduction in information hiding tends to increase complexity
Suggests that nesting subprograms and blocks should be exceptional
15. Inheritance Hierarchies
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 15
JavaScript Inheritance vs Composition (Tyler McGinnis, 2019)
“If you look at the real world, you’ll see Containment (or Exclusive Ownership) Hierarchies
everywhere.
What you won’t find is Categorical Hierarchies"
Oracle and object type inheritance
Oracle has had object type inheritance capabilities since around 1997
Very rarely used, and, perhaps, with good reason
We will look at appropriate use of OO concepts and/or syntax in Oracle later…
On Inheritance (in Goodbye, Object Oriented Programming (Scalfani, 2016)
One of many articles arguing against use of inheritance in OO languages
16. Subprogram Design
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 16
Subprogram Design Guidelines
Separate out different subprogram types, maximize the use of pure functions
Avoid state accessors unless functionally required (eg code timing instrumentation)
Use input parameters and a maximum of one return value
Use record and object types to group inputs and outputs
Subprogram structure generally flat, i.e. not nested
17. Package Design
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 17
API layer in PL/SQL consists of entry-point programs that interface between external clients
and the database
Generally access no package state but global constants may be shared
Subprograms small, single purpose, and have 0 or 1 return value
Limit package sizes
18. Object and Record Types and Collections
Brendan Furey, 2019 18
Object and Record Types and Collections
Showing how object and record types and collections may be used
to write cleaner code
Clean Coding in PL/SQL and SQL
19. Record and Object Types
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 19
Suggested Usage of Records vs Objects
Objects necessary where type for database column, or casting in SQL
Lack of index-by array support is a serious limitation for programming
For purely PL/SQL use, record types more flexible, and can be of smaller scope
Allow grouping of fields and passing as one value: DRY at field level
Fields can be defined with defaults
Fields can be scalars, record/object types or collections
Record Types
PL/SQL-only constructs, and may include PL/SQL associative (index-by) arrays
No default constructor function, but can write our own
No ‘rec IS NULL’ feature, but can add a flag null_yn and use "rec.null_yn = 'Y'"
Object Types
Database level, may not include index-by arrays, can be used for table columns
Have default constructor, and IS NULL works
20. Oracle Collection Types
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 20
Collection Types (Oracle Database PL/SQL Language Reference, v12.1)
21. Arrays and Functional Programming Methods
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 21
FP features allow functions to be passed as parameters to other functions
Cleaner code can result, for example, by removing the need for explicit iteration
Map, Filter, Reduce Methods
Map: Create a new collection by applying a function to each item of the source collection
Filter: Create a new collection by applying a Boolean function to each item of the source
collection, returning True if item to be retained
Reduce: Aggregate a collection by applying a function to each item of the source collection,
with an accumulator also passed
Can we benefit from these ideas in Oracle?
These methods correspond roughly to SQL concepts (with Select as the iterator):
Map -> Projection (Select expressions based on the fields)
Filter -> Where clause
Reduce -> Aggregate functions with grouping
1. Use SQL where possible, and then…
2. Consider design patterns and generic array types to facilitate cleaner PL/SQL code…
22. Decomposition by Arrays
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 22
Processing arrays of independent elements
PL/SQL does not have an FP-style generic map function
However, we may want to apply the same processing to each element in an array
Example 1: A logging method needs to log a list of string values
Example 2: A unit test program needs to test a set of independent scenarios
Design pattern
Encapsulate record processing in a subprogram with a parameter of element type
Call the subprogram within a loop
Subprogram is simpler for processing scalar rather than list (or array of 1-smaller dimension)
PROCEDURE Put_List(
p_line_lis L1_chr_arr,
p_log_id PLS_INTEGER := NULL,
p_line_rec line_rec := LINE_DEF) IS
…
BEGIN
…
FOR i IN 1..p_line_lis.COUNT LOOP
Put_Line(p_line_text => p_line_lis(i),
p_log_id => l_log_id,
p_line_rec => l_line_rec);
END LOOP;
…
PROCEDURE Put_Line(
p_line_text VARCHAR2,
p_log_id PLS_INTEGER := NULL,
p_line_rec line_rec := LINE_DEF) IS
…
Log_Set (My Oracle logging framework on
GitHub)
Array type L1_chr_arr in caller
Scalar VARCHAR2 in called subprogram
23. Generic Array Types and Methods
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 23
String methods: Join and Split
Most languages have string methods for conversion between list of strings and delimited string
These often simplify programming tasks
SELECT Utils.List_Delim(col_1, col_2)
BULK COLLECT INTO l_lis
FROM some_table;
CREATE TYPE L1_chr_arr IS VARRAY(32767) OF VARCHAR2(4000);
CREATE TYPE L2_chr_arr IS VARRAY(32767) OF L1_chr_arr;
CREATE TYPE L3_chr_arr IS VARRAY(32767) OF L2_chr_arr;
PL/SQL Equivalents
Generic list types of string and integer type can be defined at schema level for general use
Higher dimension lists can be defined on top of these, and may be useful, eg in unit testing
FUNCTION List_Delim (p_field_lis L1_chr_arr,
p_delim VARCHAR2
DEFAULT g_list_delimiter)
RETURN VARCHAR2;
FUNCTION Csv_To_Lis(p_csv VARCHAR2
RETURN L1_chr_arr;
Return a delimited string for input list of strings
Return a list of strings for input delimited string
Can select record set with any column list (of
char, number, date type) into a generic array
Generic type declarations
24. API Design with Examples
Brendan Furey, 2019 24
API Design with Examples
Explaining how to design APIs for both usability and internal
structure, with examples of external design and internal refactoring
Clean Coding in PL/SQL and SQL
25. Clean API Design: Overloading, Record Types, Defaults
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 25
Design Considerations
Aim to make API usage as simple as possible, at least where multiple clients involved
Prefer complexity in centralized APIs to complexity in multiple clients
Subprogram Overloading
Create multiple versions where different types of call required, rather than bundle all options
into one
Overloaded subprograms, or just different versions, as applicable
Core logic centralized, called by external subprograms
Defaults
Use defaults wherever possible to allow omission of parameters
Declare default record for record types for use in parameters
Default record has its own field level defaults
Record Types
Use to simplify parameters and centralize defaulting
Use to group parameters logically
26. API Design: Log_Set Example
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 26
TYPE construct_rec IS RECORD(
null_yn VARCHAR2(1) := 'N',
config_key VARCHAR2(30),
header log_headers%ROWTYPE,
do_close BOOLEAN := FALSE);
CONSTRUCT_DEF construct_rec;
FUNCTION Con_Construct_Rec(
p_config_key VARCHAR2 := NULL,
p_description VARCHAR2 := NULL,
p_put_lev_min PLS_INTEGER := NULL,
p_do_close BOOLEAN := NULL)
RETURN construct_rec;
FUNCTION Construct(
p_construct_rec construct_rec := CONSTRUCT_DEF)
RETURN PLS_INTEGER;
FUNCTION Construct(
p_line_text VARCHAR2,
p_construct_rec construct_rec := CONSTRUCT_DEF,
p_line_rec line_rec := LINE_DEF)
RETURN PLS_INTEGER;
FUNCTION Construct(
p_line_lis L1_chr_arr,
p_construct_rec construct_rec := CONSTRUCT_DEF,
p_line_rec line_rec := LINE_DEF)
RETURN PLS_INTEGER;
l_rec := Log_Set.Construct;
l_rec := Log_Set.Construct(
p_construct_rec => p_con_rec);
Three overloaded functions
Record defined with null flag default ‘N’
2 other scalar fields
Nested record type based on table
Record variable CONSTRUCT_DEF
Constructor function for record
All parameters optional
Multiple call structures
First form has 2 calls, with/without
parameter
Others have 1 mandatory parameter,
with 4 (= 2x2) options for other 2
Client caller can choose best for it…
27. Refactoring Example - Purely_Wrap_API - Before
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 27
Unit test subprogram to test a single scenario
Input is test data for the scenario
Formatted as a generic 3-level array, plus 2 offsets
Output is the set of outputs generated from unit under test (uut)
Formatted as a generic 2-level array
Nested block loops over a sequence of events involving calls to
logging methods from uut
It has an exception handler, which gets exception details
as an output group
Rest of main block gets the other output groups from functions
that read the database
Also rolls back and deletes committed data
Split Purely_Wrap_API in two, separating out the nested block
Make call to new function Do_Event_List
28. Refactoring Example - Purely_Wrap_API - After
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 28
Subprogram is split into two units each about half size of original
Do_Event_Lis takes all inputs as parameters and direct outputs as a return value
Also writes to database by nature of unit under test
These writes are read from caller, turned into direct output elements in the return array
Writes are then reverted to make Purely_Wrap_API ‘externally pure’
Unit Test Automation
This refactoring from
idea to publishing to
GitHub took 1 hour:
Last Fri, 0630-0730
Possible because…
Unit Testing (see over)
29. Clean Code, Refactoring and Unit Test Automation
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 29
Refactoring essential to writing clean code
Automated unit testing allows repeating tests in seconds, so can easily refactor many times
Tests must be at right level - behavioural/transactional - not Junit-style small code units
30. Oracle and Other Languages
Brendan Furey, 2019 30
Oracle and Other Languages
Concerning the integration of PL/SQL programs with other
languages
Clean Coding in PL/SQL and SQL
31. Integration of PL/SQL with Other Languages: MLE and JSON
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 31
We have emphasized use of good design principles for clean coding in PL/SQL, inspired by:
Programming design concepts in general
Functional Programming, in particular
Some functionality may just be better done in other languages though…
For example, the HTML Unit Test summary links page on last slide was created in Javascript
Oracle Database Multilingual Engine may offer a future solution for direct integration…
“MLE is an experimental feature for the Oracle Database 12c. MLE enables developers to work
efficiently with DB-resident data in modern programming languages and development environments
of their choice."
Integration via JSON file exchange (see JSON Developer's Guide)
From Oracle 12.2 we can easily use JSON features to write output files in JSON format…
…then process the files in another language such as Javascript
This is how the unit testing of the Log Set package works
Next slide shows the structure of the input and output from Purely_Wrap_API
This is converted to a JSON file with expected and actuals included on the output side
32. Integration of PL/SQL with Other Languages: Example JSON Diagram
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 32
33. Oracle's Object Orientation
Brendan Furey, 2019 33
Oracle's Object Orientation
Discussing appropriate use of Oracle’s object-oriented features
Clean Coding in PL/SQL and SQL
34. Objects in Tables
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 34
Columns Based on non-Collection Object Types
Object (or record) types may be used for grouping fields in PL/SQL, as mentioned earlier
On the database, however, the table would be the natural way to group fields
Columns Based on Collection Types
Generally master-detail relationships represented by two tables with foreign key link
This allows full use of database features such as field indexing, and simple delete and update
of detail records
In exceptional cases, it may be considered acceptable to use a collection type column instead
Where the detail entity is considered to be contained within the master entity and…
…the detail collection is always accessed as a whole
Nested array could then be considered natural physical model from logical
For example, the Log Set logging framework treats system contexts in this way as detail
collections within header and line tables
Log lines though are modelled as a conventional table linked to headers
35. Log Set Data Model with Nested Object Types
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 35
Two collection types defined on database
Used as column types in tables as shown
36. Oracle's Object Orientation - Programming Issues
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 36
Oracle has had object oriented programming capabilities since around 1997
Very rarely used, while some PL/SQL new techniques become widespread quickly. Eg…
Analytic functions introduced same time, now widespread
Subquery factors introduced in v9, now widespread
Why is this? I suggest three main reasons:
1. PL/SQL as a Persistence Layer for the Database
Recall one definition of OO paradigm:
Send messages between objects to simulate the temporal evolution of a set of real world
phenomena
Getting and setting data from/to the database is different from writing computer games
2. Deficiencies in Oracle’s OO Implementation
Oracle’s types for use in PL/SQL are defined at schema level and lack…
Private instance attributes (bad from Information Hiding perspective)
Instance level Index By arrays (important programming construct in any language)
3. Packages are Good Enough
Type inheritance, as we noted, not recommended, and other features available in packages …
37. Programming Object Instance in PL/SQL
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 37
Sometimes we need to model objects having state, eg in instrumentation code such as Log Set
Suggestion: Do not use object type bodies, but packages, records and arrays instead
TYPE log_inp_rec IS RECORD(
header log_headers%ROWTYPE,
config_rec log_configs%ROWTYPE
);
TYPE log_out_arr IS VARRAY(32767) OF
log_lines%ROWTYPE;
TYPE log_rec IS RECORD(
inps log_inp_rec,
ctx_out_lis ctx_out_arr,
out_lis log_out_arr,
lines_buf PLS_INTEGER,
lines_tab PLS_INTEGER,
log_id PLS_INTEGER
);
TYPE log_arr IS TABLE OF log_rec
INDEX BY BINARY_INTEGER;
g_log_lis log_arr;
1. Define record with the structure required for the state
2. Define an array of records to maintain the states independently
3. Use the array index as the object handle, passing it as a parameter to methods
4. Place code in a single package to represent the object, with object array at package body level
38. SQL and Modularity
Brendan Furey, 2019 38
SQL and Modularity
Discussing application of modular design concepts in relation to
SQL
Clean Coding in PL/SQL and SQL
39. Centralizing SQL in Views and Functions
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 39
Views and database functions can be used to centralize SQL
Can then use them in multiple places
However, using them as building blocks in larger queries can lead to problems…
…coupling between the calling programs and complex underlying SQL
DRY can conflict with other design principles, and sometimes…
…repeating simple declarative code such as SQL joins may be preferable
SQL and Modularity: Patterns, Anti-Patterns and the Kitchen
Sink
40. Modular SQL via Subquery Factors
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 40
Use subquery factors to modularize, diagrams can help…
Query Structure Diagramming
41. Extracting Pure Functionality from SQL Queries
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 41
We can use the idea of separating out pure functionality into modules in SQL also
Here is an example where the WITH FUNCTION clause is used to do that…
Extracting Pure Functionality from SQL Queries
WITH FUNCTION calc_bonus(p_jhs_emp_id NUMBER, p_job_id VARCHAR2, p_salary NUMBER, p_avgsal NUMBER)
RETURN NUMBER IS
BEGIN
RETURN Round(0.1 *
Nvl(p_avgsal, p_salary) *
CASE WHEN p_jhs_emp_id IS NULL THEN 1 ELSE 1.1 END *
CASE p_job_id WHEN 'IT_PROG' THEN 1.5 ELSE 1 END);
END;
depsals AS (
SELECT dep.department_id, dep.manager_id, Avg(emp.salary) avgsal
FROM departments dep
JOIN employees emp ON emp.department_id = dep.department_id
GROUP BY Dep.department_id, dep.manager_id
)
SELECT emp.employee_id, emp.salary, dsl.avgsal,
calc_bonus(jhs.employee_id, job.job_id, emp.salary, dsl.avgsal) bonus
FROM employees emp
JOIN jobs job
ON emp.job_id = job.job_id
LEFT JOIN depsals dsl
ON dsl.manager_id = emp.employee_id
LEFT JOIN (SELECT employee_id FROM job_history GROUP BY employee_id) jhs
ON jhs.employee_id = emp.employee_id
ORDER BY 1
42. Conclusion
Brendan Furey, 2019 42
Conclusion
Recommendations around Oracle program design
Clean Coding in PL/SQL and SQL
43. Conclusion
Brendan Furey, 2019 Clean Coding in PL/SQL and SQL 43
Create small, cohesive subprograms, separating pure functionality from database accessors
Subprograms should return 0 or 1 (possibly complex) values
Avoid package state, except where necessary, and use a flat, non-nested subprogram structure
Group simple, uncoupled subprograms into moderately sized packages of related types
Use a single package each for complex code serving a single purpose
Provide clean API interfaces using record types, defaults and overloading
Use generic types and collections where this reduces duplication
Facilitate refactoring with automated unit tests at a transactional level
Consider integrating other languages for complex non-database processing, possibly via JSON
Use Oracle's object types freely, but avoid inheritance and type bodies
Follow a simple array-based design pattern, where object state instances are required
Use subquery factors extensively to modularize SQL queries
Use views where appropriate, but try to avoid coupling problems from joining complex views
Use functions in the WITH clause to separate out pure functionality where possible
44. References
1. Modularity
2. OCR Computing A-Level Revision
3. Overview of programming paradigms
4. Two main approaches to programming
5. Main programming paradigms
6. Overview of the four main programming paradigms
7. DRY: Don't repeat yourself
8. Coupling versus cohesion
9. Functional design
10. information hiding (Vangie Beal in Webopeida)
11. Nesting in Ada Programs is for the Birds (Clarke, Wileden & Wolf, 1980)
12. On Inheritance (in Goodbye, Object Oriented Programming (Scalfani, 2016)
13. JavaScript Inheritance vs Composition (Tyler McGinnis, 2019)
14. Collection Types (Oracle Database PL/SQL Language Reference, v12.1)
15. Log_Set (My Oracle logging framework on GitHub)
16. Oracle Database Multilingual Engine
17. JSON Developer's Guide
18. SQL and Modularity: Patterns, Anti-Patterns and the Kitchen Sink
19. Query Structure Diagramming
20. Extracting Pure Functionality from SQL Queries
Brendan Furey, 2018 44Database API as Mathematical Function: Insights into Testing