diff --git a/.gitattributes b/.gitattributes
index df1edb9dd7a56f2fa4a188e11325afd5d794adf5..952acfe54c180a1d244aed81c1502afcda57237e 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -80,3 +80,12 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
10[[:space:]]-[[:space:]]Methods[[:space:]]in[[:space:]]Java/016[[:space:]]Homework[[:space:]]review[[:space:]]Methods.mp4 filter=lfs diff=lfs merge=lfs -text
101[[:space:]]-[[:space:]]Manage[[:space:]]a[[:space:]]Scrum[[:space:]]Team[[:space:]]with[[:space:]]ChatGPT/001[[:space:]]Managing[[:space:]]Scrum[[:space:]]&[[:space:]]Risk[[:space:]]Management[[:space:]]with[[:space:]]Custom[[:space:]]Bot,[[:space:]]Slack[[:space:]]&[[:space:]]GPT.mp4 filter=lfs diff=lfs merge=lfs -text
100[[:space:]]-[[:space:]]GPT[[:space:]]+[[:space:]]Slack[[:space:]]+[[:space:]]Jira[[:space:]]+[[:space:]]Gmail[[:space:]]Integration/002[[:space:]]Generate[[:space:]]Tickets[[:space:]]in[[:space:]]Jira[[:space:]]&[[:space:]]Send[[:space:]]Email[[:space:]]from[[:space:]]Slack[[:space:]]via[[:space:]]Chat[[:space:]]Interface.mp4 filter=lfs diff=lfs merge=lfs -text
+100[[:space:]]-[[:space:]]GPT[[:space:]]+[[:space:]]Slack[[:space:]]+[[:space:]]Jira[[:space:]]+[[:space:]]Gmail[[:space:]]Integration/001[[:space:]]GPT[[:space:]]+[[:space:]]Slack[[:space:]]+[[:space:]]Jira[[:space:]]Integration[[:space:]]Work[[:space:]]with[[:space:]]Jira[[:space:]]Datasource.mp4 filter=lfs diff=lfs merge=lfs -text
+104[[:space:]]-[[:space:]]UML[[:space:]]Introduction/001[[:space:]]Introduction[[:space:]]to[[:space:]]UML.mp4 filter=lfs diff=lfs merge=lfs -text
+102[[:space:]]-[[:space:]]DALL-E[[:space:]]-[[:space:]]Text[[:space:]]to[[:space:]]image[[:space:]]AI[[:space:]]Model[[:space:]]by[[:space:]]OpenAI/001[[:space:]]DALL-E[[:space:]]Model[[:space:]]&[[:space:]]API[[:space:]]Overview[[:space:]]With[[:space:]]Examples[[:space:]]in[[:space:]]Postman.mp4 filter=lfs diff=lfs merge=lfs -text
+103[[:space:]]-[[:space:]]Whisper[[:space:]]-[[:space:]]Speech[[:space:]]to[[:space:]]text[[:space:]]AI[[:space:]]model[[:space:]]by[[:space:]]OpenAI/001[[:space:]]Whisper[[:space:]]Model[[:space:]]&[[:space:]]API[[:space:]]Overview[[:space:]]With[[:space:]]Examples[[:space:]]in[[:space:]]Postman.mp4 filter=lfs diff=lfs merge=lfs -text
+105[[:space:]]-[[:space:]]Behavioral[[:space:]]Diagrams/001[[:space:]]Use[[:space:]]Case[[:space:]]Diagram.mp4 filter=lfs diff=lfs merge=lfs -text
+105[[:space:]]-[[:space:]]Behavioral[[:space:]]Diagrams/002[[:space:]]Sequence[[:space:]]Diagram.mp4 filter=lfs diff=lfs merge=lfs -text
+105[[:space:]]-[[:space:]]Behavioral[[:space:]]Diagrams/003[[:space:]]Activity[[:space:]]Diagram.mp4 filter=lfs diff=lfs merge=lfs -text
+105[[:space:]]-[[:space:]]Behavioral[[:space:]]Diagrams/004[[:space:]]State[[:space:]]Machine[[:space:]]Diagram.mp4 filter=lfs diff=lfs merge=lfs -text
+105[[:space:]]-[[:space:]]Behavioral[[:space:]]Diagrams/005[[:space:]]Communication[[:space:]]Diagram[[:space:]](formerly[[:space:]]known[[:space:]]as[[:space:]]Collaboration[[:space:]]Diagram).mp4 filter=lfs diff=lfs merge=lfs -text
diff --git a/100 - GPT + Slack + Jira + Gmail Integration/001 GPT + Slack + Jira Integration Work with Jira Datasource.mp4 b/100 - GPT + Slack + Jira + Gmail Integration/001 GPT + Slack + Jira Integration Work with Jira Datasource.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..5d07f59434b96d6791695a2fb68f2b3dce46a78d
--- /dev/null
+++ b/100 - GPT + Slack + Jira + Gmail Integration/001 GPT + Slack + Jira Integration Work with Jira Datasource.mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:74f6944cafe9f7048f386c0ff9c7ec5cd16cee22c820bea99e090a4580da64c3
+size 548747142
diff --git a/102 - DALL-E - Text to image AI Model by OpenAI/001 DALL-E Model & API Overview With Examples in Postman.mp4 b/102 - DALL-E - Text to image AI Model by OpenAI/001 DALL-E Model & API Overview With Examples in Postman.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..2ce76baf808e1ee9f99a89cb05c7f4aac99f919a
--- /dev/null
+++ b/102 - DALL-E - Text to image AI Model by OpenAI/001 DALL-E Model & API Overview With Examples in Postman.mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:bc49650f24e918b82f295ef291526f2583d11b8c6674b1d84dc92963ed294161
+size 328175978
diff --git a/103 - Whisper - Speech to text AI model by OpenAI/001 Whisper Model & API Overview With Examples in Postman.mp4 b/103 - Whisper - Speech to text AI model by OpenAI/001 Whisper Model & API Overview With Examples in Postman.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..1ca5059e539d09815a5faf326a80906a39d71e61
--- /dev/null
+++ b/103 - Whisper - Speech to text AI model by OpenAI/001 Whisper Model & API Overview With Examples in Postman.mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:19ee849895a8b89954fadf21ad96329a8eb9553c741aeec40aac21821a8bd98f
+size 279486114
diff --git a/104 - UML Introduction/001 Introduction to UML.mp4 b/104 - UML Introduction/001 Introduction to UML.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..1030999e9401ffdcd94d481079aca6c66d49417a
--- /dev/null
+++ b/104 - UML Introduction/001 Introduction to UML.mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:97e141fa986e93b6eb91ef5e731a81f458e60f4c2039762d256021dbd8a79323
+size 212221548
diff --git a/105 - Behavioral Diagrams/001 Use Case Diagram.mp4 b/105 - Behavioral Diagrams/001 Use Case Diagram.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..d4235029371ca120c8fb6ea155a8839a7e3597e4
--- /dev/null
+++ b/105 - Behavioral Diagrams/001 Use Case Diagram.mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4191cabdacc1f89a646a134acb59ad35a1303e077d78f9a152d8d31133d6330f
+size 242670222
diff --git a/105 - Behavioral Diagrams/002 Sequence Diagram.mp4 b/105 - Behavioral Diagrams/002 Sequence Diagram.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..4445be9b075248a9606db9c16c379d49bb9df3d9
--- /dev/null
+++ b/105 - Behavioral Diagrams/002 Sequence Diagram.mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:cd23a7644d13e525b0f61c9cf6d498046628d1d60a28db0827983a2c6cf073b7
+size 146030394
diff --git a/105 - Behavioral Diagrams/003 Activity Diagram.mp4 b/105 - Behavioral Diagrams/003 Activity Diagram.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..2ffdf4020c3c2146e9f25bd499f3e9f835c6b07d
--- /dev/null
+++ b/105 - Behavioral Diagrams/003 Activity Diagram.mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1ea420fcf39a85c286b339ce8c1bfc05a1b0e5e3f5b58b2d66f9c8d96f03cb4f
+size 231164055
diff --git a/105 - Behavioral Diagrams/004 State Machine Diagram.mp4 b/105 - Behavioral Diagrams/004 State Machine Diagram.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..cfabd2b34ef9c1783c1204a5d4d93b1b1ba8e6b3
--- /dev/null
+++ b/105 - Behavioral Diagrams/004 State Machine Diagram.mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f7daa888d1b4ad85dd55e118f1e82b07d721e3bd6f4e02cd032277da167623e8
+size 232694435
diff --git a/105 - Behavioral Diagrams/005 Communication Diagram (formerly known as Collaboration Diagram).mp4 b/105 - Behavioral Diagrams/005 Communication Diagram (formerly known as Collaboration Diagram).mp4
new file mode 100644
index 0000000000000000000000000000000000000000..f35cb4a78727a03a743a5d1b1ce1c53dea885b5a
--- /dev/null
+++ b/105 - Behavioral Diagrams/005 Communication Diagram (formerly known as Collaboration Diagram).mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:9afd530a221de4ff5bbf8213d3fe2966fffdbef6557dabfa4b3f6e6b33f0a95c
+size 191440284
diff --git a/38 - Object-oriented Architecture, Clean Code Design (Advanced)/005 YAGNI Principle in OOP_en.srt b/38 - Object-oriented Architecture, Clean Code Design (Advanced)/005 YAGNI Principle in OOP_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..cd4966dde49144dbd5813f2d7693313573f1eaba
--- /dev/null
+++ b/38 - Object-oriented Architecture, Clean Code Design (Advanced)/005 YAGNI Principle in OOP_en.srt
@@ -0,0 +1,1216 @@
+1
+00:00:05,000 --> 00:00:06,000
+Hello team!
+
+2
+00:00:06,000 --> 00:00:10,000
+In this lesson we are going to learn Yagi principle.
+
+3
+00:00:10,000 --> 00:00:15,000
+Today we'll delve into the essential aspects of the you aren't gonna need it principle.
+
+4
+00:00:15,000 --> 00:00:22,000
+We'll start by defining what the agony Principle entails, exploring its core philosophy and how it
+
+5
+00:00:22,000 --> 00:00:24,000
+applies to software development practices.
+
+6
+00:00:25,000 --> 00:00:30,000
+Next, we'll discuss the compelling benefits of embracing Yagi yarn in your projects, highlighting
+
+7
+00:00:30,000 --> 00:00:35,000
+how it reduces unnecessary complexity and optimizes resource allocation.
+
+8
+00:00:36,000 --> 00:00:42,000
+Moving forward, we'll explore practical strategies on how to effectively apply yazhini in real world
+
+9
+00:00:42,000 --> 00:00:47,000
+scenarios, emphasizing iterative development and focusing on immediate user needs.
+
+10
+00:00:48,000 --> 00:00:54,000
+Following that, we'll examine insightful case studies that showcase the successful implementation of
+
+11
+00:00:54,000 --> 00:00:57,000
+the Yagni principle in various software projects.
+
+12
+00:00:58,000 --> 00:01:06,000
+These examples will illustrate its impact on enhancing agility, maintaining code simplicity, and delivering
+
+13
+00:01:06,000 --> 00:01:07,000
+value driven solutions.
+
+14
+00:01:08,000 --> 00:01:15,000
+Moreover, we'll provide concrete code examples that demonstrate the application of yakhni, illustrating
+
+15
+00:01:15,000 --> 00:01:21,000
+how to streamline code bases by prioritizing essential functionalities and avoiding premature optimizations
+
+16
+00:01:22,000 --> 00:01:24,000
+to enrich our understanding.
+
+17
+00:01:24,000 --> 00:01:30,000
+We will compare the Yanai principle with another fundamental concept in software development keep it
+
+18
+00:01:30,000 --> 00:01:31,000
+simple, stupid principle.
+
+19
+00:01:32,000 --> 00:01:37,000
+We'll highlight the key differences between these principles, emphasizing their distinct approaches
+
+20
+00:01:37,000 --> 00:01:43,000
+to achieving simplicity and efficiency in software design and implementation.
+
+21
+00:01:43,000 --> 00:01:50,000
+By the end of this session, you'll gain a comprehensive grasp of the Yogini principles, significance,
+
+22
+00:01:50,000 --> 00:01:56,000
+and practical implementation strategies, equipping you with insights to enhance your software development
+
+23
+00:01:56,000 --> 00:01:57,000
+practices.
+
+24
+00:01:57,000 --> 00:02:05,000
+Let's dive in and explore how yogini can optimize your project workflows and drive impactful results.
+
+25
+00:02:05,000 --> 00:02:07,000
+So let's start our lesson.
+
+26
+00:02:08,000 --> 00:02:14,000
+The unit principle, which stands for you aren't gonna need it, is a fundamental tenet in software
+
+27
+00:02:14,000 --> 00:02:21,000
+development, particularly within the practices of extreme programming and agile methodologies.
+
+28
+00:02:21,000 --> 00:02:28,000
+It emphasizes simplicity and encourages developers to avoid adding functionality until it is necessary.
+
+29
+00:02:29,000 --> 00:02:37,000
+The core idea is to minimize unnecessary complexity and effort by focusing only on the immediate requirements
+
+30
+00:02:37,000 --> 00:02:38,000
+of the project.
+
+31
+00:02:39,000 --> 00:02:46,000
+The principle was introduced by Ron Jeffries, one of the original proponents of extreme programming.
+
+32
+00:02:46,000 --> 00:02:52,000
+Extreme programming is an agile software development methodology that focuses on improving software
+
+33
+00:02:52,000 --> 00:02:59,000
+quality and responsiveness to changing customer requirements through frequent releases in short development
+
+34
+00:02:59,000 --> 00:03:05,000
+cycles, which improves productivity and introduces checkpoints where new customer requirements can
+
+35
+00:03:05,000 --> 00:03:06,000
+be adopted.
+
+36
+00:03:07,000 --> 00:03:14,000
+Beyond extreme programming, Unai has influenced other agile methodologies and is widely embraced in
+
+37
+00:03:14,000 --> 00:03:15,000
+agile practices.
+
+38
+00:03:15,000 --> 00:03:22,000
+It supports the agile values of simplicity, customer collaboration, and responding to change.
+
+39
+00:03:23,000 --> 00:03:29,000
+Yanai is now considered a best practice in modern software development, reinforcing principles like
+
+40
+00:03:29,000 --> 00:03:33,000
+lean programming, which aims to minimize waste and maximize value.
+
+41
+00:03:34,000 --> 00:03:40,000
+Let's now address another important question why we need to use this principle?
+
+42
+00:03:40,000 --> 00:03:44,000
+What benefits do we expect to get from using this principle?
+
+43
+00:03:44,000 --> 00:03:50,000
+There are four critical costs in software development that are significantly influenced by adherence
+
+44
+00:03:50,000 --> 00:03:52,000
+to the you aren't gonna need it principle.
+
+45
+00:03:53,000 --> 00:03:53,000
+They are.
+
+46
+00:03:54,000 --> 00:03:55,000
+Cost of build.
+
+47
+00:03:55,000 --> 00:03:56,000
+Cost of delay.
+
+48
+00:03:57,000 --> 00:03:58,000
+Cost of carry.
+
+49
+00:03:58,000 --> 00:03:59,000
+Cost of repair.
+
+50
+00:04:00,000 --> 00:04:06,000
+By prioritizing essential functionalities and deferring non-critical decisions until necessary.
+
+51
+00:04:06,000 --> 00:04:11,000
+Jain aims to minimize waste and maximize value for users and stakeholders.
+
+52
+00:04:12,000 --> 00:04:18,000
+To answer the question why we need to use this principle, we need to understand how Jargony principle
+
+53
+00:04:18,000 --> 00:04:21,000
+may impact these four costs.
+
+54
+00:04:22,000 --> 00:04:24,000
+Let me explain you in details.
+
+55
+00:04:25,000 --> 00:04:26,000
+Cost of building.
+
+56
+00:04:26,000 --> 00:04:32,000
+The cost of building includes all resources invested in developing a feature or solution.
+
+57
+00:04:32,000 --> 00:04:38,000
+This includes time spent on planning, coding, testing and other development activities.
+
+58
+00:04:38,000 --> 00:04:46,000
+When developers adhere to Vianai, they focus only on implementing features that are currently necessary.
+
+59
+00:04:47,000 --> 00:04:53,000
+By avoiding speculative features, they minimize the amount of resources expended on functionalities
+
+60
+00:04:53,000 --> 00:05:00,000
+that may never be used, or that could change significantly before implementation.
+
+61
+00:05:01,000 --> 00:05:02,000
+Cost of delay.
+
+62
+00:05:02,000 --> 00:05:09,000
+The cost of delay refers to the missed opportunities or economic impact of not delivering a feature
+
+63
+00:05:09,000 --> 00:05:10,000
+promptly.
+
+64
+00:05:10,000 --> 00:05:18,000
+If developers prioritize less critical features over more important ones, they risk delaying the delivery
+
+65
+00:05:18,000 --> 00:05:21,000
+of value to users or stakeholders.
+
+66
+00:05:21,000 --> 00:05:28,000
+Yang encourages developers to deliver the most essential features quickly, ensuring that valuable functionalities
+
+67
+00:05:28,000 --> 00:05:31,000
+are implemented promptly without unnecessary delays.
+
+68
+00:05:32,000 --> 00:05:34,000
+Cost of carry.
+
+69
+00:05:34,000 --> 00:05:41,000
+The cost of carry relates to the ongoing challenges and additional work caused by maintaining and managing
+
+70
+00:05:41,000 --> 00:05:43,000
+specific features within the software.
+
+71
+00:05:43,000 --> 00:05:50,000
+When unnecessary or overly complex features are implemented, they can increase the overall complexity
+
+72
+00:05:50,000 --> 00:05:51,000
+of the code base.
+
+73
+00:05:51,000 --> 00:05:59,000
+This complexity makes it more difficult to maintain, debug, and enhance other parts of the software.
+
+74
+00:05:59,000 --> 00:06:07,000
+JNI helps mitigate the cost of carry by promoting simplicity and avoiding unnecessary complexity, thus
+
+75
+00:06:07,000 --> 00:06:11,000
+reducing the long term burden on development efforts.
+
+76
+00:06:12,000 --> 00:06:13,000
+Cost of repair.
+
+77
+00:06:13,000 --> 00:06:14,000
+Technical debt.
+
+78
+00:06:15,000 --> 00:06:21,000
+The cost of repair, often referred to as technical debt, is incurred when suboptimal decisions or
+
+79
+00:06:21,000 --> 00:06:24,000
+shortcuts are made during development.
+
+80
+00:06:25,000 --> 00:06:31,000
+If developers implement features that later require significant adjustments, fixing and maintaining
+
+81
+00:06:31,000 --> 00:06:35,000
+those features becomes more costly over time.
+
+82
+00:06:35,000 --> 00:06:42,000
+Yanai encourages developers to avoid premature optimization and overengineering, which can lead to
+
+83
+00:06:42,000 --> 00:06:49,000
+technical debt by focusing on immediate needs and deferring decisions about future features until they
+
+84
+00:06:49,000 --> 00:06:50,000
+are truly required.
+
+85
+00:06:50,000 --> 00:06:55,000
+Developers minimize the likelihood of accruing technical debt.
+
+86
+00:06:55,000 --> 00:07:01,000
+Just a quick note in case you will have any questions during the lesson, please don't wait till the
+
+87
+00:07:01,000 --> 00:07:02,000
+end of the lesson.
+
+88
+00:07:02,000 --> 00:07:06,000
+Just post your question below the video and I will be happy to answer.
+
+89
+00:07:07,000 --> 00:07:14,000
+Let's continue and let me now elaborate on the benefits we can expect to gain from using this principle.
+
+90
+00:07:15,000 --> 00:07:21,000
+Using the yagna principle offers several significant benefits in software development, primarily revolving
+
+91
+00:07:21,000 --> 00:07:25,000
+around efficiency, simplicity, and responsiveness.
+
+92
+00:07:26,000 --> 00:07:33,000
+Let's review in details why developers and teams should use yagna and the benefits it provides.
+
+93
+00:07:34,000 --> 00:07:35,000
+Simplified code base.
+
+94
+00:07:36,000 --> 00:07:40,000
+A smaller, simpler code base is easier to maintain.
+
+95
+00:07:40,000 --> 00:07:47,000
+There are fewer bugs, and it's easier to spot and fix issues by not adding unnecessary features.
+
+96
+00:07:47,000 --> 00:07:55,000
+You minimize technical debt, which is the cost of additional rework caused by choosing an easy solution
+
+97
+00:07:55,000 --> 00:07:58,000
+now instead of a better approach that would take longer.
+
+98
+00:07:59,000 --> 00:08:01,000
+Increased productivity.
+
+99
+00:08:02,000 --> 00:08:08,000
+Developers can work more efficiently by concentrating on immediate tasks, leading to higher productivity
+
+100
+00:08:08,000 --> 00:08:11,000
+and a more streamlined development process.
+
+101
+00:08:12,000 --> 00:08:17,000
+Completing and delivering smaller increments of functionality more quickly keeps the team motivated
+
+102
+00:08:17,000 --> 00:08:19,000
+and stakeholders satisfied.
+
+103
+00:08:20,000 --> 00:08:27,000
+Enhanced quality with fewer features to test the testing process can be more rigorous and thorough,
+
+104
+00:08:27,000 --> 00:08:29,000
+leading to higher quality software.
+
+105
+00:08:30,000 --> 00:08:35,000
+By not implementing speculative features, the potential for introducing bugs is reduced.
+
+106
+00:08:37,000 --> 00:08:42,000
+Better responsiveness to change yarn allows for greater adaptability.
+
+107
+00:08:42,000 --> 00:08:49,000
+As customer needs evolve, the team can more easily shift focus and make necessary changes without being
+
+108
+00:08:49,000 --> 00:08:51,000
+bogged down by unused features.
+
+109
+00:08:52,000 --> 00:08:58,000
+Teams can continuously refine and improve the software based on actual user feedback and requirements,
+
+110
+00:08:58,000 --> 00:09:00,000
+rather than assumptions.
+
+111
+00:09:01,000 --> 00:09:02,000
+Cost efficiency.
+
+112
+00:09:03,000 --> 00:09:08,000
+Focusing only on necessary features means fewer resources spent on development.
+
+113
+00:09:08,000 --> 00:09:11,000
+This can result in significant cost savings.
+
+114
+00:09:12,000 --> 00:09:18,000
+Resources can be allocated more effectively, prioritizing the development of features that provide
+
+115
+00:09:18,000 --> 00:09:19,000
+immediate value.
+
+116
+00:09:20,000 --> 00:09:26,000
+Increased customer satisfaction by focusing on what customers currently need.
+
+117
+00:09:26,000 --> 00:09:33,000
+Teams ensure that the delivered software meets user expectations and provides tangible benefits.
+
+118
+00:09:33,000 --> 00:09:39,000
+Regularly delivering functional increments keeps customers engaged and allows for constant feedback,
+
+119
+00:09:39,000 --> 00:09:43,000
+which helps in aligning the product with user needs.
+
+120
+00:09:44,000 --> 00:09:47,000
+How you can start applying Yang principles starting from today.
+
+121
+00:09:47,000 --> 00:09:55,000
+Already applying the you aren't gonna need it principle effectively involves adopting a mindset and
+
+122
+00:09:55,000 --> 00:10:02,000
+implementing specific practices to ensure that software development remains focused, efficient, and
+
+123
+00:10:02,000 --> 00:10:04,000
+responsive to current requirements.
+
+124
+00:10:05,000 --> 00:10:08,000
+Here is a detailed guide on how to apply yanyi in practice.
+
+125
+00:10:09,000 --> 00:10:11,000
+Focus on essential features.
+
+126
+00:10:12,000 --> 00:10:15,000
+Start with minimum viable product MVP.
+
+127
+00:10:15,000 --> 00:10:22,000
+Define and prioritize the core functionalities that are essential for the initial release of the product.
+
+128
+00:10:22,000 --> 00:10:28,000
+These are features that directly address the primary needs and provide immediate value to users.
+
+129
+00:10:29,000 --> 00:10:31,000
+Avoid speculative features.
+
+130
+00:10:31,000 --> 00:10:37,000
+Resist the temptation to implement features that are not explicitly required by current user stories
+
+131
+00:10:37,000 --> 00:10:38,000
+or business objectives.
+
+132
+00:10:39,000 --> 00:10:43,000
+Stay focused on what is essential to meet the current iteration's goals.
+
+133
+00:10:44,000 --> 00:10:46,000
+Embrace incremental development.
+
+134
+00:10:47,000 --> 00:10:50,000
+Develop software in small, manageable increments.
+
+135
+00:10:51,000 --> 00:10:55,000
+Each increment should deliver tangible value and be fully functional.
+
+136
+00:10:56,000 --> 00:10:59,000
+Seek frequent feedback from stakeholders and end users.
+
+137
+00:10:59,000 --> 00:11:05,000
+Use this feedback to validate assumptions and adjust priorities accordingly, ensuring that subsequent
+
+138
+00:11:05,000 --> 00:11:10,000
+increments reflect real needs rather than imagined future requirements.
+
+139
+00:11:11,000 --> 00:11:12,000
+Refactor and simplify.
+
+140
+00:11:12,000 --> 00:11:19,000
+Continuously refactor code to keep it clean, maintainable and aligned with current requirements.
+
+141
+00:11:20,000 --> 00:11:25,000
+Remove any unused or unnecessary code to reduce complexity and technical debt.
+
+142
+00:11:26,000 --> 00:11:31,000
+Design solutions that are straightforward and meet immediate needs without overengineering.
+
+143
+00:11:32,000 --> 00:11:36,000
+Complexity should only be added when justified by concrete requirements.
+
+144
+00:11:38,000 --> 00:11:40,000
+Prioritize delivering value.
+
+145
+00:11:40,000 --> 00:11:46,000
+Prioritize tasks and features based on the value they provide to users or stakeholders.
+
+146
+00:11:47,000 --> 00:11:52,000
+Aim to deliver the highest value items first to maximize return on investment.
+
+147
+00:11:53,000 --> 00:11:58,000
+Postpone decisions about future features until they are absolutely necessary.
+
+148
+00:11:59,000 --> 00:12:05,000
+This avoids wasting time and effort on features that may never be needed, or that may change significantly
+
+149
+00:12:05,000 --> 00:12:06,000
+before implementation.
+
+150
+00:12:08,000 --> 00:12:10,000
+Avoid premature optimization.
+
+151
+00:12:10,000 --> 00:12:15,000
+Focus on optimizing performance only when performance issues are observed and measured.
+
+152
+00:12:16,000 --> 00:12:22,000
+Avoid premature optimization, which can lead to overengineering and wasted effort on unnecessary improvements.
+
+153
+00:12:23,000 --> 00:12:25,000
+Use agile practices.
+
+154
+00:12:26,000 --> 00:12:32,000
+Adopt agile practices such as Scrum or Kanban to facilitate iterative development, frequent deliveries
+
+155
+00:12:32,000 --> 00:12:34,000
+and continuous improvement.
+
+156
+00:12:35,000 --> 00:12:41,000
+Ensure collaboration and communication among cross-functional teams developers, testers, designers,
+
+157
+00:12:41,000 --> 00:12:46,000
+product owners to promote a shared understanding of priorities and requirements.
+
+158
+00:12:47,000 --> 00:12:54,000
+validate assumptions based decisions on empirical data and user feedback, rather than assumptions or
+
+159
+00:12:54,000 --> 00:12:56,000
+predictions about future needs.
+
+160
+00:12:57,000 --> 00:13:02,000
+Use prototypes and user testing to validate assumptions early in the development process.
+
+161
+00:13:02,000 --> 00:13:07,000
+This helps to avoid building unnecessary features or functionalities.
+
+162
+00:13:08,000 --> 00:13:10,000
+Let's review some case studies now.
+
+163
+00:13:10,000 --> 00:13:16,000
+Case studies illustrating the application and benefits of the you aren't gonna need it principle in
+
+164
+00:13:16,000 --> 00:13:22,000
+software development can provide valuable insights into how this principle can be effectively implemented
+
+165
+00:13:22,000 --> 00:13:25,000
+and its impact on project success.
+
+166
+00:13:25,000 --> 00:13:31,000
+Let's review different examples that illustrate different scenarios where Yanai principles are applied.
+
+167
+00:13:32,000 --> 00:13:35,000
+Start up app development scenario.
+
+168
+00:13:35,000 --> 00:13:39,000
+A startup is developing a new mobile app for task management.
+
+169
+00:13:40,000 --> 00:13:43,000
+How unique principle is applicable in this case?
+
+170
+00:13:44,000 --> 00:13:52,000
+Initially, the team decides to implement basic task creation, editing and marking as complete functionalities.
+
+171
+00:13:53,000 --> 00:13:59,000
+They avoid adding advanced features like task dependencies or complex collaboration tools until user
+
+172
+00:13:59,000 --> 00:14:06,000
+feedback indicates a clear demand for them, the team releases the app with minimal features to gather
+
+173
+00:14:06,000 --> 00:14:07,000
+feedback quickly.
+
+174
+00:14:07,000 --> 00:14:09,000
+Based on user responses.
+
+175
+00:14:09,000 --> 00:14:17,000
+They prioritize subsequent features, such as reminders or sharing tasks that enhance usability and
+
+176
+00:14:17,000 --> 00:14:24,000
+address real user needs by focusing on essential features and iterating based on user feedback.
+
+177
+00:14:24,000 --> 00:14:29,000
+The startup delivers a streamlined product that meets core user needs early on.
+
+178
+00:14:29,000 --> 00:14:36,000
+This approach accelerates time to market and ensures resources are invested in features that provide
+
+179
+00:14:36,000 --> 00:14:37,000
+the most value.
+
+180
+00:14:38,000 --> 00:14:44,000
+E-commerce Platform Enhancement scenario an e-commerce platform is adding new payment options to improve
+
+181
+00:14:44,000 --> 00:14:46,000
+user experience.
+
+182
+00:14:47,000 --> 00:14:54,000
+Let's understand how Jamie Principle may help us in this case, as the development team starts by integrating
+
+183
+00:14:54,000 --> 00:14:59,000
+a popular payment gateway that covers the majority of user transactions.
+
+184
+00:14:59,000 --> 00:15:06,000
+They delay integrating less commonly used payment options until demand for them becomes evident through
+
+185
+00:15:06,000 --> 00:15:09,000
+transaction data and user feedback.
+
+186
+00:15:09,000 --> 00:15:15,000
+Instead of building custom integrations for all potential payment gateways up front, the team designs
+
+187
+00:15:15,000 --> 00:15:22,000
+a modular architecture that allows for easy scalability and addition of new payment options as needed.
+
+188
+00:15:22,000 --> 00:15:28,000
+By prioritizing the most used payment options initially and deferring less critical integrations, the
+
+189
+00:15:28,000 --> 00:15:33,000
+platform enhances user experience without unnecessary complexity.
+
+190
+00:15:33,000 --> 00:15:40,000
+This approach also reduces initial development costs and ensures resources are allocated based on actual
+
+191
+00:15:40,000 --> 00:15:43,000
+user behavior and preferences.
+
+192
+00:15:44,000 --> 00:15:48,000
+Social media platform development scenario.
+
+193
+00:15:48,000 --> 00:15:51,000
+Building a social media platform.
+
+194
+00:15:51,000 --> 00:15:56,000
+In this case, Yani principle also helps us to be more efficient.
+
+195
+00:15:57,000 --> 00:16:03,000
+Start with basic user registration, profile creation and posting functionalities.
+
+196
+00:16:04,000 --> 00:16:10,000
+Delay implementing advanced features like analytics, complex privacy settings, or extensive social
+
+197
+00:16:10,000 --> 00:16:15,000
+network integration until user feedback indicates a clear demand for them.
+
+198
+00:16:16,000 --> 00:16:23,000
+Continuously iterate based on user feedback, adding new features or refining existing ones in response
+
+199
+00:16:23,000 --> 00:16:25,000
+to real user needs and behaviors.
+
+200
+00:16:26,000 --> 00:16:32,000
+To help you understand this principle better, I prepared code examples before and after we applied
+
+201
+00:16:32,000 --> 00:16:35,000
+our knowledge about yogini principle.
+
+202
+00:16:35,000 --> 00:16:37,000
+Let's review these examples together.
+
+203
+00:16:38,000 --> 00:16:40,000
+Just a reminder.
+
+204
+00:16:40,000 --> 00:16:46,000
+As always, you can find all source code examples attached to the lesson if you have any questions about
+
+205
+00:16:46,000 --> 00:16:52,000
+the examples presented, please feel free to ask in the comments below the video and I'll be happy to
+
+206
+00:16:52,000 --> 00:16:53,000
+respond.
+
+207
+00:16:53,000 --> 00:16:58,000
+Let's begin by reviewing the code before applying the you aren't gonna need it principle.
+
+208
+00:16:59,000 --> 00:17:03,000
+Imagine you are tasked with implementing a messaging application.
+
+209
+00:17:03,000 --> 00:17:07,000
+What key features come to mind as essential?
+
+210
+00:17:07,000 --> 00:17:13,000
+The most critical functions for a messaging app are sending and receiving messages, right?
+
+211
+00:17:13,000 --> 00:17:20,000
+However, for some reason, you also decided to implement features like archiving messages, deleting
+
+212
+00:17:20,000 --> 00:17:22,000
+messages, and forwarding messages.
+
+213
+00:17:23,000 --> 00:17:23,000
+Why?
+
+214
+00:17:24,000 --> 00:17:29,000
+Because you thought it might be a good idea to have these features in the messaging app.
+
+215
+00:17:29,000 --> 00:17:36,000
+The messaging app class includes additional functionalities such as archive message, delete message
+
+216
+00:17:36,000 --> 00:17:42,000
+and forward message, which are not immediately necessary for basic messaging operations.
+
+217
+00:17:42,000 --> 00:17:48,000
+These methods anticipate future requirements, but add unnecessary complexity and increase the size
+
+218
+00:17:48,000 --> 00:17:50,000
+of the code base up front.
+
+219
+00:17:50,000 --> 00:17:52,000
+But remember what we've learned.
+
+220
+00:17:52,000 --> 00:17:55,000
+Focus on essential features.
+
+221
+00:17:55,000 --> 00:17:59,000
+Use agile practices and introduce improvements iteratively.
+
+222
+00:18:00,000 --> 00:18:06,000
+Focus on delivering value, perhaps creating channels with paid content and enabling content.
+
+223
+00:18:06,000 --> 00:18:13,000
+Authors to monetize their content in public channels would bring more value to your messaging app than
+
+224
+00:18:13,000 --> 00:18:16,000
+implementing archiving and forwarding features.
+
+225
+00:18:17,000 --> 00:18:20,000
+You see, what may seem obvious is never guaranteed.
+
+226
+00:18:20,000 --> 00:18:24,000
+Each team member needs to perform their role at the highest level.
+
+227
+00:18:25,000 --> 00:18:31,000
+Managers, product teams, and marketing teams should set priorities, highlight values, and make data
+
+228
+00:18:31,000 --> 00:18:32,000
+driven decisions.
+
+229
+00:18:33,000 --> 00:18:36,000
+The yagna principle should help us do just that.
+
+230
+00:18:37,000 --> 00:18:40,000
+Now let's take a look at the solution file.
+
+231
+00:18:41,000 --> 00:18:47,000
+If the task was to create a messaging app that sends and receives messages during this iteration, then
+
+232
+00:18:47,000 --> 00:18:54,000
+delivering that functionality on the expected level of quality is precisely what you need.
+
+233
+00:18:54,000 --> 00:18:58,000
+As you can see, the messaging app in this case has two methods.
+
+234
+00:18:58,000 --> 00:19:01,000
+Send message and receive message.
+
+235
+00:19:01,000 --> 00:19:01,000
+That's it.
+
+236
+00:19:02,000 --> 00:19:08,000
+By removing unnecessary methods, the code becomes simpler, more focused, and easier to maintain.
+
+237
+00:19:09,000 --> 00:19:16,000
+Solution has a streamlined design with fewer methods, making the code base cleaner and easier to understand.
+
+238
+00:19:16,000 --> 00:19:22,000
+With fewer features and complexities, there are fewer potential points of failure, reducing the likelihood
+
+239
+00:19:22,000 --> 00:19:23,000
+of bugs and issues.
+
+240
+00:19:24,000 --> 00:19:30,000
+The simplified design allows for easier future enhancements based on actual user needs and feedback,
+
+241
+00:19:30,000 --> 00:19:35,000
+without the burden of maintaining unused or unnecessary features.
+
+242
+00:19:35,000 --> 00:19:42,000
+This approach aligns with what is expected at this stage, using our team's efforts in the most efficient
+
+243
+00:19:42,000 --> 00:19:46,000
+way and focusing on what brings the most value.
+
+244
+00:19:46,000 --> 00:19:52,000
+Of course, this isn't a ready for production application, but I want you to grasp the key principle
+
+245
+00:19:52,000 --> 00:19:53,000
+here.
+
+246
+00:19:53,000 --> 00:20:00,000
+If you have any questions, please pose them below the video and I'll be happy to answer them in my
+
+247
+00:20:00,000 --> 00:20:01,000
+course.
+
+248
+00:20:01,000 --> 00:20:03,000
+We already learned keys principle.
+
+249
+00:20:03,000 --> 00:20:10,000
+Very often my students ask me, so what is actually the difference between keys and principles?
+
+250
+00:20:10,000 --> 00:20:15,000
+Because it looks like that Yagnya principle also simplifies everything.
+
+251
+00:20:15,000 --> 00:20:18,000
+Then how it is different from keys principle.
+
+252
+00:20:19,000 --> 00:20:20,000
+Let me explain the difference.
+
+253
+00:20:21,000 --> 00:20:23,000
+As you aren't gonna need it principle.
+
+254
+00:20:23,000 --> 00:20:30,000
+And to keep it simple, stupid principle are both guidelines in software development aimed at improving
+
+255
+00:20:30,000 --> 00:20:36,000
+code quality, maintainability and efficiency, but they emphasize different aspects of the development
+
+256
+00:20:36,000 --> 00:20:37,000
+process.
+
+257
+00:20:37,000 --> 00:20:43,000
+Let's review the key characteristics of each principle and then we will analyze key differences between
+
+258
+00:20:43,000 --> 00:20:43,000
+them.
+
+259
+00:20:44,000 --> 00:20:46,000
+You aren't going to need it.
+
+260
+00:20:46,000 --> 00:20:53,000
+Principal Janey advises developers to implement only features that are necessary for the current iteration
+
+261
+00:20:53,000 --> 00:20:55,000
+or immediate requirements.
+
+262
+00:20:55,000 --> 00:21:03,000
+It discourages adding functionalities based on anticipated future needs or hypothetical scenarios.
+
+263
+00:21:03,000 --> 00:21:11,000
+Janey helps in avoiding premature optimization and overengineering of solutions by deferring decisions
+
+264
+00:21:11,000 --> 00:21:14,000
+about future features until they are actually needed.
+
+265
+00:21:14,000 --> 00:21:20,000
+Developers reduce the risk of investing time and resources in unnecessary complexities.
+
+266
+00:21:20,000 --> 00:21:27,000
+It promotes an iterative approach where software evolves based on real user feedback and changing requirements.
+
+267
+00:21:28,000 --> 00:21:34,000
+Features are added incrementally as they are validated by user needs, ensuring that the software remains
+
+268
+00:21:34,000 --> 00:21:36,000
+lean and responsive.
+
+269
+00:21:37,000 --> 00:21:39,000
+On the contrary, keep it simple.
+
+270
+00:21:39,000 --> 00:21:42,000
+Stupid principle has the following key characteristics.
+
+271
+00:21:43,000 --> 00:21:47,000
+Kiss emphasizes keeping code and design as simple as possible.
+
+272
+00:21:47,000 --> 00:21:54,000
+It encourages developers to choose straightforward solutions over complex ones, prioritizing clarity
+
+273
+00:21:54,000 --> 00:21:56,000
+and ease of understanding.
+
+274
+00:21:56,000 --> 00:22:04,000
+It advocates for minimalistic designs and implementations that are easy to maintain, debug, and extend.
+
+275
+00:22:05,000 --> 00:22:12,000
+By reducing complexity, Kiss aims to improve code readability and reduce the likelihood of errors.
+
+276
+00:22:12,000 --> 00:22:19,000
+Kiss often focuses on the end user experience, aiming to create intuitive interfaces and functionalities
+
+277
+00:22:19,000 --> 00:22:24,000
+that are easy for users to understand and use without unnecessary complexity.
+
+278
+00:22:25,000 --> 00:22:29,000
+So let's sum it up and highlight key differences.
+
+279
+00:22:30,000 --> 00:22:38,000
+JNI primarily addresses the scope of features and functionalities, guiding decisions on what to implement
+
+280
+00:22:38,000 --> 00:22:39,000
+based on immediate needs.
+
+281
+00:22:40,000 --> 00:22:47,000
+In contrast, keys focuses on the simplicity of design and implementation, advocating for straightforward
+
+282
+00:22:47,000 --> 00:22:50,000
+solutions regardless of the feature set.
+
+283
+00:22:51,000 --> 00:22:58,000
+Janney suggests delaying decisions about future features until they are necessary, whereas Keyes is
+
+284
+00:22:58,000 --> 00:23:05,000
+concerned with making design and implementation decisions that prioritize simplicity from the outset.
+
+285
+00:23:06,000 --> 00:23:13,000
+Janney helps mitigate the risk of investing resources in features that may not be used or may change
+
+286
+00:23:13,000 --> 00:23:14,000
+significantly.
+
+287
+00:23:15,000 --> 00:23:21,000
+Kis mitigates the risk of complexity and maintenance overhead by promoting simpler, more manageable
+
+288
+00:23:21,000 --> 00:23:22,000
+designs.
+
+289
+00:23:23,000 --> 00:23:30,000
+In essence, while both Yanai and Kis promote simplicity and efficiency in software development, Yanai
+
+290
+00:23:30,000 --> 00:23:37,000
+specifically addresses feature scope and anticipatory design decisions, whereas quis focuses on simplicity
+
+291
+00:23:37,000 --> 00:23:42,000
+and design and implementation as guiding principles throughout the development process.
+
+292
+00:23:42,000 --> 00:23:49,000
+Integrating both principles can lead to software that is both minimalistic and responsive to real user
+
+293
+00:23:49,000 --> 00:23:49,000
+needs.
+
+294
+00:23:50,000 --> 00:23:53,000
+That's all what I wanted to discuss with you today.
+
+295
+00:23:53,000 --> 00:23:56,000
+Let's recap what we've learned in the lesson.
+
+296
+00:23:57,000 --> 00:24:02,000
+We defined the unit principle and discussed its core concepts.
+
+297
+00:24:02,000 --> 00:24:07,000
+We explored the benefits of using the unit principle in software development.
+
+298
+00:24:08,000 --> 00:24:12,000
+You learned how to apply the unit principle effectively in your projects.
+
+299
+00:24:13,000 --> 00:24:20,000
+We reviewed several case studies demonstrating the successful application of the Yanai principle.
+
+300
+00:24:21,000 --> 00:24:26,000
+You analyzed code examples to understand the practical implementation of Yanai.
+
+301
+00:24:26,000 --> 00:24:32,000
+We compared the Yanai principle with the keys principle, highlighting the key differences.
+
+302
+00:24:33,000 --> 00:24:35,000
+That's all for this lesson.
+
+303
+00:24:36,000 --> 00:24:38,000
+Thanks a lot for your attention.
+
+304
+00:24:38,000 --> 00:24:41,000
+Have a great day and see you in the next lesson.
+
diff --git a/38 - Object-oriented Architecture, Clean Code Design (Advanced)/006 DRY Principle in OOP Part 1_en.srt b/38 - Object-oriented Architecture, Clean Code Design (Advanced)/006 DRY Principle in OOP Part 1_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..53136414b289872351db93c5074fc3f045840f18
--- /dev/null
+++ b/38 - Object-oriented Architecture, Clean Code Design (Advanced)/006 DRY Principle in OOP Part 1_en.srt
@@ -0,0 +1,908 @@
+1
+00:00:05,000 --> 00:00:06,000
+Hello, team.
+
+2
+00:00:06,000 --> 00:00:11,000
+Today we have one more important lesson dedicated to the dry principle.
+
+3
+00:00:11,000 --> 00:00:15,000
+Let me elaborate on what we are going to learn in this lesson.
+
+4
+00:00:15,000 --> 00:00:17,000
+So here's what we'll be covering today.
+
+5
+00:00:17,000 --> 00:00:22,000
+We'll start with the basics by defining the don't repeat yourself principle.
+
+6
+00:00:22,000 --> 00:00:28,000
+I'll explain what it means and why it's a fundamental concept in software development.
+
+7
+00:00:28,000 --> 00:00:33,000
+Next, we'll delve into the benefits of using the Dry principle.
+
+8
+00:00:33,000 --> 00:00:39,000
+You'll understand how it can improve code maintainability, reduce errors, and enhance overall efficiency
+
+9
+00:00:39,000 --> 00:00:40,000
+in your projects.
+
+10
+00:00:41,000 --> 00:00:45,000
+After that, I'll show you how to apply the Dry principle in practice.
+
+11
+00:00:46,000 --> 00:00:52,000
+We'll look at various techniques and strategies to ensure your code adheres to this principle, making
+
+12
+00:00:52,000 --> 00:00:53,000
+it more robust and scalable.
+
+13
+00:00:54,000 --> 00:00:57,000
+We'll also discuss some contrasting concepts.
+
+14
+00:00:57,000 --> 00:01:02,000
+Specifically, write everything twice and avoid hasty abstractions.
+
+15
+00:01:02,000 --> 00:01:02,000
+Principles.
+
+16
+00:01:03,000 --> 00:01:09,000
+These concepts will provide a broader perspective on when and how to apply dry effectively.
+
+17
+00:01:10,000 --> 00:01:13,000
+Then we'll explore case studies of the Dry principle.
+
+18
+00:01:13,000 --> 00:01:19,000
+I'll present real world examples where Dry has been successfully implemented, highlighting the positive
+
+19
+00:01:19,000 --> 00:01:22,000
+impacts it has had on different projects.
+
+20
+00:01:23,000 --> 00:01:27,000
+Finally, we will go through code examples to see the dry principle in action.
+
+21
+00:01:27,000 --> 00:01:34,000
+You will get to see before and after scenarios of code refactoring to understand the practical benefits
+
+22
+00:01:34,000 --> 00:01:36,000
+of eliminating redundancy.
+
+23
+00:01:36,000 --> 00:01:39,000
+So let's dive in and start our lesson.
+
+24
+00:01:40,000 --> 00:01:43,000
+Let's learn first the definition of the dry principle.
+
+25
+00:01:44,000 --> 00:01:50,000
+The dry principle, which stands for don't repeat yourself, is a fundamental concept in software engineering
+
+26
+00:01:50,000 --> 00:01:53,000
+aimed at reducing repetition within code.
+
+27
+00:01:54,000 --> 00:02:00,000
+The principle advocates for the minimization of redundancy by ensuring that every piece of knowledge
+
+28
+00:02:00,000 --> 00:02:05,000
+or logic is represented in a single, unambiguous place in the code base.
+
+29
+00:02:06,000 --> 00:02:11,000
+This approach leads to cleaner, more maintainable and less error prone code.
+
+30
+00:02:11,000 --> 00:02:18,000
+By following the Dry principle, developers can avoid the pitfalls of duplicating code such as increased
+
+31
+00:02:18,000 --> 00:02:24,000
+risk of bugs, difficulties in making updates, and inconsistency across the application.
+
+32
+00:02:24,000 --> 00:02:32,000
+Implementing the Dry principle often involves abstracting common functionality into functions, modules,
+
+33
+00:02:32,000 --> 00:02:35,000
+or classes that can be reused throughout the code base.
+
+34
+00:02:36,000 --> 00:02:43,000
+The Don't Repeat Yourself principle was introduced by Andy Hunt and Dave Thomas in their influential
+
+35
+00:02:43,000 --> 00:02:47,000
+book The Pragmatic Programmer, published in 1999.
+
+36
+00:02:48,000 --> 00:02:53,000
+This book has had a significant impact on modern software development.
+
+37
+00:02:53,000 --> 00:03:00,000
+practices, advocating for practical and efficient coding techniques that enhance productivity and code
+
+38
+00:03:00,000 --> 00:03:00,000
+quality.
+
+39
+00:03:01,000 --> 00:03:06,000
+As always, I need to motivate you to use this principle.
+
+40
+00:03:06,000 --> 00:03:12,000
+You will be motivated to learn and apply this principle only when you understand the benefits of using
+
+41
+00:03:12,000 --> 00:03:12,000
+it.
+
+42
+00:03:13,000 --> 00:03:19,000
+So let me explain why you need to use the Dry principle and what benefits you can get from using it
+
+43
+00:03:20,000 --> 00:03:25,000
+as a don't repeat yourself principle is a cornerstone of efficient software development.
+
+44
+00:03:26,000 --> 00:03:32,000
+Its application offers several key benefits that enhance the overall quality and maintainability of
+
+45
+00:03:32,000 --> 00:03:32,000
+code.
+
+46
+00:03:33,000 --> 00:03:35,000
+Let's review benefits one by one.
+
+47
+00:03:35,000 --> 00:03:37,000
+Improved code maintainability.
+
+48
+00:03:38,000 --> 00:03:44,000
+When code is duplicated, any change needs to be made in multiple places, increasing the likelihood
+
+49
+00:03:44,000 --> 00:03:45,000
+of errors.
+
+50
+00:03:45,000 --> 00:03:49,000
+By ensuring that each piece of logic is defined in one place.
+
+51
+00:03:49,000 --> 00:03:55,000
+The Dry principle makes updating and maintaining code easier and less error prone.
+
+52
+00:03:56,000 --> 00:03:58,000
+Reduced risk of bugs.
+
+53
+00:03:58,000 --> 00:04:05,000
+Redundant code increases the chances of inconsistencies and bugs when the same logic is repeated in
+
+54
+00:04:05,000 --> 00:04:06,000
+multiple places.
+
+55
+00:04:06,000 --> 00:04:10,000
+A bug fixed in one instance might still exist in another.
+
+56
+00:04:11,000 --> 00:04:17,000
+The Dry principle helps ensure that a bug only needs to be fixed in one location.
+
+57
+00:04:18,000 --> 00:04:20,000
+Enhanced readability and clarity.
+
+58
+00:04:21,000 --> 00:04:26,000
+Code that adheres to the Dry principle tends to be more concise and easier to read.
+
+59
+00:04:26,000 --> 00:04:33,000
+When developers do not have to sift through redundant code, they can more quickly understand the functionality
+
+60
+00:04:33,000 --> 00:04:35,000
+and purpose of the code base.
+
+61
+00:04:36,000 --> 00:04:37,000
+Easier refactoring.
+
+62
+00:04:38,000 --> 00:04:41,000
+Refactoring is simpler when code is not repeated.
+
+63
+00:04:42,000 --> 00:04:48,000
+If a certain logic needs to be changed or optimized, it can be done in one place without worrying about
+
+64
+00:04:48,000 --> 00:04:50,000
+missing other instances of the same logic.
+
+65
+00:04:51,000 --> 00:04:59,000
+Increased efficiency By abstracting common functionalities into reusable components such as functions,
+
+66
+00:04:59,000 --> 00:05:00,000
+modules, or classes.
+
+67
+00:05:00,000 --> 00:05:03,000
+Developers can write less code.
+
+68
+00:05:03,000 --> 00:05:09,000
+This not only speeds up the development process, but also ensures a more consistent implementation
+
+69
+00:05:09,000 --> 00:05:11,000
+of common tasks.
+
+70
+00:05:12,000 --> 00:05:14,000
+Better code reusability.
+
+71
+00:05:14,000 --> 00:05:19,000
+The Dry principle encourages the creation of modular reusable components.
+
+72
+00:05:20,000 --> 00:05:25,000
+This modularity allows developers to leverage existing code across different parts of the application,
+
+73
+00:05:25,000 --> 00:05:30,000
+or even in different projects, promoting a more efficient development process.
+
+74
+00:05:31,000 --> 00:05:34,000
+Consistency across the code base.
+
+75
+00:05:34,000 --> 00:05:41,000
+When logic is defined in one place and reused, it ensures consistent behavior across the application.
+
+76
+00:05:42,000 --> 00:05:48,000
+This consistency is crucial for maintaining a reliable and predictable code base, especially in large
+
+77
+00:05:48,000 --> 00:05:50,000
+and complex systems.
+
+78
+00:05:51,000 --> 00:05:56,000
+Facilitates collaboration in a team environment following the Dry principle.
+
+79
+00:05:56,000 --> 00:05:59,000
+Helps ensure that everyone is on the same page.
+
+80
+00:05:59,000 --> 00:06:06,000
+Clear Non-redundant code makes it easier for team members to understand and work on the code base,
+
+81
+00:06:06,000 --> 00:06:10,000
+improving collaboration and reducing the learning curve for new developers.
+
+82
+00:06:11,000 --> 00:06:18,000
+By adhering to the DRI principle, developers can create more robust, efficient and maintainable software.
+
+83
+00:06:19,000 --> 00:06:25,000
+This principle not only saves time and effort, but also contributes to the creation of high quality
+
+84
+00:06:25,000 --> 00:06:30,000
+code that can easily adapt to changes and new requirements.
+
+85
+00:06:30,000 --> 00:06:36,000
+In the case you will have any questions related to the slides or to my comments, feel free to post
+
+86
+00:06:36,000 --> 00:06:39,000
+your questions below the video and I will be happy to answer.
+
+87
+00:06:40,000 --> 00:06:41,000
+Let's continue.
+
+88
+00:06:42,000 --> 00:06:46,000
+And how can you start applying the Dry principle to your projects?
+
+89
+00:06:47,000 --> 00:06:48,000
+What is the algorithm?
+
+90
+00:06:49,000 --> 00:06:51,000
+Algorithm is simple and straightforward.
+
+91
+00:06:51,000 --> 00:06:52,000
+Let me share it with you.
+
+92
+00:06:53,000 --> 00:06:59,000
+Applying the don't repeat yourself principle involves several key practices and strategies to reduce
+
+93
+00:06:59,000 --> 00:07:02,000
+code duplication and enhance maintainability.
+
+94
+00:07:02,000 --> 00:07:07,000
+Here are some steps and techniques to help you apply the DRI principle effectively.
+
+95
+00:07:08,000 --> 00:07:10,000
+Identify redundant code.
+
+96
+00:07:11,000 --> 00:07:15,000
+Regularly review your code base to identify duplicated code.
+
+97
+00:07:15,000 --> 00:07:20,000
+Look for similar or identical blocks of code that performs the same function.
+
+98
+00:07:21,000 --> 00:07:26,000
+Use tools that can automatically detect duplicated code within your code base.
+
+99
+00:07:27,000 --> 00:07:28,000
+Abstract.
+
+100
+00:07:28,000 --> 00:07:29,000
+Repeated logic.
+
+101
+00:07:29,000 --> 00:07:36,000
+Encapsulate repeated code in functions or methods that can be called from different parts of your application.
+
+102
+00:07:37,000 --> 00:07:43,000
+Use object oriented programming principles to create classes and objects that encapsulate common behaviors
+
+103
+00:07:43,000 --> 00:07:44,000
+and properties.
+
+104
+00:07:45,000 --> 00:07:47,000
+Modularize code.
+
+105
+00:07:48,000 --> 00:07:53,000
+Organize your code into modules or packages that contain reusable components.
+
+106
+00:07:53,000 --> 00:07:57,000
+This makes it easier to reuse and maintain code.
+
+107
+00:07:58,000 --> 00:08:03,000
+Extract common functionalities into libraries that can be shared across multiple projects.
+
+108
+00:08:04,000 --> 00:08:06,000
+Use design patterns.
+
+109
+00:08:07,000 --> 00:08:14,000
+Singleton ensures that a class has only one instance and provide a global point of access to it.
+
+110
+00:08:14,000 --> 00:08:21,000
+Factory pattern create objects without specifying the exact class of object that will be created.
+
+111
+00:08:22,000 --> 00:08:27,000
+Decorator add behavior to objects dynamically without modifying their code.
+
+112
+00:08:29,000 --> 00:08:31,000
+Leverage inheritance and polymorphism.
+
+113
+00:08:32,000 --> 00:08:38,000
+Use inheritance to create a base class with common functionality and extend it in subclasses.
+
+114
+00:08:39,000 --> 00:08:46,000
+Implement polymorphism to allow different classes to be treated as instances of the same class through
+
+115
+00:08:46,000 --> 00:08:47,000
+a common interface.
+
+116
+00:08:48,000 --> 00:08:50,000
+Utilize template methods.
+
+117
+00:08:51,000 --> 00:08:58,000
+Template method defines a skeleton of an algorithm in a base class, and allows subclasses to override
+
+118
+00:08:58,000 --> 00:09:01,000
+specific steps without changing the algorithm structure.
+
+119
+00:09:02,000 --> 00:09:05,000
+Use frameworks and libraries.
+
+120
+00:09:05,000 --> 00:09:11,000
+Leverage frameworks that provide built in functionalities to avoid writing boilerplate code.
+
+121
+00:09:11,000 --> 00:09:16,000
+Utilize third party libraries for common tasks instead of reinventing the wheel.
+
+122
+00:09:18,000 --> 00:09:19,000
+refactor regularly.
+
+123
+00:09:20,000 --> 00:09:26,000
+Make refactoring a regular part of your development process to keep your code base clean and dry.
+
+124
+00:09:27,000 --> 00:09:28,000
+Test driven development.
+
+125
+00:09:29,000 --> 00:09:34,000
+Write tests before coding to ensure that refactoring does not introduce bugs.
+
+126
+00:09:35,000 --> 00:09:37,000
+Maintain clear documentation.
+
+127
+00:09:38,000 --> 00:09:44,000
+Write clear and concise comments explaining the purpose and usage of abstracted functions, methods,
+
+128
+00:09:44,000 --> 00:09:46,000
+and classes.
+
+129
+00:09:47,000 --> 00:09:53,000
+Maintain comprehensive documentation for your code base, modules and libraries to aid in understanding
+
+130
+00:09:53,000 --> 00:09:54,000
+and reusability.
+
+131
+00:09:56,000 --> 00:10:01,000
+But if you think that Dry is a rule of thumb everywhere and for everyone, you are wrong.
+
+132
+00:10:02,000 --> 00:10:09,000
+There are principles that contradicts dry principle and you need to be aware about them in order to
+
+133
+00:10:09,000 --> 00:10:12,000
+be able to apply dry principle wisely.
+
+134
+00:10:13,000 --> 00:10:16,000
+Let's review such concepts as wet and aha.
+
+135
+00:10:17,000 --> 00:10:19,000
+Let's start with wet.
+
+136
+00:10:19,000 --> 00:10:23,000
+That stands for Write everything twice or we enjoy typing.
+
+137
+00:10:24,000 --> 00:10:29,000
+Wet is a tongue in cheek acronym that represents the opposite of don't repeat yourself.
+
+138
+00:10:30,000 --> 00:10:36,000
+It humorously suggests writing duplicate or similar code in multiple places rather than consolidating
+
+139
+00:10:36,000 --> 00:10:37,000
+it.
+
+140
+00:10:37,000 --> 00:10:44,000
+Although the term is used humorously, it highlights a practice that should be avoided in software development.
+
+141
+00:10:45,000 --> 00:10:51,000
+Writing duplicate code increases the chances of inconsistencies, introduces maintenance overhead,
+
+142
+00:10:51,000 --> 00:10:55,000
+and makes the code base harder to refactor and extend.
+
+143
+00:10:56,000 --> 00:11:01,000
+Wet code tends to be less maintainable and more error prone over time.
+
+144
+00:11:02,000 --> 00:11:08,000
+It violates principles of code reuse, increases development effort, and can lead to inefficiencies
+
+145
+00:11:08,000 --> 00:11:11,000
+in debugging and updating the software.
+
+146
+00:11:13,000 --> 00:11:18,000
+Let's now review our Hop principles that stands for Avoid Hasty Abstractions.
+
+147
+00:11:18,000 --> 00:11:18,000
+abstractions.
+
+148
+00:11:19,000 --> 00:11:25,000
+Aha advises against prematurely abstracting code or creating overly complex abstractions before fully
+
+149
+00:11:25,000 --> 00:11:29,000
+understanding the problem, domain or requirements.
+
+150
+00:11:30,000 --> 00:11:37,000
+This principle cautions developers against introducing unnecessary complexity or creating overly abstract
+
+151
+00:11:37,000 --> 00:11:40,000
+solutions without clear justification.
+
+152
+00:11:40,000 --> 00:11:45,000
+It advocates for simplicity and clarity in code design and architecture.
+
+153
+00:11:46,000 --> 00:11:53,000
+Rushing into abstractions can lead to unnecessary overhead, reduced code readability, and increased
+
+154
+00:11:53,000 --> 00:11:55,000
+cognitive load for developers.
+
+155
+00:11:55,000 --> 00:12:02,000
+It may also result in solutions that are overly generic or difficult to maintain, especially if the
+
+156
+00:12:02,000 --> 00:12:08,000
+abstractions don't accurately reflect the problem domain or evolve with changing requirements.
+
+157
+00:12:10,000 --> 00:12:15,000
+And now let's summarize how wet and aha relate to dry principle.
+
+158
+00:12:16,000 --> 00:12:22,000
+While Dry emphasizes eliminating redundancy and promoting code reuse to enhance maintainability and
+
+159
+00:12:22,000 --> 00:12:23,000
+consistency.
+
+160
+00:12:23,000 --> 00:12:30,000
+Wet and Aha caution against practices that can lead to complexity, inefficiency, and increased development
+
+161
+00:12:30,000 --> 00:12:31,000
+effort.
+
+162
+00:12:32,000 --> 00:12:36,000
+Finding a balance between these principles is crucial in software development.
+
+163
+00:12:36,000 --> 00:12:45,000
+DRI encourages efficient, reusable code, while awareness of Wet and Aha helps developers avoid pitfalls
+
+164
+00:12:45,000 --> 00:12:49,000
+such as premature optimization or excessive abstraction.
+
+165
+00:12:50,000 --> 00:12:56,000
+To better understand the application and benefits of the don't repeat yourself principle, let's explore
+
+166
+00:12:56,000 --> 00:13:00,000
+some real world case studies where this principle was successfully implemented.
+
+167
+00:13:01,000 --> 00:13:02,000
+Case study one.
+
+168
+00:13:03,000 --> 00:13:05,000
+Refactoring a legacy code base scenario.
+
+169
+00:13:06,000 --> 00:13:12,000
+A software development team inherited a legacy code base for a financial application.
+
+170
+00:13:12,000 --> 00:13:18,000
+The code base had grown organically over the years, resulting in significant code duplication.
+
+171
+00:13:19,000 --> 00:13:24,000
+Different modules implemented similar functionalities with slight variations leading to maintenance
+
+172
+00:13:24,000 --> 00:13:27,000
+challenges and frequent bugs.
+
+173
+00:13:28,000 --> 00:13:33,000
+The team conducted a thorough code review to identify redundant code sections.
+
+174
+00:13:34,000 --> 00:13:40,000
+Common functionalities such as data validation and calculation methods were abstracted into reusable
+
+175
+00:13:40,000 --> 00:13:41,000
+functions and classes.
+
+176
+00:13:42,000 --> 00:13:48,000
+The code base was reorganized into modules, each responsible for a specific functionality.
+
+177
+00:13:49,000 --> 00:13:51,000
+For example, user authentication.
+
+178
+00:13:51,000 --> 00:13:53,000
+Transaction processing.
+
+179
+00:13:53,000 --> 00:13:59,000
+As a result, the overall code base size was reduced by 30%.
+
+180
+00:14:00,000 --> 00:14:07,000
+Changes in business logic required modifications in a single location, reducing the risk of inconsistencies.
+
+181
+00:14:08,000 --> 00:14:14,000
+New developers found it easier to understand the code base due to clear modular structures, but you
+
+182
+00:14:14,000 --> 00:14:17,000
+need to be extra careful in cases like this.
+
+183
+00:14:17,000 --> 00:14:24,000
+And there is a golden rule that before start doing any refactoring, make sure you have a robust test
+
+184
+00:14:24,000 --> 00:14:26,000
+coverage on different testing layers.
+
+185
+00:14:27,000 --> 00:14:33,000
+If you don't have those, you need to start from test coverage of your application and only after that
+
+186
+00:14:33,000 --> 00:14:35,000
+proceed with refactoring.
+
+187
+00:14:37,000 --> 00:14:41,000
+Case study two developing a multi-platform mobile application scenario.
+
+188
+00:14:42,000 --> 00:14:48,000
+A startup company was developing a mobile application for both iOS and Android platforms.
+
+189
+00:14:48,000 --> 00:14:54,000
+Initially, separate code bases were maintained for each platform, leading to duplicate logic for code
+
+190
+00:14:54,000 --> 00:14:59,000
+functionalities like data synchronization and user notifications.
+
+191
+00:14:59,000 --> 00:15:07,000
+The team decided to use a cross platform framework, React Native, to write shared code for both platforms.
+
+192
+00:15:08,000 --> 00:15:15,000
+Reusable components were created for UI elements and business logic, ensuring that common functionalities
+
+193
+00:15:15,000 --> 00:15:18,000
+were implemented once and reused across the app.
+
+194
+00:15:19,000 --> 00:15:26,000
+Core business logic was centralized in shared modules, while platform specific code was minimized.
+
+195
+00:15:27,000 --> 00:15:33,000
+As a result, a single code base for both platforms reduced development and maintenance efforts.
+
+196
+00:15:34,000 --> 00:15:40,000
+The use of shared components ensured a consistent user experience across iOS and Android.
+
+197
+00:15:41,000 --> 00:15:47,000
+Time to market was significantly reduced due to the elimination of redundant coding efforts.
+
+198
+00:15:48,000 --> 00:15:53,000
+Case study three optimizing an E-commerce website.
+
+199
+00:15:54,000 --> 00:16:00,000
+An e-commerce company was facing performance issues and high maintenance costs due to duplicated code
+
+200
+00:16:00,000 --> 00:16:07,000
+across various parts of their website, including product listing, search functionality, and checkout
+
+201
+00:16:07,000 --> 00:16:08,000
+process.
+
+202
+00:16:09,000 --> 00:16:15,000
+The team implemented a template system for rendering web pages, allowing common page elements, for
+
+203
+00:16:15,000 --> 00:16:21,000
+example headers, footers, product cards to be defined once and reused.
+
+204
+00:16:22,000 --> 00:16:29,000
+A unified API layer was introduced to handle data retrieval and processing, replacing multiple redundant
+
+205
+00:16:29,000 --> 00:16:30,000
+data access methods.
+
+206
+00:16:31,000 --> 00:16:38,000
+The application was refactored into a service oriented architecture where independent services handled
+
+207
+00:16:38,000 --> 00:16:39,000
+specific business functions.
+
+208
+00:16:40,000 --> 00:16:46,000
+As a result, reduced duplication led to a leaner code base, improving site performance.
+
+209
+00:16:47,000 --> 00:16:54,000
+New features and updates were implemented faster as changes in one service did not require modifications
+
+210
+00:16:54,000 --> 00:17:02,000
+across multiple parts of the code base, the Dry principle led to lower long term maintenance costs
+
+211
+00:17:02,000 --> 00:17:05,000
+by reducing code redundancy and complexity.
+
+212
+00:17:06,000 --> 00:17:09,000
+Case study for streamlining a CRM system.
+
+213
+00:17:10,000 --> 00:17:17,000
+A large enterprise used a customer relationship management system with extensive code duplication in
+
+214
+00:17:17,000 --> 00:17:19,000
+its modules for managing customer data.
+
+215
+00:17:19,000 --> 00:17:21,000
+sales tracking and reporting.
+
+216
+00:17:22,000 --> 00:17:29,000
+Data handling routines were centralized into a common library, ensuring consistent data validation
+
+217
+00:17:29,000 --> 00:17:30,000
+and processing.
+
+218
+00:17:31,000 --> 00:17:38,000
+Common UI elements, such as forms and tables were refactored into reusable widgets.
+
+219
+00:17:39,000 --> 00:17:45,000
+Automated tests were written for the centralized components to ensure reliability and facilitate future
+
+220
+00:17:45,000 --> 00:17:46,000
+changes.
+
+221
+00:17:47,000 --> 00:17:54,000
+As a result, centralized data handling ensured consistent business rules across all modules.
+
+222
+00:17:55,000 --> 00:18:00,000
+Automated tests for common components reduce the likelihood of bugs and regressions.
+
+223
+00:18:01,000 --> 00:18:08,000
+Developers could focus on new features rather than duplicating existing logic, leading to more efficient
+
+224
+00:18:08,000 --> 00:18:10,000
+development cycles.
+
+225
+00:18:10,000 --> 00:18:16,000
+These case studies illustrate how the drive principle can be effectively applied in various contexts
+
+226
+00:18:16,000 --> 00:18:24,000
+to improve code maintainability, reduce bugs, and streamline development processes by minimising redundancy.
+
+227
+00:18:24,000 --> 00:18:28,000
+Teams can create more robust and scalable software systems.
+
diff --git a/38 - Object-oriented Architecture, Clean Code Design (Advanced)/007 Source-code-examples-shown-in-the-lesson.url b/38 - Object-oriented Architecture, Clean Code Design (Advanced)/007 Source-code-examples-shown-in-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..e89ed368f6b98623a32b473cf6b62e93570c0a31
--- /dev/null
+++ b/38 - Object-oriented Architecture, Clean Code Design (Advanced)/007 Source-code-examples-shown-in-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/oop/dry
\ No newline at end of file
diff --git a/38 - Object-oriented Architecture, Clean Code Design (Advanced)/008 Packaging Pricniples p.1 Cohesion Principles_en.srt b/38 - Object-oriented Architecture, Clean Code Design (Advanced)/008 Packaging Pricniples p.1 Cohesion Principles_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..d0532273fd25afa0b7b0a4a0dc3d4c89daafdc6e
--- /dev/null
+++ b/38 - Object-oriented Architecture, Clean Code Design (Advanced)/008 Packaging Pricniples p.1 Cohesion Principles_en.srt
@@ -0,0 +1,1112 @@
+1
+00:00:05,000 --> 00:00:11,000
+Hello, France and this nation will learn different approaches to group here called into multiple packages
+
+2
+00:00:11,000 --> 00:00:13,000
+to keep the architecture clean.
+
+3
+00:00:13,000 --> 00:00:18,000
+In this lesson, we will cover core principles regarding module structuring and code organization.
+
+4
+00:00:19,000 --> 00:00:22,000
+These principles will help you to keep your architecture clean.
+
+5
+00:00:22,000 --> 00:00:28,000
+Also, following these principles, you make your code easier to scale, maintain and reuse.
+
+6
+00:00:29,000 --> 00:00:32,000
+I'll explain why do we need a good structure and how to create it?
+
+7
+00:00:33,000 --> 00:00:37,000
+We will talk about factors that is worse to consider when we talk about packaging.
+
+8
+00:00:38,000 --> 00:00:39,000
+This topic takes time.
+
+9
+00:00:39,000 --> 00:00:42,000
+That probably is more than for one lesson.
+
+10
+00:00:42,000 --> 00:00:47,000
+That's why we'll start learning group and principles in this lesson and we'll proceed further in the
+
+11
+00:00:47,000 --> 00:00:48,000
+course.
+
+12
+00:00:48,000 --> 00:00:51,000
+In the lesson, we'll talk about cohesion principles.
+
+13
+00:00:52,000 --> 00:00:57,000
+Namely, we'll discuss common closure, common use and we release equivalence principles.
+
+14
+00:00:58,000 --> 00:01:03,000
+Let's start, as I already said in the lesson, we'll discuss group of different principles.
+
+15
+00:01:03,000 --> 00:01:08,000
+Some of them will learn in this lesson and some of them will learn in other lessons from this section.
+
+16
+00:01:09,000 --> 00:01:14,000
+But before we start investigating each particular principle, let's define the problem first.
+
+17
+00:01:14,000 --> 00:01:16,000
+While working on a class there.
+
+18
+00:01:16,000 --> 00:01:22,000
+Many design decisions that you apply in the classes you produce contain what you expect them to contain.
+
+19
+00:01:23,000 --> 00:01:28,000
+You can investigate each class and easily understand what this class was designed for and what it is
+
+20
+00:01:28,000 --> 00:01:29,000
+intended to do.
+
+21
+00:01:30,000 --> 00:01:34,000
+And Gradney As you develop your application, you start group classes.
+
+22
+00:01:34,000 --> 00:01:37,000
+You may want to group them based on different reasons.
+
+23
+00:01:37,000 --> 00:01:43,000
+Some of them are classes, are part of one feature and serves the same idea or classes do something
+
+24
+00:01:43,000 --> 00:01:45,000
+specific in similar way.
+
+25
+00:01:45,000 --> 00:01:51,000
+And it is logically to keep them together was intended to work with the same separate code in different
+
+26
+00:01:51,000 --> 00:01:57,000
+programming languages, your group and classes in packages, namespace its components, etc..
+
+27
+00:01:57,000 --> 00:02:02,000
+So let's agree that they would use such common terms as module or component.
+
+28
+00:02:02,000 --> 00:02:08,000
+That would mean some folder in the file directory, which is created to avoid name conflicts and to
+
+29
+00:02:08,000 --> 00:02:09,000
+write a better maintainable code.
+
+30
+00:02:10,000 --> 00:02:16,000
+Hope this will make a terminology the same for different programming languages in the same way as you
+
+31
+00:02:16,000 --> 00:02:18,000
+are conscious about the way you design your classes.
+
+32
+00:02:19,000 --> 00:02:24,000
+You immediately start asking yourself some questions about the design of the modules you create where
+
+33
+00:02:24,000 --> 00:02:30,000
+it is better to put this class in which module may I put it in existing module or it is better to create
+
+34
+00:02:30,000 --> 00:02:31,000
+a new one.
+
+35
+00:02:31,000 --> 00:02:35,000
+Should they split this component or it is not big enough yet.
+
+36
+00:02:35,000 --> 00:02:39,000
+It is okay if my model will depend on classes from another module.
+
+37
+00:02:39,000 --> 00:02:45,000
+Good module structure and confidence design will come from answers on such questions as does my new
+
+38
+00:02:45,000 --> 00:02:48,000
+class belong to this specific module?
+
+39
+00:02:48,000 --> 00:02:55,000
+Or now is it a self to create dependency on this component or know what is needed to be done to increase
+
+40
+00:02:55,000 --> 00:02:56,000
+the ability of a module?
+
+41
+00:02:57,000 --> 00:03:00,000
+What can I do to create a structure which is easy to maintain?
+
+42
+00:03:01,000 --> 00:03:04,000
+Why do I need to worry about good structure and organization?
+
+43
+00:03:05,000 --> 00:03:09,000
+Good code organization can use the tax benefits readability.
+
+44
+00:03:09,000 --> 00:03:15,000
+We now should forget that during software implementation, people create software for people's needs,
+
+45
+00:03:15,000 --> 00:03:20,000
+not only computers with our code, other people also reading our code.
+
+46
+00:03:21,000 --> 00:03:26,000
+You can save a lot of time for colleague of yours and money for your company in case, quote, will
+
+47
+00:03:26,000 --> 00:03:27,000
+be understandable.
+
+48
+00:03:28,000 --> 00:03:30,000
+Each engineer should feel where to expect what.
+
+49
+00:03:31,000 --> 00:03:37,000
+Ask yourself how much time does it take to understand new project or even class, which you have never
+
+50
+00:03:37,000 --> 00:03:38,000
+seen before?
+
+51
+00:03:38,000 --> 00:03:46,000
+In some cases, this can take up to 50 percent of total time reserved for development making code readable.
+
+52
+00:03:46,000 --> 00:03:52,000
+It is one of the key factors of team performance and quality for large software projects with many developers
+
+53
+00:03:52,000 --> 00:03:58,000
+and everywhere where the source code that was written by one person is going to be modified by another
+
+54
+00:03:58,000 --> 00:03:58,000
+person.
+
+55
+00:03:59,000 --> 00:04:06,000
+Modularity modularity is not only about code organization, it is also about actual dependencies between
+
+56
+00:04:06,000 --> 00:04:08,000
+the modules called in.
+
+57
+00:04:08,000 --> 00:04:15,000
+An application might be separated into modules and can even look like modular when in fact it is not.
+
+58
+00:04:15,000 --> 00:04:20,000
+Even despite multiple modules packages, name spaces are created.
+
+59
+00:04:20,000 --> 00:04:26,000
+Units in your code may still have complex interdependencies with other parts of your application and
+
+60
+00:04:26,000 --> 00:04:32,000
+can still expose its private details so they will learn core principles which will help you to stick
+
+61
+00:04:32,000 --> 00:04:33,000
+to modular approach.
+
+62
+00:04:34,000 --> 00:04:41,000
+Reusability, when software is reusable, it turns into increased productivity and quality, along with
+
+63
+00:04:41,000 --> 00:04:48,000
+minimization of risk accurate during implementation of a new project or feature within the same project.
+
+64
+00:04:49,000 --> 00:04:53,000
+Software is a beauty, doesn't depend only on classes you implemented.
+
+65
+00:04:54,000 --> 00:04:59,000
+This property of your software includes all units and entities of your software, including modules,
+
+66
+00:05:00,000 --> 00:05:01,000
+reusability and software.
+
+67
+00:05:01,000 --> 00:05:08,000
+Development encourages innovation in traditional development methods and what it's also worth to mention
+
+68
+00:05:08,000 --> 00:05:14,000
+that software is a beautiful decrease in project costs proportional to amount of code which was reused.
+
+69
+00:05:14,000 --> 00:05:16,000
+How to establish good code structure?
+
+70
+00:05:17,000 --> 00:05:23,000
+What are key points that we should always remember while establishing a good structure on your project?
+
+71
+00:05:23,000 --> 00:05:27,000
+Remember that this activity can bring benefit when it is experience based.
+
+72
+00:05:27,000 --> 00:05:34,000
+First of all, usually different business domains like banking, insurance, health care, e-commerce
+
+73
+00:05:34,000 --> 00:05:37,000
+are limited with constraints of business use cases.
+
+74
+00:05:37,000 --> 00:05:44,000
+For example, it is highly unlikely that in banking software you would need to implement a search feature
+
+75
+00:05:44,000 --> 00:05:46,000
+which is usually used in e-commerce domain.
+
+76
+00:05:46,000 --> 00:05:53,000
+Thus, in some degree, based on your experience, you can imagine how any system will look like this
+
+77
+00:05:53,000 --> 00:05:56,000
+will help you to establish better cost structure from the very beginning.
+
+78
+00:05:57,000 --> 00:06:03,000
+Today, we'll discuss patterns and recommendations to follow, but they knew nothing if you are blindly
+
+79
+00:06:03,000 --> 00:06:04,000
+following them.
+
+80
+00:06:04,000 --> 00:06:12,000
+Each project is unique and therefore the result of each project is unique and cost of each project is
+
+81
+00:06:12,000 --> 00:06:12,000
+unique to.
+
+82
+00:06:13,000 --> 00:06:19,000
+Don't be afraid to experiment with things before applying some conventions this year that they are applicable
+
+83
+00:06:19,000 --> 00:06:21,000
+directly to your project.
+
+84
+00:06:21,000 --> 00:06:28,000
+You should not forget that if refactoring or project restriction does not simplify things and make it
+
+85
+00:06:28,000 --> 00:06:31,000
+even harder to understand, the initial goal is not achieved.
+
+86
+00:06:32,000 --> 00:06:36,000
+Ask yourself, can you come quickly grasp this project?
+
+87
+00:06:36,000 --> 00:06:42,000
+All attempts to structure your code according to best practices and patterns should end up with clearer
+
+88
+00:06:42,000 --> 00:06:44,000
+design, which is easy to understand.
+
+89
+00:06:45,000 --> 00:06:48,000
+Be consistent while applying the rules and patterns.
+
+90
+00:06:48,000 --> 00:06:52,000
+For example, use the same name everywhere across your project.
+
+91
+00:06:52,000 --> 00:06:58,000
+And remember, the sooner you start thinking about construction, the less refactoring is needed later.
+
+92
+00:06:59,000 --> 00:07:02,000
+There is no silver bullet for clean design and good structure.
+
+93
+00:07:03,000 --> 00:07:05,000
+As we already discussed, each project is unique.
+
+94
+00:07:06,000 --> 00:07:11,000
+Always there are different factors which impacts your deliverables and we have to consider while project
+
+95
+00:07:11,000 --> 00:07:15,000
+implementation to name a few module cohesion.
+
+96
+00:07:15,000 --> 00:07:21,000
+And Coplin hope you already know what it is in case these terms are not familiar to you.
+
+97
+00:07:21,000 --> 00:07:27,000
+Make sure you watched my lesson about carbon and cohesion, cohesion and carbon and deal with the quality
+
+98
+00:07:27,000 --> 00:07:29,000
+of an object oriented design.
+
+99
+00:07:29,000 --> 00:07:35,000
+One of the key principles that we all know that to create maintainable code we need to follow simple
+
+100
+00:07:35,000 --> 00:07:37,000
+rule, low carbon and high cohesion.
+
+101
+00:07:38,000 --> 00:07:44,000
+When we are talking about low carbon, we want to put stress on separation of unrelated parts of the
+
+102
+00:07:44,000 --> 00:07:46,000
+code as much as we can.
+
+103
+00:07:46,000 --> 00:07:51,000
+And when we refer to high cohesion, we mean keeping the related code in a single place.
+
+104
+00:07:52,000 --> 00:07:53,000
+What is the main goal of the rule?
+
+105
+00:07:54,000 --> 00:08:01,000
+The aim of design was low carbon and high cohesion is to simplify the development process, to simplify
+
+106
+00:08:01,000 --> 00:08:06,000
+code base maintenance, simplify addition of new features, make it less fragile.
+
+107
+00:08:06,000 --> 00:08:12,000
+While is straightforward in theory, it is not always easy to follow it in real life.
+
+108
+00:08:12,000 --> 00:08:16,000
+Today will review principles with you, which will help you to adhere through.
+
+109
+00:08:17,000 --> 00:08:24,000
+The second factor is probably code based growth since software consider it to be deprecated by the time
+
+110
+00:08:24,000 --> 00:08:25,000
+it will be released.
+
+111
+00:08:25,000 --> 00:08:29,000
+We constantly evolve our vision of the product during its implementation.
+
+112
+00:08:30,000 --> 00:08:36,000
+You have to consider potential change factors which might pop up and be prepared for corn based growth
+
+113
+00:08:36,000 --> 00:08:38,000
+as new feature will be added to your project.
+
+114
+00:08:39,000 --> 00:08:43,000
+The next factor is team organization and communication between team members.
+
+115
+00:08:43,000 --> 00:08:46,000
+This very important factor for your project structure.
+
+116
+00:08:47,000 --> 00:08:48,000
+Right?
+
+117
+00:08:48,000 --> 00:08:54,000
+And this course will discuss Conway's law and will analyze how a team composition might influence project
+
+118
+00:08:54,000 --> 00:08:55,000
+code structure.
+
+119
+00:08:56,000 --> 00:09:00,000
+Technical factors can also impact your code structure in some way.
+
+120
+00:09:00,000 --> 00:09:07,000
+Also, during the course, I will show you examples to demonstrate how technical limitations might impact
+
+121
+00:09:07,000 --> 00:09:08,000
+our project structure.
+
+122
+00:09:08,000 --> 00:09:14,000
+And at the end of the day, our goal is to make navigation in your project easier and predictable.
+
+123
+00:09:14,000 --> 00:09:18,000
+There is no intention to make your cost structure harder to navigate.
+
+124
+00:09:18,000 --> 00:09:23,000
+And after applying patterns, which we'll discuss in this course, let's start from Cohesion Principles
+
+125
+00:09:23,000 --> 00:09:25,000
+of Growth Organization.
+
+126
+00:09:25,000 --> 00:09:30,000
+But before we start, let's recap definition of cohesion and understand what is modules.
+
+127
+00:09:30,000 --> 00:09:31,000
+Cohesion.
+
+128
+00:09:31,000 --> 00:09:34,000
+Cohesion refers to the degree to which the.
+
+129
+00:09:34,000 --> 00:09:37,000
+Elements of a specific component belong to Gaza.
+
+130
+00:09:37,000 --> 00:09:41,000
+It is about items which can exist and do one thing well together.
+
+131
+00:09:42,000 --> 00:09:48,000
+So cohesion is about the way how we can group our code that contributes to a single task together.
+
+132
+00:09:49,000 --> 00:09:54,000
+Also, cohesion indicates the degree to which a module has a single, more focused purpose.
+
+133
+00:09:55,000 --> 00:09:58,000
+There are many benefits which we expect to get from high cohesion.
+
+134
+00:09:58,000 --> 00:10:02,000
+Some of them maintenance of highly cohesive units is much easier.
+
+135
+00:10:03,000 --> 00:10:06,000
+Highly cohesive items are less frequently changed.
+
+136
+00:10:06,000 --> 00:10:12,000
+Reusability, reusability of such modules is higher because they are designed to serve a well focused
+
+137
+00:10:12,000 --> 00:10:18,000
+purpose and want you to understand module cohesion as a concept which will help you to compose your
+
+138
+00:10:18,000 --> 00:10:22,000
+components the way they become reusable and easily maintainable.
+
+139
+00:10:22,000 --> 00:10:28,000
+The three major module cohesion principles which we are going to review today, they are common closure
+
+140
+00:10:28,000 --> 00:10:35,000
+principle, common reuse principle and reuse release equivalence while choosing the classes which should
+
+141
+00:10:35,000 --> 00:10:42,000
+be grouped together to opposing forces related to software usability and develop ability must be taken
+
+142
+00:10:42,000 --> 00:10:43,000
+into consideration.
+
+143
+00:10:43,000 --> 00:10:46,000
+It is not an easy task to balance these forces.
+
+144
+00:10:46,000 --> 00:10:48,000
+Usually this balance is dynamic.
+
+145
+00:10:49,000 --> 00:10:56,000
+Has our module structure will evolve as focus of project shifts from develop ability to reusability
+
+146
+00:10:57,000 --> 00:10:59,000
+and we start from the common closure principle.
+
+147
+00:10:59,000 --> 00:11:05,000
+This principle states that the classes in the module should be close together against the same kinds
+
+148
+00:11:05,000 --> 00:11:12,000
+of changes and changes that affects Amodeo, affects all the classes in that module and no other modules.
+
+149
+00:11:13,000 --> 00:11:18,000
+You can treat common closure principles the same as single responsibility principle, but just related
+
+150
+00:11:18,000 --> 00:11:19,000
+to competence.
+
+151
+00:11:20,000 --> 00:11:25,000
+It is obvious that from the maintenance standpoint, changes which might impact as a module since the
+
+152
+00:11:25,000 --> 00:11:31,000
+application is not avoidable, but they should be controlled or at least minimized.
+
+153
+00:11:31,000 --> 00:11:38,000
+The main idea here is in case change has been made in one module rerelease or invalidating of other
+
+154
+00:11:38,000 --> 00:11:42,000
+modules that are not dependent on the changed one is not needed.
+
+155
+00:11:42,000 --> 00:11:49,000
+Similarly, the single responsibility principle for classes, the closure principle, states that the
+
+156
+00:11:49,000 --> 00:11:52,000
+classes in the module should not have different reasons to change.
+
+157
+00:11:53,000 --> 00:11:59,000
+If there is a need to make a change or to implement a new feature, it will be better to make changes
+
+158
+00:11:59,000 --> 00:12:03,000
+in one module rather than making changes in multiple different modules.
+
+159
+00:12:04,000 --> 00:12:08,000
+It is natural that the classes at the tightly related will change together.
+
+160
+00:12:08,000 --> 00:12:14,000
+Thus, in case we keep classes that are tightly related together in one module, only one module, a
+
+161
+00:12:14,000 --> 00:12:18,000
+very small number of them are going to be affected when a change happens.
+
+162
+00:12:18,000 --> 00:12:25,000
+And also in this case, all activity is targeted to revalidation and the reason will be decreased when
+
+163
+00:12:25,000 --> 00:12:26,000
+this slide.
+
+164
+00:12:26,000 --> 00:12:31,000
+You can see that, for example, changes in the interface of Bill and other stip most likely will cause
+
+165
+00:12:31,000 --> 00:12:33,000
+changes in invoice type.
+
+166
+00:12:33,000 --> 00:12:34,000
+There's very low.
+
+167
+00:12:34,000 --> 00:12:39,000
+Chances are changes in billing address type will cause changes in customer time.
+
+168
+00:12:39,000 --> 00:12:45,000
+It is also worth to mention that this principle is closely associated with the open closed principle.
+
+169
+00:12:45,000 --> 00:12:52,000
+You know that open closed principle states that classes should be closed for modification but open for
+
+170
+00:12:52,000 --> 00:12:53,000
+extension.
+
+171
+00:12:53,000 --> 00:12:57,000
+But in real life, 100 percent closure is not attainable.
+
+172
+00:12:57,000 --> 00:12:59,000
+Closure must be strategic.
+
+173
+00:12:59,000 --> 00:13:05,000
+We design our code modules in such a way that they are close to the most common kinds of changes that
+
+174
+00:13:05,000 --> 00:13:07,000
+we have experienced.
+
+175
+00:13:07,000 --> 00:13:13,000
+If we review common closure principle from open closed principle point of view, we can say that modules
+
+176
+00:13:13,000 --> 00:13:17,000
+should be closed against the same kinds of changes in specific.
+
+177
+00:13:17,000 --> 00:13:23,000
+This means that in case we are going to change some code in our module, it is most likely that the
+
+178
+00:13:23,000 --> 00:13:26,000
+requested change will affect only one module.
+
+179
+00:13:26,000 --> 00:13:32,000
+And contrariwise, when the changes are requested and this change affects one module most likely is
+
+180
+00:13:32,000 --> 00:13:35,000
+that all classes inside that module will be affected.
+
+181
+00:13:36,000 --> 00:13:42,000
+This principle allows us to limit amount of modules that are affected by any changes to the smallest
+
+182
+00:13:42,000 --> 00:13:43,000
+possible number.
+
+183
+00:13:44,000 --> 00:13:50,000
+Imagine also the case that people, while implementing their features or projects, create a dependency
+
+184
+00:13:50,000 --> 00:13:56,000
+on your module and most likely that people want to track all new releases of your module to keep their
+
+185
+00:13:56,000 --> 00:13:57,000
+code up to date.
+
+186
+00:13:57,000 --> 00:14:03,000
+After you released new version of your module, clients of your code will update that project, but
+
+187
+00:14:03,000 --> 00:14:06,000
+they will proceed with upgrade only in case they would know.
+
+188
+00:14:06,000 --> 00:14:12,000
+The changes you made to the module in the latest release impacts the way how module is used in the project,
+
+189
+00:14:12,000 --> 00:14:16,000
+because every such a great requires them to perform validation.
+
+190
+00:14:16,000 --> 00:14:19,000
+That existing code base still works as expected.
+
+191
+00:14:19,000 --> 00:14:25,000
+With the new version of your module being a model maintenance, you should follow the common closure
+
+192
+00:14:25,000 --> 00:14:31,000
+principle to prevent yourself from opening a module for all kinds of unrelated reasons.
+
+193
+00:14:32,000 --> 00:14:38,000
+The next principle, which we are going to review is commonly used principle, this principle states
+
+194
+00:14:38,000 --> 00:14:41,000
+that classes in the module are used together.
+
+195
+00:14:41,000 --> 00:14:45,000
+If you use one of the classes in the module, you reuse them all.
+
+196
+00:14:46,000 --> 00:14:52,000
+You need to be aware that there are always to adjust, that you need to avoid while grouping classes
+
+197
+00:14:52,000 --> 00:14:53,000
+into modules.
+
+198
+00:14:53,000 --> 00:14:58,000
+The first ATCH is that you can implement a lot of amazing classes features.
+
+199
+00:14:58,000 --> 00:15:04,000
+These classes might be very useful and super helpful, but if you will release all of these classes
+
+200
+00:15:04,000 --> 00:15:10,000
+as one module, this would mean that the class of your code should put a dependency on the entire module
+
+201
+00:15:10,000 --> 00:15:14,000
+and will be forced to be dependent on classes they don't use.
+
+202
+00:15:15,000 --> 00:15:20,000
+So even if clients of your code use only a few classes from your module, which is a very small part
+
+203
+00:15:20,000 --> 00:15:24,000
+of it, they still need to pull and try module into their project.
+
+204
+00:15:24,000 --> 00:15:26,000
+This is quite a maintenance burden for them.
+
+205
+00:15:27,000 --> 00:15:32,000
+On the other hand, you can't put each single class in a separate module.
+
+206
+00:15:32,000 --> 00:15:35,000
+First of all, this has no any sense.
+
+207
+00:15:35,000 --> 00:15:39,000
+And at the end of the day, you would need to release tons of modules.
+
+208
+00:15:39,000 --> 00:15:41,000
+This includes your own maintenance burden.
+
+209
+00:15:42,000 --> 00:15:45,000
+In this case, your clients now Bozarth with other issues.
+
+210
+00:15:45,000 --> 00:15:50,000
+They have a huge list of dependencies and they need to keep track of changes and new releases of all
+
+211
+00:15:50,000 --> 00:15:51,000
+these modules.
+
+212
+00:15:52,000 --> 00:15:59,000
+This principle tells us which classes should be grouped together as it states the classes that tend
+
+213
+00:15:59,000 --> 00:16:02,000
+to be used together should be in the same module.
+
+214
+00:16:02,000 --> 00:16:09,000
+It is more likely for reuseable classes to depend on each other, so classes are really reused and separation.
+
+215
+00:16:09,000 --> 00:16:16,000
+The principle states that the classes of a module should be inseparable, which means that if module
+
+216
+00:16:16,000 --> 00:16:22,000
+depends on another one, it should depend on all of its classes and not on a number of them.
+
+217
+00:16:23,000 --> 00:16:29,000
+Insured classes that are not tightly coupled to each other should not be kept in the same module.
+
+218
+00:16:30,000 --> 00:16:36,000
+And this also needs to be mentioned that the common reuse principle puts stress not only on classes
+
+219
+00:16:36,000 --> 00:16:42,000
+which we need to put together in the module, but it also tells us what classes not to put in the module
+
+220
+00:16:43,000 --> 00:16:46,000
+one in one module using class from another one.
+
+221
+00:16:46,000 --> 00:16:49,000
+This doesn't weaken the dependency between modules at all.
+
+222
+00:16:50,000 --> 00:16:57,000
+Modules are still dependent on each other and now every time used to module is released, the using
+
+223
+00:16:57,000 --> 00:17:03,000
+modules must be revalidated and the rereleased usually modules have physical representations and shared
+
+224
+00:17:03,000 --> 00:17:09,000
+libraries like DLs or Jar's, if they use the module is released as a jar.
+
+225
+00:17:09,000 --> 00:17:16,000
+Zinser using code depends on the entire jar and a modification to the jar, even to one class, will
+
+226
+00:17:16,000 --> 00:17:20,000
+still cause a new version of the jar to be released.
+
+227
+00:17:21,000 --> 00:17:27,000
+This principle might look pretty straightforward and obvious at first glance, just put glasses that
+
+228
+00:17:27,000 --> 00:17:29,000
+are going to be used together in one module.
+
+229
+00:17:29,000 --> 00:17:33,000
+It is even hard to put completely unrelated clauses that are never used together.
+
+230
+00:17:34,000 --> 00:17:39,000
+But things become less obvious when we consider the fact we should not put classes in one module that
+
+231
+00:17:39,000 --> 00:17:41,000
+are not used together.
+
+232
+00:17:41,000 --> 00:17:47,000
+We also need to think about classes that are likely not to be used together in the future.
+
+233
+00:17:47,000 --> 00:17:53,000
+In the example on the slide, you can see that we are sure that we don't want to put string could use
+
+234
+00:17:53,000 --> 00:17:57,000
+item in one module next to an address and invoice items.
+
+235
+00:17:57,000 --> 00:17:58,000
+Why?
+
+236
+00:17:58,000 --> 00:18:04,000
+Because we are not sure that every time we will reuse billing, address and invoice in other places
+
+237
+00:18:04,000 --> 00:18:06,000
+of our software, we would need details.
+
+238
+00:18:07,000 --> 00:18:12,000
+We are also not sure that to could use an invoice and billing address always used together.
+
+239
+00:18:13,000 --> 00:18:19,000
+And we don't want to force clients of our component to depend on all changes in strangelet.
+
+240
+00:18:19,000 --> 00:18:20,000
+Use CLOs.
+
+241
+00:18:20,000 --> 00:18:26,000
+That's why it is better to keep trying to use outside of the module, because each update of external
+
+242
+00:18:26,000 --> 00:18:31,000
+library will require regression testing of the whole system.
+
+243
+00:18:31,000 --> 00:18:37,000
+One more important principle related to module cohesion is reuse release equivalence principle.
+
+244
+00:18:37,000 --> 00:18:46,000
+This principle states that the granting of reuse is a granule of this principle also brings us to conclusion
+
+245
+00:18:46,000 --> 00:18:50,000
+that if you use are going to be released together, they should be in the one module.
+
+246
+00:18:51,000 --> 00:18:57,000
+That's why the size of the code that is intended to be reused is the same as size of the release module.
+
+247
+00:18:58,000 --> 00:19:04,000
+This principle is different from common reuse principle, but you might be wondering what is the difference?
+
+248
+00:19:04,000 --> 00:19:10,000
+The main difference is that the stress in common reuse principle is put on reusing units from the same
+
+249
+00:19:10,000 --> 00:19:18,000
+module together, whereas in reuse release equivalence principle stresses put on reusing of the whole
+
+250
+00:19:18,000 --> 00:19:18,000
+module.
+
+251
+00:19:19,000 --> 00:19:25,000
+When you project become more mature and it is time to release your code, you start thinking about what
+
+252
+00:19:25,000 --> 00:19:26,000
+modules should be released first.
+
+253
+00:19:27,000 --> 00:19:32,000
+And the answer to this question impacts the way how you approach your code organization.
+
+254
+00:19:32,000 --> 00:19:37,000
+You need to understand that the code which will be released together, will be reused together.
+
+255
+00:19:38,000 --> 00:19:44,000
+The code, which will be released together, will be maintained together as the project will grow.
+
+256
+00:19:44,000 --> 00:19:50,000
+The weight of this principle will become more because at the end of the day, you are not able to follow
+
+257
+00:19:50,000 --> 00:19:52,000
+all cohesion principles 100 percent.
+
+258
+00:19:53,000 --> 00:19:59,000
+There's always a matter of the tradeoffs and balance between all cohesion principles, and you understand
+
+259
+00:19:59,000 --> 00:20:05,000
+that sometimes it makes sense to put units together in one module if they are going to be released together
+
+260
+00:20:05,000 --> 00:20:11,000
+and not necessarily it will be used in conjunction is a good example of this principle is Java util
+
+261
+00:20:11,000 --> 00:20:12,000
+package in JDK.
+
+262
+00:20:12,000 --> 00:20:19,000
+It contains a lot of units which are often unrelated, such as collections, interfaces, classes to
+
+263
+00:20:19,000 --> 00:20:24,000
+work with date classes to work with the application locale with random number generation.
+
+264
+00:20:25,000 --> 00:20:31,000
+But the goal was to release module, which will be commonly reused across different Java applications.
+
+265
+00:20:31,000 --> 00:20:35,000
+We learned a lot in this lesson and we still have a lot of things to learn.
+
+266
+00:20:35,000 --> 00:20:37,000
+The current code grouping and packaging.
+
+267
+00:20:38,000 --> 00:20:42,000
+Namely, we still need to learn Coplan principles during the course group.
+
+268
+00:20:42,000 --> 00:20:46,000
+And what I suggest to cover this is a separate lesson take into account.
+
+269
+00:20:46,000 --> 00:20:48,000
+We have already learnt a lot.
+
+270
+00:20:48,000 --> 00:20:52,000
+Let's recap what we have learned today after this lesson.
+
+271
+00:20:52,000 --> 00:20:59,000
+You understand why we need a good structure and why question how to group classes in one module is important
+
+272
+00:20:59,000 --> 00:21:02,000
+review of the factors that will impact good structure.
+
+273
+00:21:03,000 --> 00:21:05,000
+And we review three cohesion principles.
+
+274
+00:21:05,000 --> 00:21:11,000
+They are common closure principle, common reuse principle and reuse equivalence principle.
+
+275
+00:21:12,000 --> 00:21:17,000
+I want to put stress on the fact that they are a very important lesson and I hope you loved it.
+
+276
+00:21:18,000 --> 00:21:21,000
+Will learn module structure further in the course.
+
+277
+00:21:21,000 --> 00:21:23,000
+Thanks a lot for your attention.
+
+278
+00:21:23,000 --> 00:21:25,000
+See you in the next lesson.
+
diff --git a/38 - Object-oriented Architecture, Clean Code Design (Advanced)/009 Packaging Pricniples p.2 Coupling Principles and Others_en.srt b/38 - Object-oriented Architecture, Clean Code Design (Advanced)/009 Packaging Pricniples p.2 Coupling Principles and Others_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..ee773cc87b182023a0278ae92f63203235bd745b
--- /dev/null
+++ b/38 - Object-oriented Architecture, Clean Code Design (Advanced)/009 Packaging Pricniples p.2 Coupling Principles and Others_en.srt
@@ -0,0 +1,1320 @@
+1
+00:00:05,000 --> 00:00:06,000
+Hello, Jim.
+
+2
+00:00:06,000 --> 00:00:12,000
+And this lesson will proceed, learning, packaging principles, namely, we'll talk about Coplin packaging
+
+3
+00:00:12,000 --> 00:00:14,000
+principles, I will explain.
+
+4
+00:00:14,000 --> 00:00:20,000
+It was example's next KAPLIN principles, acyclic dependencies, principle, stable dependencies and
+
+5
+00:00:20,000 --> 00:00:22,000
+stable abstractions principle.
+
+6
+00:00:22,000 --> 00:00:28,000
+Also in this lesson, we'll talk about other approaches during construction that is good to know and
+
+7
+00:00:28,000 --> 00:00:29,000
+apply in practice.
+
+8
+00:00:29,000 --> 00:00:32,000
+I will explain your package, bilayer and package by feature.
+
+9
+00:00:33,000 --> 00:00:38,000
+After that, we'll discuss how team structure may impact your cost structure and that will explain your
+
+10
+00:00:38,000 --> 00:00:44,000
+Conways law will review technical factors that may impact cost structure and at the end of the class.
+
+11
+00:00:44,000 --> 00:00:49,000
+And we'll talk about tools for code analysis that may help to keep your code clean.
+
+12
+00:00:49,000 --> 00:00:54,000
+So let's try to understand context and background for complete package and principles.
+
+13
+00:00:54,000 --> 00:01:00,000
+Understanding these rules will help us to understand the logic that stands behind each of these principles.
+
+14
+00:01:01,000 --> 00:01:06,000
+Our application usually tend to be large networks of interrelated modules.
+
+15
+00:01:06,000 --> 00:01:12,000
+That is why it is very important to find some partners and create rules that will govern this interrelationship
+
+16
+00:01:12,000 --> 00:01:14,000
+and object oriented architecture.
+
+17
+00:01:14,000 --> 00:01:19,000
+The next three principles, which we are going to discuss today focus on the interrelationships between
+
+18
+00:01:19,000 --> 00:01:20,000
+modules.
+
+19
+00:01:20,000 --> 00:01:23,000
+We already learned what Kopplin is in another lesson.
+
+20
+00:01:23,000 --> 00:01:27,000
+In case you missed that lesson, take your time to watch it.
+
+21
+00:01:27,000 --> 00:01:32,000
+But nevertheless, before we start to discuss these principles, let's recap first what Koplin.
+
+22
+00:01:32,000 --> 00:01:34,000
+S Kopplin is.
+
+23
+00:01:34,000 --> 00:01:40,000
+The degree of interdependence between software modules and measure of how closely connected to modules
+
+24
+00:01:40,000 --> 00:01:44,000
+are the strengths of the relationships between modules.
+
+25
+00:01:45,000 --> 00:01:48,000
+Coplin consider it to be the principle of separation of concerns.
+
+26
+00:01:49,000 --> 00:01:49,000
+What does it mean?
+
+27
+00:01:50,000 --> 00:01:56,000
+This means that one module should not directly affect or modify the state or behaviour of another module.
+
+28
+00:01:57,000 --> 00:02:02,000
+Company pays attention to the relationship between modules and how closely connected they are.
+
+29
+00:02:03,000 --> 00:02:07,000
+To make you understand Coplan better, let's consider the next example.
+
+30
+00:02:08,000 --> 00:02:12,000
+Tamou and C assess before to assess appeared.
+
+31
+00:02:12,000 --> 00:02:15,000
+Temel was used for both Mark-Up and presentation.
+
+32
+00:02:15,000 --> 00:02:22,000
+This ended up with creation of huge files and bloated code that was difficult to maintain and extremely
+
+33
+00:02:22,000 --> 00:02:29,000
+hard to change with the advent of T says two concerns markup and presentation have been separated.
+
+34
+00:02:30,000 --> 00:02:35,000
+After that, H.T. email became in charge of only a markup and this became used for presentation.
+
+35
+00:02:36,000 --> 00:02:39,000
+This separation made the code cleaner and easier to change.
+
+36
+00:02:40,000 --> 00:02:42,000
+Why lose company considered to be good?
+
+37
+00:02:42,000 --> 00:02:49,000
+Because Loose Kaplin led the court to be more changeable, easier to work with, and more flexible modules
+
+38
+00:02:49,000 --> 00:02:52,000
+that rely on another wants and can modify.
+
+39
+00:02:52,000 --> 00:02:59,000
+The status of other modules are set to be tightly coupled with might cause the issues because high Coplan
+
+40
+00:02:59,000 --> 00:03:06,000
+can cause so-called ripple effect when modification of code from one module also requires code changes
+
+41
+00:03:06,000 --> 00:03:07,000
+to be done in another one.
+
+42
+00:03:08,000 --> 00:03:13,000
+Where is the ability of code which is tightly coupled is also significantly decreased because code is
+
+43
+00:03:13,000 --> 00:03:15,000
+harder to separate from each other.
+
+44
+00:03:16,000 --> 00:03:21,000
+So the rule of thumb sounds like this strive for low carbon and high cohesion.
+
+45
+00:03:21,000 --> 00:03:28,000
+This rule is a reminder for us that we should strive for code that separates tasks and doesn't rely
+
+46
+00:03:28,000 --> 00:03:29,000
+heavily on each other.
+
+47
+00:03:29,000 --> 00:03:33,000
+That is why low carbon generally considered to be a good thing.
+
+48
+00:03:33,000 --> 00:03:40,000
+While high coupling is generally bad, the next principle will help us to achieve architecture with
+
+49
+00:03:40,000 --> 00:03:45,000
+low coupling, as it was stated in agenda will focus on three principles.
+
+50
+00:03:45,000 --> 00:03:51,000
+I seek dependencies, principle, stable dependencies, principle and stable abstractions principle.
+
+51
+00:03:51,000 --> 00:03:54,000
+Let's discuss each of these principles one by one.
+
+52
+00:03:55,000 --> 00:04:00,000
+The first Kopplin Principle, which we are going to review today, is acyclic dependencies principle.
+
+53
+00:04:01,000 --> 00:04:05,000
+This principle says allowing all cycles in the component dependency graph.
+
+54
+00:04:06,000 --> 00:04:12,000
+The dependencies principle is the first of three principles that deals with the relationships between
+
+55
+00:04:12,000 --> 00:04:12,000
+components.
+
+56
+00:04:13,000 --> 00:04:16,000
+How to check that you have cyclic dependency in your app.
+
+57
+00:04:16,000 --> 00:04:21,000
+If you draw the components and the dependencies between them and you are able to follow a dependency
+
+58
+00:04:21,000 --> 00:04:24,000
+back to component, you have already visited them.
+
+59
+00:04:24,000 --> 00:04:26,000
+It is validation to ADP.
+
+60
+00:04:27,000 --> 00:04:28,000
+But what do we need to strive for?
+
+61
+00:04:29,000 --> 00:04:32,000
+We always try to implement directed a secret graph.
+
+62
+00:04:33,000 --> 00:04:35,000
+So why should you care about secret dependencies?
+
+63
+00:04:35,000 --> 00:04:42,000
+Because their existence makes it very hard to split up responsibilities and work on different tasks
+
+64
+00:04:42,000 --> 00:04:45,000
+in parallel without stepping on each other's toes all the time.
+
+65
+00:04:46,000 --> 00:04:49,000
+To understand these principles better, let's consider the next example.
+
+66
+00:04:50,000 --> 00:04:57,000
+You have a system which consists of the next modules, key front and this model where all automation
+
+67
+00:04:57,000 --> 00:04:58,000
+tasks are stored.
+
+68
+00:04:59,000 --> 00:05:03,000
+Service interface, the module which expose an external interface to certain.
+
+69
+00:05:04,000 --> 00:05:11,000
+Utilities, the module with classes that helps us to perform some calculations domain the module which
+
+70
+00:05:11,000 --> 00:05:18,000
+contains actual domain logic, this module depends on the eulogists module engineers who worked on YouTube.
+
+71
+00:05:18,000 --> 00:05:24,000
+This module realized that creative from module has amazing string manipulation activities that are already
+
+72
+00:05:24,000 --> 00:05:25,000
+implemented.
+
+73
+00:05:25,000 --> 00:05:28,000
+And these engineers added a dependency.
+
+74
+00:05:28,000 --> 00:05:34,000
+Now etiologies module depends on key Front-End module and now you have cyclic dependency.
+
+75
+00:05:35,000 --> 00:05:41,000
+Everything worked fine until one day a colleague of yours updated the way housetrained Cucuta's worked
+
+76
+00:05:41,000 --> 00:05:42,000
+for the sake of automated tests.
+
+77
+00:05:43,000 --> 00:05:49,000
+Next day I realized that the main module has broken logic and system behaves not as expected.
+
+78
+00:05:49,000 --> 00:05:55,000
+Definitely creating dependency between the coaches and from that module should be considered as an alarm,
+
+79
+00:05:56,000 --> 00:06:01,000
+not only because your production code depends on key code in this case, but also because of cyclic
+
+80
+00:06:01,000 --> 00:06:06,000
+dependency, which makes code development and support sometimes unpredictable.
+
+81
+00:06:06,000 --> 00:06:07,000
+And time-Consuming.
+
+82
+00:06:07,000 --> 00:06:11,000
+To foster better architecture design, we need to break cyclic dependency.
+
+83
+00:06:12,000 --> 00:06:12,000
+But how?
+
+84
+00:06:13,000 --> 00:06:14,000
+There are two options how to break it.
+
+85
+00:06:15,000 --> 00:06:20,000
+The first option when you to apply the penalty inversion principle, for example, in this case, we
+
+86
+00:06:20,000 --> 00:06:23,000
+could create an abstraction that is required for it.
+
+87
+00:06:23,000 --> 00:06:26,000
+You adjust more module, we can put this abstraction in it.
+
+88
+00:06:26,000 --> 00:06:34,000
+You just module had inherited in from this inverse dependency between liquidities and front end module.
+
+89
+00:06:35,000 --> 00:06:41,000
+The second option is to create a new module on which both front end and the utilities depend.
+
+90
+00:06:41,000 --> 00:06:45,000
+You can move the classes that they both depend on into that pneumonia.
+
+91
+00:06:46,000 --> 00:06:52,000
+The greatest danger of cyclic dependencies is that problems in one of your dependencies might backfire
+
+92
+00:06:52,000 --> 00:06:56,000
+after they have travelled the entire cycle through the dependency graph.
+
+93
+00:06:57,000 --> 00:07:02,000
+Even when your dependency graph has no cycles, there is still a chance that dependency sophomore year
+
+94
+00:07:02,000 --> 00:07:05,000
+will start causing problems at any time in the future.
+
+95
+00:07:06,000 --> 00:07:11,000
+Whenever you upgrade one of your projects dependencies, you hope that your project will still work
+
+96
+00:07:11,000 --> 00:07:12,000
+as it did before.
+
+97
+00:07:13,000 --> 00:07:18,000
+However, there is always a risk that it suddenly starts to fail in unexpected ways.
+
+98
+00:07:19,000 --> 00:07:23,000
+The stable dependencies, principle says, depend in the direction of stability.
+
+99
+00:07:24,000 --> 00:07:26,000
+Design cannot be completely static.
+
+100
+00:07:26,000 --> 00:07:29,000
+We evolve our application constantly.
+
+101
+00:07:29,000 --> 00:07:34,000
+We apply the common closure principle to create modules that are sensitive to certain kinds of changes.
+
+102
+00:07:35,000 --> 00:07:41,000
+These modules are designed to be volatile, and we expect them to change the rule of thumb here as a
+
+103
+00:07:41,000 --> 00:07:48,000
+module that we expect to be volatile should not be depended on by a module that is difficult to change.
+
+104
+00:07:48,000 --> 00:07:54,000
+By conforming to the stable dependencies principle, we ensure that the modules that are intended to
+
+105
+00:07:54,000 --> 00:07:59,000
+be easy to change are not dependent on modules that are harder to change than they are.
+
+106
+00:07:59,000 --> 00:08:03,000
+But what is the magic to measure hardness of changes?
+
+107
+00:08:03,000 --> 00:08:10,000
+There are many factors that make software component hard to change, some of them its size, complexity,
+
+108
+00:08:10,000 --> 00:08:14,000
+clarity, mission of the component, etc..
+
+109
+00:08:14,000 --> 00:08:17,000
+But I would like to put focus on another metric.
+
+110
+00:08:17,000 --> 00:08:23,000
+The easiest way to make more difficult to change is to make lots of other software modules dependent
+
+111
+00:08:24,000 --> 00:08:25,000
+on the diagram.
+
+112
+00:08:25,000 --> 00:08:29,000
+You can see pretty stable module doing stable modules depend on it.
+
+113
+00:08:29,000 --> 00:08:34,000
+We can say that pretty stable module already has two good reasons not to change.
+
+114
+00:08:34,000 --> 00:08:40,000
+If you expect module to be flexible and volatile, it is not the best idea to make a pretty stable module
+
+115
+00:08:40,000 --> 00:08:45,000
+dependent on the flexible one because the last wheel becomes a module which is hard to change.
+
+116
+00:08:46,000 --> 00:08:51,000
+And remember the stable dependencies principle is not about making all modules stable.
+
+117
+00:08:51,000 --> 00:08:57,000
+It is impossible and at the end of the day is not needed because in case all modules are stable, that
+
+118
+00:08:57,000 --> 00:08:59,000
+means the system is unchangeable.
+
+119
+00:09:00,000 --> 00:09:06,000
+Indeed, we want to design our module structure so that some modules unstable and some are stable,
+
+120
+00:09:06,000 --> 00:09:07,000
+stable dependencies.
+
+121
+00:09:07,000 --> 00:09:14,000
+Principal emphasizes the necessity of the direction of the dependency between the modules from volatile
+
+122
+00:09:14,000 --> 00:09:15,000
+modules to stable ones.
+
+123
+00:09:16,000 --> 00:09:17,000
+Does it make sense?
+
+124
+00:09:17,000 --> 00:09:19,000
+If this is clear, I suggest to move on.
+
+125
+00:09:20,000 --> 00:09:25,000
+And the last but not the least principle related to module schöpflin is stable abstractions principle.
+
+126
+00:09:26,000 --> 00:09:30,000
+This principle states that the components should be as abstract as it is stable.
+
+127
+00:09:31,000 --> 00:09:38,000
+The name of the stable abstractions principle contains two important words stable and abstract from
+
+128
+00:09:38,000 --> 00:09:39,000
+the dependency inversion principle.
+
+129
+00:09:39,000 --> 00:09:44,000
+You know that classes should depend on abstractions, not on concrete classes.
+
+130
+00:09:44,000 --> 00:09:51,000
+The similar way we want a couple our components, however, dependency, inversion principle deals with
+
+131
+00:09:51,000 --> 00:09:53,000
+classes and with classes.
+
+132
+00:09:53,000 --> 00:09:56,000
+Everything is clear is a class is abstract or it is not.
+
+133
+00:09:57,000 --> 00:10:03,000
+So our stable module should also be abstract so that its stability doesn't prevent it from being.
+
+134
+00:10:04,000 --> 00:10:11,000
+On the other hand, in stable more, you should be concrete, since its instability allows the country
+
+135
+00:10:11,000 --> 00:10:13,000
+to one within it to be easily changed.
+
+136
+00:10:14,000 --> 00:10:20,000
+That means if a model is planned to be stable according to design, it should contain abstract types
+
+137
+00:10:20,000 --> 00:10:23,000
+in it so that it could be extended easily.
+
+138
+00:10:23,000 --> 00:10:30,000
+Stable modules that can be extended, though not overly constrain the design, but how to measure abstractness.
+
+139
+00:10:30,000 --> 00:10:36,000
+One of the possible calculations which you can do to identify abstraction of your component is to divide
+
+140
+00:10:36,000 --> 00:10:38,000
+the number of abstract entities.
+
+141
+00:10:38,000 --> 00:10:45,000
+I mean abstract classes and interfaces in your component by a number of all classes in that have value
+
+142
+00:10:45,000 --> 00:10:50,000
+of zero means that the component contains no abstract classes and value.
+
+143
+00:10:50,000 --> 00:10:54,000
+One means that components contains nothing but abstract entities.
+
+144
+00:10:55,000 --> 00:11:01,000
+So by this moment we have learned three cohesion and three Coplin principles that will help us to group
+
+145
+00:11:01,000 --> 00:11:02,000
+our code.
+
+146
+00:11:02,000 --> 00:11:07,000
+But actually the other principles exist that will help you to structure your code.
+
+147
+00:11:07,000 --> 00:11:08,000
+Let's review some of them.
+
+148
+00:11:09,000 --> 00:11:13,000
+There are many ways how to organize the classes into modules in software project.
+
+149
+00:11:14,000 --> 00:11:20,000
+I also want to review with you pros and cons of your popular ways of how to group classes in your app.
+
+150
+00:11:20,000 --> 00:11:25,000
+One of the options for you to structure your code is to group classes in modules by layers.
+
+151
+00:11:26,000 --> 00:11:30,000
+You can think about your application from architectural layer standpoint.
+
+152
+00:11:30,000 --> 00:11:37,000
+For example, you can have UI layer the network, layer the database layer services layer and model.
+
+153
+00:11:37,000 --> 00:11:43,000
+That group encode by layer is typically the default approach because after all, that's what the book's
+
+154
+00:11:43,000 --> 00:11:46,000
+tutorials and framework samples tell us to do.
+
+155
+00:11:47,000 --> 00:11:53,000
+Here we organize in code by grouping things of the same type generally where the architecture considered
+
+156
+00:11:53,000 --> 00:11:54,000
+to be a good thing.
+
+157
+00:11:54,000 --> 00:12:01,000
+Engineers useless to group their classes by applying separation of concerns, principle in this case
+
+158
+00:12:01,000 --> 00:12:05,000
+less as a primary organisational mechanism for our code.
+
+159
+00:12:05,000 --> 00:12:10,000
+It comes with such advantages as it is simple and easy for understanding.
+
+160
+00:12:10,000 --> 00:12:12,000
+You want to change that access mechanism?
+
+161
+00:12:12,000 --> 00:12:14,000
+Absolutely no problems.
+
+162
+00:12:14,000 --> 00:12:15,000
+Hammerson is in one place.
+
+163
+00:12:16,000 --> 00:12:20,000
+Testing of each layer in isolation from another layer is simpler.
+
+164
+00:12:20,000 --> 00:12:25,000
+But such approach also has some drawbacks, usually with such approach.
+
+165
+00:12:25,000 --> 00:12:30,000
+Cohesion inside each module is low and the coupling between items is very high.
+
+166
+00:12:30,000 --> 00:12:33,000
+This sounds like completely opposite of what we want to achieve.
+
+167
+00:12:34,000 --> 00:12:39,000
+At the same time, there is a community that is agree with separation of concerns of presentation,
+
+168
+00:12:39,000 --> 00:12:44,000
+application, the main infrastructure, and agree it makes sense.
+
+169
+00:12:44,000 --> 00:12:45,000
+On the example.
+
+170
+00:12:45,000 --> 00:12:51,000
+You can see that each feature has its implementation spread out over multiple directories, over so-called
+
+171
+00:12:51,000 --> 00:12:53,000
+implementation categories.
+
+172
+00:12:53,000 --> 00:13:00,000
+For example, you can see that all the feature items like all of you or the service or the wrapper are
+
+173
+00:13:00,000 --> 00:13:02,000
+spread out into three different components.
+
+174
+00:13:03,000 --> 00:13:08,000
+Each directory contains items that usually are not closely related to each other.
+
+175
+00:13:08,000 --> 00:13:14,000
+In this example, Additon of Order feature involves code changes in different directories and software
+
+176
+00:13:14,000 --> 00:13:14,000
+modules.
+
+177
+00:13:15,000 --> 00:13:19,000
+Also, deleting a feature can be performed as a single operation.
+
+178
+00:13:19,000 --> 00:13:22,000
+You have to attentively analyze each module.
+
+179
+00:13:22,000 --> 00:13:27,000
+Another popular approach to group classes is package by feature approach.
+
+180
+00:13:27,000 --> 00:13:30,000
+We might want to use this approach to reflect the feature set.
+
+181
+00:13:31,000 --> 00:13:36,000
+According to this principle, we need to place all items related to a single feature into a single module.
+
+182
+00:13:37,000 --> 00:13:43,000
+Following this approach, we can achieve high cohesion and high modularity at the same time, with low
+
+183
+00:13:43,000 --> 00:13:49,000
+coupling between components classes at work together, I placed next to each other instead of being
+
+184
+00:13:49,000 --> 00:13:51,000
+spread out all over the application.
+
+185
+00:13:52,000 --> 00:13:57,000
+In case you would like to disable or completely remove specific feature, you can just remove directory.
+
+186
+00:13:58,000 --> 00:14:03,000
+But to be able to apply this principle effectively, we need to answer one important question.
+
+187
+00:14:04,000 --> 00:14:05,000
+What is a feature?
+
+188
+00:14:05,000 --> 00:14:11,000
+There is no strict definition of such term as feature and in real life feature understanding.
+
+189
+00:14:11,000 --> 00:14:12,000
+Vorys.
+
+190
+00:14:12,000 --> 00:14:18,000
+It could mean one specific use case was a whole set of operations related to a particular business concern.
+
+191
+00:14:19,000 --> 00:14:25,000
+With this approach, we have high cohesion and low carbon and the module level and above that we can
+
+192
+00:14:25,000 --> 00:14:29,000
+easily to say what an application that's looking at its module structure.
+
+193
+00:14:30,000 --> 00:14:35,000
+On the other hand, in a typical Lares architecture, the cohesion inside the software module is usually
+
+194
+00:14:35,000 --> 00:14:42,000
+low and the carbon emitting module is high for our services group and approach stage, that is very
+
+195
+00:14:42,000 --> 00:14:43,000
+rare cases.
+
+196
+00:14:43,000 --> 00:14:47,000
+When we change technologies, we need to substitute the whole there completely.
+
+197
+00:14:47,000 --> 00:14:54,000
+Whereas new features are constantly added to the software, the package by feature concept does not
+
+198
+00:14:54,000 --> 00:14:58,000
+imply that one module can never use items belonging to another one.
+
+199
+00:14:58,000 --> 00:15:03,000
+It will be properly to say that package by feature approach prefer a package prior to.
+
+200
+00:15:03,000 --> 00:15:10,000
+As the full scope and only increases the scope of an item to public when needed, package by feature
+
+201
+00:15:10,000 --> 00:15:14,000
+has a lot of pros, not all of them are listed on this slide.
+
+202
+00:15:14,000 --> 00:15:16,000
+It also works dimensions and next benefits.
+
+203
+00:15:17,000 --> 00:15:24,000
+High modularity package by feature has more with high cohesion, high modularity and low carbon between
+
+204
+00:15:24,000 --> 00:15:27,000
+models is a good navigation.
+
+205
+00:15:27,000 --> 00:15:33,000
+Software engineers need to do less searching for items since everything related to the change request
+
+206
+00:15:33,000 --> 00:15:37,000
+Autoblog fix is placed in the same directory.
+
+207
+00:15:37,000 --> 00:15:39,000
+Better growth potential.
+
+208
+00:15:39,000 --> 00:15:42,000
+One component becomes way too large.
+
+209
+00:15:42,000 --> 00:15:47,000
+It can be refactored and be split into two separate modules in a natural way.
+
+210
+00:15:47,000 --> 00:15:54,000
+In case your hair package bilayer approach, you have comparatively monolithic module structure because
+
+211
+00:15:54,000 --> 00:15:59,000
+as an application will grow in size, the number of layers will remain the same, but the amount of
+
+212
+00:15:59,000 --> 00:16:01,000
+features will be increased.
+
+213
+00:16:01,000 --> 00:16:06,000
+Thus amount of classes in each module will increase without any bound.
+
+214
+00:16:06,000 --> 00:16:11,000
+But package by feature also comes with the price of its drawbacks.
+
+215
+00:16:11,000 --> 00:16:15,000
+Some of them are unspecified feature size.
+
+216
+00:16:15,000 --> 00:16:19,000
+In my opinion, this is the most critical disadvantage of packaging by feature.
+
+217
+00:16:19,000 --> 00:16:25,000
+First of all, because in real life, separation by features sometimes might look not so obvious as
+
+218
+00:16:25,000 --> 00:16:26,000
+it is expected.
+
+219
+00:16:27,000 --> 00:16:32,000
+If you have log in feature of your current feature, everything is straight and clear here.
+
+220
+00:16:32,000 --> 00:16:38,000
+But what if you would have service which calculates distance from point A to point B and you need to
+
+221
+00:16:38,000 --> 00:16:44,000
+perform these calculations in order feature and interactively delivery online feature, you will end
+
+222
+00:16:44,000 --> 00:16:50,000
+up having components which are still needed to be shared and least of components which can be used in
+
+223
+00:16:50,000 --> 00:16:51,000
+different features.
+
+224
+00:16:51,000 --> 00:16:56,000
+This is something with extremely hard to predict at the beginning and what you don't know, and the
+
+225
+00:16:56,000 --> 00:17:00,000
+model with shared items has a risk to becomes a huge one.
+
+226
+00:17:00,000 --> 00:17:06,000
+Mezzanines potential in a tangible domain where everything is connected to everything.
+
+227
+00:17:06,000 --> 00:17:10,000
+Separation of modules into the future might become artificial.
+
+228
+00:17:11,000 --> 00:17:14,000
+Just remember that there is no silver bullet.
+
+229
+00:17:14,000 --> 00:17:19,000
+You should be aware of different approaches and practices and choose the one which works the best for
+
+230
+00:17:19,000 --> 00:17:21,000
+your specific case and project.
+
+231
+00:17:22,000 --> 00:17:25,000
+Probably in real life, you don't need even to choose.
+
+232
+00:17:25,000 --> 00:17:27,000
+One of the two approaches suggest it.
+
+233
+00:17:27,000 --> 00:17:32,000
+Most likely it will be a combination of these two approaches where you will separate yourself to modules
+
+234
+00:17:32,000 --> 00:17:35,000
+by layers and still will separate it by features inside.
+
+235
+00:17:36,000 --> 00:17:41,000
+There is also another factor that may impact our cost structure and that we can't underestimate.
+
+236
+00:17:42,000 --> 00:17:49,000
+On nineteen sixty eight, when Conway submitted an article to the major magazine at the time, didn't
+
+237
+00:17:49,000 --> 00:17:57,000
+mention that a mention published his article with the tax head on how the committees in went after that.
+
+238
+00:17:57,000 --> 00:18:03,000
+Fred Brooks, in his famous book The Mythical Man Month, sided words of Kahnawake and called it Conaway's
+
+239
+00:18:03,000 --> 00:18:04,000
+law.
+
+240
+00:18:04,000 --> 00:18:11,000
+The law sounds like this organizations which design systems are constrained to produce designs, which
+
+241
+00:18:11,000 --> 00:18:14,000
+are copies of the communication structures of these organizations.
+
+242
+00:18:15,000 --> 00:18:21,000
+Even though Conaway's law not a scientific law and doesn't have mathematical proof, it was recognized
+
+243
+00:18:21,000 --> 00:18:24,000
+by community as valid preposition from many environments.
+
+244
+00:18:24,000 --> 00:18:30,000
+Probably you already had a chance to see how this law affects in our projects and other projects where
+
+245
+00:18:30,000 --> 00:18:36,000
+a group of people distributed teams combined, according to different rules, develop software together.
+
+246
+00:18:36,000 --> 00:18:42,000
+Honest law was not intended as a joke, but as a valid sociological observation.
+
+247
+00:18:42,000 --> 00:18:49,000
+It is a consequence of the fact that two software modules, A and B, can't interact correctly with
+
+248
+00:18:49,000 --> 00:18:55,000
+each other unless the designer and implementer of a module communicates with the design and implementation
+
+249
+00:18:55,000 --> 00:18:56,000
+of B module.
+
+250
+00:18:57,000 --> 00:19:03,000
+Thus, the interface structure of a software system necessarily will show a Congress with the social
+
+251
+00:19:03,000 --> 00:19:05,000
+structure of the organization that produced it.
+
+252
+00:19:06,000 --> 00:19:10,000
+The initial thought architectural design, in most cases, not the best possible.
+
+253
+00:19:11,000 --> 00:19:16,000
+We are dealing with software development where a lot of things can be extremely hard to predict until
+
+254
+00:19:16,000 --> 00:19:19,000
+the detailed plan and implementation.
+
+255
+00:19:19,000 --> 00:19:23,000
+That's why initial software architecture design may need to change.
+
+256
+00:19:23,000 --> 00:19:28,000
+Thus, effective design depends on how flexible organization is.
+
+257
+00:19:28,000 --> 00:19:33,000
+Nowadays, there is a trend to build cross-functional and multidisciplinary teams.
+
+258
+00:19:34,000 --> 00:19:39,000
+Such teams consist of people with different roles, different domain knowledge, guided by the business
+
+259
+00:19:39,000 --> 00:19:40,000
+capabilities.
+
+260
+00:19:40,000 --> 00:19:47,000
+Cross-functional team can address any new requirement or new business definition from the start to end.
+
+261
+00:19:47,000 --> 00:19:54,000
+This avoids processes overhead and produces different and often more distributed architecture with greater
+
+262
+00:19:54,000 --> 00:19:55,000
+capacity to evolve.
+
+263
+00:19:56,000 --> 00:20:01,000
+The interesting thing to mention here is the connection between Conway's law and single responsibility
+
+264
+00:20:01,000 --> 00:20:01,000
+principle.
+
+265
+00:20:02,000 --> 00:20:08,000
+The delivery of the software project, we can have multiple key stakeholders who has the biggest power
+
+266
+00:20:08,000 --> 00:20:14,000
+and the most interest in the goals of the project and each key stakeholder is empowered to submit is
+
+267
+00:20:14,000 --> 00:20:19,000
+a change request when you business requirement, which delivery teams should be able to address.
+
+268
+00:20:19,000 --> 00:20:25,000
+So we can say that each delivery team, which is connected with key stakeholders, has a single responsibility
+
+269
+00:20:25,000 --> 00:20:29,000
+connected with a specific part of the requirements for the whole system.
+
+270
+00:20:30,000 --> 00:20:36,000
+That's why a system architecture is designed in the way that each delivery team doesn't impact another
+
+271
+00:20:36,000 --> 00:20:36,000
+one.
+
+272
+00:20:37,000 --> 00:20:42,000
+But in this case, we can treat single responsibility principle on another level of abstraction.
+
+273
+00:20:42,000 --> 00:20:46,000
+In comparison, when we talk about this principle in scope of one class.
+
+274
+00:20:47,000 --> 00:20:53,000
+So you can see on this simple example, we discussed how single responsibility, principle and Conaway's
+
+275
+00:20:53,000 --> 00:21:00,000
+law both affect our system architecture and called organization unions are grouping items in your application.
+
+276
+00:21:00,000 --> 00:21:04,000
+You also need to take into consideration some technical factors.
+
+277
+00:21:04,000 --> 00:21:10,000
+For example, in Java, if you smart and build two from a page, you're forced to follow some basic
+
+278
+00:21:10,000 --> 00:21:16,000
+conventions where to put source code, where to put the public resources and where to put resources,
+
+279
+00:21:16,000 --> 00:21:19,000
+which you don't want to be accessible from the outside of the server.
+
+280
+00:21:19,000 --> 00:21:25,000
+Some of frameworks work better with a given structure like spring, and we see, for example, you can
+
+281
+00:21:25,000 --> 00:21:26,000
+group all your classes.
+
+282
+00:21:26,000 --> 00:21:32,000
+We should process requests and that one package because this framework will scan specific package to
+
+283
+00:21:32,000 --> 00:21:34,000
+instantiate necessary request handlers.
+
+284
+00:21:35,000 --> 00:21:37,000
+There is no harm in this technical factors.
+
+285
+00:21:37,000 --> 00:21:43,000
+At the end of the day, software development process is always a question of tradeoffs between many
+
+286
+00:21:43,000 --> 00:21:43,000
+things.
+
+287
+00:21:43,000 --> 00:21:47,000
+You can try to address one potential issue and receive another one.
+
+288
+00:21:47,000 --> 00:21:48,000
+Not in the theory.
+
+289
+00:21:49,000 --> 00:21:54,000
+You can always analyze specific case impartially and opt for the best option, which works specifically
+
+290
+00:21:54,000 --> 00:21:59,000
+for you and specifically for your project at this moment of time.
+
+291
+00:21:59,000 --> 00:22:05,000
+We shouldn't forget the tools and practices which were described in this lesson weren't created to make
+
+292
+00:22:05,000 --> 00:22:06,000
+things even more complex.
+
+293
+00:22:06,000 --> 00:22:11,000
+The goal is one to simplify solution of most common issues.
+
+294
+00:22:11,000 --> 00:22:13,000
+That's where partners are come from all.
+
+295
+00:22:13,000 --> 00:22:19,000
+Always remember that your structure should be easily navigable and should embrace the most common scenarios.
+
+296
+00:22:20,000 --> 00:22:21,000
+It also works dimensions.
+
+297
+00:22:21,000 --> 00:22:26,000
+That's probably the one of the proven ways to learn how to architect system so that it would be scalable,
+
+298
+00:22:27,000 --> 00:22:32,000
+maintainable and elements of the system will be easily reusable is getting more experience.
+
+299
+00:22:33,000 --> 00:22:35,000
+Feel free to find inspiration in open source projects.
+
+300
+00:22:36,000 --> 00:22:42,000
+Experiment with your own projects to find the recipe which will work and never forget about naming conventions
+
+301
+00:22:42,000 --> 00:22:43,000
+in your code.
+
+302
+00:22:44,000 --> 00:22:50,000
+No matter your given name to a variable across an interface or a module clean code design.
+
+303
+00:22:50,000 --> 00:22:54,000
+It is a constant process, but not one time activity.
+
+304
+00:22:54,000 --> 00:22:59,000
+Use tools which we have in place to support in design and to share experience with team members.
+
+305
+00:23:00,000 --> 00:23:05,000
+For example, you can drive clean design on your projects through the code review process or pair programming.
+
+306
+00:23:06,000 --> 00:23:11,000
+Nowadays we have multiple tools for study code analysis, which might help you to analyze metrics which
+
+307
+00:23:11,000 --> 00:23:14,000
+will force to maintain the architecture of your application.
+
+308
+00:23:15,000 --> 00:23:21,000
+For example, the next tools check JQ Assistant Tool, which can help you to validate dependencies between
+
+309
+00:23:21,000 --> 00:23:27,000
+more use of your project, including detection of common problems like cyclic dependencies.
+
+310
+00:23:27,000 --> 00:23:29,000
+It is also forces naming convention.
+
+311
+00:23:30,000 --> 00:23:36,000
+Such tool can easily be plugged into the build process to automate detection of constraint violations
+
+312
+00:23:36,000 --> 00:23:41,000
+and generate reports about user defined concepts and metrics structure.
+
+313
+00:23:41,000 --> 00:23:48,000
+Rieser software like this one has one goal to allow software developers to easily create software architecture
+
+314
+00:23:48,000 --> 00:23:50,000
+diagrams that reflect the code.
+
+315
+00:23:51,000 --> 00:23:56,000
+Unfortunately, static diagrams whether drawn on board what was the general purpose diagram?
+
+316
+00:23:56,000 --> 00:24:02,000
+And to tend to get out of date quickly and often don't reflect the real structure of the code.
+
+317
+00:24:03,000 --> 00:24:06,000
+That's where software like structure structuralism come into play.
+
+318
+00:24:06,000 --> 00:24:09,000
+I believe that you can find a lot of other similar tools.
+
+319
+00:24:10,000 --> 00:24:14,000
+These are just a few that I'd like to specify as a reference.
+
+320
+00:24:15,000 --> 00:24:16,000
+That's what I have for you for today.
+
+321
+00:24:17,000 --> 00:24:19,000
+Let's recap what we have learned today.
+
+322
+00:24:19,000 --> 00:24:20,000
+In this lesson.
+
+323
+00:24:20,000 --> 00:24:27,000
+We learned what captain principles are, and we talked in detail about such principles as cyclic dependencies,
+
+324
+00:24:27,000 --> 00:24:30,000
+stable dependencies and stable abstractions.
+
+325
+00:24:30,000 --> 00:24:34,000
+We also reviewed with your other principles that can impact your architecture.
+
+326
+00:24:34,000 --> 00:24:40,000
+Now you know how to group your code and package by way of principle and package by feature.
+
+327
+00:24:40,000 --> 00:24:46,000
+Principal explained you Conaway's law and how technical factors may impact our, quote, organization.
+
+328
+00:24:47,000 --> 00:24:47,000
+That's it.
+
+329
+00:24:48,000 --> 00:24:49,000
+Thanks a lot for your attention.
+
+330
+00:24:49,000 --> 00:24:52,000
+Have a great day and see you in the next lesson.
+
diff --git a/38 - Object-oriented Architecture, Clean Code Design (Advanced)/external-links.txt b/38 - Object-oriented Architecture, Clean Code Design (Advanced)/external-links.txt
new file mode 100644
index 0000000000000000000000000000000000000000..af22b03fcf2e9236466fcee9cba1f5c37ce3aece
--- /dev/null
+++ b/38 - Object-oriented Architecture, Clean Code Design (Advanced)/external-links.txt
@@ -0,0 +1,15 @@
+
+002 Source-code-of-Tell-don-t-ask-example-
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/oop/telldontask
+
+002 Source-code-of-data-structures-example
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/oop/datastructures
+
+004 Source-code-examples-shown-in-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/oop/kiss
+
+005 Source-code-examples-shown-in-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/oop/yagni
+
+007 Source-code-examples-shown-in-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/oop/dry
diff --git a/39 - GoF Design Patterns of Software Architecture in OOP/001 GoF Patterns Overview_en.srt b/39 - GoF Design Patterns of Software Architecture in OOP/001 GoF Patterns Overview_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..05c444e824e00107b9e11e3966bdcef066759ef1
--- /dev/null
+++ b/39 - GoF Design Patterns of Software Architecture in OOP/001 GoF Patterns Overview_en.srt
@@ -0,0 +1,744 @@
+1
+00:00:05,000 --> 00:00:09,000
+How are the students today with that very important topic?
+
+2
+00:00:09,000 --> 00:00:15,000
+We start learning of so-called Gulfport's in object oriented design, and even before we start learning
+
+3
+00:00:15,000 --> 00:00:20,000
+of golf partners, we'll try to answer a simple question why do we need design patterns?
+
+4
+00:00:21,000 --> 00:00:26,000
+And the context will help you to feel motivation that stands behind each partner.
+
+5
+00:00:26,000 --> 00:00:31,000
+In this lesson, we are going to answer first one golf patterns are and why they're called.
+
+6
+00:00:31,000 --> 00:00:38,000
+So after that, we'll learn what the key points of golf patterns we are going to review with your occasional
+
+7
+00:00:38,000 --> 00:00:45,000
+structural and behavioral patterns, how to explain what is the difference between these types of patterns.
+
+8
+00:00:45,000 --> 00:00:48,000
+And I will list main patterns from each group.
+
+9
+00:00:48,000 --> 00:00:52,000
+Also, we will learn what class and object patterns are.
+
+10
+00:00:52,000 --> 00:00:58,000
+This lesson will help you to understand what we are going to learn in this section, namely what partners
+
+11
+00:00:58,000 --> 00:00:59,000
+will learn.
+
+12
+00:01:00,000 --> 00:01:05,000
+And at the end of the lesson, I will give answers on the most common questions of my students who just
+
+13
+00:01:05,000 --> 00:01:07,000
+started going in design patterns.
+
+14
+00:01:08,000 --> 00:01:10,000
+It looks like we have really a lot of things to learn today.
+
+15
+00:01:10,000 --> 00:01:11,000
+Let's start.
+
+16
+00:01:11,000 --> 00:01:14,000
+And as I said before, let's try to understand first.
+
+17
+00:01:14,000 --> 00:01:21,000
+Why do we need design patterns when we develop software the way how we think is different?
+
+18
+00:01:21,000 --> 00:01:25,000
+Each of us can come up with different solutions for the same engineering issue.
+
+19
+00:01:26,000 --> 00:01:32,000
+And back that time, there was no any standard or general advisees of how to design application.
+
+20
+00:01:33,000 --> 00:01:38,000
+Each project had new style, new structure, and each new team members are joining.
+
+21
+00:01:38,000 --> 00:01:41,000
+The team brought his own vision on architecture.
+
+22
+00:01:41,000 --> 00:01:45,000
+Understanding of project architecture was a very complex task.
+
+23
+00:01:45,000 --> 00:01:51,000
+Well, design partners address these kind of issues and provide us with a set of solutions for most
+
+24
+00:01:51,000 --> 00:01:52,000
+difficult problems.
+
+25
+00:01:52,000 --> 00:01:56,000
+And these solutions serve as a platform for all developers.
+
+26
+00:01:57,000 --> 00:02:01,000
+We also can treat partners as recorded experience of experts in the field.
+
+27
+00:02:02,000 --> 00:02:08,000
+These design partners are intended to be used in object oriented programs and allows us to use the same
+
+28
+00:02:08,000 --> 00:02:10,000
+partners across different projects.
+
+29
+00:02:10,000 --> 00:02:16,000
+Now we understand the context, and I believe it is clear for you why we need to follow design partners
+
+30
+00:02:16,000 --> 00:02:17,000
+during the development.
+
+31
+00:02:17,000 --> 00:02:24,000
+But probably the interesting thing is to understand why these partners called Gulf Partners.
+
+32
+00:02:25,000 --> 00:02:31,000
+The name comes from the group of authors of the one great book that was written in 1990 Force.
+
+33
+00:02:32,000 --> 00:02:38,000
+The book was written by Eric Gummo, Richard Helm, Robert Johnson and John say this.
+
+34
+00:02:38,000 --> 00:02:40,000
+You can find this book online if you wish.
+
+35
+00:02:40,000 --> 00:02:45,000
+The book name is Design Patterns, elements of reusable object oriented software.
+
+36
+00:02:46,000 --> 00:02:48,000
+As I said, you can find and download it.
+
+37
+00:02:48,000 --> 00:02:54,000
+But anyway, in this course I will walk you through the most popular patterns that are still relevant
+
+38
+00:02:54,000 --> 00:02:55,000
+even nowadays.
+
+39
+00:02:56,000 --> 00:03:01,000
+And I will explain these patterns in simple words with the help of real life examples that I prepared
+
+40
+00:03:01,000 --> 00:03:04,000
+for you and that are true examples from my practice.
+
+41
+00:03:05,000 --> 00:03:13,000
+This also became known as Gang of Four, and basically partners from that book is called Gulf Partners.
+
+42
+00:03:13,000 --> 00:03:19,000
+Even despite Baja's I described in the book with examples, there may be different models, variations
+
+43
+00:03:19,000 --> 00:03:22,000
+of such patterns, and I will show you all of them.
+
+44
+00:03:23,000 --> 00:03:29,000
+Gang of Four described one in three portraits that were developed by the common experiences of software
+
+45
+00:03:29,000 --> 00:03:31,000
+developers of a period of time.
+
+46
+00:03:31,000 --> 00:03:33,000
+Nowadays, it is pretty common practice.
+
+47
+00:03:33,000 --> 00:03:39,000
+When a new member joins a development team, then the developer learns about the existing architecture.
+
+48
+00:03:40,000 --> 00:03:45,000
+This allows the developer to actively participate in the development process within a short period of
+
+49
+00:03:45,000 --> 00:03:46,000
+time.
+
+50
+00:03:46,000 --> 00:03:52,000
+What else we need to know about growth patterns before jump into details, let's review key points of
+
+51
+00:03:52,000 --> 00:03:53,000
+growth patterns.
+
+52
+00:03:54,000 --> 00:03:56,000
+The following are key points about design patterns.
+
+53
+00:03:57,000 --> 00:04:03,000
+Each design pattern is a general and reusable solution for repeatable and commonly occurring issues.
+
+54
+00:04:03,000 --> 00:04:10,000
+So the concept tells us that in typical issues you can apply typical solution without reinventing the
+
+55
+00:04:10,000 --> 00:04:10,000
+wheel.
+
+56
+00:04:11,000 --> 00:04:14,000
+And these solutions have approval over long periods of time.
+
+57
+00:04:14,000 --> 00:04:20,000
+As you can understand from this point, there are no reasons to follow patterns just because it is a
+
+58
+00:04:20,000 --> 00:04:27,000
+common practice we follow just to solve our specific issue, which is whose experience it was collected
+
+59
+00:04:27,000 --> 00:04:28,000
+over time.
+
+60
+00:04:29,000 --> 00:04:35,000
+Usually each pattern is a template of our solution that help us to achieve that better architecture
+
+61
+00:04:35,000 --> 00:04:35,000
+design.
+
+62
+00:04:35,000 --> 00:04:40,000
+Significantly faster patterns are generic and flexible for customization.
+
+63
+00:04:40,000 --> 00:04:45,000
+So each pattern describes the way how to create objects and classes.
+
+64
+00:04:45,000 --> 00:04:52,000
+And also the pattern provides us with the description of customization, the solution to achieve goal
+
+65
+00:04:52,000 --> 00:04:53,000
+in the particular context.
+
+66
+00:04:54,000 --> 00:04:57,000
+Zwigoff patterns describe twenty three design patterns.
+
+67
+00:04:57,000 --> 00:05:02,000
+Each of these patterns focuses on a particular object oriented design issue.
+
+68
+00:05:02,000 --> 00:05:09,000
+To solve, each partner can also describe the consequences and tradeoffs of use, all these 23 questions
+
+69
+00:05:09,000 --> 00:05:17,000
+are grouped in three main groups, Ziya creation patterns, structural and behavioral patterns.
+
+70
+00:05:17,000 --> 00:05:20,000
+Let's look at the list of patterns from each group.
+
+71
+00:05:20,000 --> 00:05:21,000
+In this course.
+
+72
+00:05:21,000 --> 00:05:24,000
+We are going to learn patterns from the list on this slide.
+
+73
+00:05:24,000 --> 00:05:27,000
+We don't have goal to halt overview of each part.
+
+74
+00:05:27,000 --> 00:05:32,000
+And I just want to give you an overview of what we are going to learn with you in this course.
+
+75
+00:05:33,000 --> 00:05:37,000
+You can see the names of all twenty three partners that are grouped into three groups.
+
+76
+00:05:38,000 --> 00:05:46,000
+So you can see that such patterns as Singleton prototype factory, MassArt builder and factory partners
+
+77
+00:05:46,000 --> 00:05:48,000
+are considered to be a creation of bias.
+
+78
+00:05:49,000 --> 00:05:51,000
+What is the main goal of Gradational partners?
+
+79
+00:05:51,000 --> 00:05:54,000
+These partners describe the instantiation process.
+
+80
+00:05:55,000 --> 00:06:02,000
+You make the system independent from how the objects are composed, created and represented in software
+
+81
+00:06:02,000 --> 00:06:03,000
+engineering creation.
+
+82
+00:06:03,000 --> 00:06:09,000
+Design patterns are design partners and deal with object creation mechanism, trying to create objects
+
+83
+00:06:09,000 --> 00:06:12,000
+in a manner suitable to the situation.
+
+84
+00:06:12,000 --> 00:06:19,000
+The basic form of object creation could result in design problems or added complexity to the design
+
+85
+00:06:20,000 --> 00:06:25,000
+creation design part and solve this problem by somehow controlling this object creation.
+
+86
+00:06:25,000 --> 00:06:33,000
+Sometimes creation of patterns are competitors there cases one is a prototype or abstract factory could
+
+87
+00:06:33,000 --> 00:06:34,000
+be used profitably.
+
+88
+00:06:34,000 --> 00:06:37,000
+At other times they are complementary.
+
+89
+00:06:37,000 --> 00:06:43,000
+Abasic factory might store a set of prototypes from which to clone and return product objects.
+
+90
+00:06:43,000 --> 00:06:50,000
+Abstract factory might store a set of prototypes from which to clone and return a group of related objects.
+
+91
+00:06:50,000 --> 00:06:55,000
+Builder can use one of the other parts to implement which components get built.
+
+92
+00:06:56,000 --> 00:07:01,000
+Abstract factory builder and prototype can use Singleton in the implementation.
+
+93
+00:07:02,000 --> 00:07:08,000
+Abstract factory classes are often implemented with factory methods, but they can also be implemented
+
+94
+00:07:08,000 --> 00:07:09,000
+using prototype.
+
+95
+00:07:10,000 --> 00:07:14,000
+Builder focuses on constructing a complex object step by step.
+
+96
+00:07:15,000 --> 00:07:21,000
+Often design stars out using factory method, which is less complicated, more customizable based on
+
+97
+00:07:21,000 --> 00:07:28,000
+subclasses, and evolve towards abstract factory prototype or builder that is more flexible and a more
+
+98
+00:07:28,000 --> 00:07:33,000
+complex solution as a design and discovers where more flexibility is needed.
+
+99
+00:07:34,000 --> 00:07:36,000
+The next group is a group of structural patterns.
+
+100
+00:07:37,000 --> 00:07:45,000
+Their proxy pardon flyweight Partan Composite Partan Bridge Facade Decorator and Adapter Partan.
+
+101
+00:07:45,000 --> 00:07:53,000
+This group of partners focuses on how classes and objects can be composed to form relatively large structures.
+
+102
+00:07:53,000 --> 00:07:57,000
+They generally use inheritance to compose interfaces or implementations.
+
+103
+00:07:58,000 --> 00:07:59,000
+Structural design partners.
+
+104
+00:07:59,000 --> 00:08:00,000
+I design patterns.
+
+105
+00:08:00,000 --> 00:08:06,000
+That is a design by identifying a simple way to realize the relationships between entities.
+
+106
+00:08:06,000 --> 00:08:10,000
+What defines and manner for creating relationships between objects?
+
+107
+00:08:10,000 --> 00:08:13,000
+What is the difference between structural and relational parents?
+
+108
+00:08:14,000 --> 00:08:19,000
+Conditional patterns are patterns that provides a way to create objects while height in the creation
+
+109
+00:08:19,000 --> 00:08:20,000
+of logic.
+
+110
+00:08:20,000 --> 00:08:26,000
+This provides us flexibility for creating objects based on different use cases.
+
+111
+00:08:26,000 --> 00:08:29,000
+Some examples of operational patterns we have discussed already.
+
+112
+00:08:29,000 --> 00:08:33,000
+So based on your use case, you can decide which point to use.
+
+113
+00:08:33,000 --> 00:08:40,000
+On the other hand, structural patterns provide us with options how to clap classes and objects together
+
+114
+00:08:40,000 --> 00:08:42,000
+to form large structures.
+
+115
+00:08:42,000 --> 00:08:43,000
+Does it make sense?
+
+116
+00:08:43,000 --> 00:08:46,000
+And we have group of behavioral patterns here on the slide.
+
+117
+00:08:47,000 --> 00:08:48,000
+These as an experience.
+
+118
+00:08:49,000 --> 00:08:59,000
+Observe Observer Strategy Template Masset Command Iterator Mylanta, state mediator, chain of responsibility,
+
+119
+00:08:59,000 --> 00:09:01,000
+visitor, partner and interpreter.
+
+120
+00:09:01,000 --> 00:09:02,000
+Pratham.
+
+121
+00:09:02,000 --> 00:09:09,000
+These points put a stress on algorithm's and the assignment of responsibilities and objects to ensure
+
+122
+00:09:09,000 --> 00:09:11,000
+efficient communication between them.
+
+123
+00:09:12,000 --> 00:09:16,000
+Behavioral patterns explain how objects interact between each other.
+
+124
+00:09:16,000 --> 00:09:23,000
+These partners describe how different objects and classes send messages to each other to make things
+
+125
+00:09:23,000 --> 00:09:27,000
+happen and how the steps of a task are divided among different objects.
+
+126
+00:09:28,000 --> 00:09:31,000
+What is the difference between creation and structural patterns?
+
+127
+00:09:32,000 --> 00:09:38,000
+Congressional partners mostly describe a moment of time, moment of object creation and structural patterns
+
+128
+00:09:38,000 --> 00:09:41,000
+describe and more or less static structure.
+
+129
+00:09:41,000 --> 00:09:44,000
+Behavioral patterns describe a process or a flow.
+
+130
+00:09:45,000 --> 00:09:51,000
+Behavioral patterns, on the other hand, changes the way your classes behave by changing the way they
+
+131
+00:09:51,000 --> 00:09:57,000
+interact with other classes and interfaces and the way other classes and interfaces interact with them.
+
+132
+00:09:58,000 --> 00:10:02,000
+Now, you know the main classification of Goave patterns these.
+
+133
+00:10:02,000 --> 00:10:07,000
+Apartments that we are going to learn, but also there is another classification of old patterns that
+
+134
+00:10:07,000 --> 00:10:14,000
+we need to be aware of, the Gang of Four made another classification based on Skoch Lane was a department
+
+135
+00:10:14,000 --> 00:10:22,000
+primary, focuses on the colossus or its objects class deal with classes and subclasses.
+
+136
+00:10:22,000 --> 00:10:30,000
+They use inheritance mechanism which are static and fixed at compile time object pathogen's view with
+
+137
+00:10:30,000 --> 00:10:32,000
+objects that can change at runtime.
+
+138
+00:10:33,000 --> 00:10:36,000
+So objects patterns are dynamic because.
+
+139
+00:10:36,000 --> 00:10:42,000
+We used to investigate the current slide and believes there is no need to name out loud each person
+
+140
+00:10:42,000 --> 00:10:43,000
+in each group here.
+
+141
+00:10:43,000 --> 00:10:49,000
+This table will help you to understand what design patterns in which group consider it to be is a class
+
+142
+00:10:49,000 --> 00:10:50,000
+of objects.
+
+143
+00:10:51,000 --> 00:10:55,000
+Now let me answer the most popular questions from my students.
+
+144
+00:10:55,000 --> 00:10:59,000
+And the first question is related to the difference between lust and object patterns.
+
+145
+00:11:00,000 --> 00:11:05,000
+Namely, if this is the first time you see these spirals and trying to understand them.
+
+146
+00:11:05,000 --> 00:11:11,000
+The difference between these two groups is not obvious from the first glance, angry answering this
+
+147
+00:11:11,000 --> 00:11:13,000
+question in a general way.
+
+148
+00:11:13,000 --> 00:11:17,000
+Class patterns focus on static relationship and objects.
+
+149
+00:11:17,000 --> 00:11:20,000
+Parents can focus on dynamic relationships.
+
+150
+00:11:20,000 --> 00:11:28,000
+As the name suggests, class parents focus on classes and their subclasses and object patterns focus
+
+151
+00:11:28,000 --> 00:11:30,000
+on the objects relationships.
+
+152
+00:11:30,000 --> 00:11:34,000
+On this slide, they can see specific difference between class and object patterns.
+
+153
+00:11:35,000 --> 00:11:40,000
+When we are talking about correlational patterns, we should understand that class patterns will be
+
+154
+00:11:40,000 --> 00:11:44,000
+based on the inheritance and mechanisms that are fixed and compile time.
+
+155
+00:11:45,000 --> 00:11:52,000
+Class patterns can differ creation of object to subclasses, whereas object patterns use objects at
+
+156
+00:11:52,000 --> 00:11:55,000
+the wrong time and can delegate object creation to another object.
+
+157
+00:11:56,000 --> 00:11:57,000
+As we go through each part.
+
+158
+00:11:57,000 --> 00:12:00,000
+And you will see this difference on real examples.
+
+159
+00:12:00,000 --> 00:12:07,000
+Structural class patterns focus on composition of classes, whereas structural objects patterns focus
+
+160
+00:12:07,000 --> 00:12:09,000
+on different ways of objects composition.
+
+161
+00:12:10,000 --> 00:12:16,000
+The hero class patterns describe algorithms and execution flows and behavioral objects.
+
+162
+00:12:16,000 --> 00:12:22,000
+Patterns describe how different objects can work together and complete a task home.
+
+163
+00:12:22,000 --> 00:12:23,000
+This makes more sense.
+
+164
+00:12:23,000 --> 00:12:27,000
+Now, the next question that is also one of the popular ones.
+
+165
+00:12:27,000 --> 00:12:32,000
+It was apparent that we are going to learn aspecific to any of the programming language.
+
+166
+00:12:33,000 --> 00:12:34,000
+The short answer is no.
+
+167
+00:12:35,000 --> 00:12:41,000
+The patterns are general and can be reused in different programming languages where object oriented
+
+168
+00:12:41,000 --> 00:12:42,000
+approach is applied.
+
+169
+00:12:42,000 --> 00:12:47,000
+Both partners are just templates that can be implemented in different programming languages.
+
+170
+00:12:47,000 --> 00:12:54,000
+Take into account specifics of any particular language is the next question is can implementation of
+
+171
+00:12:54,000 --> 00:12:58,000
+one part in my code exclude the possibility of applying different parts?
+
+172
+00:12:59,000 --> 00:13:00,000
+I would answer it this way.
+
+173
+00:13:01,000 --> 00:13:04,000
+In most cases, parents complement each other.
+
+174
+00:13:04,000 --> 00:13:09,000
+Some other persons have just subtle differences and even more.
+
+175
+00:13:09,000 --> 00:13:13,000
+Combining different patterns in one application is a common practice nowadays.
+
+176
+00:13:14,000 --> 00:13:19,000
+In the case you have any other questions at this moment, do not hesitate to leave your question in
+
+177
+00:13:19,000 --> 00:13:20,000
+comments to this video.
+
+178
+00:13:21,000 --> 00:13:23,000
+Let's recap what we have learned today.
+
+179
+00:13:24,000 --> 00:13:25,000
+In this lesson we learned.
+
+180
+00:13:25,000 --> 00:13:29,000
+Why do we need design patterns and what growth patterns are explained?
+
+181
+00:13:29,000 --> 00:13:31,000
+Key points of growth patterns.
+
+182
+00:13:32,000 --> 00:13:37,000
+Now, you know, what is the difference between correlational structural and behavioural group of parents?
+
+183
+00:13:38,000 --> 00:13:44,000
+Also, we learned what class and object patterns are, and I answer it as the most common questions
+
+184
+00:13:44,000 --> 00:13:48,000
+of my students about design patterns that set for this lesson.
+
+185
+00:13:48,000 --> 00:13:50,000
+Thanks a lot for your attention.
+
+186
+00:13:50,000 --> 00:13:53,000
+Have a great day and see you in the next lesson.
+
diff --git a/39 - GoF Design Patterns of Software Architecture in OOP/002 Creational Patterns_en.srt b/39 - GoF Design Patterns of Software Architecture in OOP/002 Creational Patterns_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..b9ed9e3c1997d7ef6454a295165bb103ec1707c5
--- /dev/null
+++ b/39 - GoF Design Patterns of Software Architecture in OOP/002 Creational Patterns_en.srt
@@ -0,0 +1,1688 @@
+1
+00:00:05,000 --> 00:00:10,000
+Hello there, students in this class, and we start learning correlational patterns in previous lessons,
+
+2
+00:00:10,000 --> 00:00:15,000
+we already performed an overview of correlational structural and behavioral patterns.
+
+3
+00:00:15,000 --> 00:00:21,000
+Now it is time to learn patterns from each group one by one, and we'll start from correlational patterns.
+
+4
+00:00:21,000 --> 00:00:28,000
+That's why in this lesson, we'll dive into the specifics of each gradational pattern in our plans to
+
+5
+00:00:28,000 --> 00:00:33,000
+review today's single done prototype factor and method builder and abstract factory pattern.
+
+6
+00:00:34,000 --> 00:00:39,000
+Especially for this lesson, I prepared good examples that will help you to understand and learn these
+
+7
+00:00:39,000 --> 00:00:40,000
+patterns faster.
+
+8
+00:00:41,000 --> 00:00:47,000
+Let's start in the first part on a Singleton will review each part in the similar format.
+
+9
+00:00:47,000 --> 00:00:54,000
+The first thing that we'll learn for each project is its intent and what problem we are going to address
+
+10
+00:00:54,000 --> 00:00:54,000
+with the sporran.
+
+11
+00:00:55,000 --> 00:01:02,000
+Intent of the Singleton pattern is to ensure a class has only one instance and provide a global point
+
+12
+00:01:02,000 --> 00:01:03,000
+of access to it.
+
+13
+00:01:04,000 --> 00:01:09,000
+But what problem will address in the case will have only one instance of object in our app.
+
+14
+00:01:09,000 --> 00:01:16,000
+In some cases, we don't need to create a new instance of the class each time we need immagine simple
+
+15
+00:01:16,000 --> 00:01:16,000
+example.
+
+16
+00:01:16,000 --> 00:01:19,000
+You have type code order management service.
+
+17
+00:01:19,000 --> 00:01:26,000
+The object of this class can place order and you really don't need to create multiple objects of the
+
+18
+00:01:26,000 --> 00:01:28,000
+same type because actually you don't need it.
+
+19
+00:01:29,000 --> 00:01:32,000
+What you need is just a behavior of place in order.
+
+20
+00:01:32,000 --> 00:01:38,000
+And this behavior can be executed by one single object in the application during the runtime.
+
+21
+00:01:38,000 --> 00:01:45,000
+We are going to save a little bit memory in a heap by not creating new object each new time we need
+
+22
+00:01:45,000 --> 00:01:45,000
+it.
+
+23
+00:01:45,000 --> 00:01:51,000
+We know that Java has automated memory management and we can find garbage collector in Java too.
+
+24
+00:01:51,000 --> 00:01:58,000
+But in case we will create millions of such objects that we just use only one time and that's it, we
+
+25
+00:01:58,000 --> 00:02:03,000
+will wake up garbage collector and this can reduce performance a little bit and temporarily.
+
+26
+00:02:03,000 --> 00:02:09,000
+So in this case, I just want to be sure that I don't need to make garbage collector work by creating
+
+27
+00:02:09,000 --> 00:02:11,000
+a lot of object in memory.
+
+28
+00:02:11,000 --> 00:02:17,000
+Now, when we understood the goal of Singleton pardon, let's jump to the example and we'll look at
+
+29
+00:02:17,000 --> 00:02:18,000
+the implementation.
+
+30
+00:02:18,000 --> 00:02:21,000
+So here we have order management, service class.
+
+31
+00:02:21,000 --> 00:02:27,000
+The first thing that we need to do if we want to implement Singleton pardon is to declare private static
+
+32
+00:02:27,000 --> 00:02:28,000
+fields of the same type.
+
+33
+00:02:29,000 --> 00:02:33,000
+This field will hold the reference to the single instance of the type.
+
+34
+00:02:33,000 --> 00:02:37,000
+The second thing that we need to do is to create a private constructor.
+
+35
+00:02:37,000 --> 00:02:43,000
+We need to make constructor private so that no one will be able to get access to it and call this constructor
+
+36
+00:02:43,000 --> 00:02:45,000
+outside of this class.
+
+37
+00:02:45,000 --> 00:02:50,000
+This allows us to restrict objects instantiation outside of this class.
+
+38
+00:02:50,000 --> 00:02:54,000
+The the things that we should do, we need to declare public static function.
+
+39
+00:02:55,000 --> 00:03:01,000
+We'll call it accessor function that will allow and users to access our object when it will be needed.
+
+40
+00:03:02,000 --> 00:03:08,000
+Pay attention to this function should be public and we will invoke it with the help of the class taking
+
+41
+00:03:08,000 --> 00:03:11,000
+into account we won't be able to create an instance of a class.
+
+42
+00:03:12,000 --> 00:03:16,000
+Also, I will implement the initialization inside this accessor function.
+
+43
+00:03:16,000 --> 00:03:18,000
+What does the initialization mean?
+
+44
+00:03:19,000 --> 00:03:25,000
+This means that I initialise object, not when the program is started, but I initialize the object
+
+45
+00:03:25,000 --> 00:03:32,000
+on request when it is first called here in MassArt, you can see that I perform check and if our static
+
+46
+00:03:32,000 --> 00:03:36,000
+field is now, then I initialise object.
+
+47
+00:03:36,000 --> 00:03:43,000
+In both cases I return the reference to the same object all times to avoid the very edge case of creation
+
+48
+00:03:43,000 --> 00:03:46,000
+of two objects from different sets of execution.
+
+49
+00:03:46,000 --> 00:03:52,000
+I also add synchronized keyword to this method to make sure that only once relative execution will be
+
+50
+00:03:52,000 --> 00:03:54,000
+able to enter this method.
+
+51
+00:03:54,000 --> 00:04:00,000
+But simultaneously and after that you can declare any non static behavior of this type.
+
+52
+00:04:00,000 --> 00:04:04,000
+So any message you would like to create, feel free to do it.
+
+53
+00:04:04,000 --> 00:04:07,000
+You will be able to call these methods on this object.
+
+54
+00:04:07,000 --> 00:04:13,000
+I will add one method placeholder, just an example here, basically.
+
+55
+00:04:13,000 --> 00:04:18,000
+That said, let me now open the file and show you how we can use Singleton Parren.
+
+56
+00:04:18,000 --> 00:04:22,000
+I am writing this file to explore console output with you.
+
+57
+00:04:22,000 --> 00:04:27,000
+I can create two references and initialize and use order management service object.
+
+58
+00:04:28,000 --> 00:04:34,000
+And when I compare it with equals operator, I get true because in both cases I get the reference to
+
+59
+00:04:34,000 --> 00:04:40,000
+the same object and you can initialize any filter for the management service type in your program like
+
+60
+00:04:40,000 --> 00:04:41,000
+this.
+
+61
+00:04:41,000 --> 00:04:45,000
+And be sure that you have only one object of the current type in the memory.
+
+62
+00:04:46,000 --> 00:04:49,000
+You can see here that taking into account our constructor is private.
+
+63
+00:04:50,000 --> 00:04:57,000
+I can't invoke constructor and once we get reference to object of our type, we can call any other methods
+
+64
+00:04:57,000 --> 00:04:58,000
+of this object.
+
+65
+00:04:58,000 --> 00:05:02,000
+So here I can call place or a method, for example.
+
+66
+00:05:02,000 --> 00:05:09,000
+And we can see in console output that this message was invoked on the Object Hoglan, now it is clear
+
+67
+00:05:09,000 --> 00:05:11,000
+for you how to implement Singleton pardon?
+
+68
+00:05:12,000 --> 00:05:13,000
+Now let's discuss a few things.
+
+69
+00:05:14,000 --> 00:05:20,000
+It is worth to mention that sometimes you can find in the Internet that Singleton pardon is pure evil
+
+70
+00:05:20,000 --> 00:05:27,000
+and somebody even treated as an antiabortion and telling us that is something we never should do.
+
+71
+00:05:27,000 --> 00:05:31,000
+I recommend you to be professional and don't fall in the false argument.
+
+72
+00:05:32,000 --> 00:05:35,000
+Let's try to understand why some people had some guilt on pardon.
+
+73
+00:05:36,000 --> 00:05:40,000
+First of all, I would like to say that in a case, this pardon would not be needed.
+
+74
+00:05:40,000 --> 00:05:41,000
+It would just don't exist.
+
+75
+00:05:42,000 --> 00:05:43,000
+But it exists for a reason.
+
+76
+00:05:44,000 --> 00:05:49,000
+So each pardon comes with pros and cons and we just should be aware about those rather.
+
+77
+00:05:49,000 --> 00:05:54,000
+And statements at this point is that each pardon is good for a specific case.
+
+78
+00:05:54,000 --> 00:06:01,000
+The first thing that haters of Singleton pardon is mentioning is that this specific implementation violates
+
+79
+00:06:01,000 --> 00:06:02,000
+single responsibility principle.
+
+80
+00:06:03,000 --> 00:06:09,000
+So at this moment, our order management service is responsible for both managing his own life cycle
+
+81
+00:06:09,000 --> 00:06:11,000
+and order management.
+
+82
+00:06:11,000 --> 00:06:17,000
+But how critical it is, I would say that taking into account his first responsibility, we have mentioned
+
+83
+00:06:17,000 --> 00:06:24,000
+managing lifecycle doesn't depend on other units and it is very little chance that this responsibility
+
+84
+00:06:24,000 --> 00:06:26,000
+becomes a separate reason to change.
+
+85
+00:06:26,000 --> 00:06:33,000
+And also, one will learn frameworks for Enterprise Java, for example, IGB that stands for Enterprise
+
+86
+00:06:33,000 --> 00:06:35,000
+Java Beans Hotspring Framework.
+
+87
+00:06:35,000 --> 00:06:41,000
+We will discover that these technologies describe so-called containers that manage lifecycle of all
+
+88
+00:06:41,000 --> 00:06:46,000
+instances in the app in spring, the full scope of all beans a single singleton.
+
+89
+00:06:47,000 --> 00:06:52,000
+In this case, responsibility for managing lifecycle is transferred to spring and that is fine.
+
+90
+00:06:53,000 --> 00:06:59,000
+But what to do in case you need Singleton and you don't have such container like in spring or in IGB.
+
+91
+00:06:59,000 --> 00:07:01,000
+So this point is discussable.
+
+92
+00:07:01,000 --> 00:07:08,000
+The second thing why some people hate Singleton is about static nature inside its implementation.
+
+93
+00:07:08,000 --> 00:07:09,000
+And you know what?
+
+94
+00:07:09,000 --> 00:07:15,000
+Sometimes people just hate and sinks without getting deeper understanding of what actually wrong and
+
+95
+00:07:15,000 --> 00:07:21,000
+what is the impact, the true impact of state of nature inside Singleton will impact us in case our
+
+96
+00:07:21,000 --> 00:07:23,000
+class share some state.
+
+97
+00:07:24,000 --> 00:07:30,000
+So imagine in case our order management service would have some fields and the masses would modify the
+
+98
+00:07:30,000 --> 00:07:33,000
+state of this object and take into account.
+
+99
+00:07:33,000 --> 00:07:35,000
+We have only one instance of this type.
+
+100
+00:07:35,000 --> 00:07:41,000
+We are constantly changing its state and impacting calculations in other parts of our program.
+
+101
+00:07:41,000 --> 00:07:43,000
+And this is really a true issue.
+
+102
+00:07:43,000 --> 00:07:48,000
+But we shouldn't implement Singleton pardon for types that should have some state.
+
+103
+00:07:48,000 --> 00:07:55,000
+Remember, it is very hard to gauge the effects in case our singleton doesn't have fields and any state.
+
+104
+00:07:55,000 --> 00:08:00,000
+Such types of objects are called stateless and case object is a stateless.
+
+105
+00:08:00,000 --> 00:08:04,000
+You shouldn't face was any negative consequences of Singleton.
+
+106
+00:08:04,000 --> 00:08:10,000
+And the sad things that some people is concerned about is impact during the testing of Singleton.
+
+107
+00:08:10,000 --> 00:08:16,000
+But I would say that this has potential impact of some static nature inside the singleton, because
+
+108
+00:08:16,000 --> 00:08:22,000
+in case you want to create multiple units and run them one after another, you should come up with a
+
+109
+00:08:22,000 --> 00:08:28,000
+mechanism that resets the state of the object on the test because you won't be able to create another
+
+110
+00:08:28,000 --> 00:08:32,000
+instance during the test like you usually do in the testing.
+
+111
+00:08:33,000 --> 00:08:38,000
+So as you can see, the Singleton part is not so bad as somebody can imagine.
+
+112
+00:08:38,000 --> 00:08:43,000
+And to summarize our dogs around Singleton Parren, I want to simplify your life.
+
+113
+00:08:43,000 --> 00:08:46,000
+And that's why I made a simple checklist of all.
+
+114
+00:08:46,000 --> 00:08:48,000
+In case you want to implement Singleton pardon.
+
+115
+00:08:48,000 --> 00:08:49,000
+Here it is.
+
+116
+00:08:49,000 --> 00:08:56,000
+Define a private static field in the Singleton class, make constructor a private, implement public
+
+117
+00:08:56,000 --> 00:09:03,000
+access or function implementation internalization that is creation on first use inside the accessor
+
+118
+00:09:03,000 --> 00:09:03,000
+function.
+
+119
+00:09:04,000 --> 00:09:10,000
+Make sure that accessor function is synchronized in case it is going to be used in multiple training
+
+120
+00:09:10,000 --> 00:09:10,000
+environment.
+
+121
+00:09:11,000 --> 00:09:13,000
+I think that set about Singleton.
+
+122
+00:09:13,000 --> 00:09:19,000
+Let's roll the new part now and the next part from our list is a prototype parren.
+
+123
+00:09:19,000 --> 00:09:26,000
+What is the intention of this Spartan prototype supposed to simplify project instantiation process by
+
+124
+00:09:26,000 --> 00:09:31,000
+providing us with prototypes to create complex objects faster without new keyword?
+
+125
+00:09:32,000 --> 00:09:38,000
+Because sometimes composing new object can take a lot of lines of code and specific domain knowledge
+
+126
+00:09:38,000 --> 00:09:39,000
+of the system.
+
+127
+00:09:39,000 --> 00:09:40,000
+How to construct object.
+
+128
+00:09:41,000 --> 00:09:46,000
+Multiply this by amount of times to create new objects of such type in your system and you will come
+
+129
+00:09:46,000 --> 00:09:51,000
+up with a year to create objects by Clonan prototype that should be easier.
+
+130
+00:09:52,000 --> 00:09:54,000
+Imagines a real life example.
+
+131
+00:09:54,000 --> 00:09:58,000
+Have some file on your computer that you want to copy to another directory.
+
+132
+00:09:59,000 --> 00:10:01,000
+You press control and see your file to.
+
+133
+00:10:02,000 --> 00:10:08,000
+To paste it in another directory later, this is just one of real life examples that demonstrate when
+
+134
+00:10:08,000 --> 00:10:15,000
+you might need to create a new object based on another one inside your code, you can clone any object
+
+135
+00:10:15,000 --> 00:10:17,000
+like this to create its copy.
+
+136
+00:10:17,000 --> 00:10:24,000
+Let's look at the demo to understand this part and better and to understand example on Java, make sure
+
+137
+00:10:24,000 --> 00:10:30,000
+that you are familiar with glowing objects concept in Java, because from a technical standpoint, implementation
+
+138
+00:10:30,000 --> 00:10:35,000
+of prototype depends on the implementation of Deep Clonan for specific object.
+
+139
+00:10:35,000 --> 00:10:37,000
+Let me show you an example.
+
+140
+00:10:37,000 --> 00:10:40,000
+Imagine that I have archival interface.
+
+141
+00:10:40,000 --> 00:10:46,000
+This type describes contract for all kinds of archives in my app that I'm going to use Turky files.
+
+142
+00:10:46,000 --> 00:10:51,000
+This type declares to Masset archive method itself and clone Macit.
+
+143
+00:10:52,000 --> 00:10:56,000
+We will implement Deep Clonan in all implementations of our Kivar type.
+
+144
+00:10:57,000 --> 00:11:00,000
+I hope that our cover interface looks clear for you.
+
+145
+00:11:00,000 --> 00:11:02,000
+Let's jump to implementations.
+
+146
+00:11:02,000 --> 00:11:04,000
+We have two implementations.
+
+147
+00:11:04,000 --> 00:11:08,000
+Zibakalam and Arikawa each implement archive Macel.
+
+148
+00:11:09,000 --> 00:11:14,000
+It is just a stop here for the sake of example and implementation of clone MassArt.
+
+149
+00:11:14,000 --> 00:11:20,000
+If you know how Clonan in Java works, you understand that Klown MassArt from Object Class makes shallow
+
+150
+00:11:20,000 --> 00:11:21,000
+Cloyne.
+
+151
+00:11:21,000 --> 00:11:25,000
+That means Klown only references, but not actually cloning's.
+
+152
+00:11:25,000 --> 00:11:29,000
+The whole graph of objects that stands behind the references inside the class.
+
+153
+00:11:29,000 --> 00:11:32,000
+I mean, it's state that is described in fields.
+
+154
+00:11:33,000 --> 00:11:38,000
+So always keep in mind that no matter what programming language you use, you should implement Deep
+
+155
+00:11:38,000 --> 00:11:46,000
+Clonan of object to provide external interface to Kornet, thereby implement prototype baaden and to
+
+156
+00:11:46,000 --> 00:11:47,000
+easily implemented Clonan.
+
+157
+00:11:47,000 --> 00:11:53,000
+I use out of the box method of serialization utils from Aperture Command Library.
+
+158
+00:11:53,000 --> 00:11:56,000
+It also requires MakeMyTrip serializable.
+
+159
+00:11:57,000 --> 00:12:01,000
+In case you are interested in incentivisation, feel free to check my lesson from Java course about
+
+160
+00:12:01,000 --> 00:12:02,000
+serialisation.
+
+161
+00:12:03,000 --> 00:12:09,000
+Now, when we have implementation to clone, let's think for a second how user will interact with our
+
+162
+00:12:09,000 --> 00:12:15,000
+prototypes, how to provide clients of our code with conformable interface to create objects from our
+
+163
+00:12:15,000 --> 00:12:16,000
+prototypes.
+
+164
+00:12:16,000 --> 00:12:19,000
+There are different ways to address this question.
+
+165
+00:12:19,000 --> 00:12:25,000
+I will show you just one of the possible solutions that I hope will work for you in your specific case.
+
+166
+00:12:25,000 --> 00:12:27,000
+I create archive a factory.
+
+167
+00:12:27,000 --> 00:12:34,000
+This is class that can generate objects of different types that are compatible with our Kivar interface
+
+168
+00:12:34,000 --> 00:12:41,000
+and a car factory has prototypes, map and in reconciliation block and just at different objects that
+
+169
+00:12:41,000 --> 00:12:46,000
+will be used as original objects to clone mapped with some string.
+
+170
+00:12:46,000 --> 00:12:53,000
+Also, the factory introduced public static method called get prototype for a type that takes string
+
+171
+00:12:53,000 --> 00:12:59,000
+as an argument and returns clone of our prototype based on the requested archive type.
+
+172
+00:13:00,000 --> 00:13:05,000
+Does it make sense for the video for a second and think about this solution?
+
+173
+00:13:05,000 --> 00:13:11,000
+I believe that this is a very elegant solution of the problem and when it comes to actually using the
+
+174
+00:13:11,000 --> 00:13:15,000
+prototypes you can use archive a factory like this.
+
+175
+00:13:15,000 --> 00:13:22,000
+Imagine that at runtime you have request for different archives and you have two strings ZIB and there
+
+176
+00:13:22,000 --> 00:13:29,000
+are you just use our cover factory and request our cover from it to call archive Masset on received
+
+177
+00:13:29,000 --> 00:13:30,000
+object.
+
+178
+00:13:30,000 --> 00:13:31,000
+Let me execute the program.
+
+179
+00:13:32,000 --> 00:13:38,000
+So as you can see during the runtime, I get new clients based on my prototypes and they've worked just
+
+180
+00:13:38,000 --> 00:13:39,000
+perfect.
+
+181
+00:13:39,000 --> 00:13:45,000
+Hobbs's this complete example helps you to understand how prototype model is implemented.
+
+182
+00:13:45,000 --> 00:13:49,000
+Let's look through the checklist that you will use when you will implement a prototype.
+
+183
+00:13:49,000 --> 00:13:50,000
+Pardon.
+
+184
+00:13:51,000 --> 00:13:56,000
+The first item in our list is to add clone Masset to the Iraqi of our objects.
+
+185
+00:13:56,000 --> 00:14:02,000
+The next thing would be to design a registry that maintains a cache of prototypic objects.
+
+186
+00:14:03,000 --> 00:14:09,000
+That is exactly the moment when we created factory class in our example with original prototypical objects
+
+187
+00:14:09,000 --> 00:14:10,000
+in it.
+
+188
+00:14:10,000 --> 00:14:17,000
+Remember next design APIs that allow us to clone objects inside the factory and return new objects as
+
+189
+00:14:17,000 --> 00:14:23,000
+a result, use factory API instead of new keyword to instantiate the objects.
+
+190
+00:14:23,000 --> 00:14:24,000
+That's it.
+
+191
+00:14:25,000 --> 00:14:25,000
+Let's move on.
+
+192
+00:14:26,000 --> 00:14:31,000
+The next button is a factor mass at the idea factory mass.
+
+193
+00:14:31,000 --> 00:14:37,000
+It is to define an interface, to create object, but let subclasses decide what concrete object to
+
+194
+00:14:37,000 --> 00:14:40,000
+choose and what actual class to instantiate.
+
+195
+00:14:40,000 --> 00:14:46,000
+We need to factor in mass it in cases when we need to standardize the architectural model for a range
+
+196
+00:14:46,000 --> 00:14:47,000
+of applications.
+
+197
+00:14:47,000 --> 00:14:51,000
+But each application decides what object is to instantiate.
+
+198
+00:14:51,000 --> 00:14:58,000
+And this example is just one of possible examples where factory mass is applicable in real life.
+
+199
+00:14:58,000 --> 00:15:01,000
+You will see that we are going to use flexible methods also in.
+
+200
+00:15:01,000 --> 00:15:09,000
+Partners such as abasic factory people often use Factory Masset as a standard way to create objects,
+
+201
+00:15:09,000 --> 00:15:16,000
+but it is necessary if the class that instantiated never changes or instantiation takes place in an
+
+202
+00:15:16,000 --> 00:15:22,000
+operation that subclauses can easily override, such as an initialization operation.
+
+203
+00:15:22,000 --> 00:15:28,000
+Let's look at example to understand how it works and to help you understand this person will use previous
+
+204
+00:15:28,000 --> 00:15:30,000
+example with our covers.
+
+205
+00:15:30,000 --> 00:15:33,000
+So here is our cover interface from the previous example.
+
+206
+00:15:34,000 --> 00:15:36,000
+We don't need it anymore.
+
+207
+00:15:36,000 --> 00:15:39,000
+Since I'm going to show you factory pardon.
+
+208
+00:15:39,000 --> 00:15:42,000
+We have the same implementation of our current interface.
+
+209
+00:15:43,000 --> 00:15:47,000
+We have the Panama cover and our cover factory is different.
+
+210
+00:15:47,000 --> 00:15:54,000
+I have Massoud here get our cover and this Massoud retransmit different objects of our cover interface
+
+211
+00:15:54,000 --> 00:15:56,000
+based on the string that I passed to it.
+
+212
+00:15:57,000 --> 00:16:03,000
+How exactly does it I also want to say that you will find different variations of such parren.
+
+213
+00:16:03,000 --> 00:16:09,000
+In some examples you will see that there are multiple if alse blocks here to call constructor to instantiate
+
+214
+00:16:09,000 --> 00:16:13,000
+specific type and some examples I even saw swich block.
+
+215
+00:16:13,000 --> 00:16:15,000
+That is not the best decision.
+
+216
+00:16:15,000 --> 00:16:21,000
+Take into account you are going to have long and unreadable if else statement in case you have a lot
+
+217
+00:16:21,000 --> 00:16:22,000
+of different implementations.
+
+218
+00:16:23,000 --> 00:16:29,000
+And also this approach will require you to update the source code approach that I suggest here, takes
+
+219
+00:16:29,000 --> 00:16:36,000
+less lines of code and easily customizable in case you use some Iot container like spring containers
+
+220
+00:16:36,000 --> 00:16:39,000
+that will produce new beans for you on the request.
+
+221
+00:16:39,000 --> 00:16:45,000
+In that case, I will be able easily reuse a solution and add new types by adjusting the configuration
+
+222
+00:16:45,000 --> 00:16:46,000
+XML file.
+
+223
+00:16:46,000 --> 00:16:53,000
+In my solution, I create a map with a clever type string and function that generates new object of
+
+224
+00:16:53,000 --> 00:16:54,000
+this specific type.
+
+225
+00:16:55,000 --> 00:16:56,000
+What is this function?
+
+226
+00:16:56,000 --> 00:17:01,000
+This is a constructor and you know that function that takes nothing but your chance.
+
+227
+00:17:01,000 --> 00:17:05,000
+Something in Java called supplier, if you don't remember that.
+
+228
+00:17:05,000 --> 00:17:12,000
+Feel free to check functional programming section of my Java course and then static initialization block
+
+229
+00:17:12,000 --> 00:17:17,000
+IMAP type strings with constructors with the help of method references.
+
+230
+00:17:17,000 --> 00:17:18,000
+Great.
+
+231
+00:17:18,000 --> 00:17:25,000
+And now I use ternary operator to implement Geter camera Macit in case I can't find such Mappin in Map
+
+232
+00:17:25,000 --> 00:17:26,000
+Original.
+
+233
+00:17:27,000 --> 00:17:34,000
+In case there is some mapping, I execute this function and by interface contract in suppliers we have
+
+234
+00:17:34,000 --> 00:17:35,000
+got MassArt.
+
+235
+00:17:35,000 --> 00:17:37,000
+That's why I called it here.
+
+236
+00:17:37,000 --> 00:17:39,000
+Let's look at Democrats now.
+
+237
+00:17:40,000 --> 00:17:46,000
+I just use factory method to instantiate the objects and run the program and you can see UNcancel.
+
+238
+00:17:46,000 --> 00:17:52,000
+We have different outputs produced by two different objects also to prove you that factory generates
+
+239
+00:17:52,000 --> 00:17:53,000
+new objects.
+
+240
+00:17:53,000 --> 00:17:59,000
+Each time I generated one more zip archive and compared it with existing one with equals operator.
+
+241
+00:18:00,000 --> 00:18:02,000
+And you can see in console's that the result is false.
+
+242
+00:18:03,000 --> 00:18:08,000
+That means these two references are pointing out different objects in hip memory.
+
+243
+00:18:08,000 --> 00:18:09,000
+Does it make sense?
+
+244
+00:18:10,000 --> 00:18:15,000
+In case you still have some questions, let me know by asking it in comments to this video.
+
+245
+00:18:15,000 --> 00:18:21,000
+Now let's recap factory partyin and create a checklist for its implementation in the future.
+
+246
+00:18:21,000 --> 00:18:25,000
+The first thing we need to do is to define hierarchy of objects.
+
+247
+00:18:25,000 --> 00:18:31,000
+As you can see, Factory Masset use inheritance mechanism to provide you with the object of type that
+
+248
+00:18:31,000 --> 00:18:32,000
+you need.
+
+249
+00:18:32,000 --> 00:18:37,000
+The next thing to do is to design the arguments to the factor in NASSP.
+
+250
+00:18:37,000 --> 00:18:44,000
+Think about qualities or characteristics that are necessary and sufficient to identify the correct derived
+
+251
+00:18:44,000 --> 00:18:51,000
+class to instantiate in our specific example, we used only string was our current name, but actually
+
+252
+00:18:51,000 --> 00:18:56,000
+it can be a set of arguments called factory matter during the runtime to instantiate the object that
+
+253
+00:18:56,000 --> 00:18:57,000
+you need.
+
+254
+00:18:58,000 --> 00:18:58,000
+Great.
+
+255
+00:18:58,000 --> 00:19:03,000
+Well, really done with recreational pardons to more pardons from this group left.
+
+256
+00:19:04,000 --> 00:19:07,000
+The next point that we are going to learn is build a pardon.
+
+257
+00:19:07,000 --> 00:19:09,000
+Why we might need to build a pardon.
+
+258
+00:19:10,000 --> 00:19:16,000
+Imagine that you have a complex object to build and you want to come up with the API that will allow
+
+259
+00:19:16,000 --> 00:19:20,000
+you easily to define what exact version of object you would like to construct.
+
+260
+00:19:21,000 --> 00:19:27,000
+In other words, imagine the case when an application needs to create the elements of a complex aggregate.
+
+261
+00:19:28,000 --> 00:19:32,000
+And the interesting thing about Builder is that you can find different variations of the builder.
+
+262
+00:19:32,000 --> 00:19:33,000
+Pardon?
+
+263
+00:19:33,000 --> 00:19:38,000
+Does it actually solve our original problem but implemented in different ways?
+
+264
+00:19:38,000 --> 00:19:44,000
+For example, there is a variation of partner with director class that is responsible for building objects.
+
+265
+00:19:44,000 --> 00:19:50,000
+And also there is a variation of builder patterns that called chain builder and allows to build new
+
+266
+00:19:50,000 --> 00:19:52,000
+objects step by step.
+
+267
+00:19:52,000 --> 00:19:57,000
+Personally, I believe that the second variation is more popular, but I want to share with you all.
+
+268
+00:19:57,000 --> 00:20:01,000
+Variations with examples will start from builder Partan.
+
+269
+00:20:01,000 --> 00:20:03,000
+Implementation was director.
+
+270
+00:20:03,000 --> 00:20:09,000
+Imagine that you need to build a computer and you have computer class and, you know, all properties
+
+271
+00:20:09,000 --> 00:20:10,000
+of computer.
+
+272
+00:20:10,000 --> 00:20:16,000
+Let's look at it so simple computer class that has a display system, block and manipulators.
+
+273
+00:20:17,000 --> 00:20:18,000
+We have computer builders type.
+
+274
+00:20:19,000 --> 00:20:19,000
+Here it is.
+
+275
+00:20:20,000 --> 00:20:26,000
+It has computer property, abstract assets to build each property of a computer, create new computer
+
+276
+00:20:26,000 --> 00:20:28,000
+Massett and get computer messages.
+
+277
+00:20:28,000 --> 00:20:29,000
+It returns.
+
+278
+00:20:29,000 --> 00:20:35,000
+A reference to the computer field, I believe you understood already, is that we need to create concrete
+
+279
+00:20:35,000 --> 00:20:38,000
+builders that will implement this absolute marcedes.
+
+280
+00:20:39,000 --> 00:20:43,000
+In our example, we have cheap computer builder and expensive computer builder.
+
+281
+00:20:44,000 --> 00:20:50,000
+The main thing is that you have to understand here is that these built methods change the state of our
+
+282
+00:20:50,000 --> 00:20:51,000
+computer object.
+
+283
+00:20:52,000 --> 00:20:56,000
+Take into account this a child classes of my absolute computer builder.
+
+284
+00:20:56,000 --> 00:21:01,000
+I have access to computer property inside this class to take into account.
+
+285
+00:21:01,000 --> 00:21:04,000
+In our example, the computer has only string properties.
+
+286
+00:21:04,000 --> 00:21:10,000
+I just said different strings, but in real life, all construction, the logic of each field will be
+
+287
+00:21:10,000 --> 00:21:11,000
+placed here.
+
+288
+00:21:12,000 --> 00:21:18,000
+OK, now when we have different computer builders, we need to have a director that knows how to organize
+
+289
+00:21:18,000 --> 00:21:21,000
+the work of builders to produce expected result.
+
+290
+00:21:21,000 --> 00:21:23,000
+We have computer director Glass here.
+
+291
+00:21:24,000 --> 00:21:27,000
+As you can see, it aggregates computer builder inside.
+
+292
+00:21:27,000 --> 00:21:30,000
+And this builder we can pass to the constructor.
+
+293
+00:21:30,000 --> 00:21:36,000
+We have built computer MassArt, where I build computer by delegating work to my builder.
+
+294
+00:21:36,000 --> 00:21:40,000
+And after that I can provide build computer on a separate request.
+
+295
+00:21:41,000 --> 00:21:43,000
+I'm talking about get computer Macit.
+
+296
+00:21:43,000 --> 00:21:50,000
+This architecture allows me to substitute the builder on the fly and build new computer based on that
+
+297
+00:21:50,000 --> 00:21:56,000
+as a builder, or build a series of the same computers without passing the same data multiple times,
+
+298
+00:21:56,000 --> 00:21:56,000
+etc..
+
+299
+00:21:56,000 --> 00:21:59,000
+Constructor of computer class auto setters.
+
+300
+00:22:00,000 --> 00:22:01,000
+Does it make sense so far?
+
+301
+00:22:02,000 --> 00:22:06,000
+Presuppose for me minute to understand how these classes are connected.
+
+302
+00:22:06,000 --> 00:22:13,000
+And by the way, you will find references to the source code of all examples in attachments to this
+
+303
+00:22:13,000 --> 00:22:13,000
+lesson.
+
+304
+00:22:13,000 --> 00:22:19,000
+It is just a regular git repository, so you can basically just put the repository on your local computer
+
+305
+00:22:19,000 --> 00:22:21,000
+and investigate the source code.
+
+306
+00:22:21,000 --> 00:22:22,000
+Let's continue.
+
+307
+00:22:23,000 --> 00:22:27,000
+Here is a client of our code and here you can see how builder pattern will work.
+
+308
+00:22:28,000 --> 00:22:34,000
+I great director and based on the current needs, I can set different builder after that and build a
+
+309
+00:22:34,000 --> 00:22:37,000
+computer and retrieve computer from director.
+
+310
+00:22:37,000 --> 00:22:38,000
+That's it.
+
+311
+00:22:38,000 --> 00:22:45,000
+So much preparations for done to achieve the simplicity in building complex objects and being able to
+
+312
+00:22:45,000 --> 00:22:46,000
+change boolean logic on the fly.
+
+313
+00:22:47,000 --> 00:22:52,000
+And here you can see that I set a new builder, expensive computer builder this time and built a new
+
+314
+00:22:52,000 --> 00:22:55,000
+computer and printed it again to console.
+
+315
+00:22:56,000 --> 00:22:57,000
+Let me run this program.
+
+316
+00:22:57,000 --> 00:23:03,000
+And in console output you can see that we managed to build different computers, cheap and expensive
+
+317
+00:23:03,000 --> 00:23:03,000
+one.
+
+318
+00:23:04,000 --> 00:23:08,000
+Is it clear how this version of builder pattern is clear?
+
+319
+00:23:08,000 --> 00:23:12,000
+Let's review another version of builder pattern chain builder.
+
+320
+00:23:12,000 --> 00:23:14,000
+The idea here is simple.
+
+321
+00:23:14,000 --> 00:23:19,000
+We have a class that has builder inside it that knows how to build the object.
+
+322
+00:23:19,000 --> 00:23:26,000
+Each method of the builder returns the reference to builder object to call next method enchained like
+
+323
+00:23:26,000 --> 00:23:29,000
+style take into account builder is an inner class.
+
+324
+00:23:30,000 --> 00:23:32,000
+It has access to all fields from auto class.
+
+325
+00:23:33,000 --> 00:23:34,000
+She restudy.
+
+326
+00:23:34,000 --> 00:23:38,000
+Can you build a method that creates builder based on that account object?
+
+327
+00:23:38,000 --> 00:23:41,000
+Here is the inner class builder.
+
+328
+00:23:41,000 --> 00:23:46,000
+It has private constructor so that nobody from the outside could create and build the object.
+
+329
+00:23:47,000 --> 00:23:52,000
+And after that we have satyrs methods that initialize the state of our account object.
+
+330
+00:23:52,000 --> 00:23:59,000
+And each time Setas returns the reference to the current object as a current builder, this trick allows
+
+331
+00:23:59,000 --> 00:24:03,000
+us to build change by calling the next message on our builder.
+
+332
+00:24:03,000 --> 00:24:07,000
+And we have a special method to terminate a chain of locations.
+
+333
+00:24:07,000 --> 00:24:14,000
+This is built MassArt built Macit returns as a reference to already built and constructed object.
+
+334
+00:24:14,000 --> 00:24:17,000
+Let's look at the client code to understand how it works.
+
+335
+00:24:18,000 --> 00:24:25,000
+I call the new build an asset and after that I build a chain of satyrs that I need and this chain is
+
+336
+00:24:25,000 --> 00:24:26,000
+terminated.
+
+337
+00:24:26,000 --> 00:24:26,000
+Was built.
+
+338
+00:24:26,000 --> 00:24:29,000
+Masset That's how I get my account object.
+
+339
+00:24:30,000 --> 00:24:37,000
+This architecture allows me to build objects a step by step and initialize on those properties of my
+
+340
+00:24:37,000 --> 00:24:39,000
+future object that I need help.
+
+341
+00:24:39,000 --> 00:24:41,000
+This example make things clearer.
+
+342
+00:24:42,000 --> 00:24:46,000
+Let's now come up with a checklist to implement a canonical builder and change builder.
+
+343
+00:24:46,000 --> 00:24:49,000
+Partner to implement builder partner with director.
+
+344
+00:24:49,000 --> 00:24:56,000
+We have to declare builder interface, create multiple builders, create directors that can work with
+
+345
+00:24:56,000 --> 00:25:02,000
+different builders in client code, instantiate director and can create implementation of builder to
+
+346
+00:25:02,000 --> 00:25:07,000
+build new objects to implement builder Padrón with Chain Massett.
+
+347
+00:25:07,000 --> 00:25:14,000
+Course we have to create inner builder class insight type that we want to build implement method in
+
+348
+00:25:14,000 --> 00:25:20,000
+type that returns reference to the builder object, the clear satyrs and builder that returns the reference
+
+349
+00:25:20,000 --> 00:25:28,000
+to this builder object implement build MassArt to terminate massive chain and return target object in
+
+350
+00:25:28,000 --> 00:25:33,000
+client code called Masset to get reference to build and build object step by step.
+
+351
+00:25:33,000 --> 00:25:35,000
+Basically that's it.
+
+352
+00:25:35,000 --> 00:25:36,000
+Regarding Builder Pardon.
+
+353
+00:25:36,000 --> 00:25:37,000
+Let's move on.
+
+354
+00:25:37,000 --> 00:25:41,000
+And the last but not the least plan for today is an abstract factory.
+
+355
+00:25:41,000 --> 00:25:47,000
+We need abstract factory for cases when we need to create a group of interdependent classes.
+
+356
+00:25:47,000 --> 00:25:54,000
+By implementing abstract factory part, we define an interface for families of objects without specification
+
+357
+00:25:54,000 --> 00:25:56,000
+of concrete class.
+
+358
+00:25:56,000 --> 00:25:59,000
+To understand this person, let me explain an example.
+
+359
+00:26:00,000 --> 00:26:02,000
+Look at the class diagrams that you see on the slide.
+
+360
+00:26:03,000 --> 00:26:09,000
+Imagine that we are working on the desktop application and we need to create Pop-Up Window that is specific
+
+361
+00:26:09,000 --> 00:26:10,000
+for each operating system.
+
+362
+00:26:11,000 --> 00:26:11,000
+I mean.
+
+363
+00:26:11,000 --> 00:26:17,000
+Michael, as we have close window button on the top left corner in Microsoft Windows, we have close
+
+364
+00:26:17,000 --> 00:26:22,000
+button on top right corner and we have a different styling of scrolls and balance.
+
+365
+00:26:22,000 --> 00:26:27,000
+That's why we have two abstract factories for Microsoft Windows and for Mac OS.
+
+366
+00:26:27,000 --> 00:26:32,000
+Each factory can build Windows that contains only objects that should be used together.
+
+367
+00:26:33,000 --> 00:26:40,000
+So in this task, when I create a window, I need to create a set of objects, models, scroll content
+
+368
+00:26:40,000 --> 00:26:41,000
+area and so on.
+
+369
+00:26:41,000 --> 00:26:47,000
+And I can create a scroll for windows and combine it with Macarius buttons, understand?
+
+370
+00:26:48,000 --> 00:26:53,000
+That's why we can talk about family of objects that can work together with each other.
+
+371
+00:26:54,000 --> 00:27:00,000
+I will pass my abstract factory to Gwai builder so that GWI builder can use abstract factories to create
+
+372
+00:27:00,000 --> 00:27:02,000
+all necessary elements for my window.
+
+373
+00:27:03,000 --> 00:27:04,000
+Does it make sense?
+
+374
+00:27:04,000 --> 00:27:11,000
+I can explain in theory, but to be honest, personally, for me this part wasn't obvious until I saw
+
+375
+00:27:11,000 --> 00:27:12,000
+a real life example.
+
+376
+00:27:12,000 --> 00:27:14,000
+So let's jump to an example.
+
+377
+00:27:15,000 --> 00:27:18,000
+Let's start our demo from Abstract Factory itself.
+
+378
+00:27:18,000 --> 00:27:24,000
+Here is my abstract widget factory that declares three masses, masses that should create within itself
+
+379
+00:27:24,000 --> 00:27:29,000
+a method that creates growth methods, that creates an array of navigation buttons.
+
+380
+00:27:30,000 --> 00:27:32,000
+Can you recognize what these methods remind you?
+
+381
+00:27:33,000 --> 00:27:35,000
+They look like factory masses.
+
+382
+00:27:35,000 --> 00:27:42,000
+Does this abstract factory and abstract methods here will be implemented for different families of objects?
+
+383
+00:27:42,000 --> 00:27:51,000
+I have Mac OS Widget Factory and a mass widget factory and you can see that in each class I create objects
+
+384
+00:27:51,000 --> 00:27:52,000
+that should work well with each other.
+
+385
+00:27:53,000 --> 00:28:00,000
+For Marco s widget, I create macro as window marker scroll and a Mac or as buttons for Microsoft Windows
+
+386
+00:28:00,000 --> 00:28:01,000
+algorithms window.
+
+387
+00:28:01,000 --> 00:28:03,000
+I must scroll Annemasse buttons.
+
+388
+00:28:03,000 --> 00:28:04,000
+Does it make sense?
+
+389
+00:28:05,000 --> 00:28:07,000
+Next I have Gwai builder.
+
+390
+00:28:07,000 --> 00:28:11,000
+I can pastorate any concrete implementation of abstract factory.
+
+391
+00:28:11,000 --> 00:28:18,000
+I have go builder will use this API to build all necessary elements and display them properly.
+
+392
+00:28:19,000 --> 00:28:21,000
+Now let me open my demo file.
+
+393
+00:28:21,000 --> 00:28:27,000
+You can see that I create Gwai Builder and after that, based on the user input or app configurations,
+
+394
+00:28:27,000 --> 00:28:28,000
+it doesn't matter.
+
+395
+00:28:28,000 --> 00:28:34,000
+I can take information about the operating system from different places, but when I know operating
+
+396
+00:28:34,000 --> 00:28:42,000
+system, I initialize my widget factory and call build window Masset, bypassing that my abstract factory.
+
+397
+00:28:42,000 --> 00:28:48,000
+That is how Abstract Factory pardon helps us to deal with instantiation of family of objects.
+
+398
+00:28:48,000 --> 00:28:51,000
+Now let's come up with a checklist that you need to follow.
+
+399
+00:28:51,000 --> 00:28:58,000
+When you want to implement abstract factory pattern, implement class groups or so-called type families,
+
+400
+00:28:58,000 --> 00:29:04,000
+you declare abstract factory interface with factory masset per product use abstract factory to instantiate
+
+401
+00:29:04,000 --> 00:29:11,000
+group of related objects, homes that now abstract factory part doesn't look like something scary.
+
+402
+00:29:11,000 --> 00:29:16,000
+And before we call it today, let's understand what is the difference between Factory MassArt and Abstract
+
+403
+00:29:16,000 --> 00:29:17,000
+Factory?
+
+404
+00:29:17,000 --> 00:29:19,000
+I would like to list a few differences.
+
+405
+00:29:19,000 --> 00:29:24,000
+Zaya Factory Method focuses on generation of one single object.
+
+406
+00:29:24,000 --> 00:29:30,000
+Various abstract factory should solve the issue of instantiate and group of related objects.
+
+407
+00:29:31,000 --> 00:29:37,000
+Factory Mass can be part of abstract factory, but also factory masad can exist independently.
+
+408
+00:29:37,000 --> 00:29:43,000
+When we are talking about factory Masset, we mean one method that can generate a specific object.
+
+409
+00:29:43,000 --> 00:29:49,000
+But when we are talking about abstract factory women, the type that may contain many different methods
+
+410
+00:29:49,000 --> 00:29:55,000
+that help us to create a group of objects, factory methods relies on inheritance mechanism.
+
+411
+00:29:56,000 --> 00:30:01,000
+It allows subclasses to decide what implementation of specific type to generate.
+
+412
+00:30:01,000 --> 00:30:07,000
+But in abstract factory, the main focus is on generating multiple objects from one family that are
+
+413
+00:30:07,000 --> 00:30:10,000
+not connected within one Iraqi home.
+
+414
+00:30:10,000 --> 00:30:12,000
+That visualisations on the slide.
+
+415
+00:30:12,000 --> 00:30:15,000
+And my explanation helps you to understand the difference.
+
+416
+00:30:16,000 --> 00:30:22,000
+Now, let's recap what we have learned today in this lesson, we learned five correlational golf partners
+
+417
+00:30:22,000 --> 00:30:29,000
+after this lesson, I believe, you know, Singleton prototype factory, MassArt builder and absolute
+
+418
+00:30:29,000 --> 00:30:30,000
+factory pardon's.
+
+419
+00:30:31,000 --> 00:30:31,000
+That's it.
+
+420
+00:30:32,000 --> 00:30:33,000
+Thanks a lot for your attention.
+
+421
+00:30:33,000 --> 00:30:33,000
+Yes.
+
+422
+00:30:33,000 --> 00:30:36,000
+Students, see you in the next lesson.
+
diff --git a/39 - GoF Design Patterns of Software Architecture in OOP/002 Source-code-of-all-examples-from-the-lesson.url b/39 - GoF Design Patterns of Software Architecture in OOP/002 Source-code-of-all-examples-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..df842aa0c6382dd25a924e4959da264fae0e32f5
--- /dev/null
+++ b/39 - GoF Design Patterns of Software Architecture in OOP/002 Source-code-of-all-examples-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/patterns/creational
\ No newline at end of file
diff --git a/39 - GoF Design Patterns of Software Architecture in OOP/003 Source-code-of-all-examples-from-the-lesson.url b/39 - GoF Design Patterns of Software Architecture in OOP/003 Source-code-of-all-examples-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..233b39be9a632213ca6a4282cc7cc5f6273204dc
--- /dev/null
+++ b/39 - GoF Design Patterns of Software Architecture in OOP/003 Source-code-of-all-examples-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/patterns/structural
\ No newline at end of file
diff --git a/39 - GoF Design Patterns of Software Architecture in OOP/003 Structural Patterns, p.1_en.srt b/39 - GoF Design Patterns of Software Architecture in OOP/003 Structural Patterns, p.1_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..67d5e5d789fc513149559f539e420076b2a1a4e7
--- /dev/null
+++ b/39 - GoF Design Patterns of Software Architecture in OOP/003 Structural Patterns, p.1_en.srt
@@ -0,0 +1,1604 @@
+1
+00:00:05,000 --> 00:00:06,000
+Hello, dear students.
+
+2
+00:00:06,000 --> 00:00:12,000
+We proceed learning golf patterns, and in this lesson, we are going to learn structural patterns by
+
+3
+00:00:12,000 --> 00:00:12,000
+this moment.
+
+4
+00:00:12,000 --> 00:00:18,000
+You are already familiar with overview of structural patterns, and I hope you had time to learn creation
+
+5
+00:00:18,000 --> 00:00:19,000
+of part unseen details.
+
+6
+00:00:20,000 --> 00:00:25,000
+And today we are going to start learning the most popular structural patterns and our plans to run to
+
+7
+00:00:25,000 --> 00:00:29,000
+the next Spartans proxy decorator, adaptor and facade.
+
+8
+00:00:30,000 --> 00:00:33,000
+The rest of the structural partners will learn in another lesson.
+
+9
+00:00:34,000 --> 00:00:39,000
+Also, I will try to focus your attention on the differences between these partners to make sure your
+
+10
+00:00:39,000 --> 00:00:40,000
+clearest separates them.
+
+11
+00:00:41,000 --> 00:00:45,000
+After this lesson, you will know how to create more complex structures with different units.
+
+12
+00:00:46,000 --> 00:00:51,000
+Also in this lesson, you are going to see a lot of code examples that will help you to understand this
+
+13
+00:00:51,000 --> 00:00:52,000
+topic better.
+
+14
+00:00:53,000 --> 00:00:57,000
+All code examples that you will see in this lesson attached to this video.
+
+15
+00:00:58,000 --> 00:01:02,000
+Let's start, and the first point that we are going to learn today is proxy.
+
+16
+00:01:02,000 --> 00:01:08,000
+The goal of this spartan is the following we want to protect some object of direct impact.
+
+17
+00:01:09,000 --> 00:01:15,000
+Also, we want to control interactions with the object and trigger unnecessary behavior if needed.
+
+18
+00:01:15,000 --> 00:01:21,000
+When we will use proxy power, for example, one you don't want to create a real object because it is
+
+19
+00:01:21,000 --> 00:01:27,000
+big and you want to postpone instantiation process to the moment when the object will be needed.
+
+20
+00:01:28,000 --> 00:01:34,000
+At the mean time, you can initialize variables with the proxy object to avoid null pointer exception
+
+21
+00:01:34,000 --> 00:01:38,000
+and initialize a real object on the first request to proxy.
+
+22
+00:01:38,000 --> 00:01:44,000
+The next case when you want to use proxy point is to control interactions with the object.
+
+23
+00:01:44,000 --> 00:01:49,000
+The simplest real life example is proxies that we use in the internet.
+
+24
+00:01:49,000 --> 00:01:53,000
+Imagine that in your company, you have a list of restricted resources.
+
+25
+00:01:54,000 --> 00:02:00,000
+For example, your employer restricts that Instagram and Facebook to make sure that nobody spends broken
+
+26
+00:02:00,000 --> 00:02:02,000
+time in the social networks.
+
+27
+00:02:02,000 --> 00:02:06,000
+Just an example how your boss can implement this rule.
+
+28
+00:02:06,000 --> 00:02:11,000
+It will use proxy server when your browser will send a request to a specific web site.
+
+29
+00:02:11,000 --> 00:02:18,000
+It will go through a proxy server that will validate the URL in your request with the restricted ones.
+
+30
+00:02:18,000 --> 00:02:24,000
+In the case the website, your request is bond, but your organization rules you will receive connection
+
+31
+00:02:24,000 --> 00:02:25,000
+error.
+
+32
+00:02:25,000 --> 00:02:28,000
+That's one of the examples of using proxies.
+
+33
+00:02:28,000 --> 00:02:34,000
+Also, your face was proxies in spring framework, especially in aspect oriented program.
+
+34
+00:02:35,000 --> 00:02:39,000
+In case you don't know what is aspect oriented programming, no worries, adult.
+
+35
+00:02:40,000 --> 00:02:44,000
+I'll explain it now in simple words following definition from Wikipedia.
+
+36
+00:02:44,000 --> 00:02:51,000
+Aspect oriented programming AOP is a programming paradigm that aims to increase maturity by allowing
+
+37
+00:02:51,000 --> 00:02:54,000
+the separation of cross-cutting concerns.
+
+38
+00:02:54,000 --> 00:02:57,000
+To be honest, even from users, definition is not clear.
+
+39
+00:02:58,000 --> 00:02:59,000
+Let me explain this in my words.
+
+40
+00:03:00,000 --> 00:03:03,000
+Imagine that you have some code already written.
+
+41
+00:03:03,000 --> 00:03:08,000
+Let's say some code that places order in database when customer presses by button.
+
+42
+00:03:09,000 --> 00:03:15,000
+And now you don't want on Justice Court, but you want to add additional behavior to this event.
+
+43
+00:03:16,000 --> 00:03:22,000
+Now you want to also to send emails to administrators at order has been placed 10th place order in database.
+
+44
+00:03:22,000 --> 00:03:29,000
+As usual, you can add so-called advice to the existing code and you can implement this with proxy.
+
+45
+00:03:30,000 --> 00:03:35,000
+You create wrapper around a regional object and track requests that were sent to it.
+
+46
+00:03:36,000 --> 00:03:39,000
+And depending on the request, you can add additional behavior.
+
+47
+00:03:39,000 --> 00:03:40,000
+Does it make sense?
+
+48
+00:03:41,000 --> 00:03:47,000
+While this is also an example of proxy pardon, it is hard to demo today in case you have never heard
+
+49
+00:03:47,000 --> 00:03:49,000
+about aspects around this program.
+
+50
+00:03:49,000 --> 00:03:54,000
+We learned this in adolescence and will have a little bit simpler example.
+
+51
+00:03:55,000 --> 00:04:01,000
+Also, other examples that you might already use in the unit and integration testing in Java.
+
+52
+00:04:01,000 --> 00:04:03,000
+We have Makita and is a mock library.
+
+53
+00:04:04,000 --> 00:04:09,000
+And even in other programming languages, you have libraries that help us to create test doubles.
+
+54
+00:04:09,000 --> 00:04:12,000
+Do remember such as double aspi.
+
+55
+00:04:12,000 --> 00:04:13,000
+Let me remind you quickly.
+
+56
+00:04:14,000 --> 00:04:20,000
+SPI is a test double that behaves like a real object beside masses that are stopped beforehand, such
+
+57
+00:04:20,000 --> 00:04:27,000
+as double in most cases implemented with the help of proxy pardon, the wrapper is created and the original
+
+58
+00:04:27,000 --> 00:04:30,000
+object, and each mass at invocation is controlled.
+
+59
+00:04:30,000 --> 00:04:37,000
+Is it clear home that now you understood, in simple words, why we need proxy partners sometimes?
+
+60
+00:04:37,000 --> 00:04:40,000
+And what problem it's supposed to solve?
+
+61
+00:04:40,000 --> 00:04:44,000
+Now let's look at code example to understand proxy power and better.
+
+62
+00:04:45,000 --> 00:04:47,000
+I prepared the example of internet proxy.
+
+63
+00:04:47,000 --> 00:04:50,000
+Imagine that we have some interface called internet.
+
+64
+00:04:51,000 --> 00:04:58,000
+This interface declares only one behavior in our example connect the host and takes URL as an argument.
+
+65
+00:04:59,000 --> 00:05:01,000
+We have implementation of this interface.
+
+66
+00:05:02,000 --> 00:05:05,000
+Called it default internet by default.
+
+67
+00:05:05,000 --> 00:05:07,000
+It just prints you around to console.
+
+68
+00:05:08,000 --> 00:05:13,000
+And now I'm going to create a proxy proxy should implement the same interface.
+
+69
+00:05:14,000 --> 00:05:15,000
+Here's my proxy internet.
+
+70
+00:05:16,000 --> 00:05:23,000
+As you can see, it also implements the same interface, and it aggregates default internet inside,
+
+71
+00:05:24,000 --> 00:05:26,000
+so it drops the default internet object.
+
+72
+00:05:27,000 --> 00:05:29,000
+We have list of bond websites here.
+
+73
+00:05:30,000 --> 00:05:32,000
+It can be Facebook and Instagram, for example.
+
+74
+00:05:33,000 --> 00:05:39,000
+Just how would employees sitting in social networks all day and when connect, the host method is invoked?
+
+75
+00:05:39,000 --> 00:05:43,000
+I verify it was a somebody trying to access the website.
+
+76
+00:05:44,000 --> 00:05:47,000
+If yes, then I throw an exception.
+
+77
+00:05:47,000 --> 00:05:50,000
+If no, then I proceed with internet connection.
+
+78
+00:05:50,000 --> 00:05:52,000
+Does it make sense so far?
+
+79
+00:05:52,000 --> 00:05:59,000
+Press a pause for a minute and look at this proxy one more time and try to understand how I dropped
+
+80
+00:05:59,000 --> 00:06:03,000
+default internet object here and delegated calls to.
+
+81
+00:06:03,000 --> 00:06:07,000
+If everything is clear for you now, let's create a checklist to follow.
+
+82
+00:06:07,000 --> 00:06:14,000
+In case you want to implement proxy pardon, so the implement proxy portal would need to follow next
+
+83
+00:06:14,000 --> 00:06:14,000
+steps.
+
+84
+00:06:15,000 --> 00:06:22,000
+The interface for wrapper and for regional type create proxy type that implements the current interface.
+
+85
+00:06:23,000 --> 00:06:26,000
+Aggregate objects that you want to wrap in your proxy type.
+
+86
+00:06:27,000 --> 00:06:30,000
+Implement logic of interaction with the original object.
+
+87
+00:06:30,000 --> 00:06:31,000
+That's it.
+
+88
+00:06:32,000 --> 00:06:39,000
+Regarding some items to consider, some engineers might say that introducing proxy is just about having
+
+89
+00:06:39,000 --> 00:06:42,000
+additional level of obstruction, and they will be right.
+
+90
+00:06:43,000 --> 00:06:48,000
+But remember, we're having this level of abstraction to benefit from it, not just to have it.
+
+91
+00:06:49,000 --> 00:06:54,000
+So analyze your particular case and decide whether proxy is needed in your case.
+
+92
+00:06:55,000 --> 00:06:58,000
+If everything is clear here, let's learn new bottom.
+
+93
+00:06:58,000 --> 00:07:05,000
+Let me presented decorator part, and let's try to understand what it is that can reach a part and allows
+
+94
+00:07:05,000 --> 00:07:12,000
+us to structure objects in such a way that allows us to add new features to already existing objects.
+
+95
+00:07:12,000 --> 00:07:19,000
+You can attach new behavior and extend existing one decorators, a flexible alternative to the inheritance
+
+96
+00:07:19,000 --> 00:07:21,000
+mechanism for extending the functionality.
+
+97
+00:07:22,000 --> 00:07:28,000
+Implementation of this button allows you to add new features to already constructed objects and to understand,
+
+98
+00:07:28,000 --> 00:07:29,000
+decorate and better.
+
+99
+00:07:30,000 --> 00:07:37,000
+Always keep in mind input output package in Java In case you didn't know Java yet or forgot the specifics
+
+100
+00:07:37,000 --> 00:07:44,000
+of this package, I will remind you in i o package in Java, we can create objects of input stream,
+
+101
+00:07:44,000 --> 00:07:50,000
+and after we created this object, we can rob it was buffered input stream decorator.
+
+102
+00:07:51,000 --> 00:07:56,000
+In other words, we are able to add ability to use buffer during the reading.
+
+103
+00:07:57,000 --> 00:08:02,000
+And moreover, if we want, then we can rob this new object with another one.
+
+104
+00:08:02,000 --> 00:08:09,000
+For example, data input stream that allows us to read data in specific Java data type links shared
+
+105
+00:08:09,000 --> 00:08:16,000
+by Char, Boolean, etc. And we can do this Robin as many times as we want.
+
+106
+00:08:16,000 --> 00:08:19,000
+That's how Decorator works at the end of the day.
+
+107
+00:08:20,000 --> 00:08:26,000
+It is just not possible to describe all variations of all possible types with different features.
+
+108
+00:08:26,000 --> 00:08:33,000
+Sometimes it is easier to read and the user, in our case, to engineer to decide object with which
+
+109
+00:08:33,000 --> 00:08:36,000
+specific features he or she would like to construct.
+
+110
+00:08:37,000 --> 00:08:38,000
+Does it make sense?
+
+111
+00:08:38,000 --> 00:08:46,000
+As I already said, one of the simplest and most popular clear examples of decorator pardon is i o package
+
+112
+00:08:46,000 --> 00:08:46,000
+in G Decay.
+
+113
+00:08:47,000 --> 00:08:50,000
+Feel free to investigate how a decorator is implemented z.
+
+114
+00:08:51,000 --> 00:08:56,000
+But still, I think it might be not super obvious at first glance.
+
+115
+00:08:56,000 --> 00:08:58,000
+That's why I would still prefer to explain.
+
+116
+00:08:58,000 --> 00:09:00,000
+Is this partly on this simple example?
+
+117
+00:09:01,000 --> 00:09:07,000
+Imagine that we are developing some racing again, whether the need for speed video game and we need
+
+118
+00:09:07,000 --> 00:09:09,000
+to program logic for different type of cars.
+
+119
+00:09:09,000 --> 00:09:12,000
+For example, we are going to have some regular car.
+
+120
+00:09:12,000 --> 00:09:14,000
+It could be any curves.
+
+121
+00:09:14,000 --> 00:09:21,000
+Those that we see on the streets each day also will have features of luxury and sports car, and we
+
+122
+00:09:21,000 --> 00:09:23,000
+will be able to combine these features.
+
+123
+00:09:24,000 --> 00:09:29,000
+For example, we will create luxury sport or just sports or just luxury car.
+
+124
+00:09:30,000 --> 00:09:31,000
+Now, pay attention.
+
+125
+00:09:31,000 --> 00:09:33,000
+How will structure our types here?
+
+126
+00:09:34,000 --> 00:09:39,000
+First of all, we need to define an interface of our car time here at this.
+
+127
+00:09:40,000 --> 00:09:46,000
+To simplify this example, let's pretend that we have only one massive drive and before construction
+
+128
+00:09:46,000 --> 00:09:49,000
+of complex object by adding new feature to it.
+
+129
+00:09:49,000 --> 00:09:54,000
+We need to have at least some basic object that will be used as a base.
+
+130
+00:09:55,000 --> 00:10:01,000
+That's why the first things that I did, I created this basic car class that implements current interface.
+
+131
+00:10:02,000 --> 00:10:08,000
+As you can see, there is a default implementation that just prints text to console about the fact that
+
+132
+00:10:08,000 --> 00:10:15,000
+the basic current drives now and want to implement the car interface in car, decorate the gloss.
+
+133
+00:10:15,000 --> 00:10:19,000
+This gloss will describe the logic of adding additional features to cart.
+
+134
+00:10:20,000 --> 00:10:22,000
+Here is the car decorator class.
+
+135
+00:10:23,000 --> 00:10:23,000
+Pay attention.
+
+136
+00:10:23,000 --> 00:10:26,000
+The decorator implements the same interface.
+
+137
+00:10:27,000 --> 00:10:31,000
+In this particular case, I also aggregate car object in sight.
+
+138
+00:10:31,000 --> 00:10:38,000
+I can't grade can't decorate that without another car and when drive mass is invoked.
+
+139
+00:10:38,000 --> 00:10:41,000
+You see that I called Drive Massad on this car.
+
+140
+00:10:42,000 --> 00:10:45,000
+Press a pause for a second to understand this.
+
+141
+00:10:45,000 --> 00:10:53,000
+In this case, I can build a chain of objects that wraps each other and invokes specific variation of
+
+142
+00:10:53,000 --> 00:10:54,000
+the same behavior.
+
+143
+00:10:55,000 --> 00:11:00,000
+And again, in your particular case, this mascot may be rewritten as you wish.
+
+144
+00:11:01,000 --> 00:11:02,000
+And as it will work for your logic.
+
+145
+00:11:03,000 --> 00:11:08,000
+Now let me show you classes that describe specific features to be added to the basic car.
+
+146
+00:11:09,000 --> 00:11:13,000
+As I mentioned before, we have sports car and luxury car.
+
+147
+00:11:13,000 --> 00:11:15,000
+Let's start from luxury car first.
+
+148
+00:11:16,000 --> 00:11:19,000
+You can see that it extends car decorator.
+
+149
+00:11:19,000 --> 00:11:21,000
+It takes car as an argument.
+
+150
+00:11:22,000 --> 00:11:27,000
+We override drive massive here so that we call parent and drive massive.
+
+151
+00:11:28,000 --> 00:11:34,000
+The one we have just reviewed in car decorator to invoke drive mass on aggregated car first.
+
+152
+00:11:35,000 --> 00:11:42,000
+And after that, in this massive additional behavior, in our case, it is just printing additional
+
+153
+00:11:42,000 --> 00:11:43,000
+text to consult.
+
+154
+00:11:44,000 --> 00:11:49,000
+But I believe it is clear for you that you can actually describe any as little logic here.
+
+155
+00:11:49,000 --> 00:11:53,000
+Also, pay attention that you can't create just a luxury car.
+
+156
+00:11:54,000 --> 00:11:58,000
+You can't build a luxury car only on the basis of some other car.
+
+157
+00:11:58,000 --> 00:12:02,000
+That's why it is necessary to pass this car to constructor.
+
+158
+00:12:02,000 --> 00:12:03,000
+Is that clear?
+
+159
+00:12:04,000 --> 00:12:07,000
+And in sports car, we have pretty similar situation.
+
+160
+00:12:07,000 --> 00:12:12,000
+The only difference is just the behavior in drive mass is a little bit different.
+
+161
+00:12:12,000 --> 00:12:17,000
+I print another text to reflects the fact that this is sports car driving.
+
+162
+00:12:18,000 --> 00:12:22,000
+But in the real life, you can implement any logic you think is needed here.
+
+163
+00:12:22,000 --> 00:12:25,000
+And one more important thing was decorator.
+
+164
+00:12:25,000 --> 00:12:28,000
+You're not limited only to override in some behavior.
+
+165
+00:12:29,000 --> 00:12:35,000
+You're able and welcome to introduce enhanced interface and new behavior by wrapping basic objects.
+
+166
+00:12:36,000 --> 00:12:38,000
+And also, you can declare additional fields if you need.
+
+167
+00:12:39,000 --> 00:12:45,000
+For example, here in sports car, I can declare additional behaviors that is valid for sports cars.
+
+168
+00:12:46,000 --> 00:12:52,000
+Set transmission mode If you ever draw Porsche or Ferrari, you know that they have different drive
+
+169
+00:12:52,000 --> 00:12:58,000
+modes that tuned suspension of your car exhaust transmission and other things.
+
+170
+00:12:58,000 --> 00:13:05,000
+For example, in the Porsche 911, you have regular mode sport and Sport Plus and this mass, it will
+
+171
+00:13:05,000 --> 00:13:08,000
+help us to set the transmission mode in our car.
+
+172
+00:13:09,000 --> 00:13:15,000
+Ideally, it would take in them, but in our simplified example, it takes any string as an argument.
+
+173
+00:13:16,000 --> 00:13:23,000
+And now the most interesting part is a client part and see how we can construct objects following this
+
+174
+00:13:23,000 --> 00:13:23,000
+architecture.
+
+175
+00:13:24,000 --> 00:13:28,000
+I have them across here where I collected everything in one place.
+
+176
+00:13:28,000 --> 00:13:32,000
+Let me run the program first to walk you through the console output.
+
+177
+00:13:32,000 --> 00:13:38,000
+As you can see, I create a basic car first and cold drive massive.
+
+178
+00:13:38,000 --> 00:13:42,000
+Afterwards, I decided to create a sports car to create it.
+
+179
+00:13:42,000 --> 00:13:48,000
+I need to create new object of basic car and pass it to constructor of sports car.
+
+180
+00:13:49,000 --> 00:13:57,000
+Here you can see that sports car wraps basic car, and when I call Drive Mass on sports car, you can
+
+181
+00:13:57,000 --> 00:13:59,000
+see that basic car behavior works first.
+
+182
+00:14:00,000 --> 00:14:07,000
+And after that feature of sports car worked and again, it's only up to you how you will ride this logic.
+
+183
+00:14:07,000 --> 00:14:14,000
+You can even during cold drive mass of basic car, but just use some other behavior of basic object.
+
+184
+00:14:14,000 --> 00:14:18,000
+For example, Basic Car also has four wheels.
+
+185
+00:14:18,000 --> 00:14:20,000
+You can just work with those properties.
+
+186
+00:14:21,000 --> 00:14:24,000
+We can initialize variable of specific type like with you.
+
+187
+00:14:24,000 --> 00:14:31,000
+Here was sports car, and in this case, you have access to sports car specific behavior like we described
+
+188
+00:14:32,000 --> 00:14:33,000
+set transmission mode.
+
+189
+00:14:33,000 --> 00:14:36,000
+So you can see how was decorated spartan.
+
+190
+00:14:36,000 --> 00:14:43,000
+I enhanced existent interface and having this flexibility, I can create objects with different features
+
+191
+00:14:43,000 --> 00:14:44,000
+and variations.
+
+192
+00:14:44,000 --> 00:14:48,000
+For example, I can create sports and luxury car if I wish.
+
+193
+00:14:49,000 --> 00:14:50,000
+How to do that?
+
+194
+00:14:50,000 --> 00:14:57,000
+The decorator part and allows us to pass new objects inside the constructor to wrap objects as many
+
+195
+00:14:57,000 --> 00:14:58,000
+times as I need.
+
+196
+00:14:59,000 --> 00:15:01,000
+As you can see here, I just wrapped.
+
+197
+00:15:01,000 --> 00:15:08,000
+Objects multiple times, and when I call drive massive, I can see behavior of basic car.
+
+198
+00:15:08,000 --> 00:15:12,000
+Luxury car and sports car, can you see this?
+
+199
+00:15:13,000 --> 00:15:19,000
+And in this case, you don't need to apply inheritance mechanism to create all possible combinations
+
+200
+00:15:19,000 --> 00:15:20,000
+of different types.
+
+201
+00:15:20,000 --> 00:15:25,000
+You can just construct neurons and runtime object with features that you need.
+
+202
+00:15:25,000 --> 00:15:26,000
+Isn't this cool?
+
+203
+00:15:27,000 --> 00:15:31,000
+Now you know how to implement decorator part in your application.
+
+204
+00:15:32,000 --> 00:15:36,000
+Let's now check the checklist to follow to implement decorator part.
+
+205
+00:15:36,000 --> 00:15:42,000
+And the first thing you need to do is to ensure that you have a common context also called core.
+
+206
+00:15:43,000 --> 00:15:47,000
+Like in our case, we have some basic car like an i o package.
+
+207
+00:15:47,000 --> 00:15:49,000
+We have some basic input stream type.
+
+208
+00:15:50,000 --> 00:15:55,000
+You should have at least some core component and list of features that you would like to add to it.
+
+209
+00:15:56,000 --> 00:16:03,000
+After that, create a decorator type score, gloss and decorate the gloss implements the same common
+
+210
+00:16:03,000 --> 00:16:05,000
+interface with common context.
+
+211
+00:16:06,000 --> 00:16:12,000
+Implement different features that can be added to the common context by extending or implementing decorator
+
+212
+00:16:12,000 --> 00:16:12,000
+type.
+
+213
+00:16:13,000 --> 00:16:17,000
+Implement additional and enhanced functionality in decorator classes.
+
+214
+00:16:18,000 --> 00:16:24,000
+Those are items that we went through during the implementation of Decorator part in our example homes.
+
+215
+00:16:24,000 --> 00:16:25,000
+That was a source code.
+
+216
+00:16:25,000 --> 00:16:28,000
+It was easier for you to understand the Spartan.
+
+217
+00:16:28,000 --> 00:16:36,000
+Now, when we are done with decorate pardon, let's proceed with the next one and the next part is adapter.
+
+218
+00:16:36,000 --> 00:16:42,000
+And as always, let's understand first what problem adaptive pardon is supposed to address.
+
+219
+00:16:42,000 --> 00:16:49,000
+Imagine that you already have some type that do exactly what you need, but the interface is incompatible
+
+220
+00:16:49,000 --> 00:16:51,000
+with the one you have in your system.
+
+221
+00:16:52,000 --> 00:16:56,000
+It can be because of the different reasons some of them are.
+
+222
+00:16:56,000 --> 00:17:04,000
+You are migrating part of your system and some interfaces are not matching each other or you are dealing
+
+223
+00:17:04,000 --> 00:17:12,000
+with obsolete code and you can't just remove it because it works just fine or you want to use some third
+
+224
+00:17:12,000 --> 00:17:18,000
+party library, but it has a different interface that doesn't match needs and agreements within your
+
+225
+00:17:18,000 --> 00:17:19,000
+module.
+
+226
+00:17:19,000 --> 00:17:22,000
+What solution you have to apply to solve this?
+
+227
+00:17:22,000 --> 00:17:30,000
+Just implement a doctor that helps to support existing interface and map it against another interface
+
+228
+00:17:30,000 --> 00:17:35,000
+similar to the different types of sockets when you travel to Great Britain.
+
+229
+00:17:35,000 --> 00:17:41,000
+You need specific adapter when you travel to United States, you need another adapter.
+
+230
+00:17:41,000 --> 00:17:47,000
+When you travel to Europe or Russia, you need some type of adapter to plug in your device.
+
+231
+00:17:47,000 --> 00:17:48,000
+Does it make sense?
+
+232
+00:17:49,000 --> 00:17:55,000
+Similar to this example, you can implement adapter in your code to adapt one interface to another.
+
+233
+00:17:56,000 --> 00:17:59,000
+In other words, we can see that adapter wraps.
+
+234
+00:17:59,000 --> 00:18:07,000
+Existing class was a new interface code we use, which always was a hard thing to follow and to implement
+
+235
+00:18:07,000 --> 00:18:10,000
+and adopt to pardon should help us with this.
+
+236
+00:18:10,000 --> 00:18:13,000
+Hope you already understood what do we need and up to?
+
+237
+00:18:14,000 --> 00:18:18,000
+And now let's review code examples to learn the sport and better.
+
+238
+00:18:18,000 --> 00:18:25,000
+Imagine that we have sought an interface that's supposed to sort array of ins across my app, and I
+
+239
+00:18:25,000 --> 00:18:32,000
+use it already in OSM, massive declarations in different places across my app and the margins that
+
+240
+00:18:32,000 --> 00:18:34,000
+I have third party library.
+
+241
+00:18:34,000 --> 00:18:42,000
+That source list of integers and then does its work just perfect and source faster than all gnome algorithms?
+
+242
+00:18:42,000 --> 00:18:44,000
+This is so-called no sorted.
+
+243
+00:18:45,000 --> 00:18:45,000
+Here it is.
+
+244
+00:18:46,000 --> 00:18:51,000
+According to its interface, it takes list of integers, but not array offense.
+
+245
+00:18:51,000 --> 00:18:55,000
+Here, you can imagine any times that you might have in your system.
+
+246
+00:18:55,000 --> 00:19:01,000
+The main thing to understand here is that you have some specific interface and massive signature.
+
+247
+00:19:02,000 --> 00:19:07,000
+In our case, this is sorta interface and you use it across your app.
+
+248
+00:19:07,000 --> 00:19:10,000
+You already have mass that accepts only such type.
+
+249
+00:19:10,000 --> 00:19:13,000
+It can be different variations of the same issue.
+
+250
+00:19:13,000 --> 00:19:19,000
+And now imagine that you need to search array of things, but you have new algorithms in the search
+
+251
+00:19:19,000 --> 00:19:26,000
+party, a library that is significantly faster and you want to use it in the application, but also
+
+252
+00:19:26,000 --> 00:19:29,000
+you don't want a break and isn't else in your program.
+
+253
+00:19:29,000 --> 00:19:37,000
+What has been already written before and probably even oversimplified this example, but this is just
+
+254
+00:19:37,000 --> 00:19:42,000
+to make it clear for all my students who see adoptive parents first time in their lives.
+
+255
+00:19:42,000 --> 00:19:46,000
+Definitely, you can create the least from array and vice versa.
+
+256
+00:19:46,000 --> 00:19:47,000
+And that's it.
+
+257
+00:19:47,000 --> 00:19:54,000
+But point is in the fact that you don't want to do this all the times and also you don't want it to
+
+258
+00:19:54,000 --> 00:19:56,000
+fix all places where you will use this.
+
+259
+00:19:57,000 --> 00:20:00,000
+And moreover, such case may happen with Stipe's.
+
+260
+00:20:00,000 --> 00:20:01,000
+That is not easy to.
+
+261
+00:20:01,000 --> 00:20:06,000
+The road between each other as array of ends and list of integers.
+
+262
+00:20:06,000 --> 00:20:09,000
+But again, this is just a simple example.
+
+263
+00:20:09,000 --> 00:20:16,000
+So what we have to do is the easiest thing would be to find a way out to adapt the existence sort of
+
+264
+00:20:16,000 --> 00:20:20,000
+interface to no sorter to make it sort of ends.
+
+265
+00:20:20,000 --> 00:20:27,000
+I agree why I need to think how to implement faster and more efficient algorithm of sorting array of
+
+266
+00:20:27,000 --> 00:20:28,000
+things.
+
+267
+00:20:28,000 --> 00:20:34,000
+If I have another class that do approximately the same things that I need in this specific case, I
+
+268
+00:20:34,000 --> 00:20:36,000
+need to come up with that doctor.
+
+269
+00:20:37,000 --> 00:20:44,000
+Here's my short list adopter pay attention that it implements my sort of interface that is basically
+
+270
+00:20:44,000 --> 00:20:48,000
+interface that I already use across my whole app.
+
+271
+00:20:48,000 --> 00:20:53,000
+I aggregate numbers sorter here inside and once stored mass.
+
+272
+00:20:53,000 --> 00:20:57,000
+It is called I convert array of fields to list of integers.
+
+273
+00:20:58,000 --> 00:21:00,000
+It to my number soldier.
+
+274
+00:21:00,000 --> 00:21:06,000
+Since it is already works with lists of integers and when sorting is completed, I convert it back to
+
+275
+00:21:06,000 --> 00:21:08,000
+a reference to return from the message.
+
+276
+00:21:09,000 --> 00:21:16,000
+Now you can see that actually I have the interface that they need, but I adapted the implementation
+
+277
+00:21:16,000 --> 00:21:18,000
+to make it work with third party library.
+
+278
+00:21:18,000 --> 00:21:19,000
+Can you see this?
+
+279
+00:21:20,000 --> 00:21:23,000
+Let's investigate now client code together.
+
+280
+00:21:23,000 --> 00:21:30,000
+Here we have a real fence, and it is obvious that in the case, I would use third party library directly
+
+281
+00:21:30,000 --> 00:21:31,000
+to search my array.
+
+282
+00:21:31,000 --> 00:21:35,000
+It wouldn't work because Matter's signature is different.
+
+283
+00:21:36,000 --> 00:21:43,000
+After that, I initialize my certainly adopted and you can see that I can refer to this object was the
+
+284
+00:21:43,000 --> 00:21:51,000
+reference of type sorter that is my interface, and I can use my interface that is already used across
+
+285
+00:21:51,000 --> 00:21:52,000
+my program.
+
+286
+00:21:52,000 --> 00:22:01,000
+So I just call sort massive and pos array of ins inside it is converted, the list of integers sorted
+
+287
+00:22:01,000 --> 00:22:02,000
+and converted bacteria fence.
+
+288
+00:22:03,000 --> 00:22:05,000
+Does it make more sense now?
+
+289
+00:22:05,000 --> 00:22:09,000
+And again, I would recommend you to pause the video here.
+
+290
+00:22:09,000 --> 00:22:15,000
+Make sure you downloaded the source code from attachments to this lesson and reviewed by yourself.
+
+291
+00:22:15,000 --> 00:22:21,000
+Hopefully, my comments makes sense, and now it is easier for you to understand how adoptive parent
+
+292
+00:22:21,000 --> 00:22:22,000
+works.
+
+293
+00:22:22,000 --> 00:22:29,000
+Now let's create a checklist to implement adaptive part and identifies the interface that you need to
+
+294
+00:22:29,000 --> 00:22:29,000
+follow.
+
+295
+00:22:29,000 --> 00:22:35,000
+In our case, it was sorta interface identified times that you need to adapt.
+
+296
+00:22:35,000 --> 00:22:44,000
+In our case, it was no sorta great adopters that implements target interface and aggregates Typekit
+
+297
+00:22:44,000 --> 00:22:51,000
+that you need to adapt wrapper G+ should have as a reference to the adaptive class in the final step
+
+298
+00:22:51,000 --> 00:22:54,000
+instantiate adapter in your client code and just use it.
+
+299
+00:22:55,000 --> 00:22:56,000
+That's it.
+
+300
+00:22:56,000 --> 00:23:02,000
+Hopefully, now it wouldn't be hard for you to implement adaptive porting from scratch when it will
+
+301
+00:23:02,000 --> 00:23:02,000
+be needed.
+
+302
+00:23:03,000 --> 00:23:09,000
+Now let's learn the last but not least part for today I'd like to present a facade pardon.
+
+303
+00:23:10,000 --> 00:23:11,000
+Why do we need it?
+
+304
+00:23:11,000 --> 00:23:13,000
+Let me explain an example.
+
+305
+00:23:13,000 --> 00:23:19,000
+Imagine that you are implementing some e-commerce application and you are working with business to business
+
+306
+00:23:19,000 --> 00:23:19,000
+model.
+
+307
+00:23:20,000 --> 00:23:27,000
+So-called B2B, sometimes registration of B2B customer that there's some legal entity is harder than
+
+308
+00:23:27,000 --> 00:23:29,000
+the registration of regular user.
+
+309
+00:23:29,000 --> 00:23:35,000
+For example, there is might be cases that you have multiple systems on your one on one duplication
+
+310
+00:23:35,000 --> 00:23:42,000
+of records related to the same customer or you want a verified data of legal entity in other services
+
+311
+00:23:42,000 --> 00:23:48,000
+before registration and registration of new customer will take a few subsequent calls to different services.
+
+312
+00:23:49,000 --> 00:23:55,000
+What do you think would be comfortable to develop and to support such a system having duplicated massive
+
+313
+00:23:55,000 --> 00:23:56,000
+invocations across your app?
+
+314
+00:23:57,000 --> 00:24:02,000
+And moreover, making mistake is easier when you have to remember the whole process of registration
+
+315
+00:24:02,000 --> 00:24:04,000
+for B2B customer.
+
+316
+00:24:04,000 --> 00:24:09,000
+How to simplify the life of engineers and reduce development efforts and likelihood of mistakes.
+
+317
+00:24:10,000 --> 00:24:14,000
+The proper solution here would be to introduce another level of abstraction here.
+
+318
+00:24:14,000 --> 00:24:22,000
+So-called facade bottom helps us to create a unified interface to interact with set of interfaces or
+
+319
+00:24:22,000 --> 00:24:22,000
+subsystem.
+
+320
+00:24:23,000 --> 00:24:28,000
+Facade defines a high level interface that makes a subsystem easier to use.
+
+321
+00:24:28,000 --> 00:24:35,000
+Also, using facades, it makes it easier for new engineers who are joining your team to learn the system
+
+322
+00:24:35,000 --> 00:24:35,000
+faster.
+
+323
+00:24:36,000 --> 00:24:42,000
+So I really feel really understood that the facade will become client interface to the set of other
+
+324
+00:24:42,000 --> 00:24:44,000
+types or subsystem.
+
+325
+00:24:44,000 --> 00:24:51,000
+Probably the only thing that we need to know now is to how to apply this in practice and especially
+
+326
+00:24:51,000 --> 00:24:52,000
+for this.
+
+327
+00:24:52,000 --> 00:24:57,000
+I prepared good examples that will help us to understand the sport and foster.
+
+328
+00:24:57,000 --> 00:25:01,000
+Imagine that you are implementing travel booking system.
+
+329
+00:25:01,000 --> 00:25:07,000
+And you need to allow end users to book travel route that includes flight, combined with the hotels
+
+330
+00:25:07,000 --> 00:25:09,000
+available as a selected date.
+
+331
+00:25:09,000 --> 00:25:16,000
+So as a traveler, I want to book flights and the hotel available for me at that day.
+
+332
+00:25:17,000 --> 00:25:23,000
+As you can see, I have specific business case that I need to implement and really feel ready to seize
+
+333
+00:25:23,000 --> 00:25:24,000
+the whole picture in the hat.
+
+334
+00:25:25,000 --> 00:25:31,000
+Implementation of this scenario, which require declare and set of types like the following one's flight
+
+335
+00:25:31,000 --> 00:25:39,000
+hotel the book that is sometimes that can book hotel flight book that is times that can book flight
+
+336
+00:25:39,000 --> 00:25:40,000
+for US travel route.
+
+337
+00:25:41,000 --> 00:25:46,000
+This is exactly the time that combines hotels with flights to create travel routes for tourists.
+
+338
+00:25:47,000 --> 00:25:50,000
+And here is our travel facade and our specific example.
+
+339
+00:25:50,000 --> 00:25:55,000
+It has only a few masses, but in real life it could be more massive here.
+
+340
+00:25:55,000 --> 00:26:01,000
+We have masses for our specific business case, not least of travel rules that are available and book
+
+341
+00:26:01,000 --> 00:26:03,000
+specific travel routes.
+
+342
+00:26:03,000 --> 00:26:10,000
+Here you can see that I aggregate auto and a flag book to get a list of available orders and flights
+
+343
+00:26:10,000 --> 00:26:13,000
+accordingly and book auto and flights.
+
+344
+00:26:13,000 --> 00:26:19,000
+One user will select the travel route in the Jet Travel Routes Mass, and I can just grab the logic
+
+345
+00:26:19,000 --> 00:26:25,000
+of processing for flights and autos and mapping them between each other and creating of travel routes.
+
+346
+00:26:26,000 --> 00:26:32,000
+After that, we reach a list of travel routes to not distract your attention on process and logic.
+
+347
+00:26:32,000 --> 00:26:39,000
+I just put common here and return empty list to avoid compilation error and not going to run time exception.
+
+348
+00:26:39,000 --> 00:26:45,000
+Hope you are not losing the focus from my instincts here in the book Travel Route Mass.
+
+349
+00:26:45,000 --> 00:26:52,000
+I booked separately auto and flight, and now every time I book travel route, I just need to go one
+
+350
+00:26:52,000 --> 00:26:53,000
+mass at this one.
+
+351
+00:26:54,000 --> 00:27:01,000
+Let me show you how client code looks like now is the only thing you need is just to create an instance
+
+352
+00:27:01,000 --> 00:27:06,000
+of travel facade wherever you need to get a list of travel routes and book travel.
+
+353
+00:27:07,000 --> 00:27:13,000
+You can see how easily I can get lists of travel routes and how easily I can book travel route.
+
+354
+00:27:13,000 --> 00:27:19,000
+Just imagine that every time in all places so your app you would need to instantiate flight, book auto
+
+355
+00:27:19,000 --> 00:27:23,000
+worker, describe logic of mapping and creation of travel routes.
+
+356
+00:27:24,000 --> 00:27:25,000
+That is almost impossible.
+
+357
+00:27:26,000 --> 00:27:29,000
+That's how facade may make our lives easier.
+
+358
+00:27:29,000 --> 00:27:35,000
+You have just another level of abstraction, and you can interact with a subsystem through a simple
+
+359
+00:27:35,000 --> 00:27:36,000
+interface.
+
+360
+00:27:37,000 --> 00:27:41,000
+You should always remember that your facade should not become an object.
+
+361
+00:27:42,000 --> 00:27:45,000
+Gut object is an auntie pardon that describes the case.
+
+362
+00:27:46,000 --> 00:27:49,000
+When you have objects is that can do everything in your app.
+
+363
+00:27:50,000 --> 00:27:56,000
+For example, you have a facade that can register user, lock him and create a shopping cart for him.
+
+364
+00:27:57,000 --> 00:27:58,000
+Checkout and so on.
+
+365
+00:27:59,000 --> 00:28:06,000
+You can't do everything with the one object because this will violate or be principles and will bring
+
+366
+00:28:06,000 --> 00:28:10,000
+you to the high Coplan, which already know is not perfect.
+
+367
+00:28:11,000 --> 00:28:17,000
+Basically, that sits regarding the facade pattern that's grab a checklist to implement facade bottom.
+
+368
+00:28:18,000 --> 00:28:24,000
+The first thing we need to start with is to define business cases and business scenarios that are most
+
+369
+00:28:24,000 --> 00:28:25,000
+used in your app.
+
+370
+00:28:26,000 --> 00:28:32,000
+Design the facade interfaces are described to be here, but to interact with a subsystem, aggregate
+
+371
+00:28:32,000 --> 00:28:40,000
+all necessary types inside the facade to ensure efficient and proper behavior of facade in client code.
+
+372
+00:28:40,000 --> 00:28:43,000
+Get the essence of a facade and work with it.
+
+373
+00:28:43,000 --> 00:28:50,000
+Now you can easily implement facade by your own windows and most popular structural points in this lesson,
+
+374
+00:28:50,000 --> 00:28:51,000
+in my opinion.
+
+375
+00:28:51,000 --> 00:28:59,000
+They are a proxy decorator, adopter and facade, and very often my students ask me what the specific
+
+376
+00:28:59,000 --> 00:29:01,000
+differences between these buttons.
+
+377
+00:29:02,000 --> 00:29:05,000
+Because in some degree, ziff something in common.
+
+378
+00:29:05,000 --> 00:29:08,000
+But I want you to see clear difference between them.
+
+379
+00:29:09,000 --> 00:29:12,000
+So let's now covers the differences on this slide.
+
+380
+00:29:12,000 --> 00:29:14,000
+Let's recap what this proxy pattern do.
+
+381
+00:29:15,000 --> 00:29:20,000
+Proxy wraps as the object to avoid direct interaction with object.
+
+382
+00:29:21,000 --> 00:29:27,000
+Proxy provides the same interface as wrapped object and how this is different from decorate.
+
+383
+00:29:27,000 --> 00:29:33,000
+The bottom decorator provides enhanced interface like you saw today.
+
+384
+00:29:33,000 --> 00:29:40,000
+In our example, when we decorated our car, this additional behavior and method so you can decorate
+
+385
+00:29:40,000 --> 00:29:41,000
+object was additional behavior.
+
+386
+00:29:42,000 --> 00:29:49,000
+OK, but when I tell this, my students often ask me, and what is the difference between proxy decorator
+
+387
+00:29:49,000 --> 00:29:58,000
+and doctor that my doctor provides different interface to its object and adapts one interface to nazar?
+
+388
+00:29:58,000 --> 00:29:59,000
+Is that clear?
+
+389
+00:29:59,000 --> 00:30:01,000
+And then how facade?
+
+390
+00:30:01,000 --> 00:30:10,000
+Often is different facade also introduces new interface, but I job to introduce new interface that
+
+391
+00:30:10,000 --> 00:30:18,000
+respects a particular interface that it once thought that, on the other hand, facade is used when
+
+392
+00:30:18,000 --> 00:30:24,000
+you want to create new interface to make interaction with subsystem easier.
+
+393
+00:30:24,000 --> 00:30:32,000
+And very often by combining the behavior of multiple units into complete business flow, it makes sense.
+
+394
+00:30:33,000 --> 00:30:37,000
+Hope now it is clear for you what is the difference between these buttons?
+
+395
+00:30:37,000 --> 00:30:43,000
+Now, let's recap what we have learned to date in this lesson we learned for partners.
+
+396
+00:30:43,000 --> 00:30:48,000
+They are a proxy decorator, adaptor and facade.
+
+397
+00:30:48,000 --> 00:30:55,000
+Also, we performed comparative analysis of these parts so that you could clearly understand the difference
+
+398
+00:30:55,000 --> 00:30:56,000
+between them.
+
+399
+00:30:56,000 --> 00:30:58,000
+That's it for this lesson.
+
+400
+00:30:58,000 --> 00:31:00,000
+Thanks a lot for your attention.
+
+401
+00:31:00,000 --> 00:31:03,000
+Have a great day and see you in the next lesson.
+
diff --git a/39 - GoF Design Patterns of Software Architecture in OOP/004 Source-code-of-all-examples-from-the-lesson.url b/39 - GoF Design Patterns of Software Architecture in OOP/004 Source-code-of-all-examples-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..233b39be9a632213ca6a4282cc7cc5f6273204dc
--- /dev/null
+++ b/39 - GoF Design Patterns of Software Architecture in OOP/004 Source-code-of-all-examples-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/patterns/structural
\ No newline at end of file
diff --git a/39 - GoF Design Patterns of Software Architecture in OOP/004 Structural Patterns, p.2_en.srt b/39 - GoF Design Patterns of Software Architecture in OOP/004 Structural Patterns, p.2_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..04b04647e491f32d22adbfd3d0eea68b01457ebd
--- /dev/null
+++ b/39 - GoF Design Patterns of Software Architecture in OOP/004 Structural Patterns, p.2_en.srt
@@ -0,0 +1,1144 @@
+1
+00:00:05,000 --> 00:00:11,000
+Hello, my friends, and this lesson we learned in structural patterns and previous lessons we learned
+
+2
+00:00:11,000 --> 00:00:19,000
+proxy decorator and and facade pardon, that means we have three more parties from structural S. to
+
+3
+00:00:19,000 --> 00:00:23,000
+learn in this lesson, build on bridge, lightweight and composite.
+
+4
+00:00:24,000 --> 00:00:30,000
+And as always, we learn these buttons with the help of coding examples that you can find in attachments
+
+5
+00:00:30,000 --> 00:00:31,000
+to this lesson.
+
+6
+00:00:32,000 --> 00:00:32,000
+Nothing to say.
+
+7
+00:00:32,000 --> 00:00:33,000
+More about agenda.
+
+8
+00:00:33,000 --> 00:00:34,000
+Let's stop.
+
+9
+00:00:35,000 --> 00:00:38,000
+And the first part is that we are going to review today is a bridge.
+
+10
+00:00:38,000 --> 00:00:45,000
+But the main goal of Bridgepoint is to decouple an abstraction from its implementation so that the two
+
+11
+00:00:45,000 --> 00:00:47,000
+can vary independently.
+
+12
+00:00:47,000 --> 00:00:51,000
+Let's try to understand what stands behind the statement.
+
+13
+00:00:52,000 --> 00:00:58,000
+Imagine the case when your class and what it is supposed to do will arise very often.
+
+14
+00:00:58,000 --> 00:01:04,000
+I mean, literally, you should go and change your class every time it changes the behavior.
+
+15
+00:01:04,000 --> 00:01:10,000
+Such cases are not very often, but it may happen that you would need to come up with a solution how
+
+16
+00:01:10,000 --> 00:01:12,000
+to address constant changes in behavior.
+
+17
+00:01:13,000 --> 00:01:17,000
+But what if we would separate to terms abstraction and implementation?
+
+18
+00:01:18,000 --> 00:01:23,000
+What if your class would be considered as relatively stable abstraction and you will keep implementation
+
+19
+00:01:23,000 --> 00:01:24,000
+separately?
+
+20
+00:01:24,000 --> 00:01:27,000
+That is exactly what each part is about.
+
+21
+00:01:27,000 --> 00:01:33,000
+Which point exists to address the challenge of constant behavior changes without impacting the code
+
+22
+00:01:33,000 --> 00:01:34,000
+as it was already written?
+
+23
+00:01:35,000 --> 00:01:37,000
+Don't you think so?
+
+24
+00:01:37,000 --> 00:01:38,000
+Was Bechuanaland way?
+
+25
+00:01:38,000 --> 00:01:44,000
+We have abstraction and its implementation separated and that's why they may be improved separately
+
+26
+00:01:44,000 --> 00:01:45,000
+without breach.
+
+27
+00:01:45,000 --> 00:01:51,000
+But when you have all implementations bound to the abstraction at compile time and this can be changed
+
+28
+00:01:51,000 --> 00:01:52,000
+as the runtime.
+
+29
+00:01:52,000 --> 00:01:56,000
+How is the separation of abstraction and implementation is implemented?
+
+30
+00:01:56,000 --> 00:01:57,000
+Very easy.
+
+31
+00:01:57,000 --> 00:02:00,000
+They're separated in different classes.
+
+32
+00:02:00,000 --> 00:02:06,000
+We should implement our abstraction with the possibility to delegate goals to our implementation.
+
+33
+00:02:06,000 --> 00:02:12,000
+In this case, we will be able to pass implementation during the runtime and update our behavior.
+
+34
+00:02:12,000 --> 00:02:13,000
+Does it make sense?
+
+35
+00:02:14,000 --> 00:02:18,000
+If not yet, then let me explain this one example with the details.
+
+36
+00:02:19,000 --> 00:02:23,000
+In this example, we are going to have TV, radio and remote control.
+
+37
+00:02:24,000 --> 00:02:30,000
+Remote control may control both TV and radio, unlike all other previous examples.
+
+38
+00:02:30,000 --> 00:02:33,000
+Let me start this one from the client code.
+
+39
+00:02:33,000 --> 00:02:37,000
+I'm running this demo file explorer console output.
+
+40
+00:02:37,000 --> 00:02:38,000
+Together with you.
+
+41
+00:02:38,000 --> 00:02:45,000
+We have this device, Masset, that performs same operations with different remote implementations separately
+
+42
+00:02:45,000 --> 00:02:47,000
+on TV and radio.
+
+43
+00:02:47,000 --> 00:02:50,000
+I call this massive and positive Zephyrs.
+
+44
+00:02:51,000 --> 00:02:55,000
+We have some basic remote that can only churn our device on.
+
+45
+00:02:55,000 --> 00:02:58,000
+And this is exactly what we did here.
+
+46
+00:02:58,000 --> 00:03:06,000
+We created our basic remote object and passed that our TV object and woke up our mast here and print
+
+47
+00:03:06,000 --> 00:03:06,000
+status to.
+
+48
+00:03:07,000 --> 00:03:09,000
+So let's see what we have here.
+
+49
+00:03:10,000 --> 00:03:16,000
+We have indications that this is tasked with the basic remote and notifications that we have pressed.
+
+50
+00:03:16,000 --> 00:03:17,000
+Pobre Targo.
+
+51
+00:03:18,000 --> 00:03:25,000
+After that, I call matters that all devices in my example have been status Masvidal and we have status
+
+52
+00:03:25,000 --> 00:03:30,000
+printed here and we see information about current volume and current channel rate.
+
+53
+00:03:31,000 --> 00:03:38,000
+What we can do next imagines that the next day we needed to improve our behavior and the way we interact
+
+54
+00:03:38,000 --> 00:03:41,000
+with our device and change its state.
+
+55
+00:03:41,000 --> 00:03:48,000
+Now we need to be able to use the device and what have to do I have options is to adjust my existing
+
+56
+00:03:48,000 --> 00:03:49,000
+remote control.
+
+57
+00:03:50,000 --> 00:03:54,000
+I'll get benefits from breach button and separation of obstruction and implementation.
+
+58
+00:03:55,000 --> 00:04:03,000
+So I have advanced remote object and I perform the same operation power Marsters invoked first and advanced
+
+59
+00:04:03,000 --> 00:04:05,000
+remote that has such behavior as viewed.
+
+60
+00:04:06,000 --> 00:04:08,000
+After that I bring you my status to console.
+
+61
+00:04:09,000 --> 00:04:10,000
+And what do we have here now?
+
+62
+00:04:11,000 --> 00:04:14,000
+We have the same TV, but this time it is disabled.
+
+63
+00:04:15,000 --> 00:04:15,000
+Why?
+
+64
+00:04:16,000 --> 00:04:22,000
+Because Power Tuggle has been plagued second time and the state of the TV is changed.
+
+65
+00:04:22,000 --> 00:04:29,000
+This time it is turned off and we have volume of zero because we muted our TV.
+
+66
+00:04:29,000 --> 00:04:30,000
+Is that clear?
+
+67
+00:04:31,000 --> 00:04:36,000
+You can see how I improved my remote control without touching my TV at all.
+
+68
+00:04:37,000 --> 00:04:39,000
+We have pretty similar story with the radio.
+
+69
+00:04:39,000 --> 00:04:41,000
+Renea is just another device.
+
+70
+00:04:41,000 --> 00:04:41,000
+Correct?
+
+71
+00:04:42,000 --> 00:04:48,000
+And we can apply the same behavior to the radio at the beginning and you can see the demo of the basic
+
+72
+00:04:48,000 --> 00:04:49,000
+remote object.
+
+73
+00:04:49,000 --> 00:04:55,000
+And afterwards we mute radio and you can see we have muted radio that is turned off.
+
+74
+00:04:55,000 --> 00:05:01,000
+And now is the most interesting part, how all of this is implemented now when you know how everything
+
+75
+00:05:01,000 --> 00:05:02,000
+is broken here.
+
+76
+00:05:03,000 --> 00:05:10,000
+Dive deeper into details, we have device interface and implementation in the form of TV and radio,
+
+77
+00:05:10,000 --> 00:05:15,000
+each device may perform all actions that are listed in its interface.
+
+78
+00:05:16,000 --> 00:05:17,000
+Hope that there are not questions here.
+
+79
+00:05:18,000 --> 00:05:22,000
+The next interface that we have here is a remote interface.
+
+80
+00:05:22,000 --> 00:05:28,000
+This is an interface that describes all possible actions that remote may do.
+
+81
+00:05:28,000 --> 00:05:32,000
+We have basic remote like you saw and implements this interface.
+
+82
+00:05:33,000 --> 00:05:38,000
+And in case we need additional behavior, we have advanced remote that just extends the basic remote.
+
+83
+00:05:39,000 --> 00:05:41,000
+Pay attention to one important thing here.
+
+84
+00:05:41,000 --> 00:05:47,000
+Most basic remote and advanced remote don't have constructor without arguments.
+
+85
+00:05:47,000 --> 00:05:51,000
+All of them takes abstraction as an argument to work with it.
+
+86
+00:05:51,000 --> 00:05:55,000
+So each remote takes some device during the instantiation.
+
+87
+00:05:56,000 --> 00:05:59,000
+You can't create remote without device in this case.
+
+88
+00:05:59,000 --> 00:06:04,000
+And once the remote control has device, it changes its status.
+
+89
+00:06:04,000 --> 00:06:10,000
+And by the way, here is mute in advanced remote IT pricelock to console.
+
+90
+00:06:10,000 --> 00:06:14,000
+That message has been invoked and it changes volume on the device.
+
+91
+00:06:15,000 --> 00:06:16,000
+Does it make sense?
+
+92
+00:06:16,000 --> 00:06:17,000
+In this example?
+
+93
+00:06:17,000 --> 00:06:24,000
+Our remote controls serve as an abstraction and our devices as implementation remote has a reference
+
+94
+00:06:24,000 --> 00:06:28,000
+to device and the remote manages the specific device.
+
+95
+00:06:28,000 --> 00:06:34,000
+You can improve remote controls independently without necessarily updating of devices.
+
+96
+00:06:34,000 --> 00:06:39,000
+Can you understand now how all these types are connected between each other anyway?
+
+97
+00:06:39,000 --> 00:06:45,000
+In case you have any questions, do not hesitate to write them in a section of this course.
+
+98
+00:06:45,000 --> 00:06:51,000
+And right now let's create a checklist that we need to follow during the implementation of each partner
+
+99
+00:06:52,000 --> 00:06:55,000
+to implement breach button, follow next steps.
+
+100
+00:06:55,000 --> 00:07:01,000
+Define whether you have two Iraqis that can be improved and enhanced independently.
+
+101
+00:07:01,000 --> 00:07:06,000
+If yes, then split them into Iraq of abstractions and implementations.
+
+102
+00:07:07,000 --> 00:07:10,000
+Think about operations that would be needed to your client.
+
+103
+00:07:11,000 --> 00:07:14,000
+Describe these operations in abstraction class.
+
+104
+00:07:14,000 --> 00:07:21,000
+If you need new operations, great new abstraction, class designs, a separation of concerns.
+
+105
+00:07:21,000 --> 00:07:25,000
+What is abstraction and what is implementation of behavior?
+
+106
+00:07:25,000 --> 00:07:32,000
+Great concrete classes of your domain type and behavior as a reference to the implementation to the
+
+107
+00:07:32,000 --> 00:07:39,000
+class of the abstraction zephyrs exactly how we allowed to pass the words into the constructor to apply
+
+108
+00:07:39,000 --> 00:07:41,000
+additional behavior in our example.
+
+109
+00:07:42,000 --> 00:07:45,000
+Then we get close to the target object at runtime.
+
+110
+00:07:45,000 --> 00:07:50,000
+These are steps that we passed to implement Bridgepoint from our example.
+
+111
+00:07:50,000 --> 00:07:51,000
+Hope it makes sense.
+
+112
+00:07:52,000 --> 00:07:53,000
+Let's continue.
+
+113
+00:07:53,000 --> 00:07:57,000
+And the next point that we are going to learn is a flyweight.
+
+114
+00:07:57,000 --> 00:08:04,000
+This is a program that allows us to aggregate a big number of objects by sharing the state between objects
+
+115
+00:08:04,000 --> 00:08:09,000
+to not store the duplicated state and the same data in each object.
+
+116
+00:08:09,000 --> 00:08:11,000
+To explain it in simple words.
+
+117
+00:08:12,000 --> 00:08:15,000
+Imagine the next case, your development video.
+
+118
+00:08:15,000 --> 00:08:22,000
+Again, that would be GTA and you decide to blow up hundreds of cars that drives on the highway and
+
+119
+00:08:22,000 --> 00:08:24,000
+issued them with a gun.
+
+120
+00:08:24,000 --> 00:08:31,000
+And you know that you already spent thousands of bullets and now your game crashed and closed after
+
+121
+00:08:31,000 --> 00:08:32,000
+and used to gain locks.
+
+122
+00:08:32,000 --> 00:08:38,000
+You understand that there is not enough of RAM on your computer to store information about all bullets
+
+123
+00:08:38,000 --> 00:08:40,000
+and all cars that you blew up.
+
+124
+00:08:41,000 --> 00:08:48,000
+Indeed, why should you store information about simulcasts and all bullets if are the same, that would
+
+125
+00:08:48,000 --> 00:08:50,000
+allow you to save huge amount of memory?
+
+126
+00:08:50,000 --> 00:08:53,000
+That is exactly the reason why we need to use flyways.
+
+127
+00:08:53,000 --> 00:08:59,000
+Sometimes, for example, each element should have different and common qualities.
+
+128
+00:08:59,000 --> 00:09:05,000
+For example, each car would have different color, but colors may be the same for many different objects.
+
+129
+00:09:06,000 --> 00:09:10,000
+That's why there is no need to store each color separately for each car.
+
+130
+00:09:11,000 --> 00:09:14,000
+Moreover, body of some cars also similar.
+
+131
+00:09:14,000 --> 00:09:20,000
+That's why you don't need to store dozens of the same 3D images of the same car.
+
+132
+00:09:20,000 --> 00:09:24,000
+But each car should have different coordinates in your virtual space.
+
+133
+00:09:25,000 --> 00:09:29,000
+That's what will be unique for each car and should be stored.
+
+134
+00:09:29,000 --> 00:09:36,000
+But we already saved a lot of the space because coordinates don't take as much space in RAM as cardboard
+
+135
+00:09:36,000 --> 00:09:43,000
+images and colors information we can call something what has not changed in our state of the object
+
+136
+00:09:44,000 --> 00:09:46,000
+and some state that is changed.
+
+137
+00:09:46,000 --> 00:09:53,000
+Or to state, for example, color and body type of the car in our video game is constant for each car
+
+138
+00:09:53,000 --> 00:09:56,000
+and can be considered as in their state.
+
+139
+00:09:56,000 --> 00:10:02,000
+Coordinates of the car in the space is something what is unique and specific for each car.
+
+140
+00:10:02,000 --> 00:10:03,000
+And will be different.
+
+141
+00:10:04,000 --> 00:10:11,000
+That is called border state and now you can easily understand the main idea of a five wait partner.
+
+142
+00:10:11,000 --> 00:10:19,000
+The main idea of a five week program is to store on the interstate and pass border state as arguments
+
+143
+00:10:19,000 --> 00:10:21,000
+when needed following this approach.
+
+144
+00:10:21,000 --> 00:10:28,000
+We have significantly lower number of objects and we can use the same objects with different order state
+
+145
+00:10:28,000 --> 00:10:30,000
+to reproduce the state of different objects.
+
+146
+00:10:31,000 --> 00:10:35,000
+In this case, you can reuse the same objects in different contexts.
+
+147
+00:10:35,000 --> 00:10:36,000
+Does it make sense now?
+
+148
+00:10:37,000 --> 00:10:42,000
+And flyweight partners should give us an answer where to store this order state.
+
+149
+00:10:42,000 --> 00:10:45,000
+And you can see different implementations in real life.
+
+150
+00:10:46,000 --> 00:10:52,000
+Often the state is stored in some container object, sometimes even in global context.
+
+151
+00:10:52,000 --> 00:10:58,000
+In this particular case, we have to store or a state map with the references to the real objects.
+
+152
+00:10:59,000 --> 00:11:06,000
+To simplify interaction, we can even create a factory of a flyways, for example, some factory masset
+
+153
+00:11:06,000 --> 00:11:09,000
+that takes arguments and returns.
+
+154
+00:11:09,000 --> 00:11:10,000
+You ready to use object?
+
+155
+00:11:11,000 --> 00:11:17,000
+And if you didn't skip the lesson about gradational points, namely about factory Macit now when you
+
+156
+00:11:17,000 --> 00:11:23,000
+understood what flyweight pardon is, at least on the high level, let me show you an example, because
+
+157
+00:11:23,000 --> 00:11:27,000
+with real code, it will be easier for you to get the details in.
+
+158
+00:11:27,000 --> 00:11:31,000
+Our example will create a force that consists from one million trees.
+
+159
+00:11:31,000 --> 00:11:35,000
+Each tree should be a separate object that contains info about each state.
+
+160
+00:11:36,000 --> 00:11:42,000
+Creating the forest with huge amount of trees will take a lot of space, but also a lot of trees share
+
+161
+00:11:42,000 --> 00:11:45,000
+in the same state, same color name.
+
+162
+00:11:46,000 --> 00:11:52,000
+That's where flyweight Partan come into play will separate either and order state.
+
+163
+00:11:52,000 --> 00:11:58,000
+We create multiple objects of tree type class that will cache common information.
+
+164
+00:11:59,000 --> 00:12:00,000
+Let me show you this time.
+
+165
+00:12:00,000 --> 00:12:02,000
+Here is tree type class.
+
+166
+00:12:02,000 --> 00:12:06,000
+It has such fields as name color and as a tree data.
+
+167
+00:12:07,000 --> 00:12:13,000
+And instead of having Meenan objects of tree type, we can reduce our fly objects.
+
+168
+00:12:13,000 --> 00:12:15,000
+Let me show you the tree type.
+
+169
+00:12:15,000 --> 00:12:19,000
+You can see that each tree will have unique coordinates.
+
+170
+00:12:19,000 --> 00:12:26,000
+Matri objects also will have the reference to some common information that is shared in tree type object.
+
+171
+00:12:26,000 --> 00:12:30,000
+And you can't create tree object without the tree type.
+
+172
+00:12:30,000 --> 00:12:37,000
+Pay attention to this constructor what to do in case we need to get some tree type for such cases.
+
+173
+00:12:37,000 --> 00:12:40,000
+We have tree type factory in this factory.
+
+174
+00:12:40,000 --> 00:12:47,000
+We have a map that stores only one object mapped three key and we use tree name as a key.
+
+175
+00:12:47,000 --> 00:12:54,000
+That's why we have only one object mapped to one tree name and then static methods that allows us to
+
+176
+00:12:54,000 --> 00:12:55,000
+get tree type.
+
+177
+00:12:55,000 --> 00:12:57,000
+We can request tree type.
+
+178
+00:12:58,000 --> 00:13:01,000
+I use multiple arguments to get the tree type that I need.
+
+179
+00:13:02,000 --> 00:13:03,000
+At the beginning.
+
+180
+00:13:03,000 --> 00:13:10,000
+I check whether I already have objects associated with such tree name and if no, then I create one
+
+181
+00:13:10,000 --> 00:13:12,000
+and put in my map.
+
+182
+00:13:12,000 --> 00:13:13,000
+Is it there?
+
+183
+00:13:13,000 --> 00:13:16,000
+Now let's look at the forest object.
+
+184
+00:13:16,000 --> 00:13:23,000
+In first object I have Masad plant a tree, I pass information and burn the tree that I want to plant
+
+185
+00:13:24,000 --> 00:13:27,000
+and the first thing that I do, I want to get my tree type.
+
+186
+00:13:28,000 --> 00:13:35,000
+After that I create a tree object with a tree type and after that I add this tree to this list.
+
+187
+00:13:36,000 --> 00:13:43,000
+Can you see this and understand that storing some data entry type object allows us to share some properties
+
+188
+00:13:43,000 --> 00:13:46,000
+and some state between multiple tree objects?
+
+189
+00:13:46,000 --> 00:13:51,000
+Yes, tree is a separate object and yes, it has unique values.
+
+190
+00:13:52,000 --> 00:13:59,000
+But flyweight Porten allow this to save relatively a lot of memory by sharing some state between different
+
+191
+00:13:59,000 --> 00:13:59,000
+objects.
+
+192
+00:14:00,000 --> 00:14:01,000
+Would you like to look at the client code?
+
+193
+00:14:02,000 --> 00:14:03,000
+Let's do that.
+
+194
+00:14:04,000 --> 00:14:05,000
+This is our demo file.
+
+195
+00:14:06,000 --> 00:14:11,000
+In my example, I have only two types of trees, some oak and auton oak.
+
+196
+00:14:12,000 --> 00:14:15,000
+Obviously these trees will have different colors.
+
+197
+00:14:16,000 --> 00:14:19,000
+I generate coordinates randomly with this method.
+
+198
+00:14:19,000 --> 00:14:22,000
+I will not focus on the logic of the method.
+
+199
+00:14:23,000 --> 00:14:30,000
+After I planted one million trees, I set search for my window and make it visible in parallel.
+
+200
+00:14:30,000 --> 00:14:33,000
+I print statistics to consult in statistics.
+
+201
+00:14:33,000 --> 00:14:40,000
+You may find information about memory usage and to show you how it works, let me run this program.
+
+202
+00:14:41,000 --> 00:14:48,000
+This is done with old fashioned Java stack for desktop applications, but it doesn't matter for understanding
+
+203
+00:14:48,000 --> 00:14:49,000
+of lightweight parren.
+
+204
+00:14:50,000 --> 00:14:53,000
+You see the trees are planted on the screen.
+
+205
+00:14:53,000 --> 00:14:57,000
+Let's now check console output to check the statistics.
+
+206
+00:14:57,000 --> 00:15:02,000
+By my approximate calculations, we saved approximately certain megabytes.
+
+207
+00:15:02,000 --> 00:15:09,000
+One million trees, OK, now you clearly understand how flyweight pardon works and what is needed to
+
+208
+00:15:09,000 --> 00:15:10,000
+be done to implement it.
+
+209
+00:15:11,000 --> 00:15:16,000
+Let's now create checklists to implement this plan to implement flyweight point.
+
+210
+00:15:17,000 --> 00:15:18,000
+We need to follow next steps.
+
+211
+00:15:19,000 --> 00:15:26,000
+The first thing we need to do is to split the state of our object into groups in and order state.
+
+212
+00:15:26,000 --> 00:15:33,000
+We should clearly understand what state is the same across all objects and may be shared and what state
+
+213
+00:15:33,000 --> 00:15:41,000
+is unique created that where Constance feels will be initialized as a construct to make sure that the
+
+214
+00:15:41,000 --> 00:15:42,000
+state may be passed.
+
+215
+00:15:42,000 --> 00:15:49,000
+As message arguments create factories that will Kasher state and will return already created objects
+
+216
+00:15:50,000 --> 00:15:58,000
+clients should request object to a specific state, but not create it directly to restore order, state
+
+217
+00:15:58,000 --> 00:16:05,000
+or generate ZOS and Puzzle's as an argument flyway that ensures the list of actions added to implement
+
+218
+00:16:05,000 --> 00:16:06,000
+this example.
+
+219
+00:16:07,000 --> 00:16:08,000
+Hope this will help you.
+
+220
+00:16:09,000 --> 00:16:10,000
+And we have the last but not least.
+
+221
+00:16:11,000 --> 00:16:14,000
+And for today it is called composite and few words.
+
+222
+00:16:14,000 --> 00:16:21,000
+Composite allows us to group objects in tree like structure and interact with objects as a single one.
+
+223
+00:16:22,000 --> 00:16:28,000
+Applying this pardon makes sense only in cases when all your objects may be structured in three like
+
+224
+00:16:28,000 --> 00:16:29,000
+organization.
+
+225
+00:16:30,000 --> 00:16:36,000
+For example, imagine that you have online store and use seven different products and also provide service
+
+226
+00:16:36,000 --> 00:16:38,000
+of back and products deliver.
+
+227
+00:16:38,000 --> 00:16:43,000
+Some products are wrapped in the box that customer paid for.
+
+228
+00:16:43,000 --> 00:16:46,000
+So each box may contain few products.
+
+229
+00:16:46,000 --> 00:16:50,000
+Box may contain other smaller boxes that contain products too.
+
+230
+00:16:51,000 --> 00:16:55,000
+And imagine that you need to calculate the price of the whole order.
+
+231
+00:16:55,000 --> 00:17:02,000
+The first solutions is probably you might think of is to iterate over each box, extract it and iterate
+
+232
+00:17:02,000 --> 00:17:07,000
+over each product inside and some of the price did I guess.
+
+233
+00:17:07,000 --> 00:17:09,000
+But this task might be challenging.
+
+234
+00:17:09,000 --> 00:17:16,000
+You don't always know how much less you have on each iteration and structure of the boxes composite
+
+235
+00:17:16,000 --> 00:17:23,000
+part and in this case suggest that's to take all boxes and product as a single object and get total
+
+236
+00:17:23,000 --> 00:17:26,000
+price at once for the client.
+
+237
+00:17:26,000 --> 00:17:30,000
+In this case, there is no need to know anything about internal structure.
+
+238
+00:17:30,000 --> 00:17:35,000
+But probably the most interesting thing here is how all this is implemented.
+
+239
+00:17:36,000 --> 00:17:38,000
+I suggest to investigate the code example.
+
+240
+00:17:38,000 --> 00:17:44,000
+I'm sure that the real example will bring some clarity, understanding of this point.
+
+241
+00:17:44,000 --> 00:17:47,000
+Imagine that we are developing some UI.
+
+242
+00:17:47,000 --> 00:17:53,000
+We have common interface for all shapes in our example here, shape interface this.
+
+243
+00:17:53,000 --> 00:17:57,000
+This is all behaviors that should be implemented by each shape.
+
+244
+00:17:57,000 --> 00:18:05,000
+We have abstract class based shape that implement some masses and can create shape implementations extends
+
+245
+00:18:05,000 --> 00:18:06,000
+this abstract class.
+
+246
+00:18:07,000 --> 00:18:11,000
+We have circle, compound, shape, note and rectangle.
+
+247
+00:18:11,000 --> 00:18:18,000
+Nothing special in these classes besides compound shape, class, these type aggregates least of other
+
+248
+00:18:18,000 --> 00:18:21,000
+shapes and works with a group of shapes inside.
+
+249
+00:18:22,000 --> 00:18:29,000
+The object of this type may contain multiple shapes and containers with shapes containing with shapes,
+
+250
+00:18:29,000 --> 00:18:32,000
+implements the same methods as a shape.
+
+251
+00:18:33,000 --> 00:18:40,000
+But instead of direct action, it passes the action to the shapes inside using recursion after that
+
+252
+00:18:40,000 --> 00:18:49,000
+contain some the results of our code interact with the specific interface and even don't know whether
+
+253
+00:18:49,000 --> 00:18:51,000
+we have simple shape or group of shapes.
+
+254
+00:18:51,000 --> 00:18:54,000
+We have also image added the class here.
+
+255
+00:18:54,000 --> 00:18:59,000
+But this is only specific for our demo and not specific to the composite.
+
+256
+00:18:59,000 --> 00:19:03,000
+Part of this class helps us to visualize the shapes in the window.
+
+257
+00:19:04,000 --> 00:19:08,000
+Now let's open our democracy and see what we have here.
+
+258
+00:19:08,000 --> 00:19:16,000
+I create Image editor to upload the different shapes and you can see that I uploaded circle here and
+
+259
+00:19:16,000 --> 00:19:17,000
+to compound shapes.
+
+260
+00:19:18,000 --> 00:19:20,000
+So it consists inside from different shapes.
+
+261
+00:19:21,000 --> 00:19:24,000
+There's an interesting scene also inside that image added.
+
+262
+00:19:24,000 --> 00:19:29,000
+All shapes are added in one variable of type compound shape.
+
+263
+00:19:29,000 --> 00:19:37,000
+And if you would look on these masses and in particular on MassArt of inner class editor canvas, you
+
+264
+00:19:37,000 --> 00:19:43,000
+would notice that there are no any loops here and we interact with all shapes as a single object.
+
+265
+00:19:44,000 --> 00:19:48,000
+You see just Kullen, one Masset and no loops.
+
+266
+00:19:48,000 --> 00:19:55,000
+And for energy canvas as a client, it doesn't matter whether there is a group of objects or a single
+
+267
+00:19:55,000 --> 00:19:56,000
+object behind the reference.
+
+268
+00:19:57,000 --> 00:20:01,000
+That is exactly the reason why we need to apply composites partly for and.
+
+269
+00:20:02,000 --> 00:20:08,000
+For the sake of the drama, let me run them across and here you can see different shapes and group of
+
+270
+00:20:08,000 --> 00:20:09,000
+shapes.
+
+271
+00:20:10,000 --> 00:20:14,000
+Now let's review the checklist to implement the composite pardon.
+
+272
+00:20:14,000 --> 00:20:15,000
+Follow next steps.
+
+273
+00:20:16,000 --> 00:20:20,000
+Make sure that you can apply a tree like structure for your components.
+
+274
+00:20:20,000 --> 00:20:27,000
+Create a unified interface that will combine operations on the group of objects and on the single object.
+
+275
+00:20:27,000 --> 00:20:34,000
+Create a class of single object grade class for group of objects that implements the same unified interface
+
+276
+00:20:35,000 --> 00:20:40,000
+and operations to add and remove components into the container.
+
+277
+00:20:40,000 --> 00:20:41,000
+That's it.
+
+278
+00:20:41,000 --> 00:20:47,000
+Now you have the interface that allows you to interact with a group of objects as a single one.
+
+279
+00:20:48,000 --> 00:20:49,000
+Now you know composites.
+
+280
+00:20:49,000 --> 00:20:50,000
+Pardon?
+
+281
+00:20:50,000 --> 00:20:54,000
+Let's recap what we have learned to date in this lesson.
+
+282
+00:20:54,000 --> 00:20:56,000
+Learned three structural patterns.
+
+283
+00:20:56,000 --> 00:20:59,000
+They are bridge, lightweight and composite.
+
+284
+00:21:00,000 --> 00:21:02,000
+That's it for this lesson.
+
+285
+00:21:02,000 --> 00:21:03,000
+Thanks a lot for your attention.
+
+286
+00:21:04,000 --> 00:21:06,000
+Have a great day and see you in the next lesson.
+
diff --git a/39 - GoF Design Patterns of Software Architecture in OOP/005 Behevioral Patterns, p.1_en.srt b/39 - GoF Design Patterns of Software Architecture in OOP/005 Behevioral Patterns, p.1_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..bac1b090318a303bda0c65aa08818091e8a55ac4
--- /dev/null
+++ b/39 - GoF Design Patterns of Software Architecture in OOP/005 Behevioral Patterns, p.1_en.srt
@@ -0,0 +1,1688 @@
+1
+00:00:05,000 --> 00:00:06,000
+Hello, Tim.
+
+2
+00:00:06,000 --> 00:00:12,000
+In this lesson, we start learning of golf behavioral patterns, we already performed an overview of
+
+3
+00:00:12,000 --> 00:00:19,000
+behavioral patterns and I hope you remember that the 11 of them and definitely we won't have time to
+
+4
+00:00:19,000 --> 00:00:22,000
+make an area with example for all of them in this lesson.
+
+5
+00:00:22,000 --> 00:00:28,000
+But at least we'll start we'll start from the most popular behavioral patterns, in my opinion.
+
+6
+00:00:28,000 --> 00:00:34,000
+And that's why in this last world alone, with your strategy pattern, common pattern, template, Masad
+
+7
+00:00:34,000 --> 00:00:41,000
+partner, iterator and chain of responsibility padam, you can find good examples in attachments to
+
+8
+00:00:41,000 --> 00:00:46,000
+this lesson will go over these examples as we will talk through each part.
+
+9
+00:00:46,000 --> 00:00:49,000
+Let's start and we start from strategy.
+
+10
+00:00:49,000 --> 00:00:53,000
+Parren, let me explain your strategy in simple words.
+
+11
+00:00:54,000 --> 00:00:57,000
+Imagine that you know how something is needed to be done.
+
+12
+00:00:57,000 --> 00:01:03,000
+For example, you know how certain needs to be done or to know how filtering needs to be done.
+
+13
+00:01:04,000 --> 00:01:07,000
+Or you have information how car engine should be started.
+
+14
+00:01:08,000 --> 00:01:10,000
+Now you can describe the logic in the code.
+
+15
+00:01:10,000 --> 00:01:11,000
+Correct.
+
+16
+00:01:12,000 --> 00:01:16,000
+So you encapsulated the way how something should be done in one class.
+
+17
+00:01:17,000 --> 00:01:19,000
+That is exactly what strategy partner is about.
+
+18
+00:01:20,000 --> 00:01:25,000
+And now imagine that you know that you need to search users, but you can search by first name and by
+
+19
+00:01:25,000 --> 00:01:26,000
+last name.
+
+20
+00:01:26,000 --> 00:01:29,000
+You know, that car engine should be started.
+
+21
+00:01:29,000 --> 00:01:33,000
+But the way how electric engine and petrol engine is started are different.
+
+22
+00:01:34,000 --> 00:01:35,000
+What do you need now?
+
+23
+00:01:35,000 --> 00:01:42,000
+You need an abstraction so you can create an absolute interface and have multiple implementations that
+
+24
+00:01:42,000 --> 00:01:44,000
+will describe how something should be done.
+
+25
+00:01:45,000 --> 00:01:46,000
+Does it make sense?
+
+26
+00:01:46,000 --> 00:01:53,000
+Strategic partner commands us to define a group of similar algorithms that are changing or expanding.
+
+27
+00:01:53,000 --> 00:01:58,000
+For example, a group of sorting algorithms, group of filtering algorithms, etc..
+
+28
+00:01:59,000 --> 00:02:06,000
+And with this pardon, you don't need to describe the logic inside the client classes because you encapsulated
+
+29
+00:02:06,000 --> 00:02:09,000
+the behavior and strategy that can be used across your app.
+
+30
+00:02:10,000 --> 00:02:16,000
+This should increase called reusability to help this clear for you why we need strategy.
+
+31
+00:02:16,000 --> 00:02:22,000
+And sometimes let's look at example to understand the details of implementation.
+
+32
+00:02:22,000 --> 00:02:29,000
+Imagine that we have multiple compression algorithms and I decide to group all compression algorithms
+
+33
+00:02:29,000 --> 00:02:33,000
+and the one single abstraction that is called compression strategy.
+
+34
+00:02:34,000 --> 00:02:38,000
+You can see that compression strategy is a functional interface.
+
+35
+00:02:38,000 --> 00:02:40,000
+What is a functional interface in Java?
+
+36
+00:02:41,000 --> 00:02:45,000
+You can learn from functional programming section of my Java course.
+
+37
+00:02:45,000 --> 00:02:53,000
+You can see that I have only one method here compress files that takes list of files Zellous abstractions
+
+38
+00:02:53,000 --> 00:02:56,000
+that will unite all algorithms of such type.
+
+39
+00:02:57,000 --> 00:03:05,000
+And I have recompression strategy class that implements this method and zeeb compression strategy that
+
+40
+00:03:05,000 --> 00:03:06,000
+implements this method.
+
+41
+00:03:06,000 --> 00:03:10,000
+Do for the sake of the demo I just text to console here.
+
+42
+00:03:11,000 --> 00:03:17,000
+Having this kind of abstraction, you can include it and use it in different clients.
+
+43
+00:03:17,000 --> 00:03:24,000
+For example, you may have some kind of class where you want to use compression strategy and also you
+
+44
+00:03:24,000 --> 00:03:27,000
+want to be able to substitute compression algorithm on the fly.
+
+45
+00:03:28,000 --> 00:03:30,000
+Here you can see compression context class.
+
+46
+00:03:31,000 --> 00:03:38,000
+We can declare compression strategy field right now here to set or change the compression strategy on
+
+47
+00:03:38,000 --> 00:03:38,000
+the fly.
+
+48
+00:03:38,000 --> 00:03:45,000
+We have the scatter method here and the main method of compression context would be create archive that
+
+49
+00:03:45,000 --> 00:03:53,000
+takes listo files as an argument and where we can do some preparation actions, actually compress files
+
+50
+00:03:53,000 --> 00:03:59,000
+and perform some actions after that one and being able change in compression algorithms.
+
+51
+00:04:00,000 --> 00:04:06,000
+You can set an implementation of compression strategy and it will be used to compress files here.
+
+52
+00:04:06,000 --> 00:04:07,000
+Does it make sense?
+
+53
+00:04:08,000 --> 00:04:14,000
+Another version of strategy Partons usage espersen strategy as Masset argument.
+
+54
+00:04:14,000 --> 00:04:20,000
+This is pretty convenient saying let me show you how to work with this compression context in my demo
+
+55
+00:04:20,000 --> 00:04:21,000
+file.
+
+56
+00:04:21,000 --> 00:04:25,000
+First of all, I create an object of a compression context.
+
+57
+00:04:25,000 --> 00:04:32,000
+And by the way, you can pass compression strategy is a work constructor of a certain Macit Z.
+
+58
+00:04:32,000 --> 00:04:33,000
+Yes, similar.
+
+59
+00:04:33,000 --> 00:04:35,000
+You pass strategy from outside.
+
+60
+00:04:36,000 --> 00:04:43,000
+Imagine that I have the list of files and now I call create archive masset of my compression context
+
+61
+00:04:43,000 --> 00:04:45,000
+and pass list of files there.
+
+62
+00:04:46,000 --> 00:04:53,000
+And now let me show you another way of passing strategy to the compression context in Java.
+
+63
+00:04:53,000 --> 00:05:00,000
+If we have functional interface, that means that we can describe interface with lambda expression and
+
+64
+00:05:00,000 --> 00:05:02,000
+that's why you can pass Lambda to our.
+
+65
+00:05:02,000 --> 00:05:11,000
+Overlord masses here I call creator archive Masset past list of files and lambda expression of my compression
+
+66
+00:05:11,000 --> 00:05:18,000
+strategy that technically also prints text to console and now overloaded MassArt is called Take into
+
+67
+00:05:18,000 --> 00:05:22,000
+account compression strategy is a functional interface.
+
+68
+00:05:22,000 --> 00:05:27,000
+I also may pass MASSATA reference that will meet the requirements of the interface.
+
+69
+00:05:28,000 --> 00:05:35,000
+For example, here is a static method inside my demo class that also takes list of files and prints,
+
+70
+00:05:35,000 --> 00:05:38,000
+text to console, imitate compression.
+
+71
+00:05:38,000 --> 00:05:44,000
+If you are not familiar with MassArt references lambda expressions, check the functional programming
+
+72
+00:05:44,000 --> 00:05:45,000
+section of my Java course.
+
+73
+00:05:46,000 --> 00:05:52,000
+But in this lesson, this example is more to show you how you can use strategy in real life.
+
+74
+00:05:52,000 --> 00:05:57,000
+And I am sure that you already used Strategy Partan and even didn't know about that.
+
+75
+00:05:58,000 --> 00:06:00,000
+There are no comparator interface.
+
+76
+00:06:00,000 --> 00:06:03,000
+That is pure example of strategy parren.
+
+77
+00:06:03,000 --> 00:06:12,000
+That's why I can call sort masset unleased object and pass lambda expression that because comparator
+
+78
+00:06:12,000 --> 00:06:13,000
+is a functional interface too.
+
+79
+00:06:14,000 --> 00:06:15,000
+Is that clear.
+
+80
+00:06:16,000 --> 00:06:21,000
+You can press a pause for a minute and investigate the source code that is attached to this lesson.
+
+81
+00:06:22,000 --> 00:06:26,000
+In case of any questions, you're welcome to write a question in the Commons.
+
+82
+00:06:27,000 --> 00:06:32,000
+And once you are sure that everything is clear for you, let's review the checklist of strategy.
+
+83
+00:06:32,000 --> 00:06:36,000
+Parren to implement strategy partner follow next steps.
+
+84
+00:06:36,000 --> 00:06:39,000
+Identify group of algorithms in your app.
+
+85
+00:06:40,000 --> 00:06:43,000
+Create an interface for such a group of algorithms.
+
+86
+00:06:44,000 --> 00:06:49,000
+Create concrete classes that implements the interface and can create algorithms.
+
+87
+00:06:49,000 --> 00:06:55,000
+And you know that in Java language you can also use lambda expressions or method references because
+
+88
+00:06:55,000 --> 00:06:59,000
+most likely your strategy interface will be a functional interface.
+
+89
+00:07:00,000 --> 00:07:03,000
+Use the strategy and client code wherever it is needed.
+
+90
+00:07:04,000 --> 00:07:05,000
+That Sitrick strategy parren.
+
+91
+00:07:06,000 --> 00:07:08,000
+Let's continue now.
+
+92
+00:07:08,000 --> 00:07:11,000
+Let's review the next part and its name is comment.
+
+93
+00:07:11,000 --> 00:07:13,000
+Parn Comments.
+
+94
+00:07:13,000 --> 00:07:21,000
+Partan describes how we can create an object from a request and actually we expect to get a lot of benefits
+
+95
+00:07:21,000 --> 00:07:21,000
+from that.
+
+96
+00:07:22,000 --> 00:07:26,000
+Try to see what the benefits of having request as an object.
+
+97
+00:07:27,000 --> 00:07:29,000
+You can put request in the queue.
+
+98
+00:07:29,000 --> 00:07:35,000
+You can make the first call of a request you can and the operation if needed.
+
+99
+00:07:35,000 --> 00:07:42,000
+And others imagine that you developed a new keyboard and you create software to make sure that your
+
+100
+00:07:42,000 --> 00:07:44,000
+keyboard works well with the computer.
+
+101
+00:07:44,000 --> 00:07:49,000
+And you should write code that will process event of pressing each key.
+
+102
+00:07:49,000 --> 00:07:56,000
+And imagine that you should store the code that process key button press somewhere and this code should
+
+103
+00:07:56,000 --> 00:07:56,000
+work.
+
+104
+00:07:56,000 --> 00:07:58,000
+Only one button is clicked.
+
+105
+00:07:59,000 --> 00:08:02,000
+And also you have something else to consider.
+
+106
+00:08:02,000 --> 00:08:10,000
+Such operations as copy and paste, for example, may be performed with a keyboard and mouse with keyboard.
+
+107
+00:08:10,000 --> 00:08:18,000
+For example, when you press control who I see and control passively and with mouse you can do mouse,
+
+108
+00:08:18,000 --> 00:08:18,000
+right?
+
+109
+00:08:18,000 --> 00:08:21,000
+Click and select is a copy or paste.
+
+110
+00:08:22,000 --> 00:08:28,000
+What you have to do, have this logic duplicated in two places or with the application to put logic
+
+111
+00:08:28,000 --> 00:08:31,000
+of copying and pasting in glosses.
+
+112
+00:08:31,000 --> 00:08:37,000
+The solution would be to drop a request in a single object that is called command.
+
+113
+00:08:37,000 --> 00:08:44,000
+This object will contain information about what is needed to be done and command object may be aggregated,
+
+114
+00:08:44,000 --> 00:08:52,000
+but any other object, no matter whether it is a keyboard or an operating system menu event, this request
+
+115
+00:08:52,000 --> 00:08:58,000
+will be stored in one single object and will be invoked by a client when it is needed.
+
+116
+00:08:58,000 --> 00:09:05,000
+A group of related commands may be united under the common abstraction to let clients rely on abstraction
+
+117
+00:09:06,000 --> 00:09:08,000
+but not on concrete implementations.
+
+118
+00:09:09,000 --> 00:09:14,000
+If you want to understand this problem better, let me share with your real life analogy.
+
+119
+00:09:14,000 --> 00:09:20,000
+You're at a restaurant and waiter come to you to check whether you're ready to make an order.
+
+120
+00:09:20,000 --> 00:09:29,000
+You order some food and after that waiter goes to the kitchen there, he passes your order in the process
+
+121
+00:09:29,000 --> 00:09:30,000
+of cooking is started.
+
+122
+00:09:31,000 --> 00:09:37,000
+So you encapsulated your command in Waiter Object and waiter made your order happen.
+
+123
+00:09:37,000 --> 00:09:39,000
+In this example, your request.
+
+124
+00:09:39,000 --> 00:09:44,000
+The waiter is a command and cook is a receiver.
+
+125
+00:09:44,000 --> 00:09:49,000
+You are not in touch with Schoop directly and not going to the kitchen.
+
+126
+00:09:49,000 --> 00:09:53,000
+You are sitting in the chair and making an order as it makes sense.
+
+127
+00:09:54,000 --> 00:09:57,000
+Hope you grasp the idea of command power.
+
+128
+00:09:58,000 --> 00:10:05,000
+Let's now, which is a good example of this point in our example, we'll work with the light and commands
+
+129
+00:10:05,000 --> 00:10:09,000
+to turn on and turn off the light from the remote control.
+
+130
+00:10:09,000 --> 00:10:14,000
+In this real life case, the program, such behavior, it is a good idea to use command.
+
+131
+00:10:14,000 --> 00:10:15,000
+Pardon?
+
+132
+00:10:15,000 --> 00:10:19,000
+Let's start from the client code and we'll go from there.
+
+133
+00:10:19,000 --> 00:10:22,000
+Imagine that we have remote control.
+
+134
+00:10:22,000 --> 00:10:24,000
+That is a separate class.
+
+135
+00:10:24,000 --> 00:10:26,000
+Let me open it here.
+
+136
+00:10:26,000 --> 00:10:30,000
+You can see that remote control type aggregates command inside.
+
+137
+00:10:31,000 --> 00:10:38,000
+I can set command with this set of Masset and I can press the one button on my remote control to execute
+
+138
+00:10:38,000 --> 00:10:41,000
+the behavior that is encapsulated in the command.
+
+139
+00:10:42,000 --> 00:10:44,000
+Let's look at the command interface.
+
+140
+00:10:45,000 --> 00:10:49,000
+This is an interface that declares only one Massett execute.
+
+141
+00:10:50,000 --> 00:10:53,000
+OK, now let's get back to our demo file.
+
+142
+00:10:53,000 --> 00:10:55,000
+Now we create light object.
+
+143
+00:10:56,000 --> 00:11:03,000
+This would be receiver object, the object that should expect some impact made by our command.
+
+144
+00:11:03,000 --> 00:11:05,000
+Let me open the close.
+
+145
+00:11:05,000 --> 00:11:13,000
+You can see that each state consists only from one field that reflects where the light is on or off
+
+146
+00:11:14,000 --> 00:11:16,000
+and the mass of the change.
+
+147
+00:11:16,000 --> 00:11:19,000
+The state of this field switch on and switch off.
+
+148
+00:11:20,000 --> 00:11:22,000
+Let's get back to the demo file.
+
+149
+00:11:23,000 --> 00:11:29,000
+Now I create two commands command to turn light on and to turn light off.
+
+150
+00:11:29,000 --> 00:11:34,000
+I create object of light on command type and light of command.
+
+151
+00:11:34,000 --> 00:11:43,000
+Todd, let me open one of these because they're similar in this case, my command aggregates receiver
+
+152
+00:11:43,000 --> 00:11:43,000
+object.
+
+153
+00:11:44,000 --> 00:11:51,000
+You can see I proselyte object as a constructor and initialize state of my command object.
+
+154
+00:11:51,000 --> 00:11:54,000
+This class implements command interface.
+
+155
+00:11:54,000 --> 00:11:58,000
+Thus it should provide us with execute Masset implementation.
+
+156
+00:11:59,000 --> 00:12:02,000
+And you can see here inside execute Masset.
+
+157
+00:12:02,000 --> 00:12:08,000
+I operate on light object basically that set in as a command.
+
+158
+00:12:08,000 --> 00:12:15,000
+The only thing that is different is that I could switch off Massett on the light object and that's it.
+
+159
+00:12:16,000 --> 00:12:18,000
+Now let's look how we work with these commands.
+
+160
+00:12:19,000 --> 00:12:25,000
+We are again in our demo file and looking around this file to explore console output together with you.
+
+161
+00:12:26,000 --> 00:12:30,000
+At first I said turn on command to my remote control.
+
+162
+00:12:31,000 --> 00:12:37,000
+Basically, that means when the user presses a button on the remote control, the lights on command
+
+163
+00:12:37,000 --> 00:12:38,000
+will be executed.
+
+164
+00:12:39,000 --> 00:12:43,000
+And when I press the button on, my remote light is turned on.
+
+165
+00:12:44,000 --> 00:12:50,000
+After that, I set another command to my remote control and now when the user clicks the same button
+
+166
+00:12:50,000 --> 00:12:54,000
+on the remote control, the light is turned off.
+
+167
+00:12:54,000 --> 00:12:55,000
+That's it.
+
+168
+00:12:56,000 --> 00:12:56,000
+Home.
+
+169
+00:12:56,000 --> 00:12:57,000
+That was the example.
+
+170
+00:12:57,000 --> 00:13:01,000
+It becomes clear how we'll use our command button in real life.
+
+171
+00:13:02,000 --> 00:13:05,000
+Let's create a checklist here.
+
+172
+00:13:05,000 --> 00:13:13,000
+Simple items to follow to implement the command button defines a common interface for commands and identify
+
+173
+00:13:13,000 --> 00:13:18,000
+the command and to point create implementations of this interface.
+
+174
+00:13:18,000 --> 00:13:22,000
+Each command should stores a reference to the receiver object.
+
+175
+00:13:23,000 --> 00:13:29,000
+Also, command should store all necessary arguments to cost the receiver at command.
+
+176
+00:13:30,000 --> 00:13:37,000
+The request object is the one that sends the request invoke commands Masset when needed and pass all
+
+177
+00:13:37,000 --> 00:13:41,000
+necessary arguments to interact with the receiver homes.
+
+178
+00:13:41,000 --> 00:13:46,000
+That this checklist will help you on implementation stage in your project.
+
+179
+00:13:46,000 --> 00:13:47,000
+Let's move on.
+
+180
+00:13:48,000 --> 00:13:56,000
+But before we move to the next portion, let's compare this to strategy and the command points, because
+
+181
+00:13:56,000 --> 00:14:00,000
+my students always see a lot of similar things between these two points.
+
+182
+00:14:00,000 --> 00:14:04,000
+But still, I want to make sure that you see clear difference between them.
+
+183
+00:14:05,000 --> 00:14:12,000
+Typically, the command portion is used to make an object out of what needs to be done to take in the
+
+184
+00:14:12,000 --> 00:14:20,000
+operation and its arguments and wrap them up in an object to be looked held from the center, remote
+
+185
+00:14:20,000 --> 00:14:22,000
+site, etc..
+
+186
+00:14:22,000 --> 00:14:29,000
+There will tend to be a large number of distinct command objects that pass through a given point in
+
+187
+00:14:29,000 --> 00:14:35,000
+the system over time, and the command objects will hold varying parameters.
+
+188
+00:14:35,000 --> 00:14:42,000
+Describing the operation requested the strategy part and on the other hand, is used to specify how
+
+189
+00:14:42,000 --> 00:14:49,000
+something should be done and blocks into a larger object or Massett to provide a specific algorithm.
+
+190
+00:14:49,000 --> 00:14:53,000
+A strategy for sorting might be Amersfoort.
+
+191
+00:14:53,000 --> 00:15:00,000
+Might be an insertion source or perhaps even something more complex, like only using my short if the
+
+192
+00:15:00,000 --> 00:15:04,000
+list is larger than some minimum size, feel the difference.
+
+193
+00:15:05,000 --> 00:15:12,000
+The differences are in the use cases and it in practice and the intent behind each part.
+
+194
+00:15:13,000 --> 00:15:13,000
+Let's.
+
+195
+00:15:13,000 --> 00:15:19,000
+Learning behavioral patterns, I suggest, has to focus on the template Macit part.
+
+196
+00:15:19,000 --> 00:15:27,000
+Now this part allows us to define skeleton of the algorithms and let subclasses to decide the implementation
+
+197
+00:15:27,000 --> 00:15:30,000
+of specific steps of this algorithm.
+
+198
+00:15:30,000 --> 00:15:37,000
+Subclasses may provide us with implementation of some steps of the common algorithm without changing
+
+199
+00:15:37,000 --> 00:15:38,000
+the algorithm structure.
+
+200
+00:15:39,000 --> 00:15:46,000
+Imagine that you're dealing with a case of data mining and in your app your allow and user to upload
+
+201
+00:15:46,000 --> 00:15:49,000
+Doc C suite and PDA files.
+
+202
+00:15:49,000 --> 00:15:56,000
+And once you've found that some steps are common in all cases, you always upload file to some temporary
+
+203
+00:15:56,000 --> 00:15:57,000
+storage.
+
+204
+00:15:57,000 --> 00:15:59,000
+After that, you retrieve data from it.
+
+205
+00:15:59,000 --> 00:16:03,000
+After that, you pass this data and send to a database.
+
+206
+00:16:04,000 --> 00:16:10,000
+Basically, the algorithm of data processing is the same for different types of documents.
+
+207
+00:16:10,000 --> 00:16:17,000
+The only thing that is different is the way how data is retrieved from the files of different format.
+
+208
+00:16:17,000 --> 00:16:25,000
+That's why it might be a good idea to create a template that describes each step of this algorithm and
+
+209
+00:16:25,000 --> 00:16:28,000
+that gives implementation to the common steps.
+
+210
+00:16:28,000 --> 00:16:33,000
+Instead of having this code duplicated and have specific classes, that implements one step in this
+
+211
+00:16:33,000 --> 00:16:34,000
+algorithm.
+
+212
+00:16:35,000 --> 00:16:38,000
+Following this approach, you reduce code duplication.
+
+213
+00:16:39,000 --> 00:16:42,000
+I also can come up with an analogy from the real life.
+
+214
+00:16:43,000 --> 00:16:46,000
+Imagine that you have building a company that builds houses.
+
+215
+00:16:47,000 --> 00:16:51,000
+In all cases, you have the same steps to follow during house building.
+
+216
+00:16:51,000 --> 00:16:58,000
+You should agree on architecture, prepare basement, create walls, install doors and windows and so
+
+217
+00:16:58,000 --> 00:16:59,000
+on and so forth.
+
+218
+00:16:59,000 --> 00:17:05,000
+The algorithm of house building is the same, but each step can be done differently.
+
+219
+00:17:05,000 --> 00:17:11,000
+Different doors may be installed of different sizes, different roof types and so on.
+
+220
+00:17:11,000 --> 00:17:17,000
+Let's now check the current example of this parliament to understand the details of this pardon.
+
+221
+00:17:17,000 --> 00:17:23,000
+In our example, we plan to create a template Masset for mobile app compilation template.
+
+222
+00:17:23,000 --> 00:17:26,000
+Marcet is located in Crus compiler class.
+
+223
+00:17:26,000 --> 00:17:28,000
+It is called Compile.
+
+224
+00:17:29,000 --> 00:17:36,000
+This algorithm consists of the next steps, collect all necessary sources for compilation, reserve
+
+225
+00:17:36,000 --> 00:17:42,000
+some rame, compile sources to target archive and share compilation status.
+
+226
+00:17:43,000 --> 00:17:50,000
+We have also so-called Hoak Macit here cukes a special message that is not mandatory to override or
+
+227
+00:17:50,000 --> 00:17:56,000
+implement, but they give additional opportunity for various algorithms to add some behavior.
+
+228
+00:17:57,000 --> 00:18:02,000
+As we go through the main steps of our algorithm, you can put these placeholders.
+
+229
+00:18:02,000 --> 00:18:08,000
+Mascot's in any place you think would be logical, reasonable for Skillern in the future.
+
+230
+00:18:08,000 --> 00:18:14,000
+And some of these steps are common for all compilers and some of them are not.
+
+231
+00:18:14,000 --> 00:18:20,000
+For example, reserving RAM and printing status is the same step for different compilers.
+
+232
+00:18:20,000 --> 00:18:25,000
+And you can see implementation of this method here in this abstract class.
+
+233
+00:18:25,000 --> 00:18:33,000
+But some of the masses are abstract ones because implementation will depend on the concrete implementation
+
+234
+00:18:33,000 --> 00:18:36,000
+and the specifics of normal operating system.
+
+235
+00:18:36,000 --> 00:18:42,000
+Pay attention that this is an absolute class so that no one can create an instance of this object.
+
+236
+00:18:42,000 --> 00:18:45,000
+And we have classes that extends this one.
+
+237
+00:18:46,000 --> 00:18:54,000
+We have Android compiler and ifone compiler classes, both extends across compiler and implements necessary
+
+238
+00:18:54,000 --> 00:18:57,000
+steps that are not implemented in the parent class.
+
+239
+00:18:58,000 --> 00:19:00,000
+Now, let me show you the client code.
+
+240
+00:19:01,000 --> 00:19:02,000
+Here is my demo class.
+
+241
+00:19:03,000 --> 00:19:12,000
+I create a phone compiler first and call compile Massett and after that I create Android compiler and
+
+242
+00:19:12,000 --> 00:19:13,000
+call compiler Macit.
+
+243
+00:19:13,000 --> 00:19:15,000
+Let me run this code.
+
+244
+00:19:16,000 --> 00:19:24,000
+And in console output you can see that algorithm is the same for both iPhone and Android compilers and
+
+245
+00:19:24,000 --> 00:19:25,000
+some common steps.
+
+246
+00:19:25,000 --> 00:19:33,000
+Executer twice here you can see how subclasses give implementation to some of the steps in my algorithm.
+
+247
+00:19:33,000 --> 00:19:35,000
+But algorithm is the same in general.
+
+248
+00:19:36,000 --> 00:19:44,000
+One of the obvious drawback is it algorithm is hard coded and you have to rely on inheritance mechanism
+
+249
+00:19:44,000 --> 00:19:50,000
+during the implementation of this part and you can't change algorithm or introduce new steps.
+
+250
+00:19:51,000 --> 00:19:53,000
+That's why this is not super effective.
+
+251
+00:19:53,000 --> 00:20:00,000
+But on the other hand, helps us to avoid complication for some groups of operations that have similar
+
+252
+00:20:00,000 --> 00:20:01,000
+algorithm.
+
+253
+00:20:01,000 --> 00:20:04,000
+Let's look at the checklist to implement this program.
+
+254
+00:20:04,000 --> 00:20:09,000
+There are a few important items to remember when we implement template MassArt.
+
+255
+00:20:09,000 --> 00:20:09,000
+Pardon?
+
+256
+00:20:09,000 --> 00:20:17,000
+They are Ximenes the algorithm and sync how to split the algorithm into different steps, create an
+
+257
+00:20:17,000 --> 00:20:19,000
+obstacle course and define template.
+
+258
+00:20:19,000 --> 00:20:26,000
+Massada put each step of the algorithm in the separate method described MassArt invocation sequence
+
+259
+00:20:26,000 --> 00:20:27,000
+incomplete.
+
+260
+00:20:27,000 --> 00:20:31,000
+Macit identified places for Hooke's in your algorithm.
+
+261
+00:20:32,000 --> 00:20:36,000
+Create concrete classes that implements the required steps in the algorithm.
+
+262
+00:20:37,000 --> 00:20:39,000
+That's all regarding template MassArt.
+
+263
+00:20:39,000 --> 00:20:44,000
+Hope that now you know how to implement template method partner in your application.
+
+264
+00:20:45,000 --> 00:20:46,000
+Let's proceed with the next part.
+
+265
+00:20:46,000 --> 00:20:49,000
+On the next part is Iterator.
+
+266
+00:20:49,000 --> 00:20:56,000
+If you have ever used Java collections framework, you may already understand what this is about and
+
+267
+00:20:56,000 --> 00:21:01,000
+all Java InGenius manger's implementations of Iterator Partan in JDK.
+
+268
+00:21:02,000 --> 00:21:08,000
+But in case you are not a Java developer or will code on another programming language, most likely
+
+269
+00:21:08,000 --> 00:21:09,000
+you would need to implement.
+
+270
+00:21:09,000 --> 00:21:17,000
+Iterate a from scratch by your own insert iterator is behavioral patterns that allows us to go over
+
+271
+00:21:17,000 --> 00:21:24,000
+each element of an aggregate object sequentially without exposing its underlying representation.
+
+272
+00:21:25,000 --> 00:21:26,000
+Why is this might be needed?
+
+273
+00:21:26,000 --> 00:21:34,000
+Imagine that you have some aggregate object, and no matter whether this an array or some other container,
+
+274
+00:21:34,000 --> 00:21:38,000
+you don't want to understand the internal structure of the object.
+
+275
+00:21:39,000 --> 00:21:45,000
+The only thing that you need is an interface that will allow you to get each element of this object
+
+276
+00:21:45,000 --> 00:21:50,000
+one by one, because the structure of containers might be different.
+
+277
+00:21:51,000 --> 00:21:56,000
+Some of them vectors like structure and some of them are tree like structures.
+
+278
+00:21:56,000 --> 00:22:00,000
+It is not always convenient to understand the internal structure.
+
+279
+00:22:00,000 --> 00:22:05,000
+It is better to have a single common interface to iterate over each element.
+
+280
+00:22:06,000 --> 00:22:12,000
+So the idea of the Iterator portal is to put all logic of iteration in the separate class iterate and
+
+281
+00:22:12,000 --> 00:22:17,000
+would also track progress of the iteration and state of iteration.
+
+282
+00:22:17,000 --> 00:22:25,000
+Let's now look at the example, and this time I will not create any custom example and I will perform
+
+283
+00:22:25,000 --> 00:22:27,000
+the demo on the example of the key.
+
+284
+00:22:27,000 --> 00:22:34,000
+Imagine that we have some container and it is really don't matter whether I have array based, container
+
+285
+00:22:34,000 --> 00:22:41,000
+linked based container or even hash table based container iterator interface will be the same and will
+
+286
+00:22:41,000 --> 00:22:45,000
+help you to iterate over each element in any container.
+
+287
+00:22:45,000 --> 00:22:49,000
+Here in demo class, I created objects of arriviste.
+
+288
+00:22:49,000 --> 00:22:51,000
+This is a container that is based on the array.
+
+289
+00:22:52,000 --> 00:22:53,000
+I created the linked list.
+
+290
+00:22:54,000 --> 00:23:01,000
+This is a container that is based on the linked objects and I have Hasset object Zellous container that
+
+291
+00:23:01,000 --> 00:23:02,000
+is based on hash table.
+
+292
+00:23:02,000 --> 00:23:09,000
+Basically, no matter what object I will take, each object can provide me with the iterator.
+
+293
+00:23:09,000 --> 00:23:13,000
+And here you can see that I get iterator for each collection.
+
+294
+00:23:13,000 --> 00:23:16,000
+Let's look at the Iterator interface.
+
+295
+00:23:16,000 --> 00:23:22,000
+In this particular case, Iterator provides me with MassArt has next next and remove.
+
+296
+00:23:23,000 --> 00:23:29,000
+I would say that these methods are bare minimum for iterator because in addition to these ones, it
+
+297
+00:23:29,000 --> 00:23:36,000
+is also possible to implement other methods for navigation, for example, methods for navigation in
+
+298
+00:23:36,000 --> 00:23:40,000
+other direction, like previous methods for verification.
+
+299
+00:23:40,000 --> 00:23:46,000
+Whether there is a previous element has previous method to get index of the current position method,
+
+300
+00:23:46,000 --> 00:23:53,000
+that new element during iteration of a container method to substitute the last return element.
+
+301
+00:23:53,000 --> 00:23:59,000
+And Ingenico, we have at least iterator, but it works only for liste Iraqi anyway.
+
+302
+00:23:59,000 --> 00:24:00,000
+It will be up to you.
+
+303
+00:24:00,000 --> 00:24:07,000
+What methods to implement in your iterator has next method tells us whether there is a next element
+
+304
+00:24:07,000 --> 00:24:08,000
+in the sequence.
+
+305
+00:24:08,000 --> 00:24:10,000
+This is super useful Macit.
+
+306
+00:24:10,000 --> 00:24:15,000
+The build condition in Loop's next MassArt regions.
+
+307
+00:24:15,000 --> 00:24:21,000
+The reference to the next object in the container and remove MassArt removes the last rechanged object.
+
+308
+00:24:22,000 --> 00:24:29,000
+Basically, that's all interface implementation of this interface needs to consider storing the state
+
+309
+00:24:29,000 --> 00:24:35,000
+of the iteration to remember what item was returned last and what next element I should return.
+
+310
+00:24:36,000 --> 00:24:40,000
+And we have a single iterator interface for all types of containers.
+
+311
+00:24:41,000 --> 00:24:46,000
+In the case of Java collections framework, it is duty of each container to provide the client with
+
+312
+00:24:46,000 --> 00:24:48,000
+implementation of Étretat interface.
+
+313
+00:24:49,000 --> 00:24:53,000
+Let's now switch to or at least close one eye open source.
+
+314
+00:24:53,000 --> 00:24:59,000
+Sort of iterator, Masset, I see that according to Masad signature, itra transliterate a type, but
+
+315
+00:24:59,000 --> 00:25:07,000
+what implementation of this interface here you can see that new object of etre type is created and returned
+
+316
+00:25:08,000 --> 00:25:09,000
+watrous each type.
+
+317
+00:25:10,000 --> 00:25:18,000
+This is in a class of a release that implements iterator interface and implements or abstract marcedes.
+
+318
+00:25:18,000 --> 00:25:25,000
+As you can see, we built our code by relying on abstractions and iterator interface is one of them.
+
+319
+00:25:25,000 --> 00:25:32,000
+And each container in this case is obligated to provide iterate implementation that knows the structure
+
+320
+00:25:32,000 --> 00:25:36,000
+of this container and how to iterate over each element inside this container.
+
+321
+00:25:37,000 --> 00:25:39,000
+Basically, that's it.
+
+322
+00:25:39,000 --> 00:25:43,000
+You can implement your own iterator if needed following this example.
+
+323
+00:25:44,000 --> 00:25:51,000
+Now let's create a checklist for iterate apart and define iterate interface with at least has next and
+
+324
+00:25:51,000 --> 00:25:55,000
+next method as a method might be added to.
+
+325
+00:25:55,000 --> 00:26:03,000
+As we discussed in our example, in the object that serves as a container, declare a master return
+
+326
+00:26:03,000 --> 00:26:10,000
+and iterate the great implementation of Iterator Interface for collection that you need to iterate over
+
+327
+00:26:11,000 --> 00:26:18,000
+client requests, iterate and use it for iteration of elements in container grade.
+
+328
+00:26:18,000 --> 00:26:24,000
+We learned iterate a pattern and now we are going to learn the last but not the least important for
+
+329
+00:26:24,000 --> 00:26:24,000
+today.
+
+330
+00:26:25,000 --> 00:26:29,000
+The next point that we are going to learn is called chain of responsibility.
+
+331
+00:26:30,000 --> 00:26:35,000
+This is part that allows us to process a single request by multiple handlers.
+
+332
+00:26:36,000 --> 00:26:44,000
+We build handlers in the chain and each handler is a process, request or pass the request further to
+
+333
+00:26:44,000 --> 00:26:45,000
+the next link in the chain.
+
+334
+00:26:46,000 --> 00:26:53,000
+There are a few simple examples where chain of responsibility is widely used in Web applications.
+
+335
+00:26:53,000 --> 00:26:55,000
+There is a concept of request filters.
+
+336
+00:26:56,000 --> 00:27:02,000
+Imagine that you are sending a request to a specific page, let's say admin dashboard of your online
+
+337
+00:27:02,000 --> 00:27:08,000
+shop and there is a sequence of filters your request should go through before it reach.
+
+338
+00:27:08,000 --> 00:27:14,000
+End Point and server would return you the admin dashboard page, for example.
+
+339
+00:27:14,000 --> 00:27:17,000
+The first filter might be the login filter.
+
+340
+00:27:18,000 --> 00:27:24,000
+This filter handles your web request and verifies whether you already logged in or now.
+
+341
+00:27:25,000 --> 00:27:31,000
+If you are not logged in, your request is not passed through the chain to the next filter, but instead
+
+342
+00:27:32,000 --> 00:27:34,000
+you're redirected to the login page.
+
+343
+00:27:35,000 --> 00:27:39,000
+The next filter might be authorization and authentification filter.
+
+344
+00:27:40,000 --> 00:27:47,000
+This filter will verify your user in database and will check what role and privileges your user has
+
+345
+00:27:47,000 --> 00:27:48,000
+in the system.
+
+346
+00:27:48,000 --> 00:27:54,000
+If your user has admin role, you will be finally redirected to the admin dashboard page.
+
+347
+00:27:54,000 --> 00:28:00,000
+If not, you will be redirected to our page where you will see notification about not having enough
+
+348
+00:28:00,000 --> 00:28:02,000
+rights to access this page.
+
+349
+00:28:03,000 --> 00:28:10,000
+And these filters are built into the single chain and your request pass through the each of them because
+
+350
+00:28:10,000 --> 00:28:13,000
+each filter has the reference to the next one.
+
+351
+00:28:13,000 --> 00:28:19,000
+And one more important thing, hope you already understood this from my example, is that it is not
+
+352
+00:28:19,000 --> 00:28:22,000
+necessary to pass the request through the whole chain.
+
+353
+00:28:22,000 --> 00:28:29,000
+It could be that some element in the chain decide to stop processing hope that high level overview of
+
+354
+00:28:29,000 --> 00:28:30,000
+this part is clear.
+
+355
+00:28:31,000 --> 00:28:39,000
+Now let's jump to the example and this example will create with your software for atme will build with
+
+356
+00:28:39,000 --> 00:28:45,000
+your chain of multiple dispensers that will help and users to get the cash from the ATM.
+
+357
+00:28:45,000 --> 00:28:46,000
+Let's go one by one.
+
+358
+00:28:47,000 --> 00:28:50,000
+We have an interface of the span's chain.
+
+359
+00:28:50,000 --> 00:28:51,000
+Let me show it.
+
+360
+00:28:52,000 --> 00:28:59,000
+It has Tomas's set next link that takes object of the same type as an argument and actually dispense
+
+361
+00:28:59,000 --> 00:29:01,000
+Massett the dispense some currency.
+
+362
+00:29:02,000 --> 00:29:03,000
+What is currency?
+
+363
+00:29:04,000 --> 00:29:10,000
+This is another type wrapper that contains information about cache units in one node.
+
+364
+00:29:11,000 --> 00:29:15,000
+Next, we have implementations of dispense chain interface.
+
+365
+00:29:15,000 --> 00:29:21,000
+We have fifty dollar dispenser, twenty dollar dispenser and dollar dispenser.
+
+366
+00:29:21,000 --> 00:29:23,000
+There are almost C.M.A.
+
+367
+00:29:23,000 --> 00:29:29,000
+Besides the value of the node since they are working with and to be honest this may be written with
+
+368
+00:29:29,000 --> 00:29:36,000
+one single class, but for the sake of the demo and for visibility purposes, I decided to keep all
+
+369
+00:29:36,000 --> 00:29:40,000
+these classes to make sure you understood the chain of responsibility, partner.
+
+370
+00:29:41,000 --> 00:29:45,000
+Let's now look at the dispense method of any of these classes.
+
+371
+00:29:45,000 --> 00:29:52,000
+We get amount from the currency object and if it is equal or more than the value of the current dispenser.
+
+372
+00:29:52,000 --> 00:29:59,000
+Then will perform next logic when I get a number of notes that we need to give our end user and if there
+
+373
+00:29:59,000 --> 00:30:06,000
+is some remainder, I put this request further with the new currency object, with the value of remained
+
+374
+00:30:06,000 --> 00:30:11,000
+pay attention, that e.g. dispenser has reference to another dispenser in the chain.
+
+375
+00:30:12,000 --> 00:30:19,000
+This first condition verifies what is this dispenser is allowed to process this request.
+
+376
+00:30:19,000 --> 00:30:24,000
+If not in our particular case, I pass the request further to the next dispenser.
+
+377
+00:30:25,000 --> 00:30:26,000
+Is that clear?
+
+378
+00:30:26,000 --> 00:30:29,000
+Let's now look at the client code in our demo class.
+
+379
+00:30:30,000 --> 00:30:34,000
+In my demo class, I have field of type dispense, Jane.
+
+380
+00:30:34,000 --> 00:30:38,000
+That would be my whole chain with all links in it.
+
+381
+00:30:39,000 --> 00:30:45,000
+In constructor of the demo class, I create instances of all the Spenser's and connecting them in one
+
+382
+00:30:45,000 --> 00:30:48,000
+chain using set next link MassArt.
+
+383
+00:30:49,000 --> 00:30:53,000
+So here we can see that fifty dollar dispenser is the first link.
+
+384
+00:30:53,000 --> 00:30:59,000
+Twenty dollars dispenser going next and then the dispenser is the last dispenser in the chain.
+
+385
+00:30:59,000 --> 00:31:05,000
+Now when I have my chain constructed let me run this program and explore it with you.
+
+386
+00:31:06,000 --> 00:31:12,000
+The first thing that I do in my own method, I create the object of this type that contains dispense
+
+387
+00:31:12,000 --> 00:31:13,000
+chain.
+
+388
+00:31:13,000 --> 00:31:21,000
+After that I create infinite loop and I ask user to input the amount that he or she wants to get from
+
+389
+00:31:21,000 --> 00:31:21,000
+the ATM.
+
+390
+00:31:22,000 --> 00:31:28,000
+Let's imagine I want to dispense one hundred twenty bucks and I see that ATMs are already calculated
+
+391
+00:31:28,000 --> 00:31:30,000
+how much nodes it will give me.
+
+392
+00:31:31,000 --> 00:31:36,000
+It will give me two fifty dollars nodes and one twenty dollars node.
+
+393
+00:31:36,000 --> 00:31:38,000
+Now let me request eighty bucks.
+
+394
+00:31:39,000 --> 00:31:47,000
+This time a.T.M will give me one fifty dollars node, one twenty dollars node and one ten dollars node.
+
+395
+00:31:47,000 --> 00:31:49,000
+Can I understand how it works?
+
+396
+00:31:50,000 --> 00:31:55,000
+When I call dispense method here I start the request process by my change.
+
+397
+00:31:56,000 --> 00:31:58,000
+One important thing that we didn't talk yet.
+
+398
+00:31:59,000 --> 00:32:05,000
+You should always bear in mind the logic of chain processing to understand what is the condition of
+
+399
+00:32:05,000 --> 00:32:06,000
+completion.
+
+400
+00:32:06,000 --> 00:32:10,000
+In our particular case, I have verification on client side here.
+
+401
+00:32:11,000 --> 00:32:18,000
+It is not allowed to request dispense amount that is not multiple of ten and I have ten dollars dispenser
+
+402
+00:32:18,000 --> 00:32:19,000
+in my chain.
+
+403
+00:32:19,000 --> 00:32:26,000
+That means request will go to the last link in chain for sure, because one of the risks that you might
+
+404
+00:32:26,000 --> 00:32:32,000
+face with during the implementation of Chain of Responsibility pardon is that your chain will leave
+
+405
+00:32:32,000 --> 00:32:40,000
+your request unprocessed just because conditions initially were not met and none of the items in your
+
+406
+00:32:40,000 --> 00:32:41,000
+chain prior to the request.
+
+407
+00:32:42,000 --> 00:32:48,000
+So be very careful by thinking about your condition of completion in your chain of responsibility.
+
+408
+00:32:49,000 --> 00:32:53,000
+I hope that with this example it is clear how chain of responsibility works.
+
+409
+00:32:54,000 --> 00:33:01,000
+Now let's review a checklist to implement chain of responsibility partan great interface of event handler
+
+410
+00:33:01,000 --> 00:33:03,000
+and declare Masset of event handle.
+
+411
+00:33:04,000 --> 00:33:10,000
+Make sure that each implementation of the chain interface may contain the reference to the next link
+
+412
+00:33:10,000 --> 00:33:11,000
+in the chain.
+
+413
+00:33:12,000 --> 00:33:19,000
+Each chain interface implementation contributes to the event handler if the request is needed to be
+
+414
+00:33:19,000 --> 00:33:19,000
+passed.
+
+415
+00:33:19,000 --> 00:33:24,000
+Forward Link Object calls the MassArt on the next element in the chain.
+
+416
+00:33:25,000 --> 00:33:32,000
+Client creates change depending on the business logic and launches chain from the route that sets regarding
+
+417
+00:33:32,000 --> 00:33:33,000
+chain of responsibility.
+
+418
+00:33:34,000 --> 00:33:37,000
+Now let's recap what we have learned in this lesson.
+
+419
+00:33:38,000 --> 00:33:45,000
+In this lesson, we learned five, in my opinion, the most popular behavioral patterns that strategy
+
+420
+00:33:45,000 --> 00:33:50,000
+command template, MassArt, iterator and chain of responsibility.
+
+421
+00:33:51,000 --> 00:33:52,000
+Thanks a lot for your attention.
+
+422
+00:33:52,000 --> 00:33:55,000
+Have a great day and see you in the next lesson.
+
diff --git a/39 - GoF Design Patterns of Software Architecture in OOP/005 Source-code-of-all-examples-from-the-lesson.url b/39 - GoF Design Patterns of Software Architecture in OOP/005 Source-code-of-all-examples-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..b7a99d46797bc94660943bfd3f2695a8487932d5
--- /dev/null
+++ b/39 - GoF Design Patterns of Software Architecture in OOP/005 Source-code-of-all-examples-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/patterns/behavioral
\ No newline at end of file
diff --git a/39 - GoF Design Patterns of Software Architecture in OOP/006 Behevioral Patterns, p.2_en.srt b/39 - GoF Design Patterns of Software Architecture in OOP/006 Behevioral Patterns, p.2_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..3e7a9fdca2606fa2d7fe421d3a631dbf65f3c85f
--- /dev/null
+++ b/39 - GoF Design Patterns of Software Architecture in OOP/006 Behevioral Patterns, p.2_en.srt
@@ -0,0 +1,1636 @@
+1
+00:00:05,000 --> 00:00:11,000
+Hello, team, we proceed learning of behavioral patterns, we already started learning some of them
+
+2
+00:00:11,000 --> 00:00:18,000
+in previous lesson and we'll continue in this one in this class and going with your next pardon's visitor,
+
+3
+00:00:18,000 --> 00:00:23,000
+state observer momentum and as always, for each part.
+
+4
+00:00:23,000 --> 00:00:27,000
+And you can find source code examples in attachments to this video.
+
+5
+00:00:27,000 --> 00:00:30,000
+We'll explore those examples today during the lesson.
+
+6
+00:00:31,000 --> 00:00:36,000
+But it is always a good idea to upload those good examples in your local computer and to run them to
+
+7
+00:00:36,000 --> 00:00:39,000
+understand better how everything is working.
+
+8
+00:00:39,000 --> 00:00:40,000
+Let's start.
+
+9
+00:00:41,000 --> 00:00:45,000
+And the first part is that we are going to learn today is visit partner insured.
+
+10
+00:00:45,000 --> 00:00:52,000
+This panel lets us define a new operation without changing the classes of the elements on which it operates.
+
+11
+00:00:53,000 --> 00:00:59,000
+Probably the first question that pops up in the minds of my students is how a different Xenephon decorate
+
+12
+00:00:59,000 --> 00:01:04,000
+the podium because the goal of the curator is similar, but only at the first glance.
+
+13
+00:01:05,000 --> 00:01:11,000
+Let's have an overview of the pardon and after that will perform comparative analysis between visitor
+
+14
+00:01:11,000 --> 00:01:12,000
+and decorator.
+
+15
+00:01:12,000 --> 00:01:17,000
+Imagine that you're implementing online map and you have geia objects.
+
+16
+00:01:18,000 --> 00:01:23,000
+Each object consists from your data and information about the specific object on the map.
+
+17
+00:01:24,000 --> 00:01:27,000
+It also contains information about the nearest objects.
+
+18
+00:01:27,000 --> 00:01:33,000
+This allows us to build a graph of objects that are connected with each other, and that's how we can
+
+19
+00:01:33,000 --> 00:01:41,000
+create map and imagine that new business requirement makes you do an excellent expert of Hoess graph
+
+20
+00:01:41,000 --> 00:01:45,000
+of objects to process this data for separate purposes.
+
+21
+00:01:45,000 --> 00:01:52,000
+And this task will be easy in case you would be able to adjust the Gernhardt Iraqi and implement MassArt
+
+22
+00:01:52,000 --> 00:01:54,000
+in each class of Gernhardt Iraqi.
+
+23
+00:01:54,000 --> 00:01:57,000
+That describes the way how something should be exported.
+
+24
+00:01:58,000 --> 00:02:05,000
+But Geotech Lead asked you do not dodgiest these classes and types since this is considered to be a
+
+25
+00:02:05,000 --> 00:02:10,000
+stable code already and a lot of other modules depend on this code.
+
+26
+00:02:10,000 --> 00:02:18,000
+Also attacked it passed this course already and he knows basic principles and principles of Glynco design.
+
+27
+00:02:18,000 --> 00:02:24,000
+Dependancy should go in the direction of stable modules and we shouldn't change those.
+
+28
+00:02:24,000 --> 00:02:26,000
+And above that expert behavior.
+
+29
+00:02:27,000 --> 00:02:32,000
+This is not necessarily what should be logically present in object type agree.
+
+30
+00:02:32,000 --> 00:02:38,000
+Sounds like this is not natural behavior for such types of objects and we will violate single responsibility,
+
+31
+00:02:38,000 --> 00:02:43,000
+principle and the last reason to not adjust all existing classes.
+
+32
+00:02:43,000 --> 00:02:50,000
+Imagine that next week to do expert in another format, not ximo but JSON as example.
+
+33
+00:02:50,000 --> 00:02:53,000
+What to do in this case, change all classes again.
+
+34
+00:02:54,000 --> 00:02:54,000
+No way.
+
+35
+00:02:55,000 --> 00:03:01,000
+And still, what do you have to do in this case and where you will add behavior of experts in this data
+
+36
+00:03:01,000 --> 00:03:09,000
+into ximo visitor or for us to store over here in the separate class instead of adding this behavior
+
+37
+00:03:09,000 --> 00:03:12,000
+to all classes objects that should do something.
+
+38
+00:03:12,000 --> 00:03:19,000
+In this case, the behavior of expert data to ximo need to be passed to the new class instead of Collinses
+
+39
+00:03:19,000 --> 00:03:21,000
+behavior on the existing objects.
+
+40
+00:03:21,000 --> 00:03:28,000
+It seems that we want to be able to create generic masset that will work for all different types because
+
+41
+00:03:28,000 --> 00:03:33,000
+each tag would have different structure and we should consider this when interacting with it.
+
+42
+00:03:33,000 --> 00:03:40,000
+Definitely all these matters will do the same, but type of input argument will be different and the
+
+43
+00:03:40,000 --> 00:03:44,000
+way how we interact with objects and sides and Masset might be different.
+
+44
+00:03:44,000 --> 00:03:47,000
+I hope you understood this example, at least on the high level.
+
+45
+00:03:47,000 --> 00:03:49,000
+Now let's have a number of visits.
+
+46
+00:03:49,000 --> 00:03:54,000
+A pardon will implement exactly the same example that I've just talked about.
+
+47
+00:03:55,000 --> 00:03:58,000
+Let's start from abstractions that we have Geor aliment.
+
+48
+00:03:59,000 --> 00:04:02,000
+This is abstraction over all other elements.
+
+49
+00:04:02,000 --> 00:04:07,000
+On my online map, we have multiple types that implements this interface.
+
+50
+00:04:07,000 --> 00:04:13,000
+They are industrial building park, private building and shopping centre.
+
+51
+00:04:13,000 --> 00:04:17,000
+In this particular example, I have only one abstract method in here.
+
+52
+00:04:18,000 --> 00:04:21,000
+Accept this method, accepts Visita.
+
+53
+00:04:22,000 --> 00:04:27,000
+That is exactly the message that we need to implement in all our major elements in order for us to be
+
+54
+00:04:27,000 --> 00:04:30,000
+able to scale our architecture.
+
+55
+00:04:30,000 --> 00:04:34,000
+As far as you understand, visiter is another abstraction.
+
+56
+00:04:34,000 --> 00:04:35,000
+Let's look at it.
+
+57
+00:04:36,000 --> 00:04:41,000
+This is abstract type that declares mass amount of work with each particular type.
+
+58
+00:04:42,000 --> 00:04:49,000
+Even despite industrial building, part private building and shopping center have common interface that
+
+59
+00:04:49,000 --> 00:04:55,000
+is larger and they still might have type specific masses that we need to consider while working with
+
+60
+00:04:55,000 --> 00:04:55,000
+them.
+
+61
+00:04:56,000 --> 00:04:59,000
+That's why we have separate method for each specific type.
+
+62
+00:04:59,000 --> 00:05:03,000
+Naming convention for this message and practice might be different.
+
+63
+00:05:03,000 --> 00:05:10,000
+For example, you can call them like this or just call them visit, and you have different variations
+
+64
+00:05:10,000 --> 00:05:14,000
+and implementations of this visitor in this particular example.
+
+65
+00:05:14,000 --> 00:05:17,000
+I have one more interface that extends this one.
+
+66
+00:05:17,000 --> 00:05:24,000
+It is called Experts Visit, that potentially this interface might be an abstract class, but the difference
+
+67
+00:05:24,000 --> 00:05:30,000
+about abstract classes and interface and when to use what which might complete Java course in lessons
+
+68
+00:05:30,000 --> 00:05:33,000
+about interface and abstract classes.
+
+69
+00:05:33,000 --> 00:05:40,000
+You can see that in this public default method, we take variable list of arguments of the element type.
+
+70
+00:05:41,000 --> 00:05:49,000
+And when iterating over them, we call accept Masset on it and pass this visit to the visitor that invoked
+
+71
+00:05:49,000 --> 00:05:51,000
+this expert MASP.
+
+72
+00:05:51,000 --> 00:05:52,000
+Is that clear?
+
+73
+00:05:53,000 --> 00:05:57,000
+The next thing that I need to share with you is how accepting method is implemented.
+
+74
+00:05:58,000 --> 00:06:05,000
+For example, let me open industrial building class and accept that you can see that I invoke Masset
+
+75
+00:06:05,000 --> 00:06:12,000
+specific to this type on visitor object that was passed and argument and patterns of reference to this
+
+76
+00:06:12,000 --> 00:06:13,000
+object as a method argument.
+
+77
+00:06:14,000 --> 00:06:19,000
+So now let's jump to implementation of dofor industrial building method.
+
+78
+00:06:19,000 --> 00:06:25,000
+This method is implemented in XML expert visitor Andrew Sun, expert visitor.
+
+79
+00:06:25,000 --> 00:06:27,000
+Most of them implements experts visita.
+
+80
+00:06:28,000 --> 00:06:34,000
+And you can see that in this particular case I just print text to console to indicate that this specific
+
+81
+00:06:34,000 --> 00:06:38,000
+method was invoked either from Ximo or Drayson expert visiter class.
+
+82
+00:06:39,000 --> 00:06:42,000
+And now let's open, for example, a shopping center class.
+
+83
+00:06:43,000 --> 00:06:48,000
+You can see that this class might have a little bit different set of properties and different getters
+
+84
+00:06:48,000 --> 00:06:54,000
+and setters, but the only thing that we are interested in is implementation of except Macit.
+
+85
+00:06:55,000 --> 00:06:58,000
+And we can see that this is similar to what we saw in another class.
+
+86
+00:06:59,000 --> 00:07:05,000
+Yes, we adjusted these classes with implementation of one single method, but implementation of this
+
+87
+00:07:05,000 --> 00:07:11,000
+method will allow us to implement any visitor we want and pass it to this class.
+
+88
+00:07:11,000 --> 00:07:17,000
+That additional behavior you want to add new behavior to all types, just create new visitor type and
+
+89
+00:07:17,000 --> 00:07:17,000
+that's it.
+
+90
+00:07:18,000 --> 00:07:19,000
+Does it make sense?
+
+91
+00:07:19,000 --> 00:07:21,000
+Pretty cool, don't you think so?
+
+92
+00:07:21,000 --> 00:07:25,000
+And now let's look at the demo class to explore client code.
+
+93
+00:07:25,000 --> 00:07:29,000
+Let me run this file and explore console output together with you.
+
+94
+00:07:29,000 --> 00:07:37,000
+Imagine that I created objects of different types, park buildings, etc. After that, I create a reference
+
+95
+00:07:37,000 --> 00:07:44,000
+of expert visitor type and pointed to X amount expert visitor object after I call expert Masset and
+
+96
+00:07:44,000 --> 00:07:49,000
+person alja aliments as Masad arguments and what we have.
+
+97
+00:07:49,000 --> 00:07:56,000
+And so we have indication of Masset invocations from external expert visitor object for each element.
+
+98
+00:07:57,000 --> 00:08:03,000
+After that I have separation Mark and now I point my reference to the adjacent expert visitor object
+
+99
+00:08:03,000 --> 00:08:05,000
+and cause the same method.
+
+100
+00:08:05,000 --> 00:08:13,000
+What I see and console absolutely new behavior added to already created objects is a basic yes, we
+
+101
+00:08:13,000 --> 00:08:19,000
+did a lot of preparations, but just take a look how elegant the solution is, not only elegant but
+
+102
+00:08:19,000 --> 00:08:22,000
+house capabilities to implement additional behavior.
+
+103
+00:08:22,000 --> 00:08:25,000
+You don't need to touch asset classes anymore.
+
+104
+00:08:25,000 --> 00:08:28,000
+Just implement new visiter and that's it.
+
+105
+00:08:29,000 --> 00:08:31,000
+Hope you understood visitor partner with this example.
+
+106
+00:08:32,000 --> 00:08:38,000
+Now let's create a checklist for implementation of the plan to implement visitor button, follow next
+
+107
+00:08:38,000 --> 00:08:45,000
+steps, create visitor interface and declare assets to visit each class of the elements Iraqi unit to
+
+108
+00:08:45,000 --> 00:08:49,000
+work with, declare and describe interface of elements.
+
+109
+00:08:50,000 --> 00:08:57,000
+In our particular example, it was element implement element interface in each concrete implementation
+
+110
+00:08:58,000 --> 00:09:03,000
+hierarchy of elements need to be aware only about the most abstract type of visitors.
+
+111
+00:09:04,000 --> 00:09:11,000
+On the other hand, Irakere of visitors should know all concrete implementations of element Iraqi for
+
+112
+00:09:11,000 --> 00:09:17,000
+each new behavior, create concrete implementation of visitor interface, client will create visitor
+
+113
+00:09:17,000 --> 00:09:22,000
+objects, and then will pass it to the acceptance method of each concrete element.
+
+114
+00:09:23,000 --> 00:09:23,000
+That's it.
+
+115
+00:09:23,000 --> 00:09:24,000
+Regarding Visitor Pardon.
+
+116
+00:09:25,000 --> 00:09:29,000
+And before we move further, let's compare visitor and decorate pardons.
+
+117
+00:09:30,000 --> 00:09:34,000
+Hopefully now after this example, you already understood the difference.
+
+118
+00:09:34,000 --> 00:09:38,000
+The main difference is that visitor works with a group of objects.
+
+119
+00:09:39,000 --> 00:09:45,000
+This pardon suggests a way how we can add new behavior to the group of objects.
+
+120
+00:09:45,000 --> 00:09:51,000
+The greater part and on the other hand works on adding decoration with additional behavior, a single
+
+121
+00:09:51,000 --> 00:09:52,000
+instance.
+
+122
+00:09:52,000 --> 00:09:58,000
+So we can say that decorator works on an object, but the visitor works on Iraqi of elements.
+
+123
+00:09:59,000 --> 00:10:03,000
+This is probably the one biggest reason why these patterns are different.
+
+124
+00:10:04,000 --> 00:10:09,000
+Now, let's proceed with the next part, let's learn what State Department is all about.
+
+125
+00:10:09,000 --> 00:10:16,000
+The main idea of such behavior upon a state has been able to alter object behavior when its internal
+
+126
+00:10:16,000 --> 00:10:17,000
+state changes.
+
+127
+00:10:18,000 --> 00:10:23,000
+An object might be in one of predefined states that constantly change each other.
+
+128
+00:10:24,000 --> 00:10:29,000
+Group of such states is predefined and limited and dependent on the state of the object.
+
+129
+00:10:29,000 --> 00:10:34,000
+As a specific moment of time, object may react differently on the same events.
+
+130
+00:10:35,000 --> 00:10:41,000
+For example, imagine that you are implementing online document flow system and each document may have
+
+131
+00:10:41,000 --> 00:10:48,000
+such states draft in moderation published in each of these states publish.
+
+132
+00:10:48,000 --> 00:10:54,000
+Masset will lead us to different behavior of document object because when I invoke published method
+
+133
+00:10:54,000 --> 00:10:58,000
+for object that is in draft state, I need to send it to my generation first.
+
+134
+00:10:59,000 --> 00:11:01,000
+When document is in moderation.
+
+135
+00:11:01,000 --> 00:11:08,000
+State and I could publish a massive document as published, but only with one condition that this was
+
+136
+00:11:08,000 --> 00:11:14,000
+done by the administrator in case the document already in published state and I could publish, nothing
+
+137
+00:11:14,000 --> 00:11:15,000
+should happen.
+
+138
+00:11:15,000 --> 00:11:19,000
+But the interesting thing is how would you implement this point?
+
+139
+00:11:19,000 --> 00:11:25,000
+Because the first idea that probably pops up in your mind is to implement MassArt with multiple if statements
+
+140
+00:11:26,000 --> 00:11:27,000
+or just have speech block.
+
+141
+00:11:27,000 --> 00:11:29,000
+And that is enough with the thing.
+
+142
+00:11:30,000 --> 00:11:31,000
+But I would say one thing.
+
+143
+00:11:32,000 --> 00:11:36,000
+You're watching this course to learn better ways to solve this than just put Swedenborg.
+
+144
+00:11:37,000 --> 00:11:42,000
+Imagine how you would acetates if it would be needed and your behavior for that state, how it will
+
+145
+00:11:42,000 --> 00:11:45,000
+look like with Swedenborg always multiple if statements.
+
+146
+00:11:46,000 --> 00:11:50,000
+So the solution would be to create a separate class for each state and put chords.
+
+147
+00:11:50,000 --> 00:11:57,000
+That is related exactly for that behavior in those classes, instead of one single object, you're going
+
+148
+00:11:57,000 --> 00:12:03,000
+to have so called context object that holds the reference to the state object and will delegate certain
+
+149
+00:12:03,000 --> 00:12:10,000
+locations to that object will use polymorphism principle of object oriented programming in this part
+
+150
+00:12:10,000 --> 00:12:17,000
+and by using common interface for all possible states and delegating calls to different objects without
+
+151
+00:12:17,000 --> 00:12:18,000
+relying on each specific type.
+
+152
+00:12:19,000 --> 00:12:21,000
+Is it clear on the high level?
+
+153
+00:12:21,000 --> 00:12:27,000
+If yes, then we are ready to dive into the details and explore source code example of state power.
+
+154
+00:12:28,000 --> 00:12:30,000
+And let's start this demo from the client code.
+
+155
+00:12:31,000 --> 00:12:36,000
+Let me run those Democrats to walk you through the console output and the whole classes that we have.
+
+156
+00:12:36,000 --> 00:12:43,000
+In this example, I have implemented the example with online system of document flow, very simple version
+
+157
+00:12:43,000 --> 00:12:46,000
+of it, but still real life scenarios.
+
+158
+00:12:47,000 --> 00:12:50,000
+Imagine that client of your code creates document object.
+
+159
+00:12:51,000 --> 00:12:54,000
+And we also have different types of users in our context.
+
+160
+00:12:55,000 --> 00:12:59,000
+One user has admin role and another user has content creators role.
+
+161
+00:13:00,000 --> 00:13:01,000
+Let me open a user class.
+
+162
+00:13:02,000 --> 00:13:08,000
+So as you can see, this is super simple class with two fields only, just real name and nickname.
+
+163
+00:13:09,000 --> 00:13:12,000
+We have constructor it allows us is an initialized state of this object.
+
+164
+00:13:13,000 --> 00:13:15,000
+Let's get back to the demo file.
+
+165
+00:13:15,000 --> 00:13:19,000
+And when I just created my document, what state does it have?
+
+166
+00:13:19,000 --> 00:13:22,000
+I believe we can call such state as a draft.
+
+167
+00:13:22,000 --> 00:13:28,000
+You can see that I called print status Masset on the document object to print state of the document
+
+168
+00:13:28,000 --> 00:13:28,000
+to consult.
+
+169
+00:13:29,000 --> 00:13:36,000
+And you can see that there is no information about who created this document nor moderated it or published.
+
+170
+00:13:36,000 --> 00:13:39,000
+And we can see that the document is in draft state right now.
+
+171
+00:13:40,000 --> 00:13:47,000
+And I imagine that somewhere on Web user interface musterers the API call, you want to perform publishing
+
+172
+00:13:47,000 --> 00:13:47,000
+of the document.
+
+173
+00:13:48,000 --> 00:13:54,000
+And when I perform publish behavior with the credentials of content creator user for my document, how
+
+174
+00:13:54,000 --> 00:14:00,000
+I would expect it to behave, I would like to capture the nickname of a user that created this document
+
+175
+00:14:00,000 --> 00:14:04,000
+and send it to my generation before publishing to the production environment.
+
+176
+00:14:04,000 --> 00:14:08,000
+Also, state of the document should be changed to the next one.
+
+177
+00:14:08,000 --> 00:14:09,000
+In my flow.
+
+178
+00:14:09,000 --> 00:14:12,000
+The next state is in moderation, correct?
+
+179
+00:14:13,000 --> 00:14:19,000
+Right after I could publish Masset, I could print status message to print to consult current status
+
+180
+00:14:19,000 --> 00:14:20,000
+of document object.
+
+181
+00:14:20,000 --> 00:14:27,000
+Now we can see that state is different because after I called published Masset, I initialised created
+
+182
+00:14:27,000 --> 00:14:33,000
+by Field and took the nickname of users at different publish operation and also state.
+
+183
+00:14:33,000 --> 00:14:36,000
+Of our document right now is in moderation.
+
+184
+00:14:36,000 --> 00:14:40,000
+The next step is to complete moderation and publish this document.
+
+185
+00:14:41,000 --> 00:14:47,000
+I call Publish Macit One More Time with content creator user and I see the certification.
+
+186
+00:14:47,000 --> 00:14:54,000
+You are not admin and can't publish content and in the document status we see that no change has happened.
+
+187
+00:14:55,000 --> 00:15:02,000
+So does that mean that I call the same method to publish and the behavior is different because previously
+
+188
+00:15:02,000 --> 00:15:03,000
+we just kept.
+
+189
+00:15:03,000 --> 00:15:05,000
+The nickname of creator, and that's it.
+
+190
+00:15:06,000 --> 00:15:12,000
+Let's now call the same method, but will pass user with admin role to this massive what will happen
+
+191
+00:15:12,000 --> 00:15:13,000
+now.
+
+192
+00:15:13,000 --> 00:15:20,000
+I see another notification and console document is published now and status of the document object is
+
+193
+00:15:20,000 --> 00:15:21,000
+also changed.
+
+194
+00:15:21,000 --> 00:15:26,000
+Now we have a nickname of user who performed veneration of the document and who published it.
+
+195
+00:15:26,000 --> 00:15:33,000
+As you can understand, the same method publishing behaves differently depending on the current state
+
+196
+00:15:33,000 --> 00:15:33,000
+of the object.
+
+197
+00:15:34,000 --> 00:15:39,000
+What will happen in case I would call publish MassArt once the document is published already I see it
+
+198
+00:15:39,000 --> 00:15:40,000
+as a notification.
+
+199
+00:15:40,000 --> 00:15:43,000
+Tell me that document is published already.
+
+200
+00:15:43,000 --> 00:15:45,000
+Pretty cool, don't you think so?
+
+201
+00:15:45,000 --> 00:15:52,000
+And now the most interesting seeing how all this is implemented, I would like to start from document
+
+202
+00:15:52,000 --> 00:15:55,000
+class among all different fields that describe it.
+
+203
+00:15:55,000 --> 00:15:58,000
+State a field of type state.
+
+204
+00:15:58,000 --> 00:16:00,000
+Let's check what it is.
+
+205
+00:16:01,000 --> 00:16:06,000
+As we can see, state is just a public interface that declares contract only for one method.
+
+206
+00:16:07,000 --> 00:16:11,000
+That is our publish masset that takes user as method argument.
+
+207
+00:16:11,000 --> 00:16:18,000
+We have a document state asset class that implements this interface and we have three concrete classes
+
+208
+00:16:18,000 --> 00:16:23,000
+that extends the current state class Tsar's implements state interface.
+
+209
+00:16:23,000 --> 00:16:28,000
+In this specific case, I decided to have this abstract class just to not duplicate this constructor
+
+210
+00:16:28,000 --> 00:16:33,000
+and field because an implementation of document states should have this field.
+
+211
+00:16:33,000 --> 00:16:40,000
+And here my three states draft state in the nation state and published state for each state.
+
+212
+00:16:40,000 --> 00:16:43,000
+I have separate object and published method in each state.
+
+213
+00:16:43,000 --> 00:16:49,000
+Class is implemented as it is needed for this specific state in draft state published method change
+
+214
+00:16:49,000 --> 00:16:56,000
+state of the document to in moderation state and set create a nickname Immoderation State published
+
+215
+00:16:56,000 --> 00:17:00,000
+method to verify the role of the users to request this behavior.
+
+216
+00:17:00,000 --> 00:17:07,000
+And if role is applicable, then we change state to published and populate data into moderated by and
+
+217
+00:17:07,000 --> 00:17:09,000
+published by fields of document object.
+
+218
+00:17:10,000 --> 00:17:17,000
+If user doesn't have admin role, then we do nothing and just print notification to consult in published
+
+219
+00:17:17,000 --> 00:17:17,000
+state.
+
+220
+00:17:17,000 --> 00:17:21,000
+I do nothing at all and just bring notification to council.
+
+221
+00:17:21,000 --> 00:17:22,000
+Is that clear?
+
+222
+00:17:23,000 --> 00:17:29,000
+I believe at this some is saying that I still didn't share with you is how masses of state objects and
+
+223
+00:17:29,000 --> 00:17:35,000
+vote if I interact not with state objects but was document object directly.
+
+224
+00:17:35,000 --> 00:17:39,000
+As you remember, we have state objects inside my document class.
+
+225
+00:17:39,000 --> 00:17:45,000
+So the only thing that is left to do is to delegate cause to the state objects when time comes.
+
+226
+00:17:46,000 --> 00:17:52,000
+For such purposes, I implemented the method with the signature that I need and just delegate this behavior
+
+227
+00:17:52,000 --> 00:17:53,000
+to my state object.
+
+228
+00:17:54,000 --> 00:17:57,000
+My document object also has set up for state.
+
+229
+00:17:57,000 --> 00:18:04,000
+That's why I can easily perform under operations by setting previs state to my document object.
+
+230
+00:18:04,000 --> 00:18:06,000
+Basically, that's it.
+
+231
+00:18:06,000 --> 00:18:10,000
+And that is how State Department is implemented in this example.
+
+232
+00:18:10,000 --> 00:18:15,000
+You're welcome to find the source code in attachments to this lesson and run it on your computer.
+
+233
+00:18:16,000 --> 00:18:21,000
+And in case you have any questions regarding this pardon, let me know in Q&A section of this course.
+
+234
+00:18:22,000 --> 00:18:28,000
+Now let's create a checklist to help you implement state pardon in your project to implement state pardon.
+
+235
+00:18:28,000 --> 00:18:29,000
+Follow next steps.
+
+236
+00:18:30,000 --> 00:18:37,000
+The final Iraqi of state of your domain object, great implementations and complete classes of states
+
+237
+00:18:37,000 --> 00:18:42,000
+implementing behaviors that should be different based on state of your domain object.
+
+238
+00:18:42,000 --> 00:18:44,000
+Make sure you have API to pass.
+
+239
+00:18:44,000 --> 00:18:49,000
+Object to state classes is a very constructor set of business logic methods.
+
+240
+00:18:50,000 --> 00:18:57,000
+Make sure that your domain object contains a reference to the most relevant state object at the state
+
+241
+00:18:57,000 --> 00:18:57,000
+of the main object.
+
+242
+00:18:57,000 --> 00:19:02,000
+When needed delegate method calls on the main object to current state object.
+
+243
+00:19:03,000 --> 00:19:09,000
+In this case, you will have different behavior of your object dependent on its state that it holds
+
+244
+00:19:09,000 --> 00:19:14,000
+that now you have all knowledge to implement state in the application when it will be needed.
+
+245
+00:19:15,000 --> 00:19:16,000
+Let's continue now.
+
+246
+00:19:16,000 --> 00:19:18,000
+Let's learn the next part.
+
+247
+00:19:18,000 --> 00:19:22,000
+The next part in our lesson today is observe upon in simple words.
+
+248
+00:19:23,000 --> 00:19:29,000
+Observe is a behavioral patterns that creates mechanisms that allow us to track events in other objects
+
+249
+00:19:29,000 --> 00:19:32,000
+and react on these events when it might be needed.
+
+250
+00:19:32,000 --> 00:19:34,000
+Imagine the next case.
+
+251
+00:19:34,000 --> 00:19:41,000
+You have an online store and a group of customers that are interested in the product that is currently
+
+252
+00:19:41,000 --> 00:19:45,000
+absent in your store, but you expect a new consignment to arrive soon.
+
+253
+00:19:45,000 --> 00:19:48,000
+What would be the best way to solve this issue?
+
+254
+00:19:49,000 --> 00:19:52,000
+And he would recommend our customers change the products each day.
+
+255
+00:19:53,000 --> 00:19:57,000
+They might be disappointed to learn that you don't have this product five days in a row.
+
+256
+00:19:58,000 --> 00:20:02,000
+Sending messages to all customers is not a good scene because a lot of.
+
+257
+00:20:03,000 --> 00:20:05,000
+Might be not interested in this product.
+
+258
+00:20:05,000 --> 00:20:10,000
+I would become angry about you spun and then it would be perfect.
+
+259
+00:20:10,000 --> 00:20:11,000
+That's when you will receive goods.
+
+260
+00:20:11,000 --> 00:20:16,000
+You would instantly notify only those customers who was interested in this product.
+
+261
+00:20:17,000 --> 00:20:17,000
+Agreed.
+
+262
+00:20:18,000 --> 00:20:20,000
+That is why we need to observe a pattern.
+
+263
+00:20:20,000 --> 00:20:27,000
+Observable trends, changes in your store, and once updates will be observable, notify your customers
+
+264
+00:20:27,000 --> 00:20:31,000
+to make them come to your shop and purchase the products they expected.
+
+265
+00:20:32,000 --> 00:20:33,000
+How this is implemented.
+
+266
+00:20:34,000 --> 00:20:39,000
+Observer registers objects that want to track changes and wants even this happened.
+
+267
+00:20:39,000 --> 00:20:47,000
+Broadcast this news to all list of references that it stores inside and the type of objects that registered
+
+268
+00:20:47,000 --> 00:20:52,000
+doesn't matter because all of them have to follow quencher described in common interface.
+
+269
+00:20:53,000 --> 00:20:57,000
+This contract of updating about the event does make sense.
+
+270
+00:20:58,000 --> 00:21:00,000
+Hope that you understood the idea of this forum.
+
+271
+00:21:00,000 --> 00:21:07,000
+Now, let's jump to example of this parren will implement scenarios that I've just described with online
+
+272
+00:21:07,000 --> 00:21:10,000
+store and customers who are pending order.
+
+273
+00:21:10,000 --> 00:21:15,000
+We should notify customers who abandon their products arrived to the store.
+
+274
+00:21:15,000 --> 00:21:18,000
+Let me open them a file and explain this.
+
+275
+00:21:18,000 --> 00:21:20,000
+This example line by line.
+
+276
+00:21:20,000 --> 00:21:23,000
+I create object of online store type first.
+
+277
+00:21:23,000 --> 00:21:29,000
+After that I create a different type of customers and adds a reference to my store object.
+
+278
+00:21:29,000 --> 00:21:35,000
+Into that, we have two types of customers, direct consumers and some other shops.
+
+279
+00:21:36,000 --> 00:21:40,000
+Thus our B2B customers equate to B2C customers.
+
+280
+00:21:40,000 --> 00:21:47,000
+That is business to customer model and one B2B customer that is business to business model there.
+
+281
+00:21:47,000 --> 00:21:48,000
+Almost similar.
+
+282
+00:21:48,000 --> 00:21:52,000
+For the sake of the example today, let me open B2C customer class.
+
+283
+00:21:53,000 --> 00:22:00,000
+We can see that in this particular case I use online store reference to subscribe customer to the changes
+
+284
+00:22:00,000 --> 00:22:07,000
+I call this method and listener because we add objects that once the recent events in online store.
+
+285
+00:22:07,000 --> 00:22:09,000
+Let's explore how this method works.
+
+286
+00:22:10,000 --> 00:22:16,000
+Inside online store object, we have a list of observers, our group, all of them in one container
+
+287
+00:22:16,000 --> 00:22:20,000
+in order to interact with them later, as was a group of elements.
+
+288
+00:22:20,000 --> 00:22:25,000
+Let's now get back to them a file after that Acrassicauda object.
+
+289
+00:22:25,000 --> 00:22:31,000
+For the sake of our demo, we'll use the scanner to imitate some event from outside.
+
+290
+00:22:31,000 --> 00:22:36,000
+Let me run this program now and I can see question in console.
+
+291
+00:22:36,000 --> 00:22:43,000
+I just arrived to the store and in our source code you can see that I declared variable of type boolean
+
+292
+00:22:43,000 --> 00:22:44,000
+and started a loop.
+
+293
+00:22:44,000 --> 00:22:50,000
+Until this variable will be true, I will be iterating and this loop and we will keep asking the same
+
+294
+00:22:50,000 --> 00:22:51,000
+question.
+
+295
+00:22:52,000 --> 00:22:57,000
+For example, let's answer now to our program that we still expect on arrival.
+
+296
+00:22:57,000 --> 00:23:03,000
+I'm right here and press enter and here we are again in the same loop.
+
+297
+00:23:04,000 --> 00:23:06,000
+Let me now enter through and press enter.
+
+298
+00:23:07,000 --> 00:23:12,000
+After this we go out of this loop and we have set a new state to our online store.
+
+299
+00:23:12,000 --> 00:23:17,000
+That is exactly update that all subscribers want to know about.
+
+300
+00:23:17,000 --> 00:23:20,000
+Let's explore the source code of sad state statements.
+
+301
+00:23:21,000 --> 00:23:24,000
+First of all, update state of online store.
+
+302
+00:23:24,000 --> 00:23:27,000
+And again, this is just an example.
+
+303
+00:23:27,000 --> 00:23:33,000
+And in real life, we would have a little bit more complex even system in this particular example.
+
+304
+00:23:33,000 --> 00:23:35,000
+This is just one field.
+
+305
+00:23:35,000 --> 00:23:42,000
+And once we updated state of our online store, we could notify subscribers nested inside the mass that
+
+306
+00:23:42,000 --> 00:23:47,000
+we have for each loop, iterating over each observer that we have registered in this class.
+
+307
+00:23:48,000 --> 00:23:52,000
+And for an interface that we agreed on, I call update method.
+
+308
+00:23:52,000 --> 00:23:59,000
+After the date method, each customer prints the text to console and you can implement any business
+
+309
+00:23:59,000 --> 00:24:01,000
+logic you need to handle this.
+
+310
+00:24:01,000 --> 00:24:06,000
+And now we receive an event in all subscribers that we registered in our online store.
+
+311
+00:24:07,000 --> 00:24:08,000
+Does it make more sense now?
+
+312
+00:24:09,000 --> 00:24:09,000
+Great.
+
+313
+00:24:10,000 --> 00:24:16,000
+Let's now create the checklist for observer part to implement observer upon follow next steps.
+
+314
+00:24:16,000 --> 00:24:23,000
+Separate, dependent and independent behavior dependent behavior should be executed in case when some
+
+315
+00:24:23,000 --> 00:24:30,000
+event happens, when you separate different types of behavior, make sure you have separate Iraqi for
+
+316
+00:24:30,000 --> 00:24:35,000
+your subject with independent behavior and Iraqi observers with dependent behavior.
+
+317
+00:24:36,000 --> 00:24:40,000
+Make sure that in observing interface you have method for notification.
+
+318
+00:24:41,000 --> 00:24:43,000
+Subject my store references to observers.
+
+319
+00:24:44,000 --> 00:24:47,000
+That is exactly why we created a list of observers.
+
+320
+00:24:48,000 --> 00:24:55,000
+Observers should register themselves in subject, object subject, notifies all observers about event.
+
+321
+00:24:55,000 --> 00:25:02,000
+When it happens, subject may push information to observers or let observers pool needed information
+
+322
+00:25:02,000 --> 00:25:02,000
+from subject.
+
+323
+00:25:02,000 --> 00:25:09,000
+Object, that's it, we got an observer pardon, let's continue the next part is momentum.
+
+324
+00:25:09,000 --> 00:25:14,000
+This is behavioral patterns that allow us to capture and store previous traits of the object.
+
+325
+00:25:15,000 --> 00:25:19,000
+Having this information, we can easily return our object back to that state.
+
+326
+00:25:19,000 --> 00:25:21,000
+Imagine Google Docs.
+
+327
+00:25:21,000 --> 00:25:25,000
+If you have never worked with Google Docs, I will explain its cool feature.
+
+328
+00:25:26,000 --> 00:25:30,000
+Google Docs source information literally about all changes in the document.
+
+329
+00:25:31,000 --> 00:25:35,000
+And it doesn't matter if you would even close this document and close your browser at all.
+
+330
+00:25:36,000 --> 00:25:42,000
+Any time you open this document again, you can browse the history of changes and restores the document
+
+331
+00:25:42,000 --> 00:25:46,000
+to its original state and how to solve this task on the court level.
+
+332
+00:25:47,000 --> 00:25:52,000
+This is exactly why we need momentum part sometimes and how it is implemented and how to solve this
+
+333
+00:25:52,000 --> 00:25:53,000
+issue.
+
+334
+00:25:53,000 --> 00:25:57,000
+Let's look at the court example to understand this sporran better.
+
+335
+00:25:57,000 --> 00:26:01,000
+And by example, let's agree on the terminology first.
+
+336
+00:26:01,000 --> 00:26:05,000
+The object whose state needs to be saved is called an originator.
+
+337
+00:26:06,000 --> 00:26:08,000
+Also, we have so-called caretake.
+
+338
+00:26:09,000 --> 00:26:09,000
+What is that?
+
+339
+00:26:10,000 --> 00:26:15,000
+The caretaker is the object that triggers a safe and restore of the state.
+
+340
+00:26:15,000 --> 00:26:19,000
+The state is encapsulated in object that is called the momentum.
+
+341
+00:26:20,000 --> 00:26:25,000
+The momentum object should expose as little information as possible to the caretaker.
+
+342
+00:26:26,000 --> 00:26:32,000
+This is to ensure that we don't expose internal state of the originator to the outside world as it would
+
+343
+00:26:32,000 --> 00:26:34,000
+break encapsulation principle.
+
+344
+00:26:34,000 --> 00:26:40,000
+However, the originator should access enough information in order to restore the original state.
+
+345
+00:26:41,000 --> 00:26:47,000
+When we talk about originator, it is worth to say that it can produce and consume and amend the object.
+
+346
+00:26:47,000 --> 00:26:52,000
+At the meantime, caretaker keeps the state before storing it.
+
+347
+00:26:53,000 --> 00:26:59,000
+It is often happens that having one field is more than enough to represent the state of the originator.
+
+348
+00:26:59,000 --> 00:27:05,000
+But we are not limited to one field only and the states that will keep in mind the object shouldn't
+
+349
+00:27:05,000 --> 00:27:09,000
+march to the complete state of the originator object on one hundred percent.
+
+350
+00:27:09,000 --> 00:27:15,000
+As long as we keep on the information needed to restore the state of the originator, we are not in
+
+351
+00:27:16,000 --> 00:27:16,000
+this.
+
+352
+00:27:16,000 --> 00:27:20,000
+Let's decide what clause will perform the role of originate the object.
+
+353
+00:27:21,000 --> 00:27:22,000
+We have three main classes here.
+
+354
+00:27:23,000 --> 00:27:27,000
+They are text window, text editor and text.
+
+355
+00:27:27,000 --> 00:27:34,000
+When those state text window is our originator clause, we want to store states of object of this type.
+
+356
+00:27:34,000 --> 00:27:39,000
+It consists from string builder that work with strings that we pass to this object.
+
+357
+00:27:40,000 --> 00:27:46,000
+The safe method of this class creates an object of text in those state type and restore method.
+
+358
+00:27:46,000 --> 00:27:52,000
+Initialized text in window field was the states that will pass as a method argument.
+
+359
+00:27:53,000 --> 00:27:55,000
+Text editor is our caretake.
+
+360
+00:27:55,000 --> 00:28:01,000
+A class object of this type will be in charge of saving state of the text window and restoring its state.
+
+361
+00:28:02,000 --> 00:28:05,000
+And you can see that to perform such operations.
+
+362
+00:28:05,000 --> 00:28:07,000
+We have a list of text in those states.
+
+363
+00:28:08,000 --> 00:28:15,000
+We can save state of text window and added to the list by calling Save Method and we can restore state
+
+364
+00:28:15,000 --> 00:28:21,000
+of the text window by snapshot index directly from our O'Reilley text window.
+
+365
+00:28:21,000 --> 00:28:28,000
+State class is the basis for our momentum objects and as you can see, it doesn't source to build a
+
+366
+00:28:28,000 --> 00:28:29,000
+text window.
+
+367
+00:28:29,000 --> 00:28:34,000
+It stores just enough information to restore the state of the text window.
+
+368
+00:28:34,000 --> 00:28:40,000
+Basically the strings that will be used to initialize the variable of string builder type inside the
+
+369
+00:28:40,000 --> 00:28:44,000
+text when the object is that clear how bad it is.
+
+370
+00:28:44,000 --> 00:28:46,000
+Let's now look at the demo class.
+
+371
+00:28:47,000 --> 00:28:49,000
+I will run this file to explore console output.
+
+372
+00:28:49,000 --> 00:28:55,000
+Together with you, I create object of text editor type and object of window type.
+
+373
+00:28:56,000 --> 00:29:01,000
+I call write method on text window, object to write some text into the window.
+
+374
+00:29:01,000 --> 00:29:08,000
+I call the same method with another text one more time inside text window object and just append new
+
+375
+00:29:08,000 --> 00:29:13,000
+text already existing one using all features of string builder object.
+
+376
+00:29:13,000 --> 00:29:21,000
+After that I call safe method on my text editor and I pass that text window state object that is returned
+
+377
+00:29:21,000 --> 00:29:23,000
+by calling safe method on text window.
+
+378
+00:29:24,000 --> 00:29:25,000
+That would be my first snapshot.
+
+379
+00:29:26,000 --> 00:29:30,000
+After that I write additional text and save the state one more time.
+
+380
+00:29:30,000 --> 00:29:32,000
+This is my second snapshot.
+
+381
+00:29:33,000 --> 00:29:38,000
+Now I print state of text window to consult first time and we see all three lines.
+
+382
+00:29:39,000 --> 00:29:44,000
+After that I print, separate the lines and restore the previous state how I can do it.
+
+383
+00:29:45,000 --> 00:29:49,000
+I call restore method on my text mindo object and parse that text.
+
+384
+00:29:49,000 --> 00:29:56,000
+When the state object that is returned by Massata annotation on text editor class I call get state by
+
+385
+00:29:56,000 --> 00:30:02,000
+Slapshot Index method and parse the index of the snapshot if I want to give the first snapshot.
+
+386
+00:30:02,000 --> 00:30:10,000
+I will pass in the case of zero April tax to console, and you can see this is exactly the state that
+
+387
+00:30:10,000 --> 00:30:15,000
+I had after first saving the last line and it was a separator.
+
+388
+00:30:15,000 --> 00:30:17,000
+That's why I have this tax.
+
+389
+00:30:17,000 --> 00:30:24,000
+And now I would like to do a redo operation and just restore the state of my second snapshot and bring
+
+390
+00:30:24,000 --> 00:30:25,000
+tax to consult one more time.
+
+391
+00:30:26,000 --> 00:30:31,000
+Is it clear and in real life you may have different versions of the same idea.
+
+392
+00:30:31,000 --> 00:30:37,000
+For example, you may have masses and do and will do instead of having a method of getting inception
+
+393
+00:30:37,000 --> 00:30:39,000
+by index, that is also possible.
+
+394
+00:30:39,000 --> 00:30:43,000
+The main thing is to follow the main idea I've just described.
+
+395
+00:30:43,000 --> 00:30:50,000
+I recommend you to pull these good examples from my git repository and run this example on your local
+
+396
+00:30:50,000 --> 00:30:50,000
+computer.
+
+397
+00:30:51,000 --> 00:30:57,000
+It will give you an opportunity to understand better how this court works, lets you use a checklist
+
+398
+00:30:57,000 --> 00:31:04,000
+to implement moment upon identify and split rules of originator and caretake between classes.
+
+399
+00:31:04,000 --> 00:31:11,000
+Create momentum type that contains enough information to restore originator object, caretake store
+
+400
+00:31:11,000 --> 00:31:17,000
+information about all states of originator and knows how to save and restore State of Origin.
+
+401
+00:31:17,000 --> 00:31:24,000
+If the object originator object may create momentum, objects originate and instantiate itself using
+
+402
+00:31:24,000 --> 00:31:26,000
+Safet state in the manner to object.
+
+403
+00:31:27,000 --> 00:31:30,000
+Hope you learned a lot of interesting things about momentum.
+
+404
+00:31:31,000 --> 00:31:34,000
+Now let's recap what we have learned today.
+
+405
+00:31:34,000 --> 00:31:37,000
+In this lesson we learned such behavioral patterns.
+
+406
+00:31:37,000 --> 00:31:41,000
+Visiter, State, Observer and the Mantha.
+
+407
+00:31:41,000 --> 00:31:42,000
+That's it for today.
+
+408
+00:31:43,000 --> 00:31:44,000
+Thanks a lot for your attention.
+
+409
+00:31:45,000 --> 00:31:47,000
+Have a great day and see you in the next lesson.
+
diff --git a/39 - GoF Design Patterns of Software Architecture in OOP/006 Source-code-of-all-examples-from-the-lesson.url b/39 - GoF Design Patterns of Software Architecture in OOP/006 Source-code-of-all-examples-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..b7a99d46797bc94660943bfd3f2695a8487932d5
--- /dev/null
+++ b/39 - GoF Design Patterns of Software Architecture in OOP/006 Source-code-of-all-examples-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/patterns/behavioral
\ No newline at end of file
diff --git a/39 - GoF Design Patterns of Software Architecture in OOP/007 Behevioral Patterns, p.3_en.srt b/39 - GoF Design Patterns of Software Architecture in OOP/007 Behevioral Patterns, p.3_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..cef8d0bdbf43d32926a41a2220bb4964c7842f20
--- /dev/null
+++ b/39 - GoF Design Patterns of Software Architecture in OOP/007 Behevioral Patterns, p.3_en.srt
@@ -0,0 +1,1100 @@
+1
+00:00:05,000 --> 00:00:10,000
+Hello, dear students, by this moment and now, of course, we learned really a lot of behavioral golf,
+
+2
+00:00:10,000 --> 00:00:18,000
+Gulfport's to be specific and previous lessons, I explained unan behavioral patterns, but this means
+
+3
+00:00:18,000 --> 00:00:20,000
+that we still have two more points to learn.
+
+4
+00:00:20,000 --> 00:00:23,000
+That is exactly what we are going to do in this lesson.
+
+5
+00:00:23,000 --> 00:00:27,000
+We're going to learn last but not the least, behavioral patterns.
+
+6
+00:00:27,000 --> 00:00:31,000
+And as you already understood, we have only two behavioral patterns left.
+
+7
+00:00:32,000 --> 00:00:39,000
+They are interpretor and mydata source code examples for each part in attachments to this Lassy.
+
+8
+00:00:40,000 --> 00:00:43,000
+We will review those examples together during the lesson.
+
+9
+00:00:43,000 --> 00:00:49,000
+But still, it is a good idea to run these examples locally on your computer to understand these patterns
+
+10
+00:00:49,000 --> 00:00:49,000
+better.
+
+11
+00:00:49,000 --> 00:00:57,000
+Let's start we'll start from Interpretor Barton and to explain in simple words what Interpreter Point
+
+12
+00:00:57,000 --> 00:00:59,000
+is, let me start from small example.
+
+13
+00:01:00,000 --> 00:01:03,000
+Imagine compiler, whatever compiler you can imagine.
+
+14
+00:01:03,000 --> 00:01:10,000
+For example, Java compiler compiler transforms code written in high level programming language into
+
+15
+00:01:10,000 --> 00:01:14,000
+the machine code at once before program runs.
+
+16
+00:01:14,000 --> 00:01:20,000
+So you have some language that you don't want to translate by itself each time you need to run Java
+
+17
+00:01:20,000 --> 00:01:27,000
+program on Gibeah for such purposes, you have compiler that does this work for you and translate high
+
+18
+00:01:27,000 --> 00:01:30,000
+level programming language into machine code.
+
+19
+00:01:30,000 --> 00:01:33,000
+This is one of use cases of using interpretor.
+
+20
+00:01:34,000 --> 00:01:39,000
+This pardon is used to define the description of the grammar of the interpreted language.
+
+21
+00:01:39,000 --> 00:01:45,000
+This pattern allows us technically to implement custom regular expressions, language or custom domain
+
+22
+00:01:45,000 --> 00:01:47,000
+specific language interpreter.
+
+23
+00:01:47,000 --> 00:01:51,000
+Or we can create interpreters that would pass human languages.
+
+24
+00:01:51,000 --> 00:01:53,000
+We can find even more use cases.
+
+25
+00:01:54,000 --> 00:01:58,000
+For example, your integrated development environment, your idea.
+
+26
+00:01:58,000 --> 00:02:04,000
+It constantly analyzes and interprets the code as we type in the new words in our text editor.
+
+27
+00:02:04,000 --> 00:02:11,000
+And this allows it to provide us with hints and on the basis of our code, even before code compilation
+
+28
+00:02:11,000 --> 00:02:12,000
+and execution.
+
+29
+00:02:12,000 --> 00:02:18,000
+But definitely we should keep in mind that we can successfully apply this pattern when the grammar is
+
+30
+00:02:18,000 --> 00:02:19,000
+relatively simple.
+
+31
+00:02:20,000 --> 00:02:24,000
+Let's now quickly discuss how this pardon is implemented in this part.
+
+32
+00:02:24,000 --> 00:02:26,000
+And we have two main entities.
+
+33
+00:02:26,000 --> 00:02:29,000
+They are context and expression.
+
+34
+00:02:29,000 --> 00:02:37,000
+This will allow us to do two things describe any word expression and define meaning of such expressions.
+
+35
+00:02:37,000 --> 00:02:38,000
+In specific contexts.
+
+36
+00:02:39,000 --> 00:02:45,000
+We describe abstract expressions that usually have one method that is called interpret the takes context
+
+37
+00:02:45,000 --> 00:02:47,000
+as Masad argument.
+
+38
+00:02:47,000 --> 00:02:54,000
+This will allow for each expression to affect the context by saying affect the context, I mean change
+
+39
+00:02:54,000 --> 00:02:59,000
+its state continuous interpretation or just return a result.
+
+40
+00:02:59,000 --> 00:03:05,000
+That means that we should have context class that will be considered as holder of global state of processing
+
+41
+00:03:06,000 --> 00:03:11,000
+and it will be used by different elements, different interpretation, process, abstract expression
+
+42
+00:03:11,000 --> 00:03:14,000
+might be extended by two other types.
+
+43
+00:03:14,000 --> 00:03:18,000
+They are terminal and then terminal expressions.
+
+44
+00:03:18,000 --> 00:03:23,000
+I believe that on the high level it is clear what is the difference between these two types considering
+
+45
+00:03:23,000 --> 00:03:24,000
+their names.
+
+46
+00:03:25,000 --> 00:03:27,000
+But let's make sure that we are on the same page.
+
+47
+00:03:28,000 --> 00:03:32,000
+Terminal expression is a final expression in the interpretation process.
+
+48
+00:03:32,000 --> 00:03:38,000
+None terminal expression usually has the reference to the next expression to proceed interpretation
+
+49
+00:03:38,000 --> 00:03:39,000
+process.
+
+50
+00:03:39,000 --> 00:03:41,000
+It is similar to streams in Java.
+
+51
+00:03:41,000 --> 00:03:47,000
+You have terminal methods and non terminal and only terminal expression can finish interpretation process.
+
+52
+00:03:48,000 --> 00:03:49,000
+By the way, there.
+
+53
+00:03:49,000 --> 00:03:51,000
+Remember such structural partners composite.
+
+54
+00:03:52,000 --> 00:03:54,000
+Let me just remind you what that pattern is about.
+
+55
+00:03:55,000 --> 00:04:01,000
+Composite is a structural pattern that allows us to interact with a single object, always group of
+
+56
+00:04:01,000 --> 00:04:03,000
+objects with the help of a single interface.
+
+57
+00:04:04,000 --> 00:04:09,000
+And often expressions are composite objects that encapsulate different expressions.
+
+58
+00:04:09,000 --> 00:04:12,000
+But we interact with expression as we single one.
+
+59
+00:04:13,000 --> 00:04:16,000
+The role of the client is to create an abstract syntax tree.
+
+60
+00:04:16,000 --> 00:04:20,000
+But what is an abstract syntax tree in computer science?
+
+61
+00:04:20,000 --> 00:04:29,000
+Abstract syntax tree shortened version of this is a a S.T. or just syntax tree is a tree representation
+
+62
+00:04:29,000 --> 00:04:30,000
+of sorts cost structure.
+
+63
+00:04:31,000 --> 00:04:35,000
+Each north of tree denotes a construct occurring in the source code.
+
+64
+00:04:35,000 --> 00:04:37,000
+It is called abstract syntax.
+
+65
+00:04:37,000 --> 00:04:43,000
+Three because this syntax doesn't represent all the details appear in real syntax.
+
+66
+00:04:43,000 --> 00:04:50,000
+Abstract syntax trees are data structures widely used in compilers to represent the structure of program
+
+67
+00:04:50,000 --> 00:04:58,000
+code, and ACG is usually a result of the syntax analysis phase of a compiler coming back to the client
+
+68
+00:04:58,000 --> 00:05:01,000
+code responsibilities, rephrasing it in simple words.
+
+69
+00:05:01,000 --> 00:05:03,000
+Clients should build three of.
+
+70
+00:05:03,000 --> 00:05:09,000
+Rations that will be used in interpretation homes, and this is clear now.
+
+71
+00:05:09,000 --> 00:05:15,000
+And as always, I believe that a good example worth a thousand words, let's review the source code
+
+72
+00:05:15,000 --> 00:05:17,000
+examples that I prepared for today.
+
+73
+00:05:18,000 --> 00:05:23,000
+This is not the easiest part to understand, but I will try to explain it to you as examples.
+
+74
+00:05:23,000 --> 00:05:28,000
+I have two examples here, simple and more or less real life closed.
+
+75
+00:05:29,000 --> 00:05:33,000
+Let's start from the simple one that is located in this demo.
+
+76
+00:05:33,000 --> 00:05:38,000
+One package we have expression interface that declares only one method.
+
+77
+00:05:38,000 --> 00:05:45,000
+Interpret the text, interpret interpretation context as method argument and returns string value.
+
+78
+00:05:45,000 --> 00:05:48,000
+Let's now look at interpretor context.
+
+79
+00:05:48,000 --> 00:05:50,000
+This class has only two methods.
+
+80
+00:05:50,000 --> 00:05:55,000
+They are yet binary format and got hexadecimal format.
+
+81
+00:05:55,000 --> 00:06:02,000
+And I believe you can see that we use basic behavior from integer class to convert in into different
+
+82
+00:06:02,000 --> 00:06:03,000
+formats.
+
+83
+00:06:03,000 --> 00:06:10,000
+Also, we have two implementations of expression interface layer into binary expression and intersex
+
+84
+00:06:10,000 --> 00:06:11,000
+expression.
+
+85
+00:06:12,000 --> 00:06:18,000
+As you can see these expressions to interpret the context as Masset argument and just use it to perform
+
+86
+00:06:18,000 --> 00:06:21,000
+request that the operation take into account.
+
+87
+00:06:21,000 --> 00:06:24,000
+We have to store in somewhere to perform the separation.
+
+88
+00:06:24,000 --> 00:06:25,000
+We pass it.
+
+89
+00:06:25,000 --> 00:06:31,000
+We are constructor and use it later in this method when we invoke method of interpretive context.
+
+90
+00:06:32,000 --> 00:06:34,000
+So these two classes are similar.
+
+91
+00:06:34,000 --> 00:06:38,000
+Tsong The difference is a method that we invoke and interpret the context object.
+
+92
+00:06:39,000 --> 00:06:42,000
+Now let's look at the client code and our demo class.
+
+93
+00:06:43,000 --> 00:06:48,000
+We have here interpret mass that basically describes kind of abstract syntax.
+
+94
+00:06:48,000 --> 00:06:55,000
+Three kind of basically this method contains information how to parse string in case it contains is
+
+95
+00:06:55,000 --> 00:06:57,000
+that small string of binary string.
+
+96
+00:06:58,000 --> 00:07:03,000
+Depending on this, we initialize our expression variable and perform, interpret Masset on it.
+
+97
+00:07:04,000 --> 00:07:08,000
+In our main mass, we have two strings that are started with numbers.
+
+98
+00:07:08,000 --> 00:07:14,000
+We create an object of our client code and we print the console result of interpretation.
+
+99
+00:07:14,000 --> 00:07:22,000
+Is that clear my code, evaluate the expression and understand when it needs to convert number from
+
+100
+00:07:22,000 --> 00:07:25,000
+the phrase the binary hexadecimal format.
+
+101
+00:07:26,000 --> 00:07:29,000
+Press a pause for a minute and think about this example.
+
+102
+00:07:29,000 --> 00:07:36,000
+I also encourage you to download the source code of this program and run it locally on your computer.
+
+103
+00:07:36,000 --> 00:07:42,000
+And I know that this example is oversimplified, but it is good to start with.
+
+104
+00:07:42,000 --> 00:07:44,000
+Agree why I said that?
+
+105
+00:07:44,000 --> 00:07:51,000
+It is oversimplified in my opinion because we don't have long term channel and channel expressions combined
+
+106
+00:07:51,000 --> 00:07:58,000
+together and brought us together, because definitely there is a specific sort of heaven on channel
+
+107
+00:07:58,000 --> 00:08:01,000
+and terminal expressions and interprets syntax.
+
+108
+00:08:01,000 --> 00:08:08,000
+We have over simplified syntax and room for interpretation here because in real life, syntax for interpretation
+
+109
+00:08:08,000 --> 00:08:10,000
+might be a little bit more complex.
+
+110
+00:08:10,000 --> 00:08:15,000
+OK, if you think that this example is clear for you, let's check another one.
+
+111
+00:08:16,000 --> 00:08:19,000
+Number two, it is more complex than previous one.
+
+112
+00:08:20,000 --> 00:08:21,000
+Let me start from the demo file.
+
+113
+00:08:22,000 --> 00:08:24,000
+Imagine that we have these objects.
+
+114
+00:08:25,000 --> 00:08:28,000
+Some of them represents engineers, some of the managers.
+
+115
+00:08:28,000 --> 00:08:35,000
+All of them are united with abstract class employee that serves as an abstraction for these types.
+
+116
+00:08:35,000 --> 00:08:40,000
+Each employee is in some of the departments, has some title and salary.
+
+117
+00:08:41,000 --> 00:08:44,000
+All employees also have their personal iji inside the company.
+
+118
+00:08:45,000 --> 00:08:47,000
+We have a limited number of departments.
+
+119
+00:08:47,000 --> 00:08:50,000
+That's why we have departments as in them here.
+
+120
+00:08:51,000 --> 00:08:57,000
+Each engineer has manager and that's why we are Mappin engineers and managers here.
+
+121
+00:08:57,000 --> 00:08:59,000
+And here's our first context.
+
+122
+00:08:59,000 --> 00:09:04,000
+For example, this is my own domain specific language that I introduced in this example.
+
+123
+00:09:05,000 --> 00:09:10,000
+I described this as a nation department whom he manages and what is his salary.
+
+124
+00:09:11,000 --> 00:09:17,000
+I expect to be able to get true or false in process of interpretation of this drink was my context.
+
+125
+00:09:18,000 --> 00:09:25,000
+I will pass the reference to my employee and want to get is a true or false true in case my employee
+
+126
+00:09:25,000 --> 00:09:29,000
+matches this requirements and false if doesn't.
+
+127
+00:09:29,000 --> 00:09:35,000
+The goal of this app is to verify an employee against this set of requirements.
+
+128
+00:09:35,000 --> 00:09:36,000
+Let me run this app.
+
+129
+00:09:37,000 --> 00:09:41,000
+I create expression in the next line how I do that.
+
+130
+00:09:41,000 --> 00:09:46,000
+I call part expression method on my object and pass in context.
+
+131
+00:09:46,000 --> 00:09:54,000
+Think there in this method I split all string by comma and after that have key value pairs divided by
+
+132
+00:09:54,000 --> 00:09:55,000
+semicolon.
+
+133
+00:09:55,000 --> 00:09:59,000
+I am split in this and create new expression by column get expression.
+
+134
+00:10:00,000 --> 00:10:07,000
+And you can see here that once I initialised expression available, I create an expression to collect
+
+135
+00:10:07,000 --> 00:10:09,000
+original expression and allows X.
+
+136
+00:10:10,000 --> 00:10:16,000
+And create a composite object, all expressions in this example are stored in a separate package with
+
+137
+00:10:16,000 --> 00:10:22,000
+the name expression's, the main types here are expression, interface, luncheon, terminal expression,
+
+138
+00:10:22,000 --> 00:10:29,000
+abstract class and terminal, abstract class that extends expression and expression interface, which
+
+139
+00:10:29,000 --> 00:10:32,000
+is the main mass that each expression should implement.
+
+140
+00:10:32,000 --> 00:10:38,000
+Pay attention that in this case, employee object will perform a role of interpretation, context,
+
+141
+00:10:39,000 --> 00:10:42,000
+and in this example, interpret Masset returns.
+
+142
+00:10:42,000 --> 00:10:44,000
+Boolean value is a true or false.
+
+143
+00:10:45,000 --> 00:10:47,000
+Now let's open none terminal expression.
+
+144
+00:10:48,000 --> 00:10:51,000
+You can see here we have the reference to another expression.
+
+145
+00:10:52,000 --> 00:10:56,000
+That is because the terminal expression always has an expression linked to it.
+
+146
+00:10:57,000 --> 00:11:04,000
+We have a lot of expressions listed here and to not perform review of all of them, like an open source
+
+147
+00:11:04,000 --> 00:11:06,000
+code of an expression is interesting.
+
+148
+00:11:06,000 --> 00:11:11,000
+What we can see that we have left and right expression here.
+
+149
+00:11:11,000 --> 00:11:17,000
+I believe that you learned composite part well, and you can understand, since the left and right expression
+
+150
+00:11:17,000 --> 00:11:22,000
+also can be an expression that also consists of different expressions.
+
+151
+00:11:23,000 --> 00:11:25,000
+We have different variations of expressions.
+
+152
+00:11:25,000 --> 00:11:32,000
+For example, manager of expression, name, expression, department expression and lots more.
+
+153
+00:11:32,000 --> 00:11:36,000
+One of them contains the logic described in interpret method.
+
+154
+00:11:36,000 --> 00:11:38,000
+Let's get back to our demo file.
+
+155
+00:11:39,000 --> 00:11:46,000
+And after I created my composite object, my expression, I print context, trying to console that new
+
+156
+00:11:46,000 --> 00:11:46,000
+line.
+
+157
+00:11:46,000 --> 00:11:49,000
+Then I print my manager and try to cancel.
+
+158
+00:11:50,000 --> 00:11:56,000
+And after that I format the string to represent the expression that I received after passing the contact
+
+159
+00:11:56,000 --> 00:12:00,000
+string and result of interpretation for rate as a context.
+
+160
+00:12:01,000 --> 00:12:04,000
+And we see that the answer is true indeed.
+
+161
+00:12:05,000 --> 00:12:09,000
+And managers are tone and has the salary like in our example here.
+
+162
+00:12:10,000 --> 00:12:10,000
+Is that clear?
+
+163
+00:12:11,000 --> 00:12:13,000
+Next examples are pretty similar.
+
+164
+00:12:13,000 --> 00:12:19,000
+But just to make you understand that I can use different characters and symbols in my domain specific
+
+165
+00:12:19,000 --> 00:12:20,000
+language.
+
+166
+00:12:20,000 --> 00:12:26,000
+For example, in this case we need to find a developer who is an engineering department and has salary
+
+167
+00:12:26,000 --> 00:12:28,000
+less than eighty five thousand.
+
+168
+00:12:29,000 --> 00:12:31,000
+And in the case was our term.
+
+169
+00:12:31,000 --> 00:12:38,000
+We received true when we interpreted this expression in this specific context and with the same expression,
+
+170
+00:12:38,000 --> 00:12:39,000
+I got false.
+
+171
+00:12:39,000 --> 00:12:46,000
+If I pass Aleksi as a context because Aleksei is a developer, but with higher salary higher than in
+
+172
+00:12:46,000 --> 00:12:51,000
+our condition, basically that is how interpreter partner works.
+
+173
+00:12:51,000 --> 00:12:58,000
+And I means that this example is not the easiest one, but it is nothing more to share and just encourage
+
+174
+00:12:58,000 --> 00:13:04,000
+you to run the source code in your local computer to understand how this code works and the bogert if
+
+175
+00:13:04,000 --> 00:13:04,000
+needed.
+
+176
+00:13:05,000 --> 00:13:10,000
+I believe that after sitting at most ten minutes with this example and probably watching my explanations
+
+177
+00:13:10,000 --> 00:13:14,000
+one more time, everything will become crystal clear for you.
+
+178
+00:13:14,000 --> 00:13:20,000
+Reference to code examples in attachments to this lesson, I believe the demo helps you to understand
+
+179
+00:13:20,000 --> 00:13:22,000
+interpret upon them better.
+
+180
+00:13:22,000 --> 00:13:27,000
+But now let's try to sum it up and create a checklist to implement interpretive parren.
+
+181
+00:13:28,000 --> 00:13:33,000
+The first thing you need to do is to define a grammar for language that you want to interpret.
+
+182
+00:13:33,000 --> 00:13:40,000
+After that map, each production in the grammar to a class then organize this use of grammar classes
+
+183
+00:13:40,000 --> 00:13:42,000
+into the structure of the composite palm.
+
+184
+00:13:43,000 --> 00:13:48,000
+In our example, it was expression, type, define and interpret MassArt.
+
+185
+00:13:48,000 --> 00:13:50,000
+That takes context as a parameter in the composite.
+
+186
+00:13:50,000 --> 00:13:56,000
+The Iraqi, the context object encapsulates the current state of the input and output.
+
+187
+00:13:57,000 --> 00:14:05,000
+It is affected by each grammar class as interpreting process transforms the input into the output that
+
+188
+00:14:05,000 --> 00:14:05,000
+sets.
+
+189
+00:14:05,000 --> 00:14:06,000
+We got an interpreter pattern.
+
+190
+00:14:07,000 --> 00:14:11,000
+Let's proceed with the next button and the next part is a mediator.
+
+191
+00:14:12,000 --> 00:14:18,000
+The main goal of Mediator Parren is to reduce the coupling between the classes and put all logic that
+
+192
+00:14:18,000 --> 00:14:22,000
+is related to the interaction between different classes in another separate class.
+
+193
+00:14:22,000 --> 00:14:28,000
+In this case, different objects don't interact explicitly between each other.
+
+194
+00:14:28,000 --> 00:14:33,000
+But instead of this mediator, object controls interaction between them.
+
+195
+00:14:33,000 --> 00:14:37,000
+That's why this is considered to be a good practice in Obed design.
+
+196
+00:14:37,000 --> 00:14:44,000
+We should always try to design the system in such a way that components are loosely coupled and reuseable.
+
+197
+00:14:44,000 --> 00:14:50,000
+Imagines that you're an admin of your web platform and you have a pop up dialogue to create a new user
+
+198
+00:14:50,000 --> 00:14:51,000
+in your system.
+
+199
+00:14:52,000 --> 00:14:59,000
+And this dialogue contains different text, fields, buttons, checkboxes, and all these elements should
+
+200
+00:14:59,000 --> 00:15:00,000
+interact between each other.
+
+201
+00:15:01,000 --> 00:15:07,000
+For example, if you are selecting checkbox, a new employee wants to get relocated to another country,
+
+202
+00:15:07,000 --> 00:15:09,000
+then we need to show new.
+
+203
+00:15:09,000 --> 00:15:15,000
+That contains rubdown with a list of countries for possible relocation, and in case we would put this
+
+204
+00:15:15,000 --> 00:15:21,000
+logic in checkbox, this will not allow us to use this checkbook's in other places, because from now
+
+205
+00:15:21,000 --> 00:15:25,000
+on, this checkbox will work only with this dropdown list.
+
+206
+00:15:26,000 --> 00:15:33,000
+But we need to think how we will scale our code in the future, because this might end up with us being
+
+207
+00:15:33,000 --> 00:15:38,000
+able to use behavior of these animals on the inside to create user dialogue.
+
+208
+00:15:38,000 --> 00:15:42,000
+And it will be hard to use these animals in other dialogues if needed.
+
+209
+00:15:43,000 --> 00:15:49,000
+The solution of this would be introducing a mediator pardon that's supposed to solve the issue of tight
+
+210
+00:15:49,000 --> 00:15:51,000
+coupling of components between each other.
+
+211
+00:15:52,000 --> 00:15:57,000
+We'll have separate classes that will be in charge of redirecting the request between the elements.
+
+212
+00:15:58,000 --> 00:16:04,000
+This class is a mediator class by encapsulating all complicated connections and interactions between
+
+213
+00:16:04,000 --> 00:16:07,000
+different types with decrease Coplin between classes.
+
+214
+00:16:08,000 --> 00:16:15,000
+And we know that unless Coplan then more reusable components we have and mediate in this case performs
+
+215
+00:16:15,000 --> 00:16:18,000
+and orchestration of other elements.
+
+216
+00:16:18,000 --> 00:16:25,000
+I believe that you already understood what Mediate A is on the high level and what problems is supposed
+
+217
+00:16:25,000 --> 00:16:27,000
+to solve the Lanzas foreign matter.
+
+218
+00:16:27,000 --> 00:16:34,000
+Let's look at the good example in this example will implement with due process of trying TV on and training
+
+219
+00:16:34,000 --> 00:16:38,000
+TV off with the help of the one button on our remote control.
+
+220
+00:16:39,000 --> 00:16:42,000
+Let me start the demo from the client code.
+
+221
+00:16:42,000 --> 00:16:44,000
+I opened them a class.
+
+222
+00:16:44,000 --> 00:16:47,000
+I ran the file to Explorer console output together with you.
+
+223
+00:16:48,000 --> 00:16:52,000
+The first thing that I do, I create mediator object.
+
+224
+00:16:52,000 --> 00:16:57,000
+After that I create the object object of a button type and TV display.
+
+225
+00:16:58,000 --> 00:17:01,000
+I link all these types with the help of mediator.
+
+226
+00:17:01,000 --> 00:17:07,000
+As you can see, I pass in reference to the mediator, object to constructor of each object here and
+
+227
+00:17:07,000 --> 00:17:13,000
+then use setters to pass the reference to give and display objects to my mediator object.
+
+228
+00:17:13,000 --> 00:17:14,000
+Great.
+
+229
+00:17:14,000 --> 00:17:19,000
+Now all objects know about mediator and mediator knows about all objects.
+
+230
+00:17:19,000 --> 00:17:25,000
+Before I start to do any manipulations, I print the original state of my TV to consult.
+
+231
+00:17:25,000 --> 00:17:27,000
+Let me open a TV class here.
+
+232
+00:17:27,000 --> 00:17:35,000
+We can see that state of TV is described with the help of mediator type and is on type is on is just
+
+233
+00:17:35,000 --> 00:17:39,000
+a Google flag to indicate whether the TV is on or off.
+
+234
+00:17:40,000 --> 00:17:41,000
+Let's get back to our demo file.
+
+235
+00:17:42,000 --> 00:17:45,000
+After that, I perform my first action.
+
+236
+00:17:45,000 --> 00:17:47,000
+I press the button on my remote control.
+
+237
+00:17:48,000 --> 00:17:52,000
+Let's investigate the source code of press method as other types.
+
+238
+00:17:52,000 --> 00:17:56,000
+My button type keeps the reference to the mediator object.
+
+239
+00:17:56,000 --> 00:18:02,000
+And instead of sending a request directly to TV object or to display, I am sending request the mediator
+
+240
+00:18:02,000 --> 00:18:07,000
+object that gives me opportunity to not burn this button.
+
+241
+00:18:07,000 --> 00:18:14,000
+Type two TV only probably I have also air conditioning or I have something else in my apartment and
+
+242
+00:18:14,000 --> 00:18:20,000
+I can reuse this type of model in other cases with the help of different mediators if needed.
+
+243
+00:18:20,000 --> 00:18:28,000
+Now let's go to the mediator object and explore this press Masset Press Masad checks if TV is on or
+
+244
+00:18:28,000 --> 00:18:36,000
+off and basically if TV is off, we are turning it on and if TV is on, we are turning it off.
+
+245
+00:18:36,000 --> 00:18:41,000
+The logic is pretty simple here and I interact with TV objects through the media to type.
+
+246
+00:18:42,000 --> 00:18:44,000
+Let me open key type here.
+
+247
+00:18:44,000 --> 00:18:50,000
+We can see the turn on and turn off masses also interact with the mediator object.
+
+248
+00:18:50,000 --> 00:18:56,000
+Obviously I change the state of TV itself, but also I need to channel display on.
+
+249
+00:18:57,000 --> 00:19:01,000
+But again, I don't interact with any display object directly.
+
+250
+00:19:02,000 --> 00:19:04,000
+I'm sending request back to mydata object.
+
+251
+00:19:05,000 --> 00:19:07,000
+Let's see how these masses are implemented.
+
+252
+00:19:08,000 --> 00:19:10,000
+I'm talking about start and stop masses.
+
+253
+00:19:11,000 --> 00:19:15,000
+So these masses just delegates are called to the display object and that's it.
+
+254
+00:19:16,000 --> 00:19:22,000
+And finally, if we would open display object, we can see that we just print text to console when displays
+
+255
+00:19:22,000 --> 00:19:26,000
+on or display is off and no other interactions.
+
+256
+00:19:26,000 --> 00:19:33,000
+But still, you might pass me to the constructor and work with me later to send request to other objects
+
+257
+00:19:33,000 --> 00:19:33,000
+if needed.
+
+258
+00:19:34,000 --> 00:19:34,000
+Is that clear?
+
+259
+00:19:35,000 --> 00:19:40,000
+If yes, then let's get back to the demo file and we'll review console output.
+
+260
+00:19:40,000 --> 00:19:47,000
+As you can see that after I pressed the button, I see the display is on now and state of the TV is
+
+261
+00:19:47,000 --> 00:19:48,000
+changed to.
+
+262
+00:19:48,000 --> 00:19:56,000
+And when I press the power button again, the display is turned off and TV is off to does it make sense?
+
+263
+00:19:56,000 --> 00:20:02,000
+Recommended to run this code on your local machine to explore how objects interact with each other.
+
+264
+00:20:03,000 --> 00:20:08,000
+Now let's review steps to implement, mediate apart and identify a group of classes that we want.
+
+265
+00:20:09,000 --> 00:20:15,000
+The couple created new abstraction and encapsulate all interactions inside a new class mydata class,
+
+266
+00:20:16,000 --> 00:20:20,000
+and it all exists in classes to make them interact with mydata object only.
+
+267
+00:20:21,000 --> 00:20:22,000
+That's it.
+
+268
+00:20:22,000 --> 00:20:23,000
+In my opinion.
+
+269
+00:20:23,000 --> 00:20:28,000
+This is relatively simple patterns that will help us to reduce carbon between our classes.
+
+270
+00:20:29,000 --> 00:20:31,000
+Now, let's check what we have learned today.
+
+271
+00:20:31,000 --> 00:20:34,000
+In this lesson we learned to patterns.
+
+272
+00:20:34,000 --> 00:20:40,000
+They are interpretor and mydata part, and this is part of learning behavioral patterns.
+
+273
+00:20:40,000 --> 00:20:44,000
+And I want to congratulate you as learning all behavioral patterns.
+
+274
+00:20:44,000 --> 00:20:46,000
+Now, that's it.
+
+275
+00:20:46,000 --> 00:20:49,000
+Have a great day and see you in the next lesson.
+
diff --git a/39 - GoF Design Patterns of Software Architecture in OOP/007 Source-code-of-all-examples-from-the-lesson.url b/39 - GoF Design Patterns of Software Architecture in OOP/007 Source-code-of-all-examples-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..b7a99d46797bc94660943bfd3f2695a8487932d5
--- /dev/null
+++ b/39 - GoF Design Patterns of Software Architecture in OOP/007 Source-code-of-all-examples-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/patterns/behavioral
\ No newline at end of file
diff --git a/39 - GoF Design Patterns of Software Architecture in OOP/external-links.txt b/39 - GoF Design Patterns of Software Architecture in OOP/external-links.txt
new file mode 100644
index 0000000000000000000000000000000000000000..caf50c2a541d3f2609fd99e9cf386ed472682f26
--- /dev/null
+++ b/39 - GoF Design Patterns of Software Architecture in OOP/external-links.txt
@@ -0,0 +1,18 @@
+
+002 Source-code-of-all-examples-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/patterns/creational
+
+003 Source-code-of-all-examples-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/patterns/structural
+
+004 Source-code-of-all-examples-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/patterns/structural
+
+005 Source-code-of-all-examples-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/patterns/behavioral
+
+006 Source-code-of-all-examples-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/patterns/behavioral
+
+007 Source-code-of-all-examples-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/patterns/behavioral
diff --git a/40 - ===== Design Patterns Interview Questions =====/001 Part 1 OOP & Design Patterns Interview - Questions and Answers.html b/40 - ===== Design Patterns Interview Questions =====/001 Part 1 OOP & Design Patterns Interview - Questions and Answers.html
new file mode 100644
index 0000000000000000000000000000000000000000..a8bf58831c6ba7c5447068085d31b76b0f19031e
--- /dev/null
+++ b/40 - ===== Design Patterns Interview Questions =====/001 Part 1 OOP & Design Patterns Interview - Questions and Answers.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Part 1 OOP & Design Patterns Interview - Questions and Answers
+
+
+
+
+
+
+
Part 1 OOP & Design Patterns Interview - Questions and Answers
+
Design patterns are reusable solutions to common problems encountered in software development.
In general, a template consists of four main elements:
name. The exact name provides an opportunity to immediately understand the problem and determine the solution.
a goal. Scope within the framework of solving a specific problem;
solution. An abstract description of the design elements of the design problem and how to solve it using a generalized set of classes;
results.
Creational patterns, structural patterns and behavior patterns as well as anti-patterns are distinguished.
Creational patterns are intended to organize the process of creating objects.
The most common patterns are:
Abstract Factory - provides an interface for creating related objects of families of classes without specifying their specific implementations (families of product objects);
Factory Method - defines an interface for creating objects from a hierarchical family of classes based on the transmitted data (subclass of object that is instantiated);
Builder - creates an object of a particular class in various ways (how a composite object gets created);
Singleton - guarantees the existence of only one or a finite number of instances of the class (the sole instance of a class);
Prototype - used when creating complex objects. Based on the prototype, objects are stored and recreated, for example, by copying.
GoF behavior patterns characterize the ways in which classes or objects interact with each other.
Behavioral patterns include:
Chain of Responsibility - organizes a chain of recipient objects that do not know the capabilities of each other, independent of the sender object, and pass the request to each other (object that can fulfill a request);
Command - used to determine, by some attribute, an object of a particular class to which a request will be passed for processing (when and how a request is fulfilled);
Iterator (Iterator) - allows you to sequentially traverse all the elements of a collection or other composite object, without knowing the details of the internal data representation (how an aggregate's elements are accessed, traversed);
Mediator - allows you to reduce the number of connections between classes with a large number of them, highlighting one class that knows everything about the methods of other classes;
Memento - saves the current state of the object for further restoration;
Observer - allows for a one-to-many relationship between objects to track object changes;
State - allows an object to change its behavior by changing the internal state object.
Strategy - specifies a set of algorithms with the ability to select one of the classes to perform a specific task during object creation (an algorithm);
Template Method - creates a parent class that uses several methods, the implementation of which is assigned to derived classes (steps of an algorithm);
Visitor - Represents an operation in one or more related classes of some structure that is called by a method specific to each such class in another class (operations that can be applied to object(s) without changing their class(es));
Interpreter - for a certain way of presenting information defines the rules (grammar and interpretation of a language).
Structural GoF patterns are responsible for the composition of objects and classes, and not only for bringing together parts of an application, but also for separating them.
Structural patterns include:
Adapter - is used when it is necessary to use classes together with unrelated interfaces. The behavior of the adaptable class is changed to the required one (interface to an object);
Bridge - separates the representation of the class and its implementation, allowing you to independently change both (implementation of an object);
Composite - groups objects into hierarchical tree structures and allows you to work with a single object in the same way as with a group of objects (structure and composition of an object);
Decorator - Represents a way to change the behavior of an object without creating subclasses. Allows you to use the behavior of one object in another (responsibilities of an object without subclassing);
Facade - creates a class with a common high-level interface to a certain number of interfaces in a subsystem (interface to a subsystem);
Flyweight - separates the properties of the class for optimal support for a large number of small objects (storage costs of objects);
Proxy - replaces a complex object with a simpler one and controls access to it
Some anti-patterns:
Big ball of mud is a term for a system or simply a program that does not have even the slightest discernible architecture. Typically includes more than one anti-pattern. This affects systems developed by people with no training in software architecture.
Yo-Yo problem - arises when you need to understand the program, the inheritance hierarchy and the nesting of method calls are very long and complex. The programmer therefore needs to navigate between many different classes and methods in order to control the behavior of the program. The term comes from the name of the yo-yo toy.
Magic Button - occurs when the form processing code is concentrated in one place and, of course, is not structured in any way.
Magic Number - the presence in the code of repeated the same numbers or numbers, the explanation of the origin of which is missing.
Gas Factory - complex design for a simple task.
Analiys paralisys. In software development manifests itself through extremely long phases of project planning, collecting the necessary artifacts for this, software modeling and design, which do not make much sense to achieve the final goal.
Interface Bloat is a term used to describe interfaces that try to contain all possible operations on data.
Accidental complexity is a programming problem that could easily have been avoided. Occurs due to a misunderstanding of the problem or ineffective planning.
OOAD, Object Oriented Analysis and Design - a discipline that describes the ways (options) of specifying (defining) objects and their interaction to solve a problem that is defined and described in the course of object-oriented analysis.
The main idea of object-oriented analysis and design is to consider the subject area and the logical solution of the problem from the point of view of objects (concepts and entities). In the process of object-oriented analysis, the main attention is paid to the definition and description of objects (or concepts) in terms of the subject area. In the process of object-oriented design, logical program objects are defined that will be implemented by means of an object-oriented programming language. These program objects include attributes and methods. And finally, in the process of designing (construction) or object-oriented programming (object-oriented programming), the implementation of the developed components and classes is provided.
OOD, Object Oriented Design, is a design methodology that combines the process of object decomposition and techniques for representing the logical and physical, as well as static and dynamic models of the system being designed.
OOA, Object Oriented Analysis is a methodology in which system requirements are perceived in terms of classes and objects identified in the subject area, this is a design methodology that combines the process of object decomposition and techniques for representing logical and physical, as well as static and dynamic models of the designed system.
DRY, Don't repeat yourself - this principle is so important that it does not require repetition. This is a software development principle aimed at reducing the repetition of information of various kinds, especially in systems with many layers of abstraction. In simple words, DO NOT write repetitive code, use the principle of abstraction, generalizing simple things in one place.
KISS, Keep it short and simple or Keep it simple, stupid (keep things simple) is a design and programming principle that prohibits the use of more complex tools than necessary. The principle declares the simplicity of the system as the main goal and / or value.
YAGNI, You ain't gonna need it (You won't need it) is a software design process and principle in which the rejection of redundant functionality is declared as the main goal and / or value. The bottom line is to implement only the tasks defined and to abandon redundant functionality.
Yoda conditions - A "safe" style of writing comparison expressions when programming in languages with C syntax, which consists in writing a constant member of the expression (constant or function call) to the left of the comparison operator (that is, 5 == a instead of habitual a == 5).
This style is intended to prevent the common mistake of these languages - the use of the assignment operator "=" instead of the comparison "==". The erroneous use of assignment turns Yoda's notation into an attempt to change a constant, causing a compile-time error, which eliminates the possibility of this type of error in the finished program, and also makes it easier to find and fix them in new code.
CRC cards, Class-responsibility-collaboration card (Class-Responsibility-Cooperation) is a brainstorming method for designing object-oriented software. As a rule, CRC-maps are used in those cases when classes and ways of their interactions are first defined in the software design process.
CRC maps focus the attention of the designer on the essence of the class and hide from him the details, the consideration of which at this stage would be counterproductive. CRCs also force the designer to refrain from assigning too many responsibilities to a class.
SOLID, (single responsibility, open-closed, Liskov substitution, interface segregation, and dependency inversion) is an acronym for the first five principles, which stood for the five basic principles of object-oriented programming and design.
These principles, when applied together, are intended to increase the likelihood that a programmer will create a system that is easy to maintain and expand over time. The SOLID principles are guidelines that can be applied while working on software to remove "wrap around code" by instructing the programmer to refactor the source code until it is legible and extensible. This is part of an overall agile and adaptive development strategy.
Single responsibility principle - the principle of a single responsibility (one single responsibility should be assigned to each class). If one java class implements 2 sets of functions, their chaining creates a situation where changing one will break the combination.
Open / closed principle - the principle of object-oriented programming, establishing the following position: "program entities (classes, modules, functions, etc.) must be open for extension, but closed for change"; this means that such entities can be allowed to change their behavior without changing their source code. How this can be implemented? Allow extension of the type. In this case we can override the behavior of the type without adjusting the source code of the original class. And by creating sufficient level of abstraction that wouldn’t force clients of your code to change the source code of original class.
Liskov substitution principle - Barbara Liskov's substitution principle (functions that use a base type must be able to use subtypes of the base type without knowing it. Subclasses cannot replace the behavior of base classes. Subtypes must complement base types).
Interface segregation principle - the principle of interface separation (many specialized interfaces are better than one universal one). In other words, large, voluminous interfaces should be divided into small ones in such a way that clients of small interfaces know only about those methods that they need in their work. And so that when changing the interface methods, we wouldn’t change clients that don’t depend on the methods they don’t need and don’t use.
Dependency inversion principle - the principle of dependency inversion (dependencies within the system are built on the basis of abstractions. Top-level modules do not depend on lower-level modules. Abstractions should not depend on details. Details should depend on abstractions).
GRASP, General Responsibility Assignment Software Patterns are design patterns used to solve general tasks of assigning responsibilities to classes and objects. Nine GRAPS patterns are known.
Information expert
Creator
Controller
Indirection
Low coupling
High cohesion
Polymorphism
Protected variations
Pure fabrication
GRASP identifies the following 9 template principles:
Information Expert - An information expert describes the fundamental principles for assigning responsibilities to classes and objects. According to the description, an information expert (an object endowed with certain duties) is an object that has the maximum information necessary to perform the assigned duties.
Creator - the essence of the responsibility of such an object is that it creates other objects. The analogy with factories immediately suggests itself. That is correct. Factories also have a creation responsibility.
Controller - is responsible for processing input system events, delegating the responsibility for their processing to competent classes. In general, a controller implements one or more use cases. Using controllers allows you to separate logic from presentation, thereby increasing code reusability.
Low Coupling - If objects in an application are strongly coupled, then any change to them causes changes to all related objects. And this is inconvenient and generates bugs. That's why in all learning literature it is mentioned that it is necessary that the code be loosely coupled and depend only on abstractions.
High Cohesion - High cohesion is a software engineering concept that refers to how closely all the routines in a class, or all the code in a routine, support a central purpose. Classes that contain strongly related functionalities are described as having high cohesion.
Pure Fabrication is a class that doesn't represent any real domain object, but is specifically designed to increase cohesion, decoupling, or increase reuse. Pure Fabrication reflects the concept of services in the Domain Programming model.
Indirection - the redirection pattern implements low coupling between classes by assigning responsibilities for their interaction to an additional object - an intermediary.
Protected Variations - Protects elements from being modified by other elements (objects or subsystems) by making the interaction a fixed interface. All interaction between elements must occur through it. The behavior can only be changed by creating a different implementation of the interface.
Polymorphism - allows you to handle alternative behaviors based on type and replace plug-in system components. Responsibilities are allocated to different behaviors using polymorphic operations for that class. All alternative implementations are cast to a common interface.
+
+
+
+
diff --git a/41 - I18N & L10N/001 [Part 1] Localization and Internationalization_en.srt b/41 - I18N & L10N/001 [Part 1] Localization and Internationalization_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..ec88216c7fd0113564dc581e44ab00e0285df98d
--- /dev/null
+++ b/41 - I18N & L10N/001 [Part 1] Localization and Internationalization_en.srt
@@ -0,0 +1,588 @@
+1
+00:00:05,000 --> 00:00:11,000
+And our team in this lesson, we're going to go internationalization and localization in Java.
+
+2
+00:00:11,000 --> 00:00:17,000
+We're going to study this lesson from this stand in on the challenge that you are one of us.
+
+3
+00:00:17,000 --> 00:00:24,000
+With the help of internationalization and localization, once we understand the challenge will proceed
+
+4
+00:00:24,000 --> 00:00:31,000
+as none of these two concepts, I will explain the difference between these two charms.
+
+5
+00:00:32,000 --> 00:00:34,000
+Also, today, we will have a lot of practical activities.
+
+6
+00:00:35,000 --> 00:00:43,000
+We will learn how to work with local objects on real examples using local object format, numbers,
+
+7
+00:00:43,000 --> 00:00:47,000
+currencies and dates, and examples of the lessons learned.
+
+8
+00:00:47,000 --> 00:00:49,000
+How to work with resource bundles.
+
+9
+00:00:49,000 --> 00:00:55,000
+I'll show you how to work with properties based in Java based resource bundles on real examples.
+
+10
+00:00:55,000 --> 00:01:00,000
+This is going to be very productive lesson as Gary started.
+
+11
+00:01:01,000 --> 00:01:08,000
+Let's understand the problems that we tried to address here and why we need a rationalization and localization
+
+12
+00:01:09,000 --> 00:01:17,000
+and why we should care about it nowadays, in most cases, developers work on the applications that
+
+13
+00:01:17,000 --> 00:01:24,000
+are supposed to be scaled across multiple regions, at least very often apps supposed to be available
+
+14
+00:01:24,000 --> 00:01:25,000
+in multiple countries.
+
+15
+00:01:26,000 --> 00:01:31,000
+This is widespread, non-functional requirements that software engineers should implement.
+
+16
+00:01:32,000 --> 00:01:39,000
+Have an application available across different countries means that we need to handle various regional
+
+17
+00:01:39,000 --> 00:01:46,000
+specific data, considering our application supposed to serve people from different parts of the world.
+
+18
+00:01:46,000 --> 00:01:52,000
+We should take into our towns cultural and political specifics, new ones and data representation.
+
+19
+00:01:52,000 --> 00:01:55,000
+For example, numbers, dates.
+
+20
+00:01:55,000 --> 00:01:56,000
+Currency stacks.
+
+21
+00:01:58,000 --> 00:02:01,000
+Now, let's understand what internationalization is.
+
+22
+00:02:01,000 --> 00:02:09,000
+The first thing I'd like to explain is abbreviations that is used instead of a long word internationalization.
+
+23
+00:02:10,000 --> 00:02:14,000
+As you see, usually it is named as IE 18.
+
+24
+00:02:14,000 --> 00:02:23,000
+And then number 18 here is due to 18 letters between I and and that's why all it is first, that they
+
+25
+00:02:23,000 --> 00:02:27,000
+use this abbreviation instead of writing a whole verb.
+
+26
+00:02:28,000 --> 00:02:31,000
+So what is internationalization?
+
+27
+00:02:31,000 --> 00:02:39,000
+First of all, this is a process process of what process of making software available to be used for
+
+28
+00:02:39,000 --> 00:02:46,000
+different regions and by removing any handwriting and building application architecture is the way it
+
+29
+00:02:46,000 --> 00:02:49,000
+potentially can support multiple different regions.
+
+30
+00:02:50,000 --> 00:02:59,000
+Internationalization ensures your software is localized and is typically done by software developers
+
+31
+00:02:59,000 --> 00:03:00,000
+and engineers.
+
+32
+00:03:00,000 --> 00:03:07,000
+Even if your original software, architecture and marketing campaign is oriented, funds are large on
+
+33
+00:03:07,000 --> 00:03:08,000
+the one market Romney.
+
+34
+00:03:09,000 --> 00:03:16,000
+Let's see some English speaking market internationalization allows it to ensure it could support all
+
+35
+00:03:16,000 --> 00:03:18,000
+the languages and cultures.
+
+36
+00:03:19,000 --> 00:03:27,000
+If you were to expand to additional markets in the future, so instead of high scoring individual language
+
+37
+00:03:27,000 --> 00:03:34,000
+inside application internationalization helps you to prepare your code base for using different configurations
+
+38
+00:03:35,000 --> 00:03:41,000
+and translations based on the local news and internationalization.
+
+39
+00:03:41,000 --> 00:03:47,000
+We also replace caught with some placeholders, which will be used to retrieve localized version of
+
+40
+00:03:47,000 --> 00:03:50,000
+the content from the provided configuration files.
+
+41
+00:03:51,000 --> 00:03:55,000
+To help you understand how this works, let's imagine example.
+
+42
+00:03:56,000 --> 00:04:01,000
+Together with all students, we implement our online shop during learning.
+
+43
+00:04:01,000 --> 00:04:08,000
+Our job, of course, and on the welcome screen Zoom option to log in in the English version of the
+
+44
+00:04:08,000 --> 00:04:09,000
+app.
+
+45
+00:04:09,000 --> 00:04:11,000
+We should use log in tax here.
+
+46
+00:04:11,000 --> 00:04:19,000
+But in Russian version of the app, we have to use wiki tax inside our code.
+
+47
+00:04:19,000 --> 00:04:24,000
+We need to identify place where our place code of the bottom tax will be used.
+
+48
+00:04:25,000 --> 00:04:34,000
+So during the coding of the app, we may use logging tax gone placeholder later inside our localized
+
+49
+00:04:34,000 --> 00:04:35,000
+configuration file.
+
+50
+00:04:36,000 --> 00:04:42,000
+We'll use the same key to define content for that key for different versions.
+
+51
+00:04:42,000 --> 00:04:50,000
+Similar approach in sudsy code will be applied to date time for US currency and all the components.
+
+52
+00:04:51,000 --> 00:04:55,000
+Instead of coding is the software for each specific language.
+
+53
+00:04:55,000 --> 00:05:00,000
+Internationalization process replaces that code in this case.
+
+54
+00:05:00,000 --> 00:05:08,000
+This not only makes code base easier for localization, but it also neutralized the code and adopts
+
+55
+00:05:08,000 --> 00:05:09,000
+it for various languages.
+
+56
+00:05:10,000 --> 00:05:11,000
+You may introduce in the future.
+
+57
+00:05:12,000 --> 00:05:21,000
+Now, it's time for us to learn what localization is, localization is a process of adapting your internationalized
+
+58
+00:05:21,000 --> 00:05:29,000
+software to needs a language, cultural and other requirements of a specific target market otherwise
+
+59
+00:05:29,000 --> 00:05:34,000
+known as locale by engine resources and translating content.
+
+60
+00:05:35,000 --> 00:05:41,000
+We also often use abbreviation for localization like we do for internationalization.
+
+61
+00:05:41,000 --> 00:05:49,000
+We use our Dan and app because between AL and zero, rather than characters.
+
+62
+00:05:49,000 --> 00:05:57,000
+In simple words, localization is performed by translation of content on user facing elements and components
+
+63
+00:05:57,000 --> 00:05:58,000
+of your application.
+
+64
+00:05:59,000 --> 00:06:04,000
+But localization goes beyond translations and text or presentations.
+
+65
+00:06:05,000 --> 00:06:13,000
+When we talk about localization or adaptation of all visual content, the specific local zoning includes
+
+66
+00:06:13,000 --> 00:06:20,000
+but not limited to numbers, currencies, dates, images, et cetera.
+
+67
+00:06:21,000 --> 00:06:25,000
+Let's review a few examples that will be different for different regions.
+
+68
+00:06:25,000 --> 00:06:28,000
+To help you understand what localization is.
+
+69
+00:06:29,000 --> 00:06:30,000
+For example, numbers.
+
+70
+00:06:30,000 --> 00:06:36,000
+If you are a student of my Java course, then you already know that during the course, we implement
+
+71
+00:06:36,000 --> 00:06:43,000
+online shop in online shopping display no surprises and for different regions, use different parts
+
+72
+00:06:43,000 --> 00:06:46,000
+and established to separate fractional part.
+
+73
+00:06:47,000 --> 00:06:53,000
+For instance, in the United States, you have separate spouses was comma and sans was done.
+
+74
+00:06:54,000 --> 00:07:00,000
+But in Russia it would separate thousands with space or fractional portals because this comma.
+
+75
+00:07:00,000 --> 00:07:07,000
+But in Germany, will you all for spousal separation and comma to separate fractional part?
+
+76
+00:07:08,000 --> 00:07:10,000
+We talk about manual representation.
+
+77
+00:07:10,000 --> 00:07:19,000
+Currency symbols supposed to be different to the same amount need to represent US dollar sign Russian
+
+78
+00:07:19,000 --> 00:07:23,000
+rubble using Indian rupee or British pound.
+
+79
+00:07:24,000 --> 00:07:31,000
+An important fact to know is that even if countries have the same currency in currencies single like
+
+80
+00:07:31,000 --> 00:07:36,000
+France and Italy, the position of their currencies single could be different.
+
+81
+00:07:37,000 --> 00:07:45,000
+Date and time representation also arise in the U.S. for months in my job, of course, insurance was
+
+82
+00:07:45,000 --> 00:07:48,000
+unique on time and you know how painful.
+
+83
+00:07:48,000 --> 00:07:55,000
+Sometimes it may be managing different time zones, but also there are different regions specific in
+
+84
+00:07:55,000 --> 00:08:02,000
+different time zones to represent the time to optimize the process of localization.
+
+85
+00:08:02,000 --> 00:08:10,000
+Engineers can create different source files, so-called resource bundles for each locale.
+
+86
+00:08:10,000 --> 00:08:16,000
+This resource bundles will store all the tax outside of zip code of the product.
+
+87
+00:08:16,000 --> 00:08:24,000
+This allows us to build our application in a way when we use these sources, those and apply different
+
+88
+00:08:24,000 --> 00:08:26,000
+ones based on the concrete locale.
+
+89
+00:08:27,000 --> 00:08:35,000
+In this way, we don't make any harm to our code, and not constantly changing it from the technical
+
+90
+00:08:35,000 --> 00:08:41,000
+side is of great importance is the process of localization belongs to local time.
+
+91
+00:08:42,000 --> 00:08:47,000
+Before jumping to practical example, there will be examples of using local.
+
+92
+00:08:47,000 --> 00:08:53,000
+Let's review a little bit of series about this class of a local class java.
+
+93
+00:08:54,000 --> 00:09:01,000
+You too vocal is used to represent a geographical, political or cultural region to localize it, even
+
+94
+00:09:01,000 --> 00:09:03,000
+tax number or date.
+
+95
+00:09:04,000 --> 00:09:11,000
+A local object may just contain the country language and also a variant of language.
+
+96
+00:09:11,000 --> 00:09:18,000
+For instance, a dialect spoken in a certain region of a country or spoken in a different country is
+
+97
+00:09:18,000 --> 00:09:21,000
+in the country from which the language originates.
+
+98
+00:09:21,000 --> 00:09:28,000
+The concept of Java Local is implemented by the Java due to local class that defines local.
+
+99
+00:09:28,000 --> 00:09:36,000
+For the application, you would use the local object, which is only and identify the local class,
+
+100
+00:09:36,000 --> 00:09:41,000
+can't do any internationalization or localization by itself.
+
+101
+00:09:42,000 --> 00:09:49,000
+Real localization is done by local sensitive classes or objects that you create for local sensitive
+
+102
+00:09:49,000 --> 00:09:56,000
+classes customized themselves as to how to format and represent data to the user.
+
+103
+00:09:57,000 --> 00:10:03,000
+This class is used as a local object to understand which local is being used in the application.
+
+104
+00:10:04,000 --> 00:10:14,000
+So we create local and we will set local in our application to make other local sensitive objects behave
+
+105
+00:10:14,000 --> 00:10:18,000
+differently when needed and also to use proper resource bundles.
+
+106
+00:10:19,000 --> 00:10:24,000
+A local instance contains the following supports language.
+
+107
+00:10:25,000 --> 00:10:33,000
+This can be an ISO 639 all city office record or registered language subtype.
+
+108
+00:10:33,000 --> 00:10:40,000
+In case a language has rules at two and three, cats or language could use that tax character cut,
+
+109
+00:10:41,000 --> 00:10:48,000
+a full list of language codes can be found in the I Am a Language Setback registry.
+
+110
+00:10:48,000 --> 00:10:51,000
+What is our elite AI?
+
+111
+00:10:51,000 --> 00:10:56,000
+And they stands for the interior, the signs members of sovereignty.
+
+112
+00:10:56,000 --> 00:11:04,000
+It is a standards organisation that oversees global IP address allocation, autonomous system allocation,
+
+113
+00:11:05,000 --> 00:11:12,000
+root zone management e.g. domain name system that is DNS, many other types and also easier.
+
+114
+00:11:12,000 --> 00:11:15,000
+A The length related symbols and internet numbers.
+
+115
+00:11:15,000 --> 00:11:18,000
+Language codes at case and sensitive.
+
+116
+00:11:18,000 --> 00:11:23,000
+But the local class always use lower case versions of the language codes.
+
+117
+00:11:24,000 --> 00:11:31,000
+Scripts must be a valid ISO fifty nine hundred twenty four Alpha four code.
+
+118
+00:11:32,000 --> 00:11:36,000
+This script represents a written form of the language.
+
+119
+00:11:36,000 --> 00:11:39,000
+Some languages can be written using different scripts.
+
+120
+00:11:40,000 --> 00:11:41,000
+Different alphabets.
+
+121
+00:11:42,000 --> 00:11:50,000
+Country region, the country code is still cancer code follows an ISO setting one six two six standard
+
+122
+00:11:51,000 --> 00:11:55,000
+oral U.N. and forty nine numeric area code.
+
+123
+00:11:55,000 --> 00:12:02,000
+A full list of four country and region codes can be found in the AI language stack registry.
+
+124
+00:12:03,000 --> 00:12:12,000
+Where it's a case sensitive value will set a value specifying a variation of the local variance for
+
+125
+00:12:12,000 --> 00:12:18,000
+scraps of area of a language for falls in Mississippi for a certain standard.
+
+126
+00:12:19,000 --> 00:12:20,000
+Extensions.
+
+127
+00:12:21,000 --> 00:12:27,000
+The extension cord signals extensions to the local, in addition to the language and region, for instance,
+
+128
+00:12:27,000 --> 00:12:30,000
+what calendar to use when displaying dates?
+
+129
+00:12:30,000 --> 00:12:31,000
+Wiggle room.
+
+130
+00:12:32,000 --> 00:12:34,000
+Japanese, et cetera.
+
+131
+00:12:35,000 --> 00:12:41,000
+Now, let's make sure that the difference between internationalization and localization is clear for
+
+132
+00:12:41,000 --> 00:12:47,000
+us, despite the fact that both of these storms are used to achieve the same goal.
+
+133
+00:12:47,000 --> 00:12:50,000
+Several different differences between these channels.
+
+134
+00:12:51,000 --> 00:12:52,000
+So what is the difference?
+
+135
+00:12:53,000 --> 00:13:00,000
+Internationalization is a process of designing and developing your software or mobile application code
+
+136
+00:13:01,000 --> 00:13:07,000
+so it can be adopted and localized to different cultures, regions and languages.
+
+137
+00:13:08,000 --> 00:13:16,000
+Localization is the other station of your software or mobile application product in the language, culture
+
+138
+00:13:16,000 --> 00:13:18,000
+and also requirements of each local.
+
+139
+00:13:19,000 --> 00:13:26,000
+Things a difference Already, internationalization helps you build your software or mobile application
+
+140
+00:13:26,000 --> 00:13:30,000
+product in these future markets and languages in mind.
+
+141
+00:13:31,000 --> 00:13:39,000
+It is a process of neutralizing support, quantum and design so that down the road it will be easier
+
+142
+00:13:39,000 --> 00:13:44,000
+to adapt your product to additional cultures without having to completely re-engineer.
+
+143
+00:13:45,000 --> 00:13:49,000
+Localization typically follows internationalization.
+
+144
+00:13:49,000 --> 00:13:58,000
+But beyond adapting yourself to a specific region is an localization process can also highlight any
+
+145
+00:13:58,000 --> 00:14:05,000
+words, phrases or user interface elements that have incorrectly been internationalized.
+
+146
+00:14:06,000 --> 00:14:10,000
+How is it now the difference between these two camps is clear?
+
+147
+00:14:11,000 --> 00:14:19,000
+Now, let's have a demo of local and examples of modern considering internationalization and four rules.
+
diff --git a/41 - I18N & L10N/002 Source-code-examples-from-the-lesson.url b/41 - I18N & L10N/002 Source-code-examples-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..424bf919b0e071850a0ddc9caafc756f4948406e
--- /dev/null
+++ b/41 - I18N & L10N/002 Source-code-examples-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/l18ni10n
\ No newline at end of file
diff --git a/41 - I18N & L10N/002 [Part 2] Localization and Internationalization_en.srt b/41 - I18N & L10N/002 [Part 2] Localization and Internationalization_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..433e9df5eac92be257aa2d79c42704cff2ae4e2a
--- /dev/null
+++ b/41 - I18N & L10N/002 [Part 2] Localization and Internationalization_en.srt
@@ -0,0 +1,872 @@
+1
+00:00:06,000 --> 00:00:13,000
+Let's start our demo from local clubs, let us we are going to use logo in different scenarios in the
+
+2
+00:00:13,000 --> 00:00:13,000
+lesson.
+
+3
+00:00:13,000 --> 00:00:18,000
+That's why I believe it will be logical to start from this first review first.
+
+4
+00:00:19,000 --> 00:00:22,000
+That's known how we can create local objects.
+
+5
+00:00:23,000 --> 00:00:27,000
+First of all, I want to mention that there are several constants in the local class.
+
+6
+00:00:27,000 --> 00:00:33,000
+You can refer to any of these concerns instead of creating new local objects from scratch.
+
+7
+00:00:33,000 --> 00:00:40,000
+So using constants will be the first way to obtain the references in local object you.
+
+8
+00:00:40,000 --> 00:00:44,000
+Second way to instantiate local objects is a real constructor.
+
+9
+00:00:44,000 --> 00:00:48,000
+I have separate class kids at the school local demo.
+
+10
+00:00:48,000 --> 00:00:51,000
+I put all examples related to the local insets class.
+
+11
+00:00:52,000 --> 00:01:00,000
+You can create local was a help over a new keyword, and Collins, a constructor constructor is overloaded
+
+12
+00:01:00,000 --> 00:01:03,000
+and you may use any variation of constructor you like the most.
+
+13
+00:01:04,000 --> 00:01:10,000
+For example, zero constructors where you can pass on the language or you can pass language code and
+
+14
+00:01:10,000 --> 00:01:14,000
+country quote, or you can pass language, country and variant codes.
+
+15
+00:01:15,000 --> 00:01:19,000
+And here in demo file, I create four different locales.
+
+16
+00:01:20,000 --> 00:01:24,000
+The first one is for Hindi language and in their country.
+
+17
+00:01:24,000 --> 00:01:32,000
+The second one is for English language and India country, because sometimes we may want to use English
+
+18
+00:01:32,000 --> 00:01:33,000
+language for India country.
+
+19
+00:01:34,000 --> 00:01:43,000
+Based on this local object, we will select a service bundle that fits in most our local language country
+
+20
+00:01:43,000 --> 00:01:46,000
+and very similar cases was another.
+
+21
+00:01:46,000 --> 00:01:50,000
+Local people in Ukraine speak some different languages.
+
+22
+00:01:50,000 --> 00:01:57,000
+You can set Russian language for Ukraine country and prepare a source, Bongo's, for this version of
+
+23
+00:01:57,000 --> 00:01:58,000
+local.
+
+24
+00:01:58,000 --> 00:02:03,000
+And you can also create local for Ukrainian language for Ukraine country.
+
+25
+00:02:04,000 --> 00:02:11,000
+After having the local object, you can pass it as massive argument to the local sensitive objects like
+
+26
+00:02:11,000 --> 00:02:13,000
+we discussed using slides.
+
+27
+00:02:13,000 --> 00:02:21,000
+Overview The language parameter should be a two or three letter ISO language code from ISO 669 standard.
+
+28
+00:02:22,000 --> 00:02:26,000
+You can also use the language stack of up to eight characters.
+
+29
+00:02:27,000 --> 00:02:34,000
+The country should be two character ISO country code from ISO setting one six two six standard.
+
+30
+00:02:34,000 --> 00:02:40,000
+Alternatively, you +49 character area code can be used.
+
+31
+00:02:41,000 --> 00:02:46,000
+Zverev should be an invalid VCP 47 variants of the language.
+
+32
+00:02:47,000 --> 00:02:55,000
+This sort of way of creating local object is using of local builder, you just instantiate objects of
+
+33
+00:02:55,000 --> 00:02:56,000
+nested class.
+
+34
+00:02:56,000 --> 00:03:03,000
+Local builder and after that, you set your smart assets to sell the properties once configuration is
+
+35
+00:03:03,000 --> 00:03:03,000
+done.
+
+36
+00:03:04,000 --> 00:03:10,000
+You can call build muscle that will return as a reference to the local object with the local builder.
+
+37
+00:03:10,000 --> 00:03:13,000
+It is easy to sense create an extension if you wish.
+
+38
+00:03:14,000 --> 00:03:21,000
+And the force option to create local object is static mass at the full language stack of local cloth.
+
+39
+00:03:22,000 --> 00:03:28,000
+You can call it and cross language studies that may consist of language and country codes.
+
+40
+00:03:29,000 --> 00:03:33,000
+There are different ways how you can check all available calls.
+
+41
+00:03:33,000 --> 00:03:39,000
+Just in case you want to check whether your local is supported or you forgot the codes of language or
+
+42
+00:03:39,000 --> 00:03:43,000
+country and you don't want to check it in the internet.
+
+43
+00:03:44,000 --> 00:03:47,000
+You can check it in another way directly in your program.
+
+44
+00:03:48,000 --> 00:03:55,000
+You can call get a lot of the locals is a local plus or a number for them up or on the date form of
+
+45
+00:03:55,000 --> 00:03:56,000
+class.
+
+46
+00:03:56,000 --> 00:04:00,000
+You will receive an array of all available and supported locales.
+
+47
+00:04:01,000 --> 00:04:09,000
+And sign you up, you can easily identified the local, the local is notified was environment where
+
+48
+00:04:09,000 --> 00:04:10,000
+G.M. is running.
+
+49
+00:04:10,000 --> 00:04:18,000
+For example, I have Russian local counties sat in my Windows operating system and I can easily identify
+
+50
+00:04:18,000 --> 00:04:20,000
+these by call and get the local message.
+
+51
+00:04:21,000 --> 00:04:27,000
+And in case I want to set new shop local, I can use said default massive.
+
+52
+00:04:28,000 --> 00:04:35,000
+For example, during the mobile development and Android system, one user wants to change language inside
+
+53
+00:04:35,000 --> 00:04:36,000
+that application.
+
+54
+00:04:37,000 --> 00:04:41,000
+What you do basically is changing the default local to the one selected by user.
+
+55
+00:04:42,000 --> 00:04:51,000
+I believe now, you know enough about local let us know how we can use it in single localisation examples.
+
+56
+00:04:51,000 --> 00:04:53,000
+Let's open localization demo file.
+
+57
+00:04:54,000 --> 00:04:58,000
+Let me read this example and walk you as soon as it comes out.
+
+58
+00:04:59,000 --> 00:05:06,000
+Imagine that we have some random double value unless your represents double value, considering local
+
+59
+00:05:06,000 --> 00:05:08,000
+specifics of different regions.
+
+60
+00:05:09,000 --> 00:05:10,000
+I agree.
+
+61
+00:05:10,000 --> 00:05:17,000
+No format of my column get instance massive and boss us call.
+
+62
+00:05:18,000 --> 00:05:21,000
+After that, I call form Massad of No.
+
+63
+00:05:21,000 --> 00:05:28,000
+Four Object, and plus our random number will use that and I do the same operation with Russian and
+
+64
+00:05:28,000 --> 00:05:31,000
+German local in console.
+
+65
+00:05:31,000 --> 00:05:35,000
+You can see single examples that we discussed during the slide show.
+
+66
+00:05:35,000 --> 00:05:41,000
+You can see how thousands and functional cards are separated in different local.
+
+67
+00:05:42,000 --> 00:05:47,000
+Sometimes it is just a space, sometimes it this coma, and sometimes it a point.
+
+68
+00:05:48,000 --> 00:05:48,000
+Is it clear?
+
+69
+00:05:49,000 --> 00:05:58,000
+Now on no of glass, I call static mass to get currency influence and bust different local and call
+
+70
+00:05:58,000 --> 00:05:59,000
+formats massive.
+
+71
+00:06:00,000 --> 00:06:04,000
+You can see that currency sign is at its jewels of four mind.
+
+72
+00:06:05,000 --> 00:06:09,000
+You can see the dollar euro rebel rupee.
+
+73
+00:06:09,000 --> 00:06:16,000
+Both sides are added to our random double value, depending on the locals that we use for money.
+
+74
+00:06:17,000 --> 00:06:19,000
+And you can see that automatically.
+
+75
+00:06:19,000 --> 00:06:26,000
+Currencies sign is positioned either before or after numeric value based on the specifics of a region.
+
+76
+00:06:27,000 --> 00:06:35,000
+Also, be aware that you might see in question marks instead of currency signs in case you can't see
+
+77
+00:06:35,000 --> 00:06:36,000
+currency signs.
+
+78
+00:06:37,000 --> 00:06:41,000
+That means in court in your I.D. is set correctly.
+
+79
+00:06:41,000 --> 00:06:51,000
+The changing coding click window preferences darken code in here and sign here workspace section in
+
+80
+00:06:51,000 --> 00:06:54,000
+the text file and according to Act UTF eight.
+
+81
+00:06:55,000 --> 00:06:55,000
+That's it.
+
+82
+00:06:56,000 --> 00:07:01,000
+After applying this configuration, you will be able to see and see signs.
+
+83
+00:07:02,000 --> 00:07:07,000
+Right, wind, guys, you can find the reference to all the court examples in attachments to the lesson
+
+84
+00:07:08,000 --> 00:07:15,000
+also encourage you to run these examples on your computer and play around with different masses and
+
+85
+00:07:15,000 --> 00:07:15,000
+locales.
+
+86
+00:07:16,000 --> 00:07:19,000
+This will help you to understand the topic better.
+
+87
+00:07:20,000 --> 00:07:27,000
+The last example here is the example of the four, Martin, I agree, isn't the time object.
+
+88
+00:07:28,000 --> 00:07:34,000
+And after that was the help of date time for Martha by former date was different locales.
+
+89
+00:07:35,000 --> 00:07:40,000
+If you're a student of my job, of course, please refer to the lesson about date and time.
+
+90
+00:07:40,000 --> 00:07:47,000
+Where we reviewed different ways to work was date and time, including classes from Java Time Package.
+
+91
+00:07:47,000 --> 00:07:51,000
+There are different classes that work was local to form of date.
+
+92
+00:07:52,000 --> 00:07:58,000
+I just showed one example, but I'm sure that you understood how it works.
+
+93
+00:07:58,000 --> 00:08:06,000
+And the last, but not least for this lesson resource bundles or resource bundles basically localized
+
+94
+00:08:06,000 --> 00:08:07,000
+resources.
+
+95
+00:08:08,000 --> 00:08:11,000
+We are going to review different forms of resource bundles.
+
+96
+00:08:11,000 --> 00:08:15,000
+Let's start from the properties based resource bundles.
+
+97
+00:08:15,000 --> 00:08:19,000
+First of all, I made the resource folder, my source folder.
+
+98
+00:08:20,000 --> 00:08:21,000
+How I did that.
+
+99
+00:08:22,000 --> 00:08:29,000
+You can mouse right click on a resource folder built by us and select Use as a source folder.
+
+100
+00:08:30,000 --> 00:08:32,000
+I already have resources for them.
+
+101
+00:08:32,000 --> 00:08:34,000
+What a source folder.
+
+102
+00:08:34,000 --> 00:08:43,000
+That's why I show these examples on the folder, but I believe this is clear why this is needed because
+
+103
+00:08:43,000 --> 00:08:51,000
+resource bundles should be located in the class box, but it is not a good idea to put properties.
+
+104
+00:08:51,000 --> 00:08:54,000
+Files in the same folder was the source code.
+
+105
+00:08:55,000 --> 00:09:01,000
+That's why it is a rule of thumb to have some folders dedicated for storing resources.
+
+106
+00:09:02,000 --> 00:09:05,000
+Let's review what resource bundles we have.
+
+107
+00:09:06,000 --> 00:09:10,000
+We have my labels resource bundle here and different versions of it.
+
+108
+00:09:11,000 --> 00:09:13,000
+We have default version of my labels.
+
+109
+00:09:14,000 --> 00:09:17,000
+Also, we have bundle for and yes and four.
+
+110
+00:09:19,000 --> 00:09:21,000
+This files have properties extension.
+
+111
+00:09:22,000 --> 00:09:26,000
+Let's open them one by one in the Default Resource Bundle.
+
+112
+00:09:26,000 --> 00:09:34,000
+You can see a set of key value pass these keys I used inside the code of application and the various
+
+113
+00:09:34,000 --> 00:09:40,000
+a substituted instead of placeholders in the program execution, depending on the local set.
+
+114
+00:09:40,000 --> 00:09:47,000
+Inside the app is the default property, so you can see that the welcome message is sound like welcome
+
+115
+00:09:47,000 --> 00:09:51,000
+sir, and the log in button text is log in.
+
+116
+00:09:51,000 --> 00:09:58,000
+We can write comments in property files like this, starting with no sign or exclamation mark.
+
+117
+00:09:59,000 --> 00:10:02,000
+So most of these options are considered to be invalid.
+
+118
+00:10:02,000 --> 00:10:03,000
+Common syntax.
+
+119
+00:10:04,000 --> 00:10:07,000
+Also, we can read key value parents in different ways.
+
+120
+00:10:07,000 --> 00:10:13,000
+We can easily use equals sign or column, all like in any US motion.
+
+121
+00:10:13,000 --> 00:10:17,000
+I can simply use space between key and value.
+
+122
+00:10:18,000 --> 00:10:22,000
+In the end, you ask Marshall, welcome message is just welcome.
+
+123
+00:10:23,000 --> 00:10:25,000
+And look at the bottom tax is signing.
+
+124
+00:10:26,000 --> 00:10:32,000
+In the rural version, we have welcome message, but we don't have a slogan tax mutton.
+
+125
+00:10:33,000 --> 00:10:34,000
+What does this mean?
+
+126
+00:10:34,000 --> 00:10:36,000
+This means of logging money.
+
+127
+00:10:36,000 --> 00:10:40,000
+Text will be taken from the default resource bundle.
+
+128
+00:10:41,000 --> 00:10:48,000
+And what these Unicode characters mean, this thing is was among those uploaded into Gmail.
+
+129
+00:10:48,000 --> 00:10:51,000
+We abide streams in Java version eight and below.
+
+130
+00:10:52,000 --> 00:10:58,000
+If you don't remember what barred streams are least referred to, the lessons about input output streams
+
+131
+00:10:59,000 --> 00:11:06,000
+ensure wide streams, read data, provide and torrent of streams that appear to box.
+
+132
+00:11:06,000 --> 00:11:13,000
+That means that it is impossible to describe all your characters in one bite.
+
+133
+00:11:13,000 --> 00:11:21,000
+That's why there's a workaround or just file so automatic conversion of characters not supported by
+
+134
+00:11:21,000 --> 00:11:22,000
+asking.
+
+135
+00:11:22,000 --> 00:11:30,000
+According to Unicode numbers, for example, all Russian leaders here are using Unicode numbers, and
+
+136
+00:11:30,000 --> 00:11:31,000
+this is done automatically.
+
+137
+00:11:32,000 --> 00:11:38,000
+So in case I would write something with Russian letters, my I.D. will convert it in Unicode numbers.
+
+138
+00:11:39,000 --> 00:11:45,000
+Fortunately, this inconvenience exists no longer in Java nine and upper versions.
+
+139
+00:11:46,000 --> 00:11:53,000
+JVM reads progressive files in UTF eight encoding, and there is no problem in using non Latin characters.
+
+140
+00:11:54,000 --> 00:12:02,000
+But still considering the fact that even after the release of Java version 16, Java eight is the most
+
+141
+00:12:02,000 --> 00:12:07,000
+popular Java version, I was recommended to not ignore this limitation.
+
+142
+00:12:08,000 --> 00:12:13,000
+OK, now we have four service bundles and key value pairs described here.
+
+143
+00:12:14,000 --> 00:12:18,000
+Let's take a look at how this is implemented on the code level.
+
+144
+00:12:19,000 --> 00:12:21,000
+I open the reserve's bundle demo file.
+
+145
+00:12:22,000 --> 00:12:25,000
+I create object of Resource Bundle how I can do that.
+
+146
+00:12:26,000 --> 00:12:32,000
+I call Get Bundle Massad Officers Bundle class and pass name of my bundle.
+
+147
+00:12:33,000 --> 00:12:41,000
+Pay attention that each man has base name all bundles for those three naming convention, their base
+
+148
+00:12:41,000 --> 00:12:43,000
+name and different versions.
+
+149
+00:12:44,000 --> 00:12:50,000
+You can specify language, country and variant, and separate all elements of the resource bundle name.
+
+150
+00:12:50,000 --> 00:12:58,000
+We are underscores when you create Object Officers bundle in Java, you use only base name and you let
+
+151
+00:12:58,000 --> 00:13:03,000
+Java decide which resource bundles to use based on the local set.
+
+152
+00:13:04,000 --> 00:13:07,000
+Let's make sure the default locale is through.
+
+153
+00:13:08,000 --> 00:13:16,000
+The next line of code in our example is extracting value from resource bundle by its key, let's say,
+
+154
+00:13:16,000 --> 00:13:17,000
+welcome in Russian.
+
+155
+00:13:18,000 --> 00:13:22,000
+I will run the program to explore console outputs together with you.
+
+156
+00:13:23,000 --> 00:13:28,000
+I use guest drink massive on my research bundle object and boss key.
+
+157
+00:13:28,000 --> 00:13:30,000
+This is exactly what you should need.
+
+158
+00:13:30,000 --> 00:13:33,000
+You're working on internationalization in your app.
+
+159
+00:13:34,000 --> 00:13:40,000
+This approach will allow you to run your app on the market by simply adding your resource bundle.
+
+160
+00:13:40,000 --> 00:13:41,000
+That said.
+
+161
+00:13:42,000 --> 00:13:50,000
+But what will happen if I would try to extract value for logging bottom tax that is absent in the resource
+
+162
+00:13:50,000 --> 00:13:51,000
+bundle?
+
+163
+00:13:51,000 --> 00:13:54,000
+Value from the falls, my look will be taken.
+
+164
+00:13:55,000 --> 00:13:56,000
+Let me show you this.
+
+165
+00:13:57,000 --> 00:14:05,000
+And as you can see in so even despite we have Russian local set, we get taxed in English because the
+
+166
+00:14:05,000 --> 00:14:12,000
+value for this key is just absent in Russian version of the source bundle and default version is taken.
+
+167
+00:14:13,000 --> 00:14:14,000
+Can you understand this?
+
+168
+00:14:15,000 --> 00:14:22,000
+And logically, after I changed local to and yes and print its values for these two kids using the same
+
+169
+00:14:22,000 --> 00:14:27,000
+place holders, I get values from another version of my research bundle.
+
+170
+00:14:28,000 --> 00:14:31,000
+You can also see examples with the for local.
+
+171
+00:14:32,000 --> 00:14:39,000
+I believe you already understood how properties based resource bundles were retention that I applaud
+
+172
+00:14:39,000 --> 00:14:42,000
+the resource bundle after I change in local.
+
+173
+00:14:43,000 --> 00:14:50,000
+But we can also declare a Java based resource bundles why we need them is a Java based resource.
+
+174
+00:14:50,000 --> 00:14:53,000
+Bundles have the only one biggest advantage.
+
+175
+00:14:53,000 --> 00:15:00,000
+You can get localized versions of objects because with the properties files, you can get on the string
+
+176
+00:15:00,000 --> 00:15:01,000
+values.
+
+177
+00:15:01,000 --> 00:15:10,000
+But was Java based models you can get localized object associated was the key, but to be honest, not
+
+178
+00:15:10,000 --> 00:15:18,000
+so often unique need to version of objects more often in your translations for your UI elements, but
+
+179
+00:15:18,000 --> 00:15:20,000
+not localized objects.
+
+180
+00:15:21,000 --> 00:15:29,000
+Nevertheless, let me show you how you can create Java based resource bundles just in case you have
+
+181
+00:15:29,000 --> 00:15:35,000
+to create a class with the name of your resource, bundle and language and country code, if needed.
+
+182
+00:15:36,000 --> 00:15:43,000
+This is exactly the case when you can violate Java naming convention and use underscores and class names
+
+183
+00:15:44,000 --> 00:15:46,000
+because it will not work otherwise.
+
+184
+00:15:46,000 --> 00:15:54,000
+In case you will not use underscores, this clause should extend least resource bundle abstract class
+
+185
+00:15:54,000 --> 00:15:58,000
+and you should override gut contents massive.
+
+186
+00:15:58,000 --> 00:16:02,000
+This should return multidimensional array matches.
+
+187
+00:16:02,000 --> 00:16:06,000
+Each array in this multidimensional array is a key value pair.
+
+188
+00:16:07,000 --> 00:16:07,000
+That's it.
+
+189
+00:16:08,000 --> 00:16:11,000
+Let's get back to our servicemen demo.
+
+190
+00:16:12,000 --> 00:16:18,000
+I change local and their attention after changing local and its resource bundle each time in the resource
+
+191
+00:16:18,000 --> 00:16:20,000
+bundle would be updated.
+
+192
+00:16:21,000 --> 00:16:26,000
+And now I can extract object by call and get object massive and passing key.
+
+193
+00:16:27,000 --> 00:16:31,000
+After that, we can cast objects manually if we need.
+
+194
+00:16:32,000 --> 00:16:39,000
+Also, in case I forgot what keys are available, I can extract the key set of all keys.
+
+195
+00:16:40,000 --> 00:16:44,000
+You can explore API officers bundle by your own.
+
+196
+00:16:45,000 --> 00:16:48,000
+You would find awesome masses if they use a for you.
+
+197
+00:16:49,000 --> 00:16:56,000
+But I really believe I highlighted the most important masses like most likely you are going to use in
+
+198
+00:16:56,000 --> 00:16:56,000
+practice.
+
+199
+00:16:57,000 --> 00:17:03,000
+And in case you have any questions, you can ask them in comments to the video, and I will be happy
+
+200
+00:17:03,000 --> 00:17:04,000
+to answer.
+
+201
+00:17:05,000 --> 00:17:10,000
+One more important thing to know is priority for select and offer source bundles.
+
+202
+00:17:10,000 --> 00:17:16,000
+In the beginning, the application of the look for the file since across most suitable for the local
+
+203
+00:17:16,000 --> 00:17:24,000
+you ask for, it starts with the most specific name that is one contained in a country language.
+
+204
+00:17:25,000 --> 00:17:29,000
+Then it goes to more general is there is no much.
+
+205
+00:17:29,000 --> 00:17:31,000
+It falls back to the default local.
+
+206
+00:17:32,000 --> 00:17:43,000
+Let's imagine that we have a local set in our app Zip or two musical and what my labels will rule my
+
+207
+00:17:43,000 --> 00:17:48,000
+label's route and my labels is that this our default one.
+
+208
+00:17:49,000 --> 00:17:56,000
+We should keep in mind that each name represents both Jawa and Properties files, but the pool or if
+
+209
+00:17:56,000 --> 00:18:04,000
+you will go, was Java bundles once there is no suitable file, a missing resource, exceptions thrown.
+
+210
+00:18:05,000 --> 00:18:07,000
+All what I wanted to share with you today.
+
+211
+00:18:08,000 --> 00:18:10,000
+Let's recap what we have announced today.
+
+212
+00:18:11,000 --> 00:18:16,000
+They will run what internationalization and localization is.
+
+213
+00:18:16,000 --> 00:18:19,000
+Also, you know, the difference between these two terms.
+
+214
+00:18:20,000 --> 00:18:23,000
+One examples we learnt how to work was no code class.
+
+215
+00:18:24,000 --> 00:18:28,000
+You saw how to format numbers, currencies and dates.
+
+216
+00:18:29,000 --> 00:18:36,000
+And at the end of the lesson we learned how to work was properties based on Java based resource bundles.
+
+217
+00:18:37,000 --> 00:18:39,000
+Thanks a lot for your attention.
+
+218
+00:18:39,000 --> 00:18:42,000
+Have a great day and see you in the next lesson.
+
diff --git a/41 - I18N & L10N/external-links.txt b/41 - I18N & L10N/external-links.txt
new file mode 100644
index 0000000000000000000000000000000000000000..74084cfcbafe3fece2c6cb09a4607edb177bfc74
--- /dev/null
+++ b/41 - I18N & L10N/external-links.txt
@@ -0,0 +1,3 @@
+
+002 Source-code-examples-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/l18ni10n
diff --git a/42 - ===== Java Core Interview Preparation =====/001 How to be prepared for the interview.html b/42 - ===== Java Core Interview Preparation =====/001 How to be prepared for the interview.html
new file mode 100644
index 0000000000000000000000000000000000000000..7e8c0fead313aa48c3d84843f8b7802443d5d505
--- /dev/null
+++ b/42 - ===== Java Core Interview Preparation =====/001 How to be prepared for the interview.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ How to be prepared for the interview
+
+
+
+
+
+
+
How to be prepared for the interview
+
I gathered for you the most popular questions during the Java Interview in JAVA CORE topic. How you can be prepared for the interview?
Just read the question first. Try to answer the question by yourself. After that, compare your answer with the answer provided. Remember, that this is just a reference to the answer. Because sometimes the topic is big, and you can go really deep with your answer. In case you feel like you don’t understand what the answer is about - feel free to get back in the course and review the relevant section, and relevant lesson one more time.
Also, you are always welcome to ask your questions and I will be happy to answer. I’m sure that these questions will help you to be prepared for the JAVA CORE interview. You need to be ready to answer perfectly on these questions.
In case there are questions that you don't know the answers to, please, feel free to check my full and the most complete course "Java From Zero to First Job".
+
+
+
+
diff --git a/42 - ===== Java Core Interview Preparation =====/002 Part 1 Java Core Interview Questions and Answers.html b/42 - ===== Java Core Interview Preparation =====/002 Part 1 Java Core Interview Questions and Answers.html
new file mode 100644
index 0000000000000000000000000000000000000000..8c5af03c9be7e799adb97000c8b25441bcf7396e
--- /dev/null
+++ b/42 - ===== Java Core Interview Preparation =====/002 Part 1 Java Core Interview Questions and Answers.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Part 1 Java Core Interview Questions and Answers
+
+
+
+
+
+
+
Part 1 Java Core Interview Questions and Answers
+
JRE in short - to make Java application run. Java Runtime Environment (abbr. JRE) - the minimum virtual machine implementation required to run Java applications without a compiler and other development tools. It consists of a virtual machine - Java Virtual Machine and a Java class library.
JDK in short - for programming. Java Development Kit (abbreviated as JDK) is a free Java application development kit distributed by Oracle Corporation (formerly Sun Microsystems), which includes the Java compiler (javac), standard Java class libraries, examples, documentation, various utilities, and the Java runtime environment( JRE).
Java Virtual Machine (abbreviated Java VM, JVM) - Java virtual machine - the main part of the Java execution system, the so-called Java Runtime Environment (JRE). The Java Virtual Machine interprets the Java Bytecode previously generated from the Java program source code by the Java Compiler (javac). The JVM can also be used to execute programs written in other programming languages.
Java has the following access modifiers:
private: (used in constructors, inner classes, methods and class fields) - Access is allowed only in the current class.
default (package-private): (used in classes, constructors, interfaces, inner classes, methods and class fields) - Package level access. If the class is declared like this, it will only be available within the package.
protected: (used in constructors, inner classes, methods, and class fields) An access modifier at the package level and in the inheritance hierarchy.
public: (used in classes, constructors, interfaces, inner classes, methods and class fields) - Public access modifier, available to everyone.
The sequence of modifiers in descending order of privacy level: private, default ,protected, public).
An abstract class is a class that is marked "abstract" and may or may not contain abstract methods. An instance of an abstract class cannot be instantiated. A class that inherits from an abstract class may or may not implement abstract methods. In case child class doesn’t implement all abstract methods, then it must also be abstract. Also, if the inheritor class overrides the method implemented in the abstract parent class, it can be overridden with the abstract modifier! That is, to abandon the implementation. Accordingly, this class must also be abstract as well.
As for the interface, it contains only abstract methods and constants, this was the case before the release of Java 8. Starting with Java 8, in addition to abstract methods, we can also use standard methods (default methods) and static methods (static methods) in interfaces.
A Default method in an interface is a method in an interface with default logic that is not required to be defined in the implementation of that interface.
Static methods in an interface are essentially the same as static methods in an abstract class.
When implementing an interface, a class must implement all methods of the interface. Otherwise, the class must be marked as abstract. An interface can also contain inner classes. And no abstract methods in them.
Also, always remember that you can extend only one class in Java, but you can implement multiple interfaces.
What to use: Interface or Abstract class?
An abstract class is used when we need some kind of default implementation. An interface is used when a class needs to specify specific behavior. Often an interface and an abstract class are combined, i.e. implement an interface in an abstract class to specify the default behavior and implementation.
In general, a private class variable can only be accessed within the class in which it is declared. Private variables can also be accessed through the Java Reflection API.
Static methods can be overloaded by non-static methods and vice versa - without restrictions. But there is no point in overriding a static method.
An inner class is a class that exists within a class or interface. In doing so, it gains access to all fields and methods of its outer class.
What can it be used for? For example, to provide some additional class logic and encapsulate it. Although the use of inner classes complicates the program, it is recommended to avoid their use.
Static variables are initialized when the class is loaded by the classloader, and do not depend on the object. An instance variable is initialized when the class is created.
Example: For example, we need a global variable for all objects of a class, such as the number of visits by users of a particular article on the Internet. Each time an article is visited, a new object is created and the visits variable is incremented. The visits variable is a static variable that remains the same for all instances of the same class.
Any class used in a Java program has somehow been loaded into the program context by some kind of loader. All Java virtual machines include at least one class loader, the so-called base loader. It loads all the main classes, these are classes from rt.jar. It is interesting that this loader is not related to the program in any way, that is, we cannot get the name of the loader from java.lang.Object, for example, the getClassLoader() method will return null to us.
The next loader is the extension loader, it loads classes from $JAVA_HOME/lib/ext.
Next in the hierarchy is the system loader, it loads the classes, the path to which is specified in the classpath variable. For example, let's say that we have a custom class MyClass and we use it. How is it loading...
First, the system loader tries to find it in its load cache; if found, the class is successfully loaded, otherwise, the load control is transferred to the extension loader, it also checks its load cache and, if unsuccessful, transfers the task to the base loader. It checks the cache and in case of failure tries to download it, if the download was successful - the download is complete. If not, it transfers control to the extension loader. The extension loader attempts to load the class and, if it fails, passes this task to the system loader. The system loader tries to load the class, and if it fails, a java.lang.ClassNotFoundException is thrown.
This is how class loading works in Java. The so-called delegation of loading.
If there are custom loaders in the system, then they must be inherited from the java.lang.ClassLoader class.
Static class loading occurs when using the "new" operator.
Dynamic loading occurs "on the fly" during program execution using the static class method Class.forName(class name). What is dynamic loading for? For example, we do not know what class we need and make a decision during the execution of the program by passing the class name to the static forName() method.
+
+
+
+
diff --git a/42 - ===== Java Core Interview Preparation =====/003 Part 2 Java Core Interview Questions and Answers.html b/42 - ===== Java Core Interview Preparation =====/003 Part 2 Java Core Interview Questions and Answers.html
new file mode 100644
index 0000000000000000000000000000000000000000..c1c79f3b4007d3b2472725c4924b5ffb1675f8eb
--- /dev/null
+++ b/42 - ===== Java Core Interview Preparation =====/003 Part 2 Java Core Interview Questions and Answers.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Part 2 Java Core Interview Questions and Answers
+
+
+
+
+
+
+
Part 2 Java Core Interview Questions and Answers
+
These are the so-called interfaces - markers. They simply indicate that the class belongs to a particular group of classes. For example, the Clonable interface indicates that a class supports the cloning mechanism.
The degree of abstraction in this case is brought to the absolute.
Marker interfaces in Java examples:
Searilizable interface
Cloneable interface
Remote interface
In Java, memory is arranged as follows, there are two types:
A heap consists of a static context and the heap itself
Let's move on to the heap. The heap consists of two parts:
The new heap, in turn, consists of two parts:
Short description:
Eden Space (heap) - memory will be allocated in this area for all objects created from the program. Most of the objects do not live long (iterators, temporary objects used inside methods, etc.), and are deleted during garbage collections - these are areas of memory that are not moved to other areas of memory. When a given region fills up (i.e., the amount of allocated memory in this region exceeds some specified percentage), the GC performs a minor garbage collection. Compared to a full garbage collection, it takes little time, and only affects this area of memory - it cleans up obsolete Eden Space objects and moves the surviving objects to the next area.
Survivor Space (heap) - objects from the previous one are moved here after they have survived at least one garbage collection. From time to time, long-lived objects from this area move to Tenured Space.
Tenured (Old) Generation (heap) - Long-lived objects accumulate here (large high-level objects, singletons, resource managers, etc.). When this area fills up, a full, major collection is performed, which processes all objects created by the JVM.
Permanent Generation (non-heap) - This is where the meta-information used by the JVM (used classes, methods, etc.) is stored.
String can be used to create immutable objects. That is, for adding data to an already existing string, a new string object is created.
StringBuffer and StringBuilder can change and adding a string. These operations are not that expensive in terms of memory. The first is synchronized, the second is not. This is their only difference.
True, if we need to make a substring of a string, then it is better to use String, since its character array does not change and is not created anew for a new string. But in StringBuffer and StringBuilder, a new array of characters is created to create a substring.
There are two types of I/O streams:
These are all abstract classes - decorators, to which additional functionality can be added, for example:
In this case we added additional functionality of reading the data from the file.
Java Heap (heap) - a dynamically allocated memory area created when the JVM starts. Used by Java Runtime to allocate memory for objects and JRE. The creation of a new object also happens in the heap. This is where the garbage collector works: it frees memory by deleting objects that do not have any references. Any object created in the heap is globally accessible and can be referenced from any part of the application.
Key things to remember:
All objects live in the heap and get there when they are created.
An object consists of class fields and methods.
a place is allocated in the heap for the object itself, the amount of allocated memory depends on the fields, if your class field, for example, is an int variable, then it does not matter if you initialize it as "0" or as "1000000" - the object will occupy its own bits, + as many bytes as the int type (+32 bits) can hold, and so on with each field.
Stack memory in Java works according to the LIFO (Last-In-First-Out) scheme. Whenever a method is called, a new block is created in the stack memory that contains the primitives and references to other objects in the method, locating in RAM and reaching the processor via the stack pointer. As soon as the method ends, the block is also unused, thus providing access to the next method. Stack memory is much smaller than heap memory.
Key things to remember:
All methods live on the stack and get there when called.
Variables in methods also have stack memory because they are local.
If an object is created in the method, then it is placed on the heap, but its reference will still be on the stack, and after the method leaves the stack, the object will become a victim of the garbage collector, since the strong reference to it is lost, and it will be impossible to get from the main program stack to such an object.
Firstly, it is worth saying that the garbage collector has several algorithms for working, it is not one.
When is memory cleared? If the memory in the First heap is completely full, then the garbage collector goes there and does its job. Which one depends on the circumstances.
For example, if there is a lot of garbage in the first heap (i.e. objects with a null reference), then the garbage collector marks these objects, further, those that remain with references, he transfers them to the Surviving heap, and in the first heap, he simply deletes everything.
The situation is different, if in the first heap there is little garbage, but a lot of work objects. What does the garbage collector do in this case? It marks the garbage, removes it, and composes the remaining objects.
It should also be noted that when there is not enough space in the Surviving heap, objects are transferred to the old heap, as a rule, long-lived objects are stored there.
It should also be noted that the garbage collector itself is called periodically, and not only when there is not enough memory.
Type casting is setting the type of a variable or object to something other than the current type. There are two types of cast in jew:
Automatic happens for example in such cases:
byte->short->int->long->float->double
that is, if we extend the type, then no explicit conversion is required, the cast happens automatically. If we are narrowing, then it is necessary to explicitly specify the type conversion.
In the case of objects, we can automatically cast from the child type to the parent, but not vice versa, then a ClassCastException will be thrown.
A static class can only be an nested class (a class definition is placed inside another class). An object of an ordinary inner class holds a reference to an object of the outer class. There is no such reference inside a static inner class.
That is: An object of an outer class is not needed to create an object of a static inner class. From an object of a static nested class, you cannot directly access the non-static members of the outer class. Also, ordinary inner classes cannot contain static methods and members.
Why do we need nested classes at all? Each inner class is able to independently inherit a specific implementation. Thus, the nested class is not restricted from being inherited in situations where the outer class already inherits the implementation. That is, it is like a solution to the problem of multiple inheritance.
Nested classes exist within other classes. A normal class is a full member of a package. Nested classes, which have been available since Java 1.1, can be of four types:
static nested classes
non-static inner classes
local classes
anonymous classes
Static nested classes - like any other static method, it has access to any static methods of its outer class, including private ones. It cannot access non-static fields and methods of the enclosing class directly. It can only use them through a reference to an instance of the parent's class.
Non-static inner classes - classes that are declared inside other class and that are have access to the non-static properties of the outer parent class.
Local classes are classes that are defined in a block, which is a group of zero or more statements between balanced braces. You typically find local classes defined in the body of a method.
Anonymous Classes - These class types do not have a name and are only visible inside the block.
+
+
+
+
diff --git a/42 - ===== Java Core Interview Preparation =====/004 Part 3 Java Core Interview Questions and Answers.html b/42 - ===== Java Core Interview Preparation =====/004 Part 3 Java Core Interview Questions and Answers.html
new file mode 100644
index 0000000000000000000000000000000000000000..fb25cfbb55b5f5a0a1cf73faea7f717370814823
--- /dev/null
+++ b/42 - ===== Java Core Interview Preparation =====/004 Part 3 Java Core Interview Questions and Answers.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Part 3 Java Core Interview Questions and Answers
+
+
+
+
+
+
+
Part 3 Java Core Interview Questions and Answers
+
Yes, if you expand (package -> protected -> public)
Yes, if Downcasting is performed (downcasting, conversion down the hierarchy), that is, the return type in the overridden method of the heir class must NOT be wider than in the parent class (Object -> Number -> Integer)
No, in this case, Overload occurs
Yes
It is possible to change the order. It is possible to remove the throws section from the method altogether, since it is already defined. It is also possible to add new exceptions that inherit from declared or runtime exceptions.
Method overriding is valid when classes are inherited, i.e. a method with the same signature is declared in the descendant class as in the parent class. This means that this method has overridden the method of its superclass.
A few points about this:
The access modifier in the method of the descendant class must be NOT narrower than in the parent class, otherwise there will be a compilation error.
The description of the exception in the overridden method of the descendant class must NOT be wider than in the parent class, otherwise a compilation error will appear.
A method declared as "private" in a parent class cannot be overridden!
Autoboxing/Unboxing - automatic conversion between Java primitive types and corresponding wrapper types (for example, between int - Integer). Having this capability reduces code because it eliminates the need to perform explicit type conversions in obvious cases.
"Java Generics" is a technical term for a set of language features that allow generic types and methods to be defined and used. Generic types or methods differ from regular ones in that they have typed parameters.
An example of generics or generic types is the collection library in Java. For example, the class LinkedList<E> is a typical generic type. It contains an E parameter that represents the type of elements that will be stored in the collection. Instead of just using LinkedList without saying anything about the type of element in the list, we can use LinkedList<String> or LinkedList<Integer>. Generic type objects are created by replacing parameterized types with real data types. A class of type LinkedList<E> is a generic type that contains a parameter E. Creating objects such as LinkedList<String> or LinkedList<Integer> are called parameterized types, while String and Integer are real argument types.
Using generics you can describe class, methods, properties on the different level of abstraction and after that usethe instances of the class parametrized by any type.
In java, parameters are passed to methods by value, that is, copies of parameters are created and work is done with them in the method. In the case of primitive types, when passing a parameter, the variable itself will not change, since its value is simply copied to the method.
But when passing an object, a reference to the object is copied, that is, if we change the state of the object in the method, then the state of the object will also change after the method. But if we try to assign a new link to the object to this copy of the link, then the old link will not change.
We can say that everything in Java is passed by value. But in case with the reference types we pass the copy of the variable, and in case with primitive types we pass the copy of the primitive.
Use the == operator to test the object reference passed to the equals method. If the links match, return true. This is not necessary, rather for optimization, but can save time in case of "heavy" comparisons.
Use the instanceof operator to check the type of an argument. If the types do not match, return false.
Convert the argument to the correct type. Since we performed the check in the previous step, the transformation is correct.
Go through all the significant fields of the objects and compare them with each other. If all fields are equal, return true. Use == to compare simple types. For fields with object references, use equals.
Convert float to int with Float.floatToIntBits and compare with ==.
Convert double to long with Double.doubleToLongBits and compare with ==.
For collections, the above rules apply to each element in the collection. It is necessary to take into account the possibility of null fields/objects. The order in which fields are compared can have a significant impact on performance.
Once you've finished implementing equals, ask yourself if the method is symmetric, transitive, and consistent.
And one more rule: when overriding equals, always override hashCode for the sake of hash tables.
The equals() method denotes an object equivalence relationship. An equivalent relation is one that is symmetric, transitive, and reflexive.
Reflexivity: for any non-null x, x.equals(x) will return true;
Transitivity: for any non-zero x, y, and z, if x.equals(y) and y.eqals(z) return true, then x.equals(z) also returns true;
Symmetry: For any non-zero x and y, x.equals(y) must return true if and only if y.equals(x) returns true.
Also for any non-null x, x.equals(null) should return false.
Objects are equal when a.equals(b)=true and a.hashCode==b.hashcode -> true
But it is not necessary for two different objects to return different hash codes (this situation is called a collision). This is possible because hashCode returns value of type int. And int value has its ranges, while the set of objects theoretically may be close to infinite.
The elements in the hashtables would be not possible to find in Hash tables data structures, such as HashMap, HashSet.
The fact is that for a quick search, the hash table based data structure calculates the hashCode for each element to define the backet where to put element. It is also uses hashCode() method to find the backet where the element is located when it is time to retrieve the element. Once element is found, it is compared with the element that we used as a search criteria via equals() method. That’s why we can state that equals() and hashCode() works together and that’s why it is important to override hashCode() method too.
Yes, there are. It is necessary to use unique, preferably primitive fields, such as id, uuid, for example. Moreover, if these fields are involved in the calculation of hashCode, then you need to use them when performing equals.
General advice: choose fields that are very likely to differ. And use the same fields that you used in equals() method for comparison.
There are collections (HashMap, HashSet) that use the hash code as the basis for working with objects. And if the hash for equal objects is different, then the HashMap will have two equal values, which is an error. Therefore, it is necessary to override the hashCode() method appropriately.
Hashing - converting an input data array of arbitrary length into an output bit string of a fixed length. Such transformations are also called hash functions or convolution functions, and their results are called hashes or hash codes.
Hash table is a data structure that implements the interface of an associative array, namely, it allows you to store pairs (key, value) and perform at least three main operations: the operation of adding a new pair, the operation of searching and the operation of deleting a pair by key.
The execution of an operation in a hash table begins with the calculation of the hash function of the key. The resulting hash value i = hash(key) acts as an index into the array H. Then the operation performed (add, remove or lookup) is redirected to the object stored in the corresponding cell in the array H[i].
One of the methods for constructing a hash function is the division method with a remainder (division method) is that the key k is assigned the remainder of dividing k by m, where m is the number of possible hash values.
The implementation of hashCode() uses a few simple rules. First of all, when calculating the hash code, you should use the same fields that are compared in equals() method. This, firstly, will give equality of hash codes for equal objects, and secondly, the resulting value will be distributed in exactly the same way as the original data. Theoretically, you can make the hash code always equal to 0, and this will be a completely legal implementation. Another thing this will not bring you any sens and any value.
Even though the hash codes of equal objects should be equal, the reverse is not true! Two unequal objects can have equal hash codes.
Another important requirement for the hashCode() method is the speed of calculation, because this has to be done very often. Therefore, in some cases it makes sense to calculate the hash code in advance and simply issue it on request. First of all, this should be done when the calculation is long, heavy, and the object is immutable.
+
+
+
+
diff --git a/42 - ===== Java Core Interview Preparation =====/005 Part 4 Java Core Interview Questions and Answers.html b/42 - ===== Java Core Interview Preparation =====/005 Part 4 Java Core Interview Questions and Answers.html
new file mode 100644
index 0000000000000000000000000000000000000000..7d8819baf61d9338558618c1928612ad57c9c389
--- /dev/null
+++ b/42 - ===== Java Core Interview Preparation =====/005 Part 4 Java Core Interview Questions and Answers.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Part 4 Java Core Interview Questions and Answers
+
+
+
+
+
+
+
Part 4 Java Core Interview Questions and Answers
+
For an object to be cloneable, it must implement the Cloneable(marker) interface. The use of this interface affects the behavior of the "clone" method of the Object class. In this way
myObj.clone() will create a clone of our object for us, but this clone will be superficial.
What does superficial mean? This means that only primitive class fields are cloned, reference fields are not cloned!
In order to perform deep cloning, it is necessary to override the clone() method in the cloned class and clone the variable fields of the object in it.
The clone() method in Java is used to clone objects. Because Java works with objects using references, then simple assignment is not enough here, because in this case only the address is copied, and we will get two references to the same object, and this is not what we need. The copy mechanism provides the clone() method of the Object class.
clone() acts like a copy constructor. It usually calls the clone() method of the superclass, and so on. until it gets to Object.
The clone() method of the Object class creates and returns a copy of the object with the same field values. Object.clone() throws CloneNotSupportedException if you are trying to clone an object that does not implement the Cloneable interface. The default implementation of the Object.clone() method performs a shallow copy. If you need a full / deep (deep) copy of a class, then in the clone() method of this class, after obtaining a clone of the superclass, you need to copy the necessary fields.
One of the disadvantages of the clone() method is the fact that the type returned is Object, so a downcast is required. However, since Java 1.5, when overriding a method, you can narrow the return type.
A few words about clone() and final fields.
The clone() method is incompatible with final fields. If you try to clone a final field the compiler will stop you. The only solution is to drop final.
For example, you need to use private constructor in a Singleton pattern. In the same class, a static method is created. Where an instance of the class is created, of course, if it is not already created, then it is simply returned by the method.
In Java, if there are no explicitly defined constructors in a class, then the compiler uses an implicitly defined default constructor, which is similar to a "pure" default constructor. The default constructor is a fairly simple construct, which boils down to creating a constructor for a type with no parameters. So, for example, if a user-defined constructor is not declared when declaring a non-static class (it doesn’t matter if it has parameters or without them), then the compiler will independently generate a constructor without parameters. Some programmers explicitly set a default constructor out of habit so they don't forget later, but this is not necessary.
In Java, if the derived class does not explicitly call the base class constructor (in Java, using super() in the first line), then the default constructor is implicitly called. If the base class does not have a default constructor, then this is considered an error.
final - You cannot inherit from a final class. You cannot override the final method. You cannot change the value of the final field.
finally - used in error handling, always called even if an error occurs (except System.exit(0)). Useful for freeing up resources.
finalize() - starting from the Java 9 it is a deprecated method of an Object class. It is called before the garbage collector will free the memory. It is not recommended to use it to free up system resources, since it is not known when the garbage collector will clean up. In general, few people use this method. The only thing you can use this method to close a resource is that it should run for the duration of the program and close when it ends. You can also use the method to protect against the so-called "fools", check whether the resources are freed, if not, then close them.
All exception classes extend the Throwable class, which is a direct extension of the object class.
The Throwable class and all its extensions traditionally have two constructors:
The message written in the constructor can then be retrieved using the getMessage() method. If the object was created by the default constructor, then this method will return null.
The toString method returns a brief description of the event, which is what worked in the previous listings.
Three methods print messages about all methods encountered along the path of the "flight" of the exception:
printstackTrace() - prints messages to standard output, usually the console;
printStackTrace(PrintStream stream) - prints messages to the byte stream stream;
printStackTrace(PrintWriter stream) - prints messages to the character stream stream.
The Throwable class has two direct descendants, the Error and Exception classes. They do not add new methods, but serve to separate exception classes into two large families - the family of error classes (error) and the family of exception classes themselves (exception).
Error classes that extend the Error class indicate difficult situations in the Java Virtual Machine. Their processing requires a deep understanding of all the intricacies of the JVM. It is not recommended to perform it in a regular program. It is not even advised to throw errors with the throw statement. You should not make your exception classes extensions of the Error class or some subclass of it.
Error class names, by convention, end with the word Error.
Exception classes that extend the Exception class mark the occurrence of a common abnormal situation that can and should even be handled. Such exceptions should be thrown with the throw statement. There are a lot of exception classes, more than two hundred. They are scattered throughout literally all JDK packages. In most cases, you will be able to pick up a ready-made exception class to handle exceptions in your program. If you wish, you can create your own exception class by extending the Exception class or any of its subclasses.
Among the exception classes, the RuntimeException class stands out - a direct extension of the Exception class. In it and its subclasses, exceptions are noted that occurred during the operation of the JVM, but are not as serious as errors. They can be processed and thrown away, extended with their own classes, but it is better to entrust this to the JVM, since most often this is just a bug in the program that needs to be fixed. The peculiarity of exceptions of this class is that they do not need to be marked in the method header with the throws mark.
Exception class names, by convention, end with the word Exception.
All exceptional situations can be divided into two categories: checked and unchecked.
All exceptions thrown from Throwable can be divided into three groups. They are defined by three base types: the Throwable descendants, the Error and Exception classes, and the Exception descendant, RuntimeException.
Exceptions that are descended from Exception class (and are not descendants of RuntimeException ) are checkable. Those. at compile time, it is checked whether the handling of possible exceptions is provided. As a rule, these are errors related to the program environment (network, file I/O, etc.), which can occur regardless of whether the code is written correctly or not. For example, opening a network connection or a file may result in an error, and the compiler requires the programmer to take some action to handle possible problems. This increases the reliability of the program, its stability in case of possible failures.
Exceptions thrown from RuntimeException are unchecked and are not required to be handled by the compiler.
As a rule, these are program errors that should not occur if coded correctly (for example, IndexOutOfBoundsException - array bounds out of bounds, java.lang.ArithmeticException - division by zero). Therefore, in order not to clutter up the program, the compiler leaves it up to the programmer to handle such exceptions and whether developer would like to handle such exceptions using try-catch blocks.
Exceptions thrown from Error are not checked either. They are intended to notify the application about the occurrence of a fatal situation, which is almost impossible to eliminate programmatically (although formally a handler is allowed). They may indicate program errors, but they are usually unrecoverable problems at the JVM level. Examples include StackOverflowError (stack overflow), OutOfMemoryError (out of memory).
Methods whose code can throw checked exceptions must either handle them themselves, or the method header must contain the throws keyword with a list of unhandled checked exceptions. This rule does not apply to unchecked errors.
An overridden method cannot extend the list of possible exceptions of the original method.
Checked exceptions are those that should be handled by the catch block or described in the method signature. Unchecked may not be handled and declared.
An example of an unchecked exception is NullPointerException, a checked exception is IOException.
Inherit from RuntimeException.
If one of the catch blocks fires, then the remaining blocks in this try-catch construct will not be executed.
Exceptions do not have the transactional property - actions performed in the try block before the exception occurs are not canceled after it occurs.
Finally block is executed even in case there was a mistake in the catch block, or even in case there is no catch block. Definately, there are some exceptions when finally block will not be executed till the end. Such cases for example: in case we call System.exit(0) and stoped virtual machine, or finally block was part of the daemon thread execution and the parent thread is stopped and edge cases like this.
There is also possibility to add multiple exceptions into the catch statement of catch block.
try can be paired with finally, without catch. It works exactly the same - after exiting the try block, the finally block is executed. This can be useful, for example, in the following situation. When you exit the method, you need to perform some action. And return in this method is in several places. It is not practical to write the same code before each return. It is much easier and more efficient to put the main code in a try and the exit code in a finally.
Or in case you need to close some resources - you can do this in finally block.
Not always, for example in the following situations:
There are daemon threads - threads that provide some services, working in the background while the program is running, but are not an integral part of it. Thus, when all non-daemon threads terminate, the program terminates. In daemon threads, the finally block is not executed, they are interrupted abruptly.
System.exit(0)
if an exception occurs in the finally block and there is no handler, then the remaining code in the finally block may not be executed.
+
+
+
+
diff --git a/42 - ===== Java Core Interview Preparation =====/006 Part 5 Java Core Interview Questions and Answers.html b/42 - ===== Java Core Interview Preparation =====/006 Part 5 Java Core Interview Questions and Answers.html
new file mode 100644
index 0000000000000000000000000000000000000000..06e5093c95791573a5c107f7247b077dfb91554e
--- /dev/null
+++ b/42 - ===== Java Core Interview Preparation =====/006 Part 5 Java Core Interview Questions and Answers.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Part 5 Java Core Interview Questions and Answers
+
+
+
+
+
+
+
Part 5 Java Core Interview Questions and Answers
+
The internal state of the String class cannot be changed after it has been created, i.e. this class is immutable so when you write String str = "One" + "Two"; the third String “OneTwo” is created! object of class String.
It cannot be inherited from because the String class is declared final: public final class String
The String class has a public String intern() method that returns a string in its canonical representation from the internal string pool maintained by the JVM, it is needed to use == instead of String.equals().
Why you may want to do this? It is clear that the reference comparison operator is much faster than a character-by-character string comparison.
They are mainly used where you have to compare many strings, for example, in some kind of XML parsers.
And in general on increase in productivity still a question. For the intern() method should then be faster than equals(), each time you call the intern() method, the string pool is searched for the presence of such a string, and if there is already one in the pool, then a reference to it is returned. They are compared through equals()
No, because String class if final. It has “final” modificator and can’t be extended.
A string pool is a collection of strings that is stored in Java heap memory. We know that String is a special class in Java, and we can create objects of this class using the new operator just like we can create objects by providing a string value in double quotes.
String pooling is possible solely due to the immutability of strings in Java and the implementation of the idea of string interning.
The string pool helps save a lot of memory, but on the other hand, creating a string takes more time.
When we use double quotes to create a string, it first looks for a string in the pool with the same value, if found, it simply returns a reference, otherwise a new string is created in the pool, and then a reference is returned.
However, when we use the new operator, we force the String class to create a new string object, and then we can use the intern() method to put the string into the pool, or retrieve from the pool a reference to another String object with the same value.
Since strings are immutable, their hashcode is cached at the time of creation and does not need to be recomputed. This makes strings an excellent candidate for a key in a Map, and they process faster than other HashMap key objects. This is why strings are predominantly used as HashMap keys.
Also, the String object is immutable and you can’t lose the value that is associated with the String key because String key can’t be changed or modified.
There is no sense in this because all objects of type String are immutable. If you want to work with mutable strings and synchronize access to them - then you need to use StringBuffer.
Bring them to the same type and compare.
There are several advantages to string immutability:
The string pool is only possible because the string is immutable in Java, thus the virtual machine saves a lot of heap space since different string variables point to the same variable in the pool. If a string were not immutable, then string interning would not be possible, because if any variable changes its value, the rest of the variables referring to that string will also be affected.
If the string is mutable, then it becomes a serious security risk to the application. For example, the database username and password are passed as a string to obtain a database connection, and in socket programming, host and port details are passed as a string. Since the string is immutable, its value cannot be changed, otherwise any hacker could change the value of the link and cause security problems for the application.
Strings are used in the Java classloader and immutability ensures that the class is correctly loaded by the Classloader. For example, think about the class instance when you are trying to load the java.sql.Connection class, but the reference value is changed to myhacked.Connection class, which can do unwanted things to your database.
Since the string is immutable, its hashcode is cached at the time of creation and there is no need to calculate it again. This makes the string an excellent candidate for a Map key and will be faster to process than other HashMap keys. This is the reason why string is the most commonly used object used as a HashMap key.
+
+
+
+
diff --git a/42 - ===== Java Core Interview Preparation =====/007 Part 6 Java Core Interview Questions and Answers.html b/42 - ===== Java Core Interview Preparation =====/007 Part 6 Java Core Interview Questions and Answers.html
new file mode 100644
index 0000000000000000000000000000000000000000..0d63dc3016541a6a2251a5ec59946f74d76da7ad
--- /dev/null
+++ b/42 - ===== Java Core Interview Preparation =====/007 Part 6 Java Core Interview Questions and Answers.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Part 6 Java Core Interview Questions and Answers
+
+
+
+
+
+
+
Part 6 Java Core Interview Questions and Answers
+
Reflection is used to obtain or modify type information during program execution. This mechanism allows you to get information about classes, interfaces, fields, methods, constructors during program execution. You don't need to know the names of classes, methods, or interfaces. It also allows you to create new objects, execute methods, and get and set field values.
Internationalization (or i18n for short) is a way of building applications so that they can be easily adapted to different audiences speaking different languages.
Localization (for short - l10n) - adaptation of the application interface for several languages.
Annotations are a kind of meta tags that are added to code and applied to the declaration of packages, classes, constructors, methods, fields, parameters, and local variables.
Annotations always have some information and link this "additional data" and all the listed language constructs.
In fact, annotations are their additional modifiers, the use of which does not entail changes in the previously created code.
The annotation performs the following functions:
gives the necessary information to the compiler;
gives information to various tools for generating other code, configurations, etc.;
can be used while the code is running;
The most common annotation that any programmer, even a beginner, has come across is @Override.
These annotations have the following meaning:
@Retention - this annotation is intended to be applied only as an annotation to other annotations, allows you to specify the life cycle of the annotation: will it be present only in the source code, in the compiled file, or will it also be visible during execution. Choosing the right type depends on how you want to use the annotation.
@Documented is a marker interface that tells the tool that the annotation should be documented.
@Target - This annotation specifies the type of declaration to which the annotation can be applied. Takes one argument, which must be a constant from the ElementType enumeration, it can be a field, method, type, etc. For example, to indicate that an annotation only applies to fields and local variables: @Targer({ ElementType.FIELD, ElementTyle.LOCAL_VARIABLE } )
@Inherited is a marker annotation that can be applied in another annotation declaration, it only applies to annotations that will be used in class declarations. Indicates that an annotation interface is automatically inherited. This annotation allows a super class annotation to be inherited in a subclass.
These annotations are for:
@Override is a marker annotation that can only be applied to methods. A method annotated with @Override must override a super class method.
@Deprecated - Indicates that the declaration is deprecated and should be replaced with a newer form.
@SafeVarargs is a marker annotation applied to methods and constructors. It specifies that no unsafe behavior associated with the variable number of arguments option is allowed. Applies only to variadic methods and constructors that are declared static or final.
@SuppressWarnings - This annotation specifies that one or more warnings that may be issued by the compiler should be suppressed.
There are 3 possible options to specify where the annotation will live. They are encapsulated in a java.lang.annotation.RetentionPolicy enum. These are SOURSE, CLASS, RUNTIME.
SOURCE - annotation is contained only in the source file and discarded when compiling.
CLASS - stored in a file, however annotations are not available to the JVM at runtime.
RUNTIME - annotations are stored in a file at compile time and remain available to the JVM at run time.
In order to limit the use of an annotation, it must be annotated. There is a @Target annotation for this.
@Target(ElementType.PACKAGE) - for packages only;
@Target(ElementType.TYPE) - for classes only;
@Target(ElementType.CONSTRUCTOR) - for constructors only;
@Target(ElementType.METHOD) - for methods only;
@Target(ElementType.FIELD) - only for class attributes (variables);
@Target(ElementType.PARAMATER) - only for method parameters;
@Target(ElementType.LOCAL_VARIABLE) - for local variables only.
Writing your annotation is not as difficult as it might seem.
In the place where we usually write class or interface, we have @interface written.
The structure is almost the same as for interfaces, only @interface is written.
The annotation is ready, now it can be used, and the annotation can also be configured. You can configure @Target and @Retention for this annotation
Attributes can only have the following types:
The last point should be understood as the fact that only one-dimensional arrays are allowed.
In Java technology, security is provided by the following three mechanisms:
structural functionality of the language (for example, array bounds checking, the prohibition of unchecked type conversions, the absence of pointers, etc.).
access controls that determine the actions that are allowed or prohibited to be performed in the code (for example, whether the code can access files, transfer data over the network, etc.).
a digital signature mechanism that allows authors to use standard algorithms to authenticate their programs, and users to determine exactly who created the code and whether it has changed since it was signed.
Refactoring is the process of changing the internal structure of a program without affecting its external behavior and with the aim of making it easier to understand how it works. Refactoring is based on a series of small equivalent (that is, behavior-preserving) transformations.
+
+
+
+
diff --git a/42 - ===== Java Core Interview Preparation =====/008 Part 7 Java Core Interview Questions and Answers.html b/42 - ===== Java Core Interview Preparation =====/008 Part 7 Java Core Interview Questions and Answers.html
new file mode 100644
index 0000000000000000000000000000000000000000..dcf56d78b7809da3edb73e2e6792885e903fcc32
--- /dev/null
+++ b/42 - ===== Java Core Interview Preparation =====/008 Part 7 Java Core Interview Questions and Answers.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Part 7 Java Core Interview Questions and Answers
+
+
+
+
+
+
+
Part 7 Java Core Interview Questions and Answers
+
StringJoiner is used to create a delimiter-separated sequence of characters that may (but need not) start with a prefix and end with a suffix.
Starting with Java 8, we can use default methods and static methods in interfaces.
A default method is a method in an interface with default logic that is not required to be implemented during the implementation of the interface.
Static methods in an interface are essentially the same as static methods in an abstract class.
Static methods in an interface are part of the interface, we cannot use it on objects of the implementation class.
Static methods in an interface are good for providing helper methods like checking for null, sorting collections, etc.
Static methods in an interface help provide security by preventing classes that implement the interface from overriding them.
Optional is an object container, it can contain a value, or some type T, or just be null. It provides many useful methods to avoid adding repeated if null/notNull checks, allowing us to focus on what we want to do.
The isPresent() method returns true if the Optional instance contains a non-null value and false otherwise. The orElseGet() method contains a fallback mechanism to result if the Optional is null, accepting functions to generate a default value. The map() method transforms the current Optional value and returns a new Optional instance. The orElse() method is similar to orElseGet(), but instead of a function, it takes a default value.
Nashorn is a JavaScript engine developed entirely in Java by Oracle. It is designed to enable JavaScript code to be embedded in Java applications. Compared to Rhino, which is maintained by the Mozilla Foundation, Nashorn provides 2x to 10x better performance because it directly compiles the code in memory and passes the bytecode to the Java Virtual Machine. Nashorn can compile JavaScript code and generate Java classes that are loaded by a special loader. It is possible to call Java code directly from JavaScript.
Nashorn comes with a jjs cmd utility that allows you to execute JavaScript directly in the console. jjs takes a list of JavaScript source files and runs them. To run the file, let's pass it as an argument to jjs:
LocalDateTime combines LocaleDate and LocalTime together and contains the date and time, but without the time zone in the ISO-8601 calendar system. Time is stored with nanosecond precision, so LocalTime can store, for example, the value "13:45.30.123456789".
There are many useful methods like plusMinutes, plusHours, isAfter, toSecondOfDay, etc.
ZonedDateTime is similar to java.util.Calendar. This is the most powerful class with complete information about the time context, including the time zone. It contains the date and time in the ISO-8601 calendar system.
+
+
+
+
diff --git a/43 - == EXAM Java Standard Edition - Online Store - Task description and solution ==/001 Implement online store application.html b/43 - == EXAM Java Standard Edition - Online Store - Task description and solution ==/001 Implement online store application.html
new file mode 100644
index 0000000000000000000000000000000000000000..dd6d2046ec14ee430d227c4a1f4bc142e2dd1785
--- /dev/null
+++ b/43 - == EXAM Java Standard Edition - Online Store - Task description and solution ==/001 Implement online store application.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Implement online store application
+
+
+
+
+
+
+
Implement online store application
+
Hello team,
If you follow the course, then you already know that we are in progress of implementation of our online shop. And with each new topic learned, I want you gradually implement more and more features. This time we are going to implement new features taking into account new topics that we've learned.
- As the basis for the project, let's take the last improvement that we did. It is located here - https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/exam/template
- On top of template implement tasks described below.
1. Mail sender and mockito test
- Create MailSender interface. The interface has only one method - void sendEmail(String sendTo, String messageToSend);
- Create ResetPasswordService interface with one method - void resetPasswordForUser(User user);
Why for a user but not just for email? Because of potential scalability. Imagine that we will implement login via phone number? In this case we can find the user by his phone and send the password to his email. Or, we still can extract a user from storage and keep the same API. We would just need to implement a different implementation of service that will consider resetting via phone number. That's the reason why I recommend keeping User in API here.
- Create implementation of ResetPasswordService - DefaultResetPasswordService
- DefaultResetPasswordService uses instance of MailSender to send message to user email. Message should contain current user password.
- Create test with the help of Mockito that verifies that when we call resetPasswordForUser method, we send message to user's email, but not to different email, and message should contain current password of a user.
Commit on the github with solution of this task is here - https://github.com/AndriiPiatakha/learnit_java_core/commit/28b0bad9668222b175f7529a16c7465ea386e1df
Solution is here - https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/exam/solution
2. Implement annotation for user validation.
- Create annotation @Validate
- This annotation will be used with class attributes of String type
- Annotation has one attribute that is called "pattern" - string value
- As a developer I can use annotation to add validation rules for string fields
- Create interface Validator with one method - boolean isValid(Object obj);
- Create implementation of Validator interface - DefaultValidator. When I call isValid method I receive true in case pattern specified in @Validate annotation matched with attribute values in particular fields, if not, then I return false.
- For demo purposes, you can mark with this annotation and with your pattern such fields in DefaultUser class - firstName, lastName and email. Come up with a regex pattern by yourself.
- Implement unit tests that demo the functionality
Commit on the github with solution of this task is here - https://github.com/AndriiPiatakha/learnit_java_core/commit/ae2949bde68d30cd3798d8c254f419d7b75f3308
3. Implement multithreading approach
- Implement additional menu option - Reset password
- After navigating on the reset menu, the user is asked to provide his email.
- Once a user submitted an email, we instantly showing him the message "Your password has been sent to your email. Please, check the mailbox. You will receive the email within the next 5 minutes".
- In parallel, we have a separate thread running that finds a user by email in our storage. And we use ResetPasswordService to send email in the background, while a user without any waiting time can navigate to different menus.
4. Implement I18N and L10N for the app.
- All text elements should support at least two languages
- There is a separate menu that is called “Change Language”. After selecting this menu, the user can select one of the languages for the user interface.
- After user changed language - All text items translated to different language automatically
The whole solution is here - https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/exam/solution
Resource bundles are here - https://github.com/AndriiPiatakha/learnit_java_core/tree/master/resources/exam
+
+
+
+
diff --git a/44 - Java New Versions/001 Java 8 Features (Lambda, Stream API, Optional, Effectively Final, etc.)_en.srt b/44 - Java New Versions/001 Java 8 Features (Lambda, Stream API, Optional, Effectively Final, etc.)_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..2cd7ff39d37a4bc1adacc748fe807f81385df7cb
--- /dev/null
+++ b/44 - Java New Versions/001 Java 8 Features (Lambda, Stream API, Optional, Effectively Final, etc.)_en.srt
@@ -0,0 +1,1644 @@
+1
+00:00:06,000 --> 00:00:12,000
+Hello dear students, I promised you to provide updates about new Java versions and new features.
+
+2
+00:00:12,000 --> 00:00:16,000
+In this lesson we are going to learn features from Java version eight.
+
+3
+00:00:16,000 --> 00:00:22,000
+I know that we learned a lot of Java eight features in my course Java from zero to first job, but probably
+
+4
+00:00:22,000 --> 00:00:27,000
+you were not aware that these features are available just from Java eight.
+
+5
+00:00:27,000 --> 00:00:32,000
+And still, I believe this would be important to learn in order to structure your knowledge.
+
+6
+00:00:33,000 --> 00:00:38,000
+This lesson is going to be full of practical examples, because I plan to show you a new features on
+
+7
+00:00:38,000 --> 00:00:40,000
+real examples.
+
+8
+00:00:40,000 --> 00:00:42,000
+Today we will review such features.
+
+9
+00:00:43,000 --> 00:00:45,000
+Interface, default and static methods.
+
+10
+00:00:45,000 --> 00:00:47,000
+Functional interfaces.
+
+11
+00:00:47,000 --> 00:00:48,000
+Lambda expressions.
+
+12
+00:00:48,000 --> 00:00:49,000
+Methods.
+
+13
+00:00:49,000 --> 00:00:50,000
+References.
+
+14
+00:00:50,000 --> 00:00:56,000
+Effectively final variables stream API in my course Java from zero to first job.
+
+15
+00:00:56,000 --> 00:01:02,000
+I even have separate section about functional programming in Java, where we learn some of these topics
+
+16
+00:01:02,000 --> 00:01:09,000
+in details in case you want to learn Lambda functions, method references and stream API in more details,
+
+17
+00:01:09,000 --> 00:01:12,000
+feel free to refer to that section.
+
+18
+00:01:12,000 --> 00:01:15,000
+In this lesson we will also review some examples.
+
+19
+00:01:15,000 --> 00:01:23,000
+But as I said, if you need even more details, feel free to check separate section of the course dedicated
+
+20
+00:01:23,000 --> 00:01:24,000
+to these topics.
+
+21
+00:01:24,000 --> 00:01:31,000
+Because Java version eight was revolutionary back then and features introduced in Java eight were huge.
+
+22
+00:01:32,000 --> 00:01:37,000
+That's why I created separate lessons for those topics and even separate sections.
+
+23
+00:01:38,000 --> 00:01:41,000
+Also, we are going to learn optional class in my Java course.
+
+24
+00:01:41,000 --> 00:01:44,000
+We already had a separate lesson for that one two.
+
+25
+00:01:44,000 --> 00:01:48,000
+But today we will make a summary and highlight the most important points.
+
+26
+00:01:48,000 --> 00:01:50,000
+Repeating annotations.
+
+27
+00:01:50,000 --> 00:01:52,000
+That is something new for you.
+
+28
+00:01:52,000 --> 00:01:55,000
+Because I didn't have opportunity to stop on this topic before.
+
+29
+00:01:55,000 --> 00:02:00,000
+You see, not all topics require separate lessons because they are not so huge.
+
+30
+00:02:00,000 --> 00:02:09,000
+That's why we will use some topics in scope of other lessons and new data time API in my course Java
+
+31
+00:02:09,000 --> 00:02:15,000
+from zero to first job, I created separate section with multiple lessons about date and time in JDK.
+
+32
+00:02:15,000 --> 00:02:18,000
+But today we are going to make a summary.
+
+33
+00:02:18,000 --> 00:02:24,000
+And at the end of the lesson, we are going to learn two things that were marked as deprecated in Java
+
+34
+00:02:24,000 --> 00:02:25,000
+version eight.
+
+35
+00:02:25,000 --> 00:02:28,000
+I am talking about the extension mechanism.
+
+36
+00:02:28,000 --> 00:02:35,000
+Java ext dirs property and rarely used garbage collectors combinations.
+
+37
+00:02:35,000 --> 00:02:38,000
+So let's start our lesson.
+
+38
+00:02:39,000 --> 00:02:45,000
+As I already mentioned, today we are going to have a lesson full of practical examples and exercises.
+
+39
+00:02:45,000 --> 00:02:51,000
+So let me just start screen sharing and review with the examples that I prepared for you.
+
+40
+00:02:51,000 --> 00:02:57,000
+I prepared examples before the lesson in order to not spend your time during the video lesson, you
+
+41
+00:02:57,000 --> 00:03:00,000
+sitting and waiting while I finish typing code.
+
+42
+00:03:00,000 --> 00:03:04,000
+And also I wanted to bring more structural approach into this lesson.
+
+43
+00:03:05,000 --> 00:03:10,000
+In attachments to the lesson, you can find the reference to the source code examples shared in the
+
+44
+00:03:10,000 --> 00:03:18,000
+video, exploring the source code on your personal computer, changing it, playing with it will help
+
+45
+00:03:18,000 --> 00:03:24,000
+you to understand the code better, so feel free to copy examples and understand them.
+
+46
+00:03:25,000 --> 00:03:29,000
+We are going to review this example line by line.
+
+47
+00:03:29,000 --> 00:03:30,000
+Always remember that.
+
+48
+00:03:30,000 --> 00:03:35,000
+I encourage you to ask questions below the video in case something is not clear.
+
+49
+00:03:35,000 --> 00:03:40,000
+You don't have to write in reviews at course was unclear and lessons are bad.
+
+50
+00:03:40,000 --> 00:03:44,000
+Just post your questions below the video and I will be happy to answer.
+
+51
+00:03:45,000 --> 00:03:51,000
+I check all questions on regular basis and make sure that all questions are properly answered.
+
+52
+00:03:52,000 --> 00:03:57,000
+I will run this program and together we will explore console output with the source code.
+
+53
+00:03:58,000 --> 00:04:02,000
+And I want to start with interface, default and static methods.
+
+54
+00:04:02,000 --> 00:04:09,000
+In Java, starting from version eight, interfaces can contain default and static methods, providing
+
+55
+00:04:09,000 --> 00:04:14,000
+a new way to evolve interfaces without breaking existing implementations.
+
+56
+00:04:15,000 --> 00:04:22,000
+These methods offer a means to introduce new functionality to interfaces in a backward compatible manner.
+
+57
+00:04:23,000 --> 00:04:25,000
+A default method is a method in an interface.
+
+58
+00:04:25,000 --> 00:04:28,000
+It provides a default implementation.
+
+59
+00:04:28,000 --> 00:04:36,000
+It allows an interface to have massive implementations without forcing the implementing classes to provide
+
+60
+00:04:36,000 --> 00:04:38,000
+their own implementation.
+
+61
+00:04:38,000 --> 00:04:42,000
+Default methods are declared using the default keyword.
+
+62
+00:04:43,000 --> 00:04:50,000
+In this example, I declared my interface in the same file, just to keep all examples grouped together
+
+63
+00:04:50,000 --> 00:04:51,000
+in one file.
+
+64
+00:04:51,000 --> 00:04:59,000
+As you can see, my interface has regular abstract method without method body has default methods that
+
+65
+00:04:59,000 --> 00:05:06,000
+contains body and that has default keyword and static method that contains method, body and static
+
+66
+00:05:06,000 --> 00:05:07,000
+keyword.
+
+67
+00:05:08,000 --> 00:05:12,000
+I have class that is called my class and it implements my interface.
+
+68
+00:05:12,000 --> 00:05:18,000
+And usually we have to give implementation to all abstract masses in class, right?
+
+69
+00:05:18,000 --> 00:05:25,000
+We need to do this to define specific behavior and to be able to create instances of this class.
+
+70
+00:05:25,000 --> 00:05:30,000
+That's why I implemented only regular method and that's it.
+
+71
+00:05:30,000 --> 00:05:35,000
+You don't need to give implementation neither to default nor to static methods.
+
+72
+00:05:36,000 --> 00:05:43,000
+In main method you can see how I create instance of type my class and I invoke regular method and default
+
+73
+00:05:43,000 --> 00:05:46,000
+method and pay attention to the console output.
+
+74
+00:05:47,000 --> 00:05:52,000
+Basically, the default method prints text that we defined in the interface.
+
+75
+00:05:52,000 --> 00:05:57,000
+That means that you don't need to force all classes that implements your interface.
+
+76
+00:05:57,000 --> 00:06:00,000
+Implement behavior for default method.
+
+77
+00:06:01,000 --> 00:06:04,000
+Instead, you can suggest the default behavior for method.
+
+78
+00:06:04,000 --> 00:06:06,000
+And that's it.
+
+79
+00:06:06,000 --> 00:06:08,000
+That's what default methods are about.
+
+80
+00:06:09,000 --> 00:06:11,000
+With static methods, everything is simple.
+
+81
+00:06:11,000 --> 00:06:16,000
+Static methods in interface are similar to static methods in classes.
+
+82
+00:06:16,000 --> 00:06:22,000
+They are associated with the interface and can be invoked using the interface name.
+
+83
+00:06:22,000 --> 00:06:28,000
+Static methods are defined using the static keyword and the same as all static methods.
+
+84
+00:06:28,000 --> 00:06:36,000
+You can't override behavior of static methods, so when to use what, when to use default masses and
+
+85
+00:06:36,000 --> 00:06:38,000
+when to use static methods.
+
+86
+00:06:38,000 --> 00:06:43,000
+I believe that you already know the answer, so let me just make a summary.
+
+87
+00:06:44,000 --> 00:06:50,000
+Default methods are useful for evolving interfaces without breaking existing implementations.
+
+88
+00:06:50,000 --> 00:06:57,000
+For example, adding new methods to existing Java collections interfaces without forcing developers
+
+89
+00:06:57,000 --> 00:06:59,000
+to update their implementations.
+
+90
+00:07:00,000 --> 00:07:06,000
+Static masses handy for providing utility masses related to the interface.
+
+91
+00:07:06,000 --> 00:07:11,000
+For instance, helper masses for processing data specific to the interface.
+
+92
+00:07:11,000 --> 00:07:14,000
+Use this toolset wisely.
+
+93
+00:07:14,000 --> 00:07:20,000
+Also, feel free to refer to the lesson about interfaces in my course Java from zero to First Job.
+
+94
+00:07:20,000 --> 00:07:26,000
+In that lesson, I reviewed different combinations of default methods and showed examples of diamond
+
+95
+00:07:26,000 --> 00:07:33,000
+problem because technically speaking, class may implement multiple interfaces, right?
+
+96
+00:07:33,000 --> 00:07:40,000
+And multiple interfaces theoretically may declare masses with the same signature, and this will cause
+
+97
+00:07:40,000 --> 00:07:41,000
+compilation error.
+
+98
+00:07:42,000 --> 00:07:47,000
+This is called problem of a diamond or simply diamond problem.
+
+99
+00:07:47,000 --> 00:07:55,000
+Talents at Java don't know which default implementation of the method from which interface to select
+
+100
+00:07:55,000 --> 00:07:56,000
+during the runtime.
+
+101
+00:07:57,000 --> 00:08:04,000
+Okay, let's move on and talk about such feature as functional interface that was also introduced in
+
+102
+00:08:04,000 --> 00:08:06,000
+Java version eight.
+
+103
+00:08:06,000 --> 00:08:14,000
+In Java eight, the concept of functional interfaces was introduced to support the new features like
+
+104
+00:08:14,000 --> 00:08:17,000
+lambda expressions and method references.
+
+105
+00:08:17,000 --> 00:08:19,000
+We'll review them in a minute too.
+
+106
+00:08:19,000 --> 00:08:27,000
+A functional interface is an interface that contains exactly one abstract method known as a functional
+
+107
+00:08:27,000 --> 00:08:28,000
+method.
+
+108
+00:08:28,000 --> 00:08:36,000
+Functional interfaces can have multiple default or static methods, but they must have only one abstract
+
+109
+00:08:36,000 --> 00:08:39,000
+method to qualify as a functional interface.
+
+110
+00:08:40,000 --> 00:08:46,000
+So the interface with name my interface that we have just reviewed in scope of previous example is a
+
+111
+00:08:46,000 --> 00:08:48,000
+functional interface.
+
+112
+00:08:48,000 --> 00:08:55,000
+The functional interface annotation can be used to ensure that an interface is functional interface.
+
+113
+00:08:56,000 --> 00:08:58,000
+While the annotation is optional.
+
+114
+00:08:58,000 --> 00:09:05,000
+It's good practice to use it to clearly indicate the intention of creating a functional interface,
+
+115
+00:09:05,000 --> 00:09:11,000
+and in case there will be two abstract methods, or somebody would decide to add more abstract methods
+
+116
+00:09:11,000 --> 00:09:17,000
+to the interface, there will be compilation error reminding you that this is functional interface,
+
+117
+00:09:17,000 --> 00:09:20,000
+and you should have only one abstract method.
+
+118
+00:09:21,000 --> 00:09:25,000
+In main method you can find example of usage of functional interface.
+
+119
+00:09:26,000 --> 00:09:30,000
+Usually, functional interfaces are defined in order to flag that.
+
+120
+00:09:30,000 --> 00:09:33,000
+You can describe this type with lambda expression.
+
+121
+00:09:34,000 --> 00:09:43,000
+In this case it is anonymous method without name and without parameters defined that just prints text
+
+122
+00:09:43,000 --> 00:09:47,000
+to console and basically to create instance of my interface.
+
+123
+00:09:47,000 --> 00:09:51,000
+You just need to provide implementation of one abstract method, right?
+
+124
+00:09:52,000 --> 00:09:55,000
+That would be enough for Java to create object of this type.
+
+125
+00:09:56,000 --> 00:10:02,000
+That's why providing anonymous function is enough for Java to create object of my interface type.
+
+126
+00:10:03,000 --> 00:10:06,000
+Let's learn what lambda expressions are in details.
+
+127
+00:10:07,000 --> 00:10:13,000
+Lambda expressions introduced in Java eight, provides a concise way to express instances of single
+
+128
+00:10:13,000 --> 00:10:15,000
+method interfaces.
+
+129
+00:10:15,000 --> 00:10:17,000
+Functional interfaces.
+
+130
+00:10:17,000 --> 00:10:24,000
+They enhance the readability and maintainability of Java code by allowing the expression of instances
+
+131
+00:10:24,000 --> 00:10:27,000
+of single method interfaces more briefly.
+
+132
+00:10:28,000 --> 00:10:31,000
+A lambda expression consists of three main components.
+
+133
+00:10:32,000 --> 00:10:37,000
+Parameters similar to method parameters, but without explicit types.
+
+134
+00:10:37,000 --> 00:10:43,000
+If a lambda takes no parameters, you use an empty set of parentheses.
+
+135
+00:10:43,000 --> 00:10:48,000
+If it takes multiple parameters, you separate them with commas.
+
+136
+00:10:48,000 --> 00:10:54,000
+If you want, you can specify types of parameters vividly, but it is not mandatory.
+
+137
+00:10:56,000 --> 00:11:03,000
+The next component is arrow token, known as the lambda operator or arrow token.
+
+138
+00:11:03,000 --> 00:11:08,000
+It separates the parameter list from the body of the lambda expression.
+
+139
+00:11:08,000 --> 00:11:14,000
+It signifies that the parameters are being used to produce the result defined by the lambda.
+
+140
+00:11:15,000 --> 00:11:17,000
+The third component body.
+
+141
+00:11:17,000 --> 00:11:23,000
+It contains the code that specifies what the lambda expression does for a single expression.
+
+142
+00:11:23,000 --> 00:11:27,000
+The body can be just that expression for multiple statements.
+
+143
+00:11:27,000 --> 00:11:31,000
+The body is enclosed in curly braces.
+
+144
+00:11:31,000 --> 00:11:36,000
+For example, comparator is a functional interface.
+
+145
+00:11:36,000 --> 00:11:38,000
+It has just one abstract mass it.
+
+146
+00:11:38,000 --> 00:11:44,000
+Compare that we need to implement in order to be able to create instances of comparator type.
+
+147
+00:11:45,000 --> 00:11:50,000
+Here is an example of how a comparator implementation looked before Java eight.
+
+148
+00:11:50,000 --> 00:11:55,000
+Basically, you described anonymous class where you provided implementation to the method.
+
+149
+00:11:56,000 --> 00:11:58,000
+This is just a sorting example.
+
+150
+00:11:59,000 --> 00:12:04,000
+And here is an example of how we can take advantage of lambda expressions.
+
+151
+00:12:04,000 --> 00:12:09,000
+Basically we just provide an implementation of compare method here.
+
+152
+00:12:09,000 --> 00:12:11,000
+Here are two parameters.
+
+153
+00:12:11,000 --> 00:12:16,000
+And compiler is smart enough to understand that these are strings.
+
+154
+00:12:16,000 --> 00:12:18,000
+And here is method body.
+
+155
+00:12:19,000 --> 00:12:25,000
+Taking into account it takes just one line I don't need to use curly brackets.
+
+156
+00:12:25,000 --> 00:12:29,000
+And compiler is also smart enough to understand that.
+
+157
+00:12:29,000 --> 00:12:35,000
+Here is return statement because it knows that comparator should be here.
+
+158
+00:12:35,000 --> 00:12:42,000
+And in case lambda expressions matches requirements of abstract method, compiler is happy and this
+
+159
+00:12:42,000 --> 00:12:45,000
+implementation will be used during the runtime.
+
+160
+00:12:46,000 --> 00:12:52,000
+In case you have any questions, please do not hesitate to post your questions below the video and I
+
+161
+00:12:52,000 --> 00:12:53,000
+will be happy to answer.
+
+162
+00:12:54,000 --> 00:12:58,000
+There is another charm that was introduced starting from Java eight.
+
+163
+00:12:58,000 --> 00:13:01,000
+It is called effectively final variables.
+
+164
+00:13:01,000 --> 00:13:03,000
+Let's learn what are they about?
+
+165
+00:13:04,000 --> 00:13:11,000
+In Java, a variable is considered effectively final if its value doesn't change after it is assigned.
+
+166
+00:13:11,000 --> 00:13:17,000
+This concept becomes relevant with the introduction of lambda expressions in Java eight.
+
+167
+00:13:17,000 --> 00:13:24,000
+Lambda expressions in Java eight have a restriction that they can only capture variables that are effectively
+
+168
+00:13:24,000 --> 00:13:24,000
+final.
+
+169
+00:13:25,000 --> 00:13:30,000
+In a lambda expression, you can reference variables from the surrounding scope.
+
+170
+00:13:30,000 --> 00:13:35,000
+However, these variables must be effectively final and effectively.
+
+171
+00:13:35,000 --> 00:13:40,000
+Final variable is a variable whose value doesn't change after it is initially assigned.
+
+172
+00:13:41,000 --> 00:13:49,000
+In this example, regular variable is a regular variable while effectively final variable is effectively
+
+173
+00:13:49,000 --> 00:13:49,000
+final.
+
+174
+00:13:50,000 --> 00:13:57,000
+If you try to modify the regular variable after it is used in the lambda expression, you will get a
+
+175
+00:13:57,000 --> 00:13:59,000
+compilation error.
+
+176
+00:13:59,000 --> 00:14:05,000
+This restriction is in place to ensure that lambda expressions can safely capture variables from the
+
+177
+00:14:05,000 --> 00:14:09,000
+enclosing scope, without unexpected changes.
+
+178
+00:14:09,000 --> 00:14:11,000
+What are use cases?
+
+179
+00:14:11,000 --> 00:14:19,000
+This effectively final rule ensures that lambda expressions behave predictably and don't introduce side
+
+180
+00:14:19,000 --> 00:14:22,000
+effects by modifying variables from the enclosing scope.
+
+181
+00:14:22,000 --> 00:14:29,000
+It promotes safer and more readable code by avoiding accidental modifications of captured variables.
+
+182
+00:14:29,000 --> 00:14:36,000
+Keep in mind that starting from Java eight, the compiler is smart enough to recognize effectively final
+
+183
+00:14:36,000 --> 00:14:40,000
+variables, and you don't have to explicitly declare them as such.
+
+184
+00:14:41,000 --> 00:14:47,000
+If a variable is effectively final, the compiler will treat it accordingly, allowing you to use it
+
+185
+00:14:47,000 --> 00:14:49,000
+in lambda expressions without any issues.
+
+186
+00:14:50,000 --> 00:14:54,000
+What is the difference between final variables and effectively final variables?
+
+187
+00:14:55,000 --> 00:15:01,000
+An effectively final variable is a concept that comes into play specifically in the context of lambda
+
+188
+00:15:01,000 --> 00:15:03,000
+expressions introduced in Java eight.
+
+189
+00:15:04,000 --> 00:15:10,000
+According to the language specification, a variable referenced in a lambda expression must be effectively
+
+190
+00:15:10,000 --> 00:15:17,000
+final, meaning its value doesn't change after it is assigned and it shouldn't necessarily have final
+
+191
+00:15:17,000 --> 00:15:23,000
+modifier, and final variable is called so when it has final modifier.
+
+192
+00:15:23,000 --> 00:15:25,000
+That's the difference.
+
+193
+00:15:26,000 --> 00:15:32,000
+This next feature that was also introduced in Java eight, and that I want to review with you is method
+
+194
+00:15:32,000 --> 00:15:33,000
+reference.
+
+195
+00:15:33,000 --> 00:15:40,000
+Method references in Java provide a shorthand notation for expressing lambda expressions that directly
+
+196
+00:15:40,000 --> 00:15:42,000
+invoke a method or constructor.
+
+197
+00:15:42,000 --> 00:15:49,000
+They make the code more concise and readable, especially when the lambda expression merely calls an
+
+198
+00:15:49,000 --> 00:15:50,000
+existing method.
+
+199
+00:15:51,000 --> 00:15:57,000
+Method references are particularly useful when working with functional interfaces, allowing you to
+
+200
+00:15:57,000 --> 00:16:00,000
+replace lambda expressions with a reference to an existing method.
+
+201
+00:16:01,000 --> 00:16:04,000
+There are four main types of method references.
+
+202
+00:16:04,000 --> 00:16:10,000
+They are reference to a static method and here you can see an example.
+
+203
+00:16:11,000 --> 00:16:14,000
+Reference to an instance method of a particular object.
+
+204
+00:16:14,000 --> 00:16:22,000
+In this example, you can see how I put the reference to the println method of the out object from the
+
+205
+00:16:22,000 --> 00:16:23,000
+system class.
+
+206
+00:16:24,000 --> 00:16:29,000
+Reference to an instance method of an arbitrary object of a particular type.
+
+207
+00:16:29,000 --> 00:16:37,000
+As you can see, this is reference not to a static method, but I use type name here instead of reference
+
+208
+00:16:37,000 --> 00:16:38,000
+to a particular object.
+
+209
+00:16:39,000 --> 00:16:46,000
+In this example, this lambda expression and this method reference performs the same operation on each
+
+210
+00:16:46,000 --> 00:16:53,000
+object, whereas this comparator will be used and describes the logic of string comparing.
+
+211
+00:16:54,000 --> 00:17:01,000
+Reference to a constructor in Java eight API, you would find cases when an interface requires you to
+
+212
+00:17:01,000 --> 00:17:07,000
+provide some kind of supplier that knows how to create objects of the specific type.
+
+213
+00:17:07,000 --> 00:17:12,000
+In such cases, you can use method references like this.
+
+214
+00:17:13,000 --> 00:17:15,000
+I believe that syntax is clear.
+
+215
+00:17:15,000 --> 00:17:20,000
+In case you have any questions, post your questions below the video players.
+
+216
+00:17:20,000 --> 00:17:25,000
+The next feature of Java eight is that I would like to review with you is stream API.
+
+217
+00:17:26,000 --> 00:17:32,000
+The stream API introduced in Java eight, provides a powerful and expressive way to process and manipulate
+
+218
+00:17:32,000 --> 00:17:34,000
+collections of data.
+
+219
+00:17:34,000 --> 00:17:41,000
+It allows developers to write functional style code to perform operations on collections, enabling
+
+220
+00:17:41,000 --> 00:17:44,000
+concise and readable code for data processing.
+
+221
+00:17:44,000 --> 00:17:47,000
+Streams are not collections themselves.
+
+222
+00:17:48,000 --> 00:17:54,000
+Rather, they are a pipeline of data that can be processed in a functional programming paradigm.
+
+223
+00:17:54,000 --> 00:18:01,000
+Streams can be created from various sources such as collections, arrays, or input output channels.
+
+224
+00:18:02,000 --> 00:18:05,000
+For example, creating a stream from a list.
+
+225
+00:18:06,000 --> 00:18:07,000
+Intermediate operations.
+
+226
+00:18:08,000 --> 00:18:12,000
+Intermediate operations transform a stream into another stream.
+
+227
+00:18:12,000 --> 00:18:18,000
+They are lazy and do not execute until a terminal operation is invoked.
+
+228
+00:18:18,000 --> 00:18:21,000
+For example, such intermediate operations as.
+
+229
+00:18:21,000 --> 00:18:23,000
+Filter map.
+
+230
+00:18:23,000 --> 00:18:23,000
+Distinct.
+
+231
+00:18:23,000 --> 00:18:24,000
+Sorted.
+
+232
+00:18:25,000 --> 00:18:33,000
+Terminal operations produce a result or a side effect and terminate the stream after a terminal operation.
+
+233
+00:18:33,000 --> 00:18:41,000
+A stream cannot be reused, for example, for each collect reuse count.
+
+234
+00:18:42,000 --> 00:18:44,000
+Parallel streams.
+
+235
+00:18:44,000 --> 00:18:49,000
+Streams can be processed in parallel to take advantage of multi-core processors.
+
+236
+00:18:50,000 --> 00:18:57,000
+But be careful with this in multi-threading part of the course, I explained in details how multi-threading
+
+237
+00:18:57,000 --> 00:18:58,000
+works in Java.
+
+238
+00:18:58,000 --> 00:19:06,000
+Be aware that on some amount of data, parallel processing can take longer than single thread processing
+
+239
+00:19:06,000 --> 00:19:12,000
+because of additional efforts that are required to synchronize work of threads between each other.
+
+240
+00:19:12,000 --> 00:19:17,000
+You can use parallel processing with parallel stream.
+
+241
+00:19:17,000 --> 00:19:24,000
+In my example, you can see how I filtered strings based on the condition and turned all strings to
+
+242
+00:19:24,000 --> 00:19:25,000
+uppercase.
+
+243
+00:19:25,000 --> 00:19:32,000
+In the next example, I used count terminal function to count amount of elements left after filtering.
+
+244
+00:19:33,000 --> 00:19:39,000
+Feel free to check Java Collections Framework section of the course where I explained a lot of others
+
+245
+00:19:39,000 --> 00:19:42,000
+different examples of using stream API.
+
+246
+00:19:43,000 --> 00:19:49,000
+The next cool and useful feature that was also introduced in Java eight is optional.
+
+247
+00:19:49,000 --> 00:19:56,000
+In Java eight, the optional class was introduced as a container object that may or may not contain
+
+248
+00:19:56,000 --> 00:19:58,000
+a non-null value.
+
+249
+00:19:59,000 --> 00:20:07,000
+It helps to handle situations where a method may or may not return a result, avoiding null checks and
+
+250
+00:20:07,000 --> 00:20:11,000
+providing a more expressive way to represent the absence of a value.
+
+251
+00:20:11,000 --> 00:20:17,000
+The optional class was introduced to address the issue of dealing with potentially null values, and
+
+252
+00:20:17,000 --> 00:20:23,000
+to reduce the occurrence of null pointer exceptions when it is recommended to use.
+
+253
+00:20:23,000 --> 00:20:24,000
+Optional.
+
+254
+00:20:24,000 --> 00:20:31,000
+Using optional helps prevent null pointer exceptions by explicitly indicating the absence of a value.
+
+255
+00:20:32,000 --> 00:20:38,000
+Optional provides a more expressive way to handle no checks compared to traditional node checks.
+
+256
+00:20:39,000 --> 00:20:44,000
+It supports functional programming principles by providing masses for handling values in a functional
+
+257
+00:20:44,000 --> 00:20:45,000
+manner.
+
+258
+00:20:46,000 --> 00:20:52,000
+Basically optional, acts as a wrapper around value, and API is built to provide you with different
+
+259
+00:20:52,000 --> 00:20:56,000
+options and opportunities to handle potential new values.
+
+260
+00:20:56,000 --> 00:20:57,000
+Processing as you wish.
+
+261
+00:20:58,000 --> 00:21:01,000
+I prepared different examples for you.
+
+262
+00:21:01,000 --> 00:21:05,000
+Here is an example of how to create optional from string.
+
+263
+00:21:05,000 --> 00:21:12,000
+Then goes example of how you can check if value is present in optional, and how to extract the value
+
+264
+00:21:12,000 --> 00:21:19,000
+in case you want to return some default value in case of null inside optional, you can use or else
+
+265
+00:21:19,000 --> 00:21:20,000
+method.
+
+266
+00:21:21,000 --> 00:21:25,000
+Here is an example of how you can initialize optional out of null value.
+
+267
+00:21:26,000 --> 00:21:31,000
+Also, in case you want to provide a function that would extract the default value in case of.
+
+268
+00:21:31,000 --> 00:21:34,000
+Now you can use or else get method.
+
+269
+00:21:35,000 --> 00:21:42,000
+You can also apply function to value if it is present with map function, or perform some function if
+
+270
+00:21:42,000 --> 00:21:46,000
+value is present using if present method.
+
+271
+00:21:47,000 --> 00:21:54,000
+You can sync that if present method is similar to map function, but they are different if present.
+
+272
+00:21:54,000 --> 00:21:57,000
+Returns void map.
+
+273
+00:21:57,000 --> 00:22:01,000
+Returns a new optional containing the result of the transformation.
+
+274
+00:22:02,000 --> 00:22:07,000
+Use if present when you want to perform an action on the value if it exists.
+
+275
+00:22:08,000 --> 00:22:12,000
+Use map when you want to transform the value if it exists.
+
+276
+00:22:12,000 --> 00:22:14,000
+That's all regarding optional.
+
+277
+00:22:15,000 --> 00:22:20,000
+Feel free to check separate lesson with dedicated only to optional plus.
+
+278
+00:22:21,000 --> 00:22:25,000
+The next features that we are going to review is called repeated annotations.
+
+279
+00:22:26,000 --> 00:22:32,000
+Java eight introduced the Repeating Annotations feature, which allows you to apply the same annotation
+
+280
+00:22:32,000 --> 00:22:35,000
+more than once to a declaration.
+
+281
+00:22:35,000 --> 00:22:41,000
+Before Java eight, if you wanted to use an annotation multiple times, you had to create a container
+
+282
+00:22:41,000 --> 00:22:45,000
+annotation to hold multiple instances of the target annotation.
+
+283
+00:22:46,000 --> 00:22:50,000
+Repeating annotations simplifies this process.
+
+284
+00:22:50,000 --> 00:22:57,000
+To define a repeated annotation, you need to use the repeatable meta annotation along with an annotation
+
+285
+00:22:57,000 --> 00:23:02,000
+type that acts as a container for the repeated annotations.
+
+286
+00:23:02,000 --> 00:23:06,000
+What are the benefits and use cases of using repeated annotations?
+
+287
+00:23:07,000 --> 00:23:13,000
+Repeating annotations provide a more concise syntax for applying the same annotation multiple times.
+
+288
+00:23:14,000 --> 00:23:20,000
+The code becomes more readable and avoids the need for a separate container annotation.
+
+289
+00:23:20,000 --> 00:23:26,000
+Repeating annotations are particularly useful in frameworks and libraries, where the same annotation
+
+290
+00:23:26,000 --> 00:23:29,000
+might be applied multiple times with different values.
+
+291
+00:23:30,000 --> 00:23:36,000
+If you scroll the source code to the bottom, you will see examples of repeated annotation.
+
+292
+00:23:36,000 --> 00:23:39,000
+In order to create repeated annotation.
+
+293
+00:23:39,000 --> 00:23:44,000
+You first need to create annotations that can store an array of other annotations.
+
+294
+00:23:44,000 --> 00:23:51,000
+And when you use repeatable annotation during the definition of the new annotation, you need to provide
+
+295
+00:23:51,000 --> 00:23:57,000
+it with the class that knows how to store an array of annotations of specific type.
+
+296
+00:23:57,000 --> 00:24:03,000
+And in my class example, you can see how I used multiple annotations of the same type.
+
+297
+00:24:03,000 --> 00:24:05,000
+Basically that's it.
+
+298
+00:24:05,000 --> 00:24:10,000
+If you want to learn more about annotations, feel free to check my course Java from zero to First Job.
+
+299
+00:24:11,000 --> 00:24:14,000
+There you will find separate lesson about annotations in Java.
+
+300
+00:24:15,000 --> 00:24:20,000
+And in case you have any questions regarding repeating annotations, feel free to post your questions
+
+301
+00:24:20,000 --> 00:24:23,000
+below the video and I will be happy to answer you.
+
+302
+00:24:24,000 --> 00:24:25,000
+At the meantime, let's continue.
+
+303
+00:24:26,000 --> 00:24:31,000
+Huge achievement of Java eight is release of new data and time API.
+
+304
+00:24:32,000 --> 00:24:39,000
+Java eight introduced a new date and Time API in the Java Time package to address the limitations and
+
+305
+00:24:39,000 --> 00:24:44,000
+shortcomings of the old Java.util.date and Java util calendar classes.
+
+306
+00:24:45,000 --> 00:24:52,000
+The new API is more comprehensive, immutable, and provides better support for handling date and time
+
+307
+00:24:52,000 --> 00:24:53,000
+operations.
+
+308
+00:24:53,000 --> 00:24:57,000
+The key classes in the new date and Time API include.
+
+309
+00:24:57,000 --> 00:25:05,000
+Local date, local time, local date time, zoned date time, instant duration, and period.
+
+310
+00:25:05,000 --> 00:25:10,000
+In this lesson, I don't have goal to review all API in details.
+
+311
+00:25:10,000 --> 00:25:16,000
+There is a separate section in my course Java from zero to first job that is called date and time in
+
+312
+00:25:16,000 --> 00:25:17,000
+GCC.
+
+313
+00:25:18,000 --> 00:25:25,000
+This section consists of multiple lessons where we learn API in details with all possible examples.
+
+314
+00:25:25,000 --> 00:25:30,000
+That's why I wouldn't stop too much on this topic in scope of this lesson, because I have multiple
+
+315
+00:25:30,000 --> 00:25:33,000
+other lessons dedicated to this topic.
+
+316
+00:25:33,000 --> 00:25:39,000
+But still, in the file with the source code of examples, you can find examples of different cases
+
+317
+00:25:39,000 --> 00:25:41,000
+and examples of different types.
+
+318
+00:25:41,000 --> 00:25:45,000
+Namely, there are examples with local date.
+
+319
+00:25:45,000 --> 00:25:47,000
+Local time.
+
+320
+00:25:47,000 --> 00:25:47,000
+Local date.
+
+321
+00:25:47,000 --> 00:25:49,000
+Time zone.
+
+322
+00:25:49,000 --> 00:25:50,000
+Date time.
+
+323
+00:25:50,000 --> 00:25:52,000
+Instant duration period.
+
+324
+00:25:53,000 --> 00:25:56,000
+Take your time exploring these examples.
+
+325
+00:25:56,000 --> 00:26:00,000
+In case you want to learn more, feel free to check the sections that I mentioned.
+
+326
+00:26:00,000 --> 00:26:04,000
+And in case of any questions, post them below the video.
+
+327
+00:26:04,000 --> 00:26:05,000
+Let's move on.
+
+328
+00:26:06,000 --> 00:26:11,000
+But new Java version is not just about introduction of new things.
+
+329
+00:26:12,000 --> 00:26:15,000
+It is also about marking some things as deprecated.
+
+330
+00:26:16,000 --> 00:26:23,000
+Marking sinks as deprecated doesn't necessarily mean that these things will be removed from next JDK
+
+331
+00:26:23,000 --> 00:26:24,000
+version.
+
+332
+00:26:25,000 --> 00:26:31,000
+The deprecation process typically involves marking an element as deprecated in one release, and then
+
+333
+00:26:31,000 --> 00:26:34,000
+remove it in in a subsequent release.
+
+334
+00:26:35,000 --> 00:26:41,000
+This provides developers with the time to update their code and migrate to alternative solutions.
+
+335
+00:26:42,000 --> 00:26:49,000
+Deprecation is often used when there are better alternatives available, and developers are encouraged
+
+336
+00:26:49,000 --> 00:26:51,000
+to use the newer options.
+
+337
+00:26:52,000 --> 00:26:59,000
+In some cases, deprecation may be related to security concerns, and continued use of the deprecated
+
+338
+00:26:59,000 --> 00:27:04,000
+element may pose risks as APIs evolve.
+
+339
+00:27:04,000 --> 00:27:11,000
+Certain elements may become outdated, and deprecation provides a clear path for developers to transition
+
+340
+00:27:11,000 --> 00:27:12,000
+to newer features.
+
+341
+00:27:13,000 --> 00:27:20,000
+But in Java eight, some things were marked as deprecated and were already removed in Java version nine.
+
+342
+00:27:20,000 --> 00:27:24,000
+So let's review things that were marked as deprecated in Java eight.
+
+343
+00:27:25,000 --> 00:27:29,000
+Let's review the deprecation of extension mechanism.
+
+344
+00:27:29,000 --> 00:27:36,000
+The extension mechanism in Java was a feature that allowed developers to extend the core functionality
+
+345
+00:27:36,000 --> 00:27:41,000
+of the Java platform by adding custom classes to the extension directories.
+
+346
+00:27:41,000 --> 00:27:48,000
+These extension directories were specified by the Java ext system property, and typically contained
+
+347
+00:27:48,000 --> 00:27:56,000
+Jar files with classes that extended or replaced existing classes in the Java standard libraries.
+
+348
+00:27:57,000 --> 00:28:05,000
+The Java ext year property was used to specify one or more directories containing extension libraries.
+
+349
+00:28:05,000 --> 00:28:12,000
+When Java Virtual Machine started, it would look in these directories to find and load classes before
+
+350
+00:28:12,000 --> 00:28:14,000
+checking the standard classpath.
+
+351
+00:28:14,000 --> 00:28:21,000
+This allowed developers to add or replace classes in the standard libraries without modifying the core
+
+352
+00:28:21,000 --> 00:28:23,000
+Java installation.
+
+353
+00:28:23,000 --> 00:28:27,000
+However, the extension mechanism had several drawbacks and issues.
+
+354
+00:28:28,000 --> 00:28:31,000
+Number one global namespace.
+
+355
+00:28:31,000 --> 00:28:38,000
+All installed extensions shared the same global namespace, which could lead to naming conflicts.
+
+356
+00:28:38,000 --> 00:28:46,000
+If multiple extensions defined classes with the same name, it could result in unpredictable behavior.
+
+357
+00:28:47,000 --> 00:28:48,000
+Versioning issues.
+
+358
+00:28:48,000 --> 00:28:55,000
+There was no clear versioning mechanism for extensions if different applications relied on different
+
+359
+00:28:55,000 --> 00:28:56,000
+versions of an extension.
+
+360
+00:28:56,000 --> 00:28:58,000
+Conflicts could arise.
+
+361
+00:28:59,000 --> 00:29:01,000
+Security concerns.
+
+362
+00:29:01,000 --> 00:29:06,000
+Allowing applications to modify the core libraries raised security concerns.
+
+363
+00:29:07,000 --> 00:29:14,000
+Malicious extensions could potentially compromise the stability and security of the Java Runtime environment.
+
+364
+00:29:14,000 --> 00:29:16,000
+LastPass complexity.
+
+365
+00:29:16,000 --> 00:29:23,000
+The extension mechanism added complexity to the classpath resolution process, making it harder to manage
+
+366
+00:29:23,000 --> 00:29:26,000
+dependencies and troubleshoot issues.
+
+367
+00:29:27,000 --> 00:29:33,000
+Due to these issues and the evolving security requirements, the extension mechanism was deprecated
+
+368
+00:29:33,000 --> 00:29:34,000
+in Java eight.
+
+369
+00:29:35,000 --> 00:29:41,000
+Deprecated means that the feature is still available, but it is advised against using it because it
+
+370
+00:29:41,000 --> 00:29:44,000
+may be removed in future versions.
+
+371
+00:29:44,000 --> 00:29:51,000
+As an alternative, developers are encouraged to use other mechanisms for extended functionality, such
+
+372
+00:29:51,000 --> 00:29:53,000
+as using standard classpath entries.
+
+373
+00:29:53,000 --> 00:29:59,000
+Build tools like Maven or Gradle for managing dependencies and modularization.
+
+374
+00:29:59,000 --> 00:30:04,000
+Introduced in Java nine with the Java Platform Module system.
+
+375
+00:30:04,000 --> 00:30:11,000
+So the deprecation of the extension mechanism was a step towards addressing naming conflicts, versioning
+
+376
+00:30:11,000 --> 00:30:18,000
+issues and security concerns, while encouraging better practices for managing dependencies and modularization
+
+377
+00:30:18,000 --> 00:30:20,000
+in Java applications.
+
+378
+00:30:21,000 --> 00:30:27,000
+Another thing that was deprecated are some rarely used garbage collection combinations.
+
+379
+00:30:27,000 --> 00:30:35,000
+The motivation behind deprecation lies in addressing the high maintenance costs associated with maintaining
+
+380
+00:30:35,000 --> 00:30:38,000
+deprecated garbage collector combinations.
+
+381
+00:30:38,000 --> 00:30:45,000
+By removing these combinations, the hotspot garbage collector code can be simplified, resulting in
+
+382
+00:30:45,000 --> 00:30:52,000
+a reduction of bugs and facilitating faster development of remaining garbage collector combinations.
+
+383
+00:30:52,000 --> 00:31:00,000
+The core of this deprecation is the removal of flags that control deprecated garbage collector combinations
+
+384
+00:31:00,000 --> 00:31:04,000
+and concurrent mark sweep foreground collector flags.
+
+385
+00:31:05,000 --> 00:31:08,000
+This removal means no deprecation messages will be printed.
+
+386
+00:31:09,000 --> 00:31:13,000
+Instead, the JVM will not start if these deprecated flags are used.
+
+387
+00:31:14,000 --> 00:31:20,000
+This initiative will also lead to the removal of that code from the garbage collector code base.
+
+388
+00:31:20,000 --> 00:31:25,000
+Once the slide, you can find deprecated garbage collector combinations.
+
+389
+00:31:25,000 --> 00:31:32,000
+There is a risk that users need to update JVM startup command lines if they were using the removed flags.
+
+390
+00:31:32,000 --> 00:31:38,000
+However, the assumption is that users will benefit from migrating to more modern garbage collector
+
+391
+00:31:38,000 --> 00:31:40,000
+tuning options.
+
+392
+00:31:40,000 --> 00:31:48,000
+The benefit of this deprecation includes a cleaner code base, reduced bugs, and an accelerated development
+
+393
+00:31:48,000 --> 00:31:48,000
+pace.
+
+394
+00:31:49,000 --> 00:31:58,000
+Users transitioning from JDK eight to JDK nine should be aware of these deprecations, so it is recommended
+
+395
+00:31:58,000 --> 00:32:03,000
+embracing more modern garbage collector tuning options for optimal performance.
+
+396
+00:32:04,000 --> 00:32:06,000
+That's all regarding Java eight updates.
+
+397
+00:32:06,000 --> 00:32:09,000
+I believe we need a great review.
+
+398
+00:32:09,000 --> 00:32:12,000
+Let's recap what we have learned in this lesson.
+
+399
+00:32:13,000 --> 00:32:21,000
+Java eight is a revolutionary update for Java, which updated Java significantly and increased its popularity
+
+400
+00:32:21,000 --> 00:32:23,000
+among modern programming languages.
+
+401
+00:32:24,000 --> 00:32:31,000
+We learned all new features that were released in Java version eight, namely interface, default and
+
+402
+00:32:31,000 --> 00:32:37,000
+static methods, functional interfaces, Lambda expressions, message references.
+
+403
+00:32:37,000 --> 00:32:43,000
+Effectively final variables stream API optional class repeating annotations.
+
+404
+00:32:43,000 --> 00:32:45,000
+New data time API.
+
+405
+00:32:45,000 --> 00:32:51,000
+Besides learning what was new in Java eight, we learned also what was marked as deprecated in Java
+
+406
+00:32:51,000 --> 00:32:52,000
+eight.
+
+407
+00:32:52,000 --> 00:32:59,000
+We learned about deprecation of the extension mechanism and deprecation of rarely used garbage collectors
+
+408
+00:32:59,000 --> 00:33:00,000
+combinations.
+
+409
+00:33:01,000 --> 00:33:03,000
+So that's it for this lesson.
+
+410
+00:33:03,000 --> 00:33:05,000
+Thanks a lot for your attention.
+
+411
+00:33:05,000 --> 00:33:08,000
+Have a great day and see you in the next lesson.
+
diff --git a/44 - Java New Versions/001 Source-code-example-from-the-lesson.url b/44 - Java New Versions/001 Source-code-example-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..56ec74f974dbc6dccc24f205638d6d27db883258
--- /dev/null
+++ b/44 - Java New Versions/001 Source-code-example-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/commit/040f22477c4b9d4d33c2be9d5a385821c6b866e6
\ No newline at end of file
diff --git a/44 - Java New Versions/002 Java 9 Stream API Updates, Multi-Resolution Image, Stack-Walking API, etc_en.srt b/44 - Java New Versions/002 Java 9 Stream API Updates, Multi-Resolution Image, Stack-Walking API, etc_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..556ad931e363dc88c45ea869a7e8b99ee9876b7a
--- /dev/null
+++ b/44 - Java New Versions/002 Java 9 Stream API Updates, Multi-Resolution Image, Stack-Walking API, etc_en.srt
@@ -0,0 +1,960 @@
+1
+00:00:05,000 --> 00:00:11,000
+Hello dear students, in this lesson we are going to learn features and updates in Java version nine.
+
+2
+00:00:12,000 --> 00:00:19,000
+Today we'll dive into language enhancements and API updates, discovering tools that simplify development
+
+3
+00:00:19,000 --> 00:00:21,000
+and make your code more efficient.
+
+4
+00:00:22,000 --> 00:00:26,000
+Java nine introduces game changing improvements to the language.
+
+5
+00:00:26,000 --> 00:00:32,000
+We'll explore the flow API, empowering developers with reactive stream capabilities.
+
+6
+00:00:32,000 --> 00:00:40,000
+The Java Platform Module system revolutionized project organization and the collection factory methods
+
+7
+00:00:40,000 --> 00:00:45,000
+that offer concise ways to create lists, sets, and maps.
+
+8
+00:00:45,000 --> 00:00:53,000
+Stream API enhancements, Multi-resolution image handling, and the Stack Walking API provide a comprehensive
+
+9
+00:00:53,000 --> 00:00:56,000
+look at Java's evolving capabilities.
+
+10
+00:00:56,000 --> 00:00:59,000
+And also we'll review a lot of other features.
+
+11
+00:01:00,000 --> 00:01:03,000
+Our journey doesn't stop at language features.
+
+12
+00:01:03,000 --> 00:01:05,000
+We'll learn the process API updates.
+
+13
+00:01:05,000 --> 00:01:12,000
+Gaining in-depth insights into process management, the Completablefuture API introduces new methods
+
+14
+00:01:12,000 --> 00:01:14,000
+for asynchronous operations.
+
+15
+00:01:14,000 --> 00:01:20,000
+We'll learn such tools as Jlink that provide practical solutions for creating custom jewelry, images,
+
+16
+00:01:20,000 --> 00:01:22,000
+and interactive Java commands.
+
+17
+00:01:23,000 --> 00:01:28,000
+I will explain you what the Jshell is and how you can use it during the development.
+
+18
+00:01:28,000 --> 00:01:36,000
+But besides new things, we'll also learn which things were marked as deprecated and which things were
+
+19
+00:01:36,000 --> 00:01:38,000
+completely removed starting from Java nine.
+
+20
+00:01:39,000 --> 00:01:46,000
+I will highlight changes like the applet API deprecation, Cms's garbage collector removal, and the
+
+21
+00:01:46,000 --> 00:01:48,000
+farewell to Java Web Start.
+
+22
+00:01:48,000 --> 00:01:54,000
+As you can see in the agenda, we have significantly more to learn in this lesson.
+
+23
+00:01:55,000 --> 00:02:00,000
+After this lesson, you are going to know literally everything about Java nine update and you will have
+
+24
+00:02:00,000 --> 00:02:03,000
+enough knowledge to implement improvements on practice.
+
+25
+00:02:03,000 --> 00:02:05,000
+Let's start our lesson.
+
+26
+00:02:06,000 --> 00:02:12,000
+If you are a student of my course Java from zero to first job, then you are already aware of the fact
+
+27
+00:02:12,000 --> 00:02:16,000
+that we learned some of the Java nine features before.
+
+28
+00:02:16,000 --> 00:02:22,000
+There are some bigger topics that may require separate lessons, and it would be hard to cover them
+
+29
+00:02:22,000 --> 00:02:26,000
+together with other topics because we need more time to learn them.
+
+30
+00:02:27,000 --> 00:02:34,000
+Namely, we already had a lesson about flow API and reactive programming in Java, so feel free to find
+
+31
+00:02:34,000 --> 00:02:37,000
+the full lesson about flow API in my course.
+
+32
+00:02:37,000 --> 00:02:39,000
+Java from zero to First job.
+
+33
+00:02:40,000 --> 00:02:43,000
+I will just briefly remind you what flow API is about.
+
+34
+00:02:43,000 --> 00:02:49,000
+The Java Flow API is a set of programming interfaces introduced in Java nine to simplify the development
+
+35
+00:02:49,000 --> 00:02:52,000
+of reactive and asynchronous programming.
+
+36
+00:02:52,000 --> 00:02:58,000
+It provides a framework for handling streams of data in a non-blocking manner, allowing developers
+
+37
+00:02:58,000 --> 00:03:02,000
+to write more scalable and responsive applications.
+
+38
+00:03:02,000 --> 00:03:10,000
+The flow API includes components such as publishers, subscribers, and processors which enable the
+
+39
+00:03:10,000 --> 00:03:12,000
+implementation of reactive streams.
+
+40
+00:03:12,000 --> 00:03:18,000
+This facilitates the communication and coordination between different parts of a program, making it
+
+41
+00:03:18,000 --> 00:03:23,000
+easier to handle asynchronous events and manage data flow efficiently.
+
+42
+00:03:23,000 --> 00:03:30,000
+Another topic that we already discussed and learned in a separate lesson is Java Platform Module System.
+
+43
+00:03:30,000 --> 00:03:37,000
+In my course Java from zero to first job, we have separate sections that is called Java Platform Module
+
+44
+00:03:37,000 --> 00:03:40,000
+System and that consists of multiple lessons.
+
+45
+00:03:41,000 --> 00:03:47,000
+In those lessons, we review examples of modular application in Java and how to migrate existing Java
+
+46
+00:03:47,000 --> 00:03:50,000
+applications to modular applications.
+
+47
+00:03:50,000 --> 00:03:53,000
+Let me remind you what this feature is about.
+
+48
+00:03:53,000 --> 00:04:00,000
+The Java Platform Module System is a feature introduced in Java nine to enhance modularity in the Java
+
+49
+00:04:00,000 --> 00:04:02,000
+Standard Edition platform.
+
+50
+00:04:03,000 --> 00:04:09,000
+It enables developers to organize code into modular components called modules, allowing for better
+
+51
+00:04:09,000 --> 00:04:14,000
+encapsulation, reusability, and maintainability of Java applications.
+
+52
+00:04:15,000 --> 00:04:21,000
+With Java Platform Module system, developers can explicitly declare dependencies between modules,
+
+53
+00:04:21,000 --> 00:04:25,000
+leading to a more efficient and scalable software architecture.
+
+54
+00:04:25,000 --> 00:04:32,000
+This modular approach helps in managing the complexity of large code bases, improves code organization,
+
+55
+00:04:32,000 --> 00:04:39,000
+and enhances the maintainability of Java applications by reducing dependencies and providing a clearer
+
+56
+00:04:39,000 --> 00:04:43,000
+separation of concerns between different parts of the system.
+
+57
+00:04:44,000 --> 00:04:50,000
+But there are a lot of other smaller updates that I decided to group in one lesson and review them with
+
+58
+00:04:50,000 --> 00:04:56,000
+you today, and we are going to learn them on practical examples, especially for you.
+
+59
+00:04:56,000 --> 00:04:59,000
+I prepared code examples with new features.
+
+60
+00:04:59,000 --> 00:05:03,000
+In this way it will be easier for you to understand new concepts.
+
+61
+00:05:04,000 --> 00:05:08,000
+As always, you can find source code attachments to the lesson.
+
+62
+00:05:08,000 --> 00:05:15,000
+Let me start screen sharing and we will review examples that I prepared for you and grouped examples
+
+63
+00:05:15,000 --> 00:05:17,000
+under Java nine package.
+
+64
+00:05:17,000 --> 00:05:20,000
+Feel free to explore the source code examples.
+
+65
+00:05:20,000 --> 00:05:25,000
+We are going to review each feature one by one in case you would have any questions.
+
+66
+00:05:25,000 --> 00:05:30,000
+Post your questions below the video and I will be happy to answer those.
+
+67
+00:05:30,000 --> 00:05:33,000
+I opened the file that is called Java nine.
+
+68
+00:05:34,000 --> 00:05:39,000
+Let me run it in order to print all console output and explore it with you.
+
+69
+00:05:39,000 --> 00:05:42,000
+Reviewing the source code line by line.
+
+70
+00:05:42,000 --> 00:05:47,000
+Let's review new collection factory methods that were introduced in Java nine.
+
+71
+00:05:48,000 --> 00:05:51,000
+List of set of map of.
+
+72
+00:05:52,000 --> 00:05:58,000
+Java nine introduced several new features, and one notable addition is a collection factory methods.
+
+73
+00:05:59,000 --> 00:06:05,000
+These methods provide a concise way to create immutable instances of lists, set and map.
+
+74
+00:06:05,000 --> 00:06:12,000
+The collection factory methods introduced in Java nine, such as list of set off and map off, produce
+
+75
+00:06:12,000 --> 00:06:14,000
+immutable collections.
+
+76
+00:06:14,000 --> 00:06:21,000
+Immutability means that the contents of the collection can't be changed after the collection is created.
+
+77
+00:06:22,000 --> 00:06:26,000
+Let's review examples for each list of methods.
+
+78
+00:06:26,000 --> 00:06:32,000
+List of method allows you to create an immutable list with a specified number of elements.
+
+79
+00:06:33,000 --> 00:06:38,000
+In the example, the list of method is used to create an immutable list of strings.
+
+80
+00:06:38,000 --> 00:06:46,000
+Once created, the list can be modified, providing a simple and safe way to work with constant data.
+
+81
+00:06:47,000 --> 00:06:48,000
+Set off mast.
+
+82
+00:06:49,000 --> 00:06:55,000
+The set off method is used to create an immutable set with a specified elements.
+
+83
+00:06:55,000 --> 00:07:02,000
+In the example, the set off method creates an immutable set of integers similar to lists.
+
+84
+00:07:02,000 --> 00:07:07,000
+Sets created with this method can't be modified after creation.
+
+85
+00:07:08,000 --> 00:07:09,000
+Map of Mashhad.
+
+86
+00:07:09,000 --> 00:07:14,000
+The map of Mashhad creates an immutable map with key value pairs.
+
+87
+00:07:15,000 --> 00:07:21,000
+In this example, the map of Mashhad is used to create an immutable map where names are associated with
+
+88
+00:07:21,000 --> 00:07:23,000
+the corresponding ages.
+
+89
+00:07:23,000 --> 00:07:29,000
+Once created, the entries in the map can be added, removed or modified.
+
+90
+00:07:29,000 --> 00:07:36,000
+This collection factory methods in Java nine provide a convenient way to create small, immutable collections
+
+91
+00:07:36,000 --> 00:07:43,000
+with a simple and readable syntax, promoting better code clarity and reducing the risk of accidental
+
+92
+00:07:43,000 --> 00:07:45,000
+modifications.
+
+93
+00:07:45,000 --> 00:07:51,000
+But why immutable collections are needed and in which cases it is recommended to use them.
+
+94
+00:07:51,000 --> 00:07:56,000
+There are several reasons why these collections are designed to be immutable.
+
+95
+00:07:56,000 --> 00:07:58,000
+Thread safety.
+
+96
+00:07:58,000 --> 00:08:05,000
+Immutable collections are inherently thread safe since the contents can be modified after creation.
+
+97
+00:08:05,000 --> 00:08:12,000
+There is no need for locks or synchronization mechanism when accessing collection from multiple threads.
+
+98
+00:08:13,000 --> 00:08:19,000
+This simplifies concurrent programming and reduces the risk of race conditions.
+
+99
+00:08:20,000 --> 00:08:21,000
+Predictable behavior.
+
+100
+00:08:21,000 --> 00:08:28,000
+Immutability ensures that the state of the collection remains constant throughout its life cycle.
+
+101
+00:08:28,000 --> 00:08:35,000
+This predictability is beneficial for reasoning about code, making it easier to understand and maintain.
+
+102
+00:08:35,000 --> 00:08:43,000
+Developers can rely on the fact that once a collection is created, its contents will not change unexpectedly.
+
+103
+00:08:44,000 --> 00:08:45,000
+Security.
+
+104
+00:08:45,000 --> 00:08:53,000
+Immutable collections can enhance security by preventing unintended modifications in scenarios where
+
+105
+00:08:53,000 --> 00:08:54,000
+constant data is required.
+
+106
+00:08:54,000 --> 00:09:02,000
+Using immutable collections helps safeguard against accidental changes or tampering with critical data
+
+107
+00:09:02,000 --> 00:09:03,000
+structures.
+
+108
+00:09:04,000 --> 00:09:05,000
+Simplified code.
+
+109
+00:09:05,000 --> 00:09:11,000
+Immutable collections encourage a functional programming style, where operations on collections do
+
+110
+00:09:11,000 --> 00:09:18,000
+not modify the original data, but instead create new instances with the desired changes.
+
+111
+00:09:18,000 --> 00:09:25,000
+This can lead to cleaner and more maintainable code as it reduces the risk of side effects.
+
+112
+00:09:25,000 --> 00:09:27,000
+Performance optimizations.
+
+113
+00:09:28,000 --> 00:09:31,000
+Immutability allows for certain performance optimizations.
+
+114
+00:09:31,000 --> 00:09:38,000
+For instance, implementations can share internal data structures between different instances of immutable
+
+115
+00:09:38,000 --> 00:09:41,000
+collections when they have the same elements.
+
+116
+00:09:42,000 --> 00:09:48,000
+This sharing reduces memory overhead and can lead to more efficient use of resources.
+
+117
+00:09:49,000 --> 00:09:50,000
+API design.
+
+118
+00:09:50,000 --> 00:09:54,000
+Immutable collections provide a clear and consistent API.
+
+119
+00:09:54,000 --> 00:10:01,000
+Once created, developers can rely on the fact that the collection will not be altered unexpectedly.
+
+120
+00:10:01,000 --> 00:10:07,000
+This simplicity in design makes APIs more intuitive and less error prone.
+
+121
+00:10:08,000 --> 00:10:09,000
+Okay.
+
+122
+00:10:09,000 --> 00:10:11,000
+Let's continue and review the next feature.
+
+123
+00:10:11,000 --> 00:10:13,000
+Let's get back to our source code.
+
+124
+00:10:13,000 --> 00:10:14,000
+Examples.
+
+125
+00:10:15,000 --> 00:10:22,000
+Java nine introduced several enhancements to the stream API, including the tick while drop while of
+
+126
+00:10:22,000 --> 00:10:26,000
+nullable, and improvements to the iterate method.
+
+127
+00:10:26,000 --> 00:10:29,000
+Let's explore each of these features with examples.
+
+128
+00:10:30,000 --> 00:10:31,000
+Take wild method.
+
+129
+00:10:32,000 --> 00:10:38,000
+The Take wild method allows you to take elements from a stream while a specified condition holds true.
+
+130
+00:10:39,000 --> 00:10:44,000
+It stops processing the stream once the condition becomes false.
+
+131
+00:10:44,000 --> 00:10:50,000
+In the example, the take while method is used to take elements from the stream, while the condition
+
+132
+00:10:50,000 --> 00:10:54,000
+and less than four holds true.
+
+133
+00:10:55,000 --> 00:11:02,000
+Drop while massive, the drop while massive skips elements from a stream while a specified condition
+
+134
+00:11:02,000 --> 00:11:04,000
+holds true.
+
+135
+00:11:04,000 --> 00:11:09,000
+Basically, this method is the opposite to the one that we reviewed.
+
+136
+00:11:09,000 --> 00:11:13,000
+It starts processing the stream once the condition becomes false.
+
+137
+00:11:14,000 --> 00:11:21,000
+Here the drop while method skips elements until the condition n less than four becomes false.
+
+138
+00:11:22,000 --> 00:11:24,000
+Of nullable masses.
+
+139
+00:11:24,000 --> 00:11:32,000
+The of nullable method allows you to create a stream with a single non-null element, or an empty stream
+
+140
+00:11:32,000 --> 00:11:34,000
+if the provided element is null.
+
+141
+00:11:34,000 --> 00:11:40,000
+In this example, the of nullable mass, it creates a stream with the value 42.
+
+142
+00:11:41,000 --> 00:11:46,000
+It helps in reducing the need for explicit null checks before creating a stream.
+
+143
+00:11:46,000 --> 00:11:53,000
+Instead of checking if an object is null and then deciding whether to create a stream, you can use
+
+144
+00:11:53,000 --> 00:11:56,000
+stream of nullable method directly.
+
+145
+00:11:56,000 --> 00:12:04,000
+When working with optional values, stream of nullable can be used to convert an optional into a stream.
+
+146
+00:12:04,000 --> 00:12:11,000
+When the stream contains either the value if present or is empty if the optional is empty.
+
+147
+00:12:12,000 --> 00:12:14,000
+Improved iterate method.
+
+148
+00:12:15,000 --> 00:12:22,000
+The iterate method has been enhanced to take a predicate, allowing you to iterate over elements while
+
+149
+00:12:22,000 --> 00:12:24,000
+a condition holds true.
+
+150
+00:12:24,000 --> 00:12:31,000
+Here, the iterate method generates a stream starting from one and doubling the value until the condition
+
+151
+00:12:31,000 --> 00:12:35,000
+and less than ten becomes false.
+
+152
+00:12:35,000 --> 00:12:42,000
+This enhancements in Java nine stream API provide more expressive ways to work with streams, allowing
+
+153
+00:12:42,000 --> 00:12:49,000
+for concise and readable code when dealing with conditions and transformations of streaming data.
+
+154
+00:12:50,000 --> 00:12:56,000
+The next update in Java nine is that I want to review with you is Multi-resolution image API.
+
+155
+00:12:56,000 --> 00:13:04,000
+The Multi-resolution image interface in Java is like a smart image that knows how to pick the best version
+
+156
+00:13:04,000 --> 00:13:08,000
+of itself based on different resolutions or sizes.
+
+157
+00:13:09,000 --> 00:13:16,000
+It's useful when you have various versions of an image tailored for different screen sizes or display
+
+158
+00:13:16,000 --> 00:13:17,000
+resolutions.
+
+159
+00:13:17,000 --> 00:13:18,000
+Why it is needed.
+
+160
+00:13:19,000 --> 00:13:25,000
+When you have an application that runs on devices with different screen sizes or resolutions, using
+
+161
+00:13:25,000 --> 00:13:30,000
+Multi-resolution image can help display the most suitable image version for each device.
+
+162
+00:13:31,000 --> 00:13:37,000
+This ensures that your application looks good and performs well on various screens.
+
+163
+00:13:38,000 --> 00:13:39,000
+When to use it.
+
+164
+00:13:39,000 --> 00:13:46,000
+Use Multi-resolution image when you want your application to adapt to different screen sizes.
+
+165
+00:13:46,000 --> 00:13:54,000
+It's handy for responsive design, making sure your images look cool and well suited for various devices,
+
+166
+00:13:54,000 --> 00:13:58,000
+from small smartphones to large desktop monitors.
+
+167
+00:13:59,000 --> 00:14:01,000
+Let's review an example.
+
+168
+00:14:01,000 --> 00:14:09,000
+Let's say you have a logo for your app, and you want it to look sharp on both small mobile screens
+
+169
+00:14:09,000 --> 00:14:12,000
+and large desktop monitors.
+
+170
+00:14:12,000 --> 00:14:20,000
+But for mobile screens, there is no need to upload the heaviest version of an image because mobile
+
+171
+00:14:20,000 --> 00:14:21,000
+screens are smaller.
+
+172
+00:14:22,000 --> 00:14:29,000
+And that's why there is just no need in uploading heavy version with high resolution that you would
+
+173
+00:14:29,000 --> 00:14:30,000
+use for TV resolution.
+
+174
+00:14:30,000 --> 00:14:38,000
+For example, you create a multi resolution image for the logo, providing different versions of the
+
+175
+00:14:38,000 --> 00:14:41,000
+image optimized for different resolutions.
+
+176
+00:14:41,000 --> 00:14:49,000
+When the app runs, the multi resolution image selects the best version based on the screen size, depending
+
+177
+00:14:49,000 --> 00:14:53,000
+on the selection logic that you would define in the code.
+
+178
+00:14:53,000 --> 00:15:00,000
+In this example, the multi resolution image ensures that the app logo looks great on screens of different
+
+179
+00:15:00,000 --> 00:15:01,000
+sizes.
+
+180
+00:15:01,000 --> 00:15:08,000
+By dynamically selecting the most suitable version, I create an object of multi resolution image type.
+
+181
+00:15:08,000 --> 00:15:14,000
+In simple words, this object is a container for different resolution of one image.
+
+182
+00:15:14,000 --> 00:15:17,000
+For the sake of this demo I created get logo method.
+
+183
+00:15:18,000 --> 00:15:25,000
+Feel free to explore the source code in details here, but in short I create three image objects and
+
+184
+00:15:25,000 --> 00:15:34,000
+then I create object of my custom type simple multi resolution image, which in turn implements Multi-resolution
+
+185
+00:15:34,000 --> 00:15:36,000
+image interface in mass.
+
+186
+00:15:36,000 --> 00:15:42,000
+At get resolution variant, you need to define logic which version of image to provide.
+
+187
+00:15:42,000 --> 00:15:49,000
+Based on the provided screen resolution, you need to come up with some business rules when to return
+
+188
+00:15:49,000 --> 00:15:50,000
+which image.
+
+189
+00:15:51,000 --> 00:15:55,000
+In this particular case, I just return the first element from the list.
+
+190
+00:15:55,000 --> 00:16:03,000
+In order to simplify the example from logo object, I can get the image that's use the best to the specified
+
+191
+00:16:03,000 --> 00:16:08,000
+resolution by invoking get resolution variant method.
+
+192
+00:16:08,000 --> 00:16:16,000
+In this case, I just passed some screen width and screen height, and in order to show you the selected
+
+193
+00:16:16,000 --> 00:16:20,000
+image, I use Jframe from Javax swing package.
+
+194
+00:16:21,000 --> 00:16:23,000
+I set the selected image to the frame.
+
+195
+00:16:24,000 --> 00:16:25,000
+That's how it works.
+
+196
+00:16:25,000 --> 00:16:32,000
+In case you have any questions, please post your questions below the video and I will be happy to answer.
+
+197
+00:16:32,000 --> 00:16:37,000
+Let's review the next feature that was released in Java version nine.
+
+198
+00:16:37,000 --> 00:16:40,000
+Now we are going to review Stack Working API.
+
+199
+00:16:41,000 --> 00:16:49,000
+The Stack Working API in Java nine provides a way to traverse the stack frames of a thread, allowing
+
+200
+00:16:49,000 --> 00:16:53,000
+you to inspect and manipulate the frames at the runtime.
+
+201
+00:16:53,000 --> 00:17:02,000
+This API is part of the Java Lang package, and it is introduced to replace the older and less flexible
+
+202
+00:17:02,000 --> 00:17:05,000
+sun reflect reflection.
+
+203
+00:17:05,000 --> 00:17:07,000
+Get color class method.
+
+204
+00:17:07,000 --> 00:17:14,000
+The Stack Working API is particularly useful for various diagnostic and monitoring tools, profilers,
+
+205
+00:17:14,000 --> 00:17:19,000
+and security frameworks that need to analyze the call stack dynamically.
+
+206
+00:17:19,000 --> 00:17:26,000
+It allows you to walk up and down the stack frames, inspecting information about the classes, methods,
+
+207
+00:17:26,000 --> 00:17:28,000
+and other details.
+
+208
+00:17:28,000 --> 00:17:33,000
+Here is a brief overview of main components of stack working API.
+
+209
+00:17:34,000 --> 00:17:35,000
+Stack worker class.
+
+210
+00:17:36,000 --> 00:17:40,000
+The stack worker class is the entry point to the stack working API.
+
+211
+00:17:40,000 --> 00:17:44,000
+It provides factory methods to obtain instances of stack worker.
+
+212
+00:17:45,000 --> 00:17:50,000
+You can create a stack worker for the current thread or for a specific thread.
+
+213
+00:17:50,000 --> 00:17:53,000
+Basically you can use get instance method.
+
+214
+00:17:53,000 --> 00:17:55,000
+It is overloaded.
+
+215
+00:17:56,000 --> 00:17:58,000
+Stack frame interface.
+
+216
+00:17:58,000 --> 00:18:03,000
+The stack frame interface represents a single frame in the call stack.
+
+217
+00:18:04,000 --> 00:18:10,000
+It provides methods to retrieve information about the class method, and other details of the frame.
+
+218
+00:18:11,000 --> 00:18:12,000
+Walking the stack.
+
+219
+00:18:13,000 --> 00:18:19,000
+You can use the stack walk walk method to traverse the stack frames.
+
+220
+00:18:19,000 --> 00:18:26,000
+The Walk action interface allows you to define custom actions that are executed for each frame in the
+
+221
+00:18:26,000 --> 00:18:27,000
+stack.
+
+222
+00:18:27,000 --> 00:18:31,000
+In the examples that you see on the screen, stack walk.
+
+223
+00:18:31,000 --> 00:18:39,000
+Walk is used to walk the stack frames and information about each frame is collected and printed.
+
+224
+00:18:39,000 --> 00:18:46,000
+The stack frame to string method is just one way to obtain information about the frame.
+
+225
+00:18:46,000 --> 00:18:53,000
+You can use various other methods provided by the stack frame interface to access specific details.
+
+226
+00:18:54,000 --> 00:19:00,000
+It is important to note that walking the entire stack can have performance implications, and the stack
+
+227
+00:19:00,000 --> 00:19:05,000
+walking API is intended for diagnostic and monitoring purposes.
+
+228
+00:19:06,000 --> 00:19:14,000
+Always be mindful of the impact on performance when using such APIs, especially in production code.
+
+229
+00:19:14,000 --> 00:19:21,000
+The Stack Walker API is useful in scenarios where you need to dynamically inspect the call stack frames
+
+230
+00:19:21,000 --> 00:19:23,000
+of a running Java program.
+
+231
+00:19:23,000 --> 00:19:31,000
+This API is commonly used in various diagnostic and monitoring tools, profiling applications, security
+
+232
+00:19:31,000 --> 00:19:36,000
+frameworks, and other scenarios where runtime stack analysis is required.
+
+233
+00:19:37,000 --> 00:19:43,000
+The next improvement in Java version nine is minor, but still interesting to talk about.
+
+234
+00:19:43,000 --> 00:19:49,000
+I am talking about get package name method of the class object in Java nine.
+
+235
+00:19:49,000 --> 00:19:56,000
+The get package name method was introduced to the class class, providing a convenient way to retrieve
+
+236
+00:19:56,000 --> 00:19:58,000
+the package name of a class directly.
+
+237
+00:19:58,000 --> 00:20:06,000
+Before Java nine, developers often had to use the get package method, followed by calling get name
+
+238
+00:20:06,000 --> 00:20:07,000
+to get the package name.
+
+239
+00:20:08,000 --> 00:20:14,000
+Actually not a significant change and not too many things to elaborate here.
+
+240
+00:20:14,000 --> 00:20:15,000
+Let's continue.
+
diff --git a/44 - Java New Versions/002 Source-code-example-from-the-lesson.url b/44 - Java New Versions/002 Source-code-example-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..0bd957d35e00de3e3b6aeeb1b5e1f9c855793e6c
--- /dev/null
+++ b/44 - Java New Versions/002 Source-code-example-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/commit/e53e759c361aedca987fd1a24f9fc2e3a1cb3d63
\ No newline at end of file
diff --git a/44 - Java New Versions/003 Java 9 Process API & CompletableFuture API updates, Interface Private Methods_en.srt b/44 - Java New Versions/003 Java 9 Process API & CompletableFuture API updates, Interface Private Methods_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..9c409cd6b28a649fe0010ad75ef8a31f9cca5b98
--- /dev/null
+++ b/44 - Java New Versions/003 Java 9 Process API & CompletableFuture API updates, Interface Private Methods_en.srt
@@ -0,0 +1,800 @@
+1
+00:00:04,000 --> 00:00:09,000
+Let's talk about process API updates that were introduced in Java nine.
+
+2
+00:00:09,000 --> 00:00:16,000
+In Java nine, significant updates were introduced to the process API, providing more control and information
+
+3
+00:00:16,000 --> 00:00:18,000
+about operating system processes.
+
+4
+00:00:19,000 --> 00:00:26,000
+These enhancements aim to improve the interaction with native processes and facilitate better management
+
+5
+00:00:26,000 --> 00:00:28,000
+of external commands and applications.
+
+6
+00:00:29,000 --> 00:00:34,000
+Here are the key features related to process API updates in Java nine.
+
+7
+00:00:35,000 --> 00:00:35,000
+Process.
+
+8
+00:00:35,000 --> 00:00:37,000
+Handle interface.
+
+9
+00:00:37,000 --> 00:00:43,000
+The process handle interface is introduced in Java nine, offering a handle to a native process.
+
+10
+00:00:44,000 --> 00:00:50,000
+It provides methods to query information about the process, such as the process, ID, parent process,
+
+11
+00:00:50,000 --> 00:00:52,000
+and whether the process is alive.
+
+12
+00:00:53,000 --> 00:00:56,000
+You can obtain a process handle from a process object.
+
+13
+00:00:56,000 --> 00:00:58,000
+Let me show you this on an example.
+
+14
+00:00:59,000 --> 00:01:02,000
+Imagine that I have notepad process.
+
+15
+00:01:02,000 --> 00:01:09,000
+If you run this code on a windows machine, then it will be executed successfully because notepad dot
+
+16
+00:01:09,000 --> 00:01:14,000
+exe is a default text editor that is present on windows machines.
+
+17
+00:01:15,000 --> 00:01:20,000
+I create instance of process builder type and pass the name of the process.
+
+18
+00:01:20,000 --> 00:01:23,000
+I can start the process by calling start method.
+
+19
+00:01:24,000 --> 00:01:27,000
+Then I receive process object.
+
+20
+00:01:27,000 --> 00:01:34,000
+The process handle interface represents a handle to a native process in the operating system.
+
+21
+00:01:34,000 --> 00:01:38,000
+It was introduced in Java nine as part of the process API updates.
+
+22
+00:01:38,000 --> 00:01:44,000
+The Process handle interface provides methods to obtain information about a process and to interact
+
+23
+00:01:44,000 --> 00:01:45,000
+with it.
+
+24
+00:01:45,000 --> 00:01:52,000
+It is a more modern way and comprehensive replacement for the older process class.
+
+25
+00:01:52,000 --> 00:01:59,000
+When you call the two handle method on a process object, it returns process handle object associated
+
+26
+00:01:59,000 --> 00:02:00,000
+with that process.
+
+27
+00:02:01,000 --> 00:02:07,000
+You can use the process handle methods to query information about the process and perform various operations.
+
+28
+00:02:08,000 --> 00:02:09,000
+On exit method.
+
+29
+00:02:09,000 --> 00:02:16,000
+The on exit method is available in the process handle interface, allowing you to define actions to
+
+30
+00:02:16,000 --> 00:02:19,000
+be executed when the process exits.
+
+31
+00:02:19,000 --> 00:02:27,000
+This method takes a consumer parameter, enabling you to specify behavior such as logging or clean up
+
+32
+00:02:27,000 --> 00:02:29,000
+after the process terminates.
+
+33
+00:02:29,000 --> 00:02:36,000
+So when I would close notepad process its process ID will be printed to console.
+
+34
+00:02:37,000 --> 00:02:40,000
+Destroy and destroy forcibly masses.
+
+35
+00:02:41,000 --> 00:02:47,000
+The destroy and destroy forcibly masses are available in the process handle interface to terminate the
+
+36
+00:02:47,000 --> 00:02:49,000
+associated process.
+
+37
+00:02:49,000 --> 00:02:57,000
+The destroy method sends a request to the process to terminate gracefully, while destroy forcibly attempts
+
+38
+00:02:57,000 --> 00:02:59,000
+to forcibly terminate the process.
+
+39
+00:03:00,000 --> 00:03:07,000
+These enhancements provide better control and visibility into native processes, making it easier to
+
+40
+00:03:07,000 --> 00:03:13,000
+work with external commands, subprocesses, and system level processes in Java.
+
+41
+00:03:13,000 --> 00:03:14,000
+Applications.
+
+42
+00:03:14,000 --> 00:03:20,000
+The Process Handle interface offers a more comprehensive set of methods for managing and interacting
+
+43
+00:03:20,000 --> 00:03:26,000
+with processes, contributing to improved process control in Java applications.
+
+44
+00:03:26,000 --> 00:03:33,000
+In case you have any questions, feel free to post them below the video and I will be happy to answer.
+
+45
+00:03:33,000 --> 00:03:41,000
+The next Java nine update that I want to talk about is new methods in Completablefuture API in Java
+
+46
+00:03:41,000 --> 00:03:41,000
+nine.
+
+47
+00:03:41,000 --> 00:03:48,000
+The Completablefuture API was enhanced with additional methods to support delays and timeouts.
+
+48
+00:03:48,000 --> 00:03:54,000
+These new methods provide more flexibility when dealing with asynchronous computations.
+
+49
+00:03:55,000 --> 00:03:57,000
+Let's review a few of them now.
+
+50
+00:03:57,000 --> 00:04:02,000
+And after that we'll review more of new methods from Completablefuture API.
+
+51
+00:04:03,000 --> 00:04:05,000
+Delayed execute the method.
+
+52
+00:04:06,000 --> 00:04:11,000
+The delayed execute method was introduced to the Completablefuture class.
+
+53
+00:04:11,000 --> 00:04:18,000
+This method allows you to create and execute that introduces a delay before executing tasks.
+
+54
+00:04:19,000 --> 00:04:25,000
+This is useful when you want to introduce a delay before performing an asynchronous operation.
+
+55
+00:04:26,000 --> 00:04:33,000
+In this example, the completablefuture delayed executor that takes as arguments three and time unit
+
+56
+00:04:33,000 --> 00:04:40,000
+seconds creates an executor that introduces a three second delay before executing the task asynchronously.
+
+57
+00:04:41,000 --> 00:04:45,000
+Or timeout and complete on timeout masses.
+
+58
+00:04:45,000 --> 00:04:52,000
+The all timeout method and the completed timeout method were added to the Completablefuture class to
+
+59
+00:04:52,000 --> 00:04:53,000
+handle timeouts.
+
+60
+00:04:53,000 --> 00:05:01,000
+The timeout method completes the Completablefuture with a timeout exception if the original computation
+
+61
+00:05:01,000 --> 00:05:04,000
+takes longer than the specified duration.
+
+62
+00:05:05,000 --> 00:05:13,000
+In this example, you can see that inside callable I imitate time consuming work by putting five second
+
+63
+00:05:13,000 --> 00:05:14,000
+sleep inside.
+
+64
+00:05:15,000 --> 00:05:20,000
+On the other hand, I create a new future object using or timeout method.
+
+65
+00:05:21,000 --> 00:05:27,000
+In this case, if there is no result within two seconds, then exception will be thrown.
+
+66
+00:05:28,000 --> 00:05:33,000
+There will be execution exception with course timeout exception.
+
+67
+00:05:33,000 --> 00:05:38,000
+I catch it here and print it to console to prove it to you.
+
+68
+00:05:38,000 --> 00:05:44,000
+By the way, if you want to learn more about multi-threading, Completablefuture, API, future type
+
+69
+00:05:44,000 --> 00:05:50,000
+and other things, feel free to check multi-threading and concurrency section of my course Java from
+
+70
+00:05:50,000 --> 00:05:52,000
+zero to first job.
+
+71
+00:05:52,000 --> 00:05:58,000
+There are a lot of examples and lessons that will help you to learn multi-threading in Java.
+
+72
+00:05:58,000 --> 00:06:05,000
+The complete on timeout method completes the Completablefuture with a default value if the original
+
+73
+00:06:05,000 --> 00:06:10,000
+computation takes longer than the specified duration.
+
+74
+00:06:11,000 --> 00:06:14,000
+In the similar example, we wouldn't get timeout exception.
+
+75
+00:06:15,000 --> 00:06:18,000
+Instead, we'll just receive default value.
+
+76
+00:06:18,000 --> 00:06:25,000
+Both of these methods provide a convenient way to handle timeouts in asynchronous computations.
+
+77
+00:06:26,000 --> 00:06:33,000
+These additions in Java nine enhance the Completablefuture API, making it more powerful and expressive
+
+78
+00:06:33,000 --> 00:06:36,000
+when dealing with asynchronous and concurrent programming.
+
+79
+00:06:37,000 --> 00:06:43,000
+They enable developers to control and manage delays and timeouts in a more straightforward manner.
+
+80
+00:06:44,000 --> 00:06:47,000
+There are some more updates to Completablefuture API.
+
+81
+00:06:47,000 --> 00:06:49,000
+Let's review them.
+
+82
+00:06:49,000 --> 00:06:51,000
+Default executor method.
+
+83
+00:06:51,000 --> 00:06:56,000
+The default executor method is a new method introduced in Java nine.
+
+84
+00:06:56,000 --> 00:07:05,000
+It returns the default executor used for asynchronous execution of dependent tasks when not explicitly
+
+85
+00:07:05,000 --> 00:07:06,000
+specified.
+
+86
+00:07:06,000 --> 00:07:14,000
+In this example, the default executor method is used to obtain the default executor and then then accept.
+
+87
+00:07:14,000 --> 00:07:21,000
+Async is invoked with the executor for the asynchronous execution of the dependent task.
+
+88
+00:07:22,000 --> 00:07:25,000
+But what is the type of default executor?
+
+89
+00:07:25,000 --> 00:07:28,000
+It is Java.util.concurrent Forkjoinpool.
+
+90
+00:07:29,000 --> 00:07:31,000
+New incomplete future method.
+
+91
+00:07:32,000 --> 00:07:39,000
+The new incomplete future method in the Completablefuture class is a factory method that creates a new
+
+92
+00:07:39,000 --> 00:07:42,000
+incomplete Completablefuture instance.
+
+93
+00:07:42,000 --> 00:07:50,000
+This method returns a new Completablefuture that is initially neither completed nor exceptionally completed.
+
+94
+00:07:50,000 --> 00:07:56,000
+This method is particularly useful in scenarios where you want to manually control the completion of
+
+95
+00:07:56,000 --> 00:07:58,000
+Completablefuture instance.
+
+96
+00:07:59,000 --> 00:08:06,000
+By obtaining an incomplete completablefuture, you have the flexibility to complete it with a value
+
+97
+00:08:06,000 --> 00:08:10,000
+or an exception at a later point in your code.
+
+98
+00:08:10,000 --> 00:08:16,000
+This method is typically used in custom scenarios, where you want to manually manage the completion
+
+99
+00:08:16,000 --> 00:08:20,000
+of a Completablefuture, and here you can find an example.
+
+100
+00:08:20,000 --> 00:08:26,000
+I create incomplete future and pass it to the perform async operation method.
+
+101
+00:08:27,000 --> 00:08:35,000
+Here you can see I call complete method on the future variable, and later I call join method on incomplete
+
+102
+00:08:35,000 --> 00:08:39,000
+future object to join it to the main thread of execution.
+
+103
+00:08:40,000 --> 00:08:44,000
+This short example illustrates how you can apply this on practice.
+
+104
+00:08:45,000 --> 00:08:46,000
+Copy Macid.
+
+105
+00:08:46,000 --> 00:08:52,000
+The copy method creates and returns a copy of the current Completablefuture instance.
+
+106
+00:08:52,000 --> 00:08:59,000
+The copy method is useful when you want to create an independent copy of an existing Completablefuture
+
+107
+00:08:59,000 --> 00:09:01,000
+to apply different operations.
+
+108
+00:09:02,000 --> 00:09:05,000
+Minimal completion stage method.
+
+109
+00:09:05,000 --> 00:09:12,000
+The minimal completion stage method returns a completion stage view of the current Completeable feature.
+
+110
+00:09:12,000 --> 00:09:16,000
+This allows working with a broader completion stage API.
+
+111
+00:09:16,000 --> 00:09:23,000
+This can be useful when you need to interact with libraries or methods that work with the more general
+
+112
+00:09:23,000 --> 00:09:24,000
+completion stage.
+
+113
+00:09:24,000 --> 00:09:25,000
+Interface.
+
+114
+00:09:25,000 --> 00:09:31,000
+If you are working with library or methods that expects a completion stage and you have Completeable
+
+115
+00:09:31,000 --> 00:09:37,000
+future, using minimal completion stage allows you to seamlessly integrate your completeable future
+
+116
+00:09:37,000 --> 00:09:40,000
+into a more generic completion stage context.
+
+117
+00:09:41,000 --> 00:09:48,000
+In this example, we have Completeable future and we obtain a completion stage view of it using Completeable
+
+118
+00:09:48,000 --> 00:09:51,000
+future minimal completion stage.
+
+119
+00:09:52,000 --> 00:09:59,000
+The process with completion stage method then demonstrates using the completion Stage API, showing
+
+120
+00:09:59,000 --> 00:10:05,000
+how you can chain asynchronous operations, handle success, and handle exceptions.
+
+121
+00:10:06,000 --> 00:10:13,000
+This method allows you to work with the broader completion stage interface, while still utilizing the
+
+122
+00:10:13,000 --> 00:10:16,000
+features provided by Completablefuture.
+
+123
+00:10:16,000 --> 00:10:23,000
+It's a way to bridge between the specific features of Completablefuture and the more general completion
+
+124
+00:10:23,000 --> 00:10:30,000
+stage interface when needed for compatibility or consistency reasons in your code base.
+
+125
+00:10:31,000 --> 00:10:37,000
+In case you would have any questions, please let me know below the video and I will be happy to answer.
+
+126
+00:10:39,000 --> 00:10:40,000
+Complete a sync message.
+
+127
+00:10:41,000 --> 00:10:48,000
+The complete A sync message completes the completablefuture A synchronously using the specified supplier
+
+128
+00:10:48,000 --> 00:10:49,000
+to generate the result.
+
+129
+00:10:50,000 --> 00:10:55,000
+These methods allow you to complete the Completablefuture asynchronously, providing a more flexible
+
+130
+00:10:55,000 --> 00:10:57,000
+way to produce the result.
+
+131
+00:10:57,000 --> 00:11:03,000
+These additions in Java nine provide a more options and flexibility when working with Completablefuture.
+
+132
+00:11:03,000 --> 00:11:11,000
+They enable better control and customization of asynchronous computations, making it easier to integrate
+
+133
+00:11:11,000 --> 00:11:15,000
+with different execution environments and scenarios.
+
+134
+00:11:15,000 --> 00:11:20,000
+There is one more interesting feature that was introduced in Java version nine.
+
+135
+00:11:20,000 --> 00:11:23,000
+It is Interface Private Methods.
+
+136
+00:11:23,000 --> 00:11:31,000
+In Java nine, a new feature was introduced that allows interface methods to have private implementation.
+
+137
+00:11:31,000 --> 00:11:38,000
+Before Java nine, all methods in an interface were implicitly public and abstract.
+
+138
+00:11:38,000 --> 00:11:44,000
+With the addition of private methods in interfaces, developers can include helper methods that are
+
+139
+00:11:44,000 --> 00:11:50,000
+used only within the interface, making the code more modular and maintainable.
+
+140
+00:11:51,000 --> 00:11:54,000
+I decided to put this example in the separate file.
+
+141
+00:11:54,000 --> 00:11:57,000
+The file is called interface Private methods demo.
+
+142
+00:11:58,000 --> 00:12:07,000
+As you can see here is a calculator interface and multiply method is the default one that uses private
+
+143
+00:12:07,000 --> 00:12:08,000
+method inside.
+
+144
+00:12:08,000 --> 00:12:11,000
+Basically you just put private modifier.
+
+145
+00:12:11,000 --> 00:12:16,000
+You don't need to add any other modifiers like default or any other ones.
+
+146
+00:12:16,000 --> 00:12:25,000
+This private helper method is only accessible within the interface and can be accessed by classes implementing
+
+147
+00:12:25,000 --> 00:12:26,000
+the interface.
+
+148
+00:12:27,000 --> 00:12:34,000
+This feature enhances the expressiveness and maintainability of code in interface, by allowing developers
+
+149
+00:12:34,000 --> 00:12:40,000
+to encapsulate implementation details that are not part of the public API.
+
+150
+00:12:40,000 --> 00:12:48,000
+It is important to note that private methods in interfaces can't be overridden or accessed by implementing
+
+151
+00:12:48,000 --> 00:12:49,000
+classes.
+
+152
+00:12:49,000 --> 00:12:54,000
+They are intended purely for internal use within the interface itself.
+
+153
+00:12:55,000 --> 00:12:59,000
+So remember this and use this when it would be needed.
+
+154
+00:12:59,000 --> 00:13:04,000
+Let's review the next Java nine update in Java nine.
+
+155
+00:13:04,000 --> 00:13:10,000
+Two new attributes since and for removal were introduced to the deprecated annotation.
+
+156
+00:13:11,000 --> 00:13:17,000
+These attributes provide additional information about the deprecation of a class, method, field,
+
+157
+00:13:17,000 --> 00:13:18,000
+or interface.
+
+158
+00:13:19,000 --> 00:13:26,000
+The since attribute allows developers to specify the version in which the annotated element was deprecated.
+
+159
+00:13:27,000 --> 00:13:33,000
+It is helpful for providing information about when the deprecation occurred, making it easier for developers
+
+160
+00:13:33,000 --> 00:13:35,000
+to understand the deprecation.
+
+161
+00:13:35,000 --> 00:13:36,000
+History.
+
+162
+00:13:37,000 --> 00:13:44,000
+The removal attribute is a Boolean flag that signals whether the annotated element is intended for removal
+
+163
+00:13:44,000 --> 00:13:46,000
+in the future versions.
+
+164
+00:13:46,000 --> 00:13:53,000
+It provides a way to convey the deprecated elements is planned for removal in subsequent releases.
+
+165
+00:13:54,000 --> 00:13:59,000
+For the sake of the demo, I added deprecated annotation with these new attributes above.
+
+166
+00:13:59,000 --> 00:14:00,000
+Subtract method.
+
+167
+00:14:01,000 --> 00:14:06,000
+Also in Java nine, there is a preview of new Http client API.
+
+168
+00:14:06,000 --> 00:14:13,000
+But before learning the details of new Http client API, let's try to understand what does previous
+
+169
+00:14:13,000 --> 00:14:16,000
+status mean and how it is different from the release.
+
+170
+00:14:17,000 --> 00:14:24,000
+A preview feature means that the feature is included in the release for developers to try out and provide
+
+171
+00:14:24,000 --> 00:14:30,000
+feedback, but it is not yet finalized and may undergo changes based on user feedback.
+
+172
+00:14:31,000 --> 00:14:34,000
+Here are some key points regarding preview features.
+
+173
+00:14:34,000 --> 00:14:35,000
+Usability.
+
+174
+00:14:36,000 --> 00:14:43,000
+You can use preview features in your Java code, including the new Http client API, by enabling preview
+
+175
+00:14:43,000 --> 00:14:45,000
+language features in the Java compiler.
+
+176
+00:14:45,000 --> 00:14:52,000
+You can do this by adding the Enable Preview option when compiling or running your code.
+
+177
+00:14:53,000 --> 00:14:54,000
+Feedback.
+
+178
+00:14:54,000 --> 00:15:01,000
+The inclusion of a feature as a preview is an opportunity for developers to try it out and provide feedback
+
+179
+00:15:01,000 --> 00:15:02,000
+to the Java development team.
+
+180
+00:15:03,000 --> 00:15:09,000
+Feedback is valuable for identifying issues, making improvements, and ensuring that the feature meets
+
+181
+00:15:09,000 --> 00:15:12,000
+the needs of the development community.
+
+182
+00:15:12,000 --> 00:15:14,000
+Potential changes.
+
+183
+00:15:14,000 --> 00:15:20,000
+Since preview features are not finalized, there is a possibility that the feature may undergo changes
+
+184
+00:15:20,000 --> 00:15:22,000
+based on feedback.
+
+185
+00:15:22,000 --> 00:15:29,000
+This means that code written using preview features might need adjustments in later versions of Java.
+
+186
+00:15:30,000 --> 00:15:33,000
+Stability and compatibility.
+
+187
+00:15:33,000 --> 00:15:39,000
+While preview features are intended for experimentation and feedback, they are not guaranteed to be
+
+188
+00:15:39,000 --> 00:15:43,000
+as stable or compatible as finalized features.
+
+189
+00:15:44,000 --> 00:15:50,000
+It is generally not recommended to use preview features in production code that requires a long terme
+
+190
+00:15:50,000 --> 00:15:51,000
+stability.
+
+191
+00:15:52,000 --> 00:15:53,000
+Official release.
+
+192
+00:15:53,000 --> 00:16:00,000
+Once a feature has received sufficient feedback and any necessary refinements have been made, it may
+
+193
+00:16:00,000 --> 00:16:06,000
+be promoted to the fully supported and finalized feature in subsequent Java releases.
+
+194
+00:16:06,000 --> 00:16:11,000
+At that point, you can use the feature without the need for the Enable Preview option.
+
+195
+00:16:12,000 --> 00:16:19,000
+Regarding the new Http client API, it is a powerful and modern API designed to replace the legacy Http
+
+196
+00:16:19,000 --> 00:16:21,000
+url connection API.
+
+197
+00:16:21,000 --> 00:16:27,000
+While it was initially introduced as a preview feature in Java nine, it has been refined and improved
+
+198
+00:16:27,000 --> 00:16:28,000
+in subsequent releases.
+
+199
+00:16:29,000 --> 00:16:35,000
+The feature was released in Java 11, so we will learn it in details in the separate lesson when we
+
+200
+00:16:35,000 --> 00:16:38,000
+will learn features of Java 11.
+
diff --git a/44 - Java New Versions/003 Source-code-example-from-the-lesson.url b/44 - Java New Versions/003 Source-code-example-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..0bd957d35e00de3e3b6aeeb1b5e1f9c855793e6c
--- /dev/null
+++ b/44 - Java New Versions/003 Source-code-example-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/commit/e53e759c361aedca987fd1a24f9fc2e3a1cb3d63
\ No newline at end of file
diff --git a/44 - Java New Versions/004 Java 9 jlink & jshell_en.srt b/44 - Java New Versions/004 Java 9 jlink & jshell_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..131ba1422de1e9a3452a1db1fe08a47926fe5de7
--- /dev/null
+++ b/44 - Java New Versions/004 Java 9 jlink & jshell_en.srt
@@ -0,0 +1,692 @@
+1
+00:00:03,000 --> 00:00:10,000
+As you learned from agenda, there are new JDK tools and features since Java eight were released.
+
+2
+00:00:10,000 --> 00:00:16,000
+Let's learn them and understand how they can be useful for us as developers.
+
+3
+00:00:16,000 --> 00:00:19,000
+I will start with explanation of Jlink.
+
+4
+00:00:19,000 --> 00:00:25,000
+Jlink is a tool introduced in Java nine as a part of the Java Platform Module system.
+
+5
+00:00:25,000 --> 00:00:32,000
+Its primary purpose is to assemble and optimize a set of modules and their dependencies into a custom
+
+6
+00:00:32,000 --> 00:00:34,000
+runtime image.
+
+7
+00:00:34,000 --> 00:00:41,000
+This image includes only the modules that are required for a specific application, resulting in a more
+
+8
+00:00:41,000 --> 00:00:43,000
+compact and efficient distribution.
+
+9
+00:00:44,000 --> 00:00:51,000
+Jlink helps reduce the size of the runtime image, resulting in a smaller footprint for Java applications.
+
+10
+00:00:52,000 --> 00:00:59,000
+Developers can customize the runtime image to include or exclude specific modules, which is particularly
+
+11
+00:00:59,000 --> 00:01:03,000
+useful when creating tailored images for different deployment scenarios.
+
+12
+00:01:03,000 --> 00:01:08,000
+When Jlink may be used in which use cases it will be helpful.
+
+13
+00:01:08,000 --> 00:01:10,000
+Microservices deployment.
+
+14
+00:01:11,000 --> 00:01:18,000
+When deploying microservices, where each service has its own set of dependencies, Jlink allows you
+
+15
+00:01:18,000 --> 00:01:25,000
+to create a custom runtime image for each service with only the required modules, reducing the overall
+
+16
+00:01:25,000 --> 00:01:27,000
+resource consumption.
+
+17
+00:01:27,000 --> 00:01:29,000
+Embedded systems.
+
+18
+00:01:29,000 --> 00:01:35,000
+In embedded systems or environments with resource constraints, Jlink can be used to create minimal
+
+19
+00:01:35,000 --> 00:01:41,000
+runtime image that includes only the essential components needed to run the application.
+
+20
+00:01:42,000 --> 00:01:44,000
+Client side applications.
+
+21
+00:01:44,000 --> 00:01:51,000
+For client side applications such as desktop applications, Jlink can help create a standalone runtime
+
+22
+00:01:51,000 --> 00:01:57,000
+image that includes the necessary modules, simplifying the deployment process for end users.
+
+23
+00:01:57,000 --> 00:02:00,000
+Let's review some examples of using Jlink.
+
+24
+00:02:01,000 --> 00:02:08,000
+Pay attention that examples that we are going to review now are intended to be executed in Bash Terminal.
+
+25
+00:02:08,000 --> 00:02:15,000
+If you want to run the same commands in windows CMG Command Prompt, you may need to adjust syntax.
+
+26
+00:02:16,000 --> 00:02:24,000
+If you have windows machine and you don't want to adjust syntax, just use git bash terminal and execute
+
+27
+00:02:24,000 --> 00:02:25,000
+commands there.
+
+28
+00:02:26,000 --> 00:02:32,000
+Suppose you have a modular Java application named my application with modules.
+
+29
+00:02:32,000 --> 00:02:37,000
+Com example module one and Com example module two.
+
+30
+00:02:38,000 --> 00:02:42,000
+You can create a custom runtime image as you can see on the slide.
+
+31
+00:02:43,000 --> 00:02:44,000
+At the beginning.
+
+32
+00:02:44,000 --> 00:02:46,000
+You compile modules.
+
+33
+00:02:46,000 --> 00:02:48,000
+Let me explain this command.
+
+34
+00:02:49,000 --> 00:02:56,000
+Dash d Outdir specifies the output directory for compiled classes.
+
+35
+00:02:56,000 --> 00:03:01,000
+Double dash module dash source dash pass src.
+
+36
+00:03:01,000 --> 00:03:05,000
+Indicates the root directory for module source files.
+
+37
+00:03:06,000 --> 00:03:08,000
+Find a CRC name.
+
+38
+00:03:08,000 --> 00:03:16,000
+Asterisks dot Java uses the find command to locate all Java files under the src directory, and includes
+
+39
+00:03:16,000 --> 00:03:18,000
+them in the compilation.
+
+40
+00:03:18,000 --> 00:03:25,000
+After running this command, the compiled class files will be placed in the Outdir directory.
+
+41
+00:03:25,000 --> 00:03:28,000
+Then we create module jars.
+
+42
+00:03:29,000 --> 00:03:31,000
+Let me explain these commands.
+
+43
+00:03:31,000 --> 00:03:36,000
+Double dash create creates a new jar file.
+
+44
+00:03:36,000 --> 00:03:37,000
+Double dash file.
+
+45
+00:03:37,000 --> 00:03:42,000
+Module one dot jar specifies the name of the jar file to be created.
+
+46
+00:03:43,000 --> 00:03:43,000
+Dash.
+
+47
+00:03:43,000 --> 00:03:51,000
+See how dear slash com dot example dot module one and dot.
+
+48
+00:03:51,000 --> 00:03:58,000
+Add the contents of the Outdir comics module one directory to the jar file.
+
+49
+00:03:59,000 --> 00:04:03,000
+The dot at the end represents the current directory.
+
+50
+00:04:03,000 --> 00:04:10,000
+In this context, it tells the jar command to include files from the current directory in the Jar archive.
+
+51
+00:04:11,000 --> 00:04:18,000
+Similarly, the second command creates a jar file module two dot jar for the second module.
+
+52
+00:04:19,000 --> 00:04:22,000
+Now we are ready to run Jlink command.
+
+53
+00:04:23,000 --> 00:04:26,000
+Let's reuse this command in details.
+
+54
+00:04:27,000 --> 00:04:29,000
+Double dash module.
+
+55
+00:04:29,000 --> 00:04:32,000
+Dash pass module one dot jar.
+
+56
+00:04:32,000 --> 00:04:33,000
+Colon.
+
+57
+00:04:33,000 --> 00:04:35,000
+Module two dot jar.
+
+58
+00:04:35,000 --> 00:04:40,000
+Colon dollar sign Javahome slash G modes.
+
+59
+00:04:41,000 --> 00:04:44,000
+This part specifies the module path.
+
+60
+00:04:44,000 --> 00:04:52,000
+Basically, I specify path to all locations where modules may be located, including the jar files for
+
+61
+00:04:52,000 --> 00:05:00,000
+the modules, module one jar and module two jar and the Java runtime modules Java Home slash G modes.
+
+62
+00:05:01,000 --> 00:05:02,000
+Pay attention to the separator.
+
+63
+00:05:02,000 --> 00:05:10,000
+The correct separator for the double dash module dash pass option on Unix like systems, including Linux
+
+64
+00:05:10,000 --> 00:05:13,000
+and macOS, is a column.
+
+65
+00:05:13,000 --> 00:05:16,000
+On windows, the separator is a semicolon.
+
+66
+00:05:17,000 --> 00:05:20,000
+As I told you, feel free to use git bash.
+
+67
+00:05:20,000 --> 00:05:24,000
+If you have a windows machine and you want to run the same command.
+
+68
+00:05:25,000 --> 00:05:31,000
+The Java Home Slash modes directory contains the Java Runtime system modules.
+
+69
+00:05:31,000 --> 00:05:38,000
+These modules are part of the Java Standard Edition platform modules, and they are included in the
+
+70
+00:05:38,000 --> 00:05:40,000
+Java Development Kit distribution.
+
+71
+00:05:40,000 --> 00:05:49,000
+The G modes directory contains module descriptors, module info class, and other resources needed for
+
+72
+00:05:49,000 --> 00:05:50,000
+the Java runtime.
+
+73
+00:05:51,000 --> 00:05:57,000
+Including the runtime modules is necessary to ensure that your application can access the core Java
+
+74
+00:05:57,000 --> 00:05:59,000
+APIs and features.
+
+75
+00:06:00,000 --> 00:06:01,000
+Double dash.
+
+76
+00:06:01,000 --> 00:06:03,000
+Add dash modules.
+
+77
+00:06:03,000 --> 00:06:11,000
+Space comm dot example dot module one comma com dot example dot module two.
+
+78
+00:06:11,000 --> 00:06:21,000
+So before with previous command I specified just pass to all potential modules and with this parameter
+
+79
+00:06:21,000 --> 00:06:27,000
+add modules I actually include specific modules to the green image.
+
+80
+00:06:28,000 --> 00:06:33,000
+When using Jlink is a Java based module is automatically included by default.
+
+81
+00:06:33,000 --> 00:06:40,000
+It is considered the fundamental module that provides core functionality including the Java language,
+
+82
+00:06:40,000 --> 00:06:43,000
+basic APIs, and essential runtime capabilities.
+
+83
+00:06:44,000 --> 00:06:50,000
+Therefore, you do not need to explicitly add Java base to the Add Modules option when creating a custom
+
+84
+00:06:50,000 --> 00:06:51,000
+runtime image.
+
+85
+00:06:52,000 --> 00:06:58,000
+Here you can add Java modules besides Java base that is included by default.
+
+86
+00:06:58,000 --> 00:07:03,000
+You can include modules that you need and that your application requires.
+
+87
+00:07:03,000 --> 00:07:04,000
+But what are they?
+
+88
+00:07:05,000 --> 00:07:06,000
+Let's learn this.
+
+89
+00:07:07,000 --> 00:07:12,000
+To check the list of all available Java modules, you can use the following command.
+
+90
+00:07:12,000 --> 00:07:15,000
+Java double dash least dash modules.
+
+91
+00:07:16,000 --> 00:07:22,000
+You can use this command to check what modules are present in your version of Java.
+
+92
+00:07:22,000 --> 00:07:27,000
+Then you can select only modules that you need to create your own gray.
+
+93
+00:07:27,000 --> 00:07:34,000
+For example, if you know that your application doesn't use anything for desktop user classes from Java
+
+94
+00:07:34,000 --> 00:07:42,000
+dot package nor classes from other packages, then there is no sense for you to include those into the
+
+95
+00:07:42,000 --> 00:07:43,000
+gray.
+
+96
+00:07:44,000 --> 00:07:50,000
+That's exactly how you can make your gray more lightweight and less in total size.
+
+97
+00:07:51,000 --> 00:07:51,000
+Let's finish.
+
+98
+00:07:51,000 --> 00:07:54,000
+Review of the Jlink generation.
+
+99
+00:07:54,000 --> 00:07:58,000
+And the last parameter that we used is output.
+
+100
+00:07:58,000 --> 00:07:59,000
+Double dash output.
+
+101
+00:07:59,000 --> 00:08:05,000
+My app image specifies the output directory for the generated runtime image.
+
+102
+00:08:06,000 --> 00:08:13,000
+After running this command, my app image will contain a minimal gray along with the specified modules
+
+103
+00:08:13,000 --> 00:08:18,000
+ready to be distributed and run as a standalone application.
+
+104
+00:08:18,000 --> 00:08:21,000
+Now you can run application from image.
+
+105
+00:08:22,000 --> 00:08:29,000
+You can use Java program from the gray image that we just created to run your application.
+
+106
+00:08:29,000 --> 00:08:31,000
+Dot slash.
+
+107
+00:08:31,000 --> 00:08:31,000
+Myapp.
+
+108
+00:08:31,000 --> 00:08:36,000
+Image slash bin slash Java dash m.
+
+109
+00:08:37,000 --> 00:08:43,000
+Com dot example dot module one slash comic dot module one main.
+
+110
+00:08:43,000 --> 00:08:49,000
+So I believe it is obvious that dot slash my app image slash slash Java.
+
+111
+00:08:49,000 --> 00:08:57,000
+This part specifies the path to the Java executable inside the custom Java runtime image.
+
+112
+00:08:57,000 --> 00:09:04,000
+The dot slash my app image indicates the root directory of the custom runtime image, and the second
+
+113
+00:09:04,000 --> 00:09:10,000
+part, which is dash m name of the module and full name of the main class.
+
+114
+00:09:10,000 --> 00:09:13,000
+This part specifies the main module, which is.
+
+115
+00:09:13,000 --> 00:09:20,000
+Com example dot module one and the main class which is com dot example dot module one dot main.
+
+116
+00:09:20,000 --> 00:09:27,000
+To be executed, the dash m option is used to specify the module and its main class.
+
+117
+00:09:27,000 --> 00:09:35,000
+So to sum it up, in this example, Jlink is used to create a custom runtime image, which is called
+
+118
+00:09:35,000 --> 00:09:40,000
+my app image config, meaning only the specified modules which is calm.
+
+119
+00:09:40,000 --> 00:09:44,000
+That example dot module one and com example module two.
+
+120
+00:09:45,000 --> 00:09:50,000
+The resulting image can be distributed as a standalone application with a reduced size.
+
+121
+00:09:51,000 --> 00:09:57,000
+Adjust the commands and module names based on your project structure and requirements.
+
+122
+00:09:58,000 --> 00:10:03,000
+Keep in mind that the usage of jlink is more relevant in modular applications.
+
+123
+00:10:03,000 --> 00:10:09,000
+If your application is not modular, you might not benefit as much from using Jlink.
+
+124
+00:10:10,000 --> 00:10:14,000
+Now let's learn other tools that was released in Java nine.
+
+125
+00:10:14,000 --> 00:10:16,000
+I'm talking about j shell.
+
+126
+00:10:17,000 --> 00:10:20,000
+J shell is a Repl tool.
+
+127
+00:10:21,000 --> 00:10:25,000
+Repl stands for read eval print loop.
+
+128
+00:10:26,000 --> 00:10:29,000
+This tool is for Java programming language.
+
+129
+00:10:29,000 --> 00:10:35,000
+It is obvious it was introduced in Java nine to provide a lightweight, interactive environment for
+
+130
+00:10:35,000 --> 00:10:40,000
+experimenting with Java code snippets, expressions and statements.
+
+131
+00:10:40,000 --> 00:10:47,000
+Jshell provides an interactive command line interface where you can type Java code directly and see
+
+132
+00:10:47,000 --> 00:10:49,000
+the results immediately.
+
+133
+00:10:49,000 --> 00:10:56,000
+It is designed to make it easy to experiment, test small code snippets, and learn Java without the
+
+134
+00:10:56,000 --> 00:10:59,000
+need for a full fledged development environment.
+
+135
+00:11:00,000 --> 00:11:03,000
+Let me show you the demo of how you can use Jshell.
+
+136
+00:11:04,000 --> 00:11:08,000
+Like we discussed, you can use Jshell from command prompt.
+
+137
+00:11:08,000 --> 00:11:12,000
+Just open a command prompt and type Jshell.
+
+138
+00:11:12,000 --> 00:11:20,000
+This will start Jshell program and when it is started you can type Java expressions and evaluate them.
+
+139
+00:11:21,000 --> 00:11:24,000
+Jshell also supports statements.
+
+140
+00:11:24,000 --> 00:11:32,000
+For example, let me initialize x variable and now let me print the console x variable.
+
+141
+00:11:32,000 --> 00:11:36,000
+And as you can see x value is printed in jshell.
+
+142
+00:11:36,000 --> 00:11:41,000
+It is not even mandatory to write semicolon at the end of the line.
+
+143
+00:11:41,000 --> 00:11:49,000
+Jshell provides immediate feedback for each entered line displaying the results of expressions or the
+
+144
+00:11:49,000 --> 00:11:50,000
+effects of statements.
+
+145
+00:11:51,000 --> 00:11:57,000
+Jshell keeps a history of your input, and you can use arrow keys to navigate through previous commands.
+
+146
+00:11:58,000 --> 00:12:02,000
+For example, click arrow up or arrow down.
+
+147
+00:12:02,000 --> 00:12:06,000
+You can also edit and rerun previous commands.
+
+148
+00:12:06,000 --> 00:12:14,000
+JCL supports tab completion, making it easy to explore available classes, methods, and variables.
+
+149
+00:12:15,000 --> 00:12:25,000
+For example, you can type Rs and click tab, then type O and click tab and then type print.
+
+150
+00:12:26,000 --> 00:12:29,000
+And here is our System.out.print command.
+
+151
+00:12:29,000 --> 00:12:35,000
+It is not so powerful as an IDE, but still it is a nice feature for a command prompt.
+
+152
+00:12:36,000 --> 00:12:44,000
+Jshell supports special command prefixes, for example slash help slash list slash vars to perform various
+
+153
+00:12:44,000 --> 00:12:46,000
+actions and queries.
+
+154
+00:12:46,000 --> 00:12:55,000
+You can type slash list to see all the executed lines, or you can execute slash vars to see all declared
+
+155
+00:12:55,000 --> 00:12:57,000
+variables and their values.
+
+156
+00:12:58,000 --> 00:13:02,000
+The exit Jshell just type slash exit and press enter.
+
+157
+00:13:03,000 --> 00:13:05,000
+So when to use Jshell.
+
+158
+00:13:06,000 --> 00:13:10,000
+The primary use case is learning and experimentation.
+
+159
+00:13:10,000 --> 00:13:16,000
+Jshell is excellent for learning Java and experimenting with Java code snippets.
+
+160
+00:13:16,000 --> 00:13:22,000
+It allows you to quickly see the results of your code without the need to compile and run a full Java
+
+161
+00:13:22,000 --> 00:13:23,000
+program.
+
+162
+00:13:24,000 --> 00:13:25,000
+Prototyping.
+
+163
+00:13:25,000 --> 00:13:32,000
+When prototyping ideas or trying out new features, Jshell provides a convenient environment for quick
+
+164
+00:13:32,000 --> 00:13:33,000
+testing and validation.
+
+165
+00:13:34,000 --> 00:13:41,000
+Debugging Jshell can be used for interactive debugging, allowing you to test and inspect code snippets
+
+166
+00:13:41,000 --> 00:13:42,000
+on the fly.
+
+167
+00:13:43,000 --> 00:13:50,000
+While this also possible to use for prototyping and debugging, as you can see, the usability of Jshell
+
+168
+00:13:50,000 --> 00:13:55,000
+tool is relatively low if we compare it with IDE.
+
+169
+00:13:55,000 --> 00:14:03,000
+So definitely you won't be able to debug something really complex or to prototype some complex scenarios,
+
+170
+00:14:03,000 --> 00:14:05,000
+especially using third party libraries.
+
+171
+00:14:06,000 --> 00:14:12,000
+Remember, Jshell is most useful for small scale experimentation and learning.
+
+172
+00:14:12,000 --> 00:14:19,000
+For larger project or full scale development, using an integrated development environment such as eclipse
+
+173
+00:14:19,000 --> 00:14:21,000
+is generally more suitable.
+
diff --git a/44 - Java New Versions/005 Java 9 Multi-Release JAR Files & Compact Strings_en.srt b/44 - Java New Versions/005 Java 9 Multi-Release JAR Files & Compact Strings_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..fa24ba95c3e0be72c01c4e6ee685840233505892
--- /dev/null
+++ b/44 - Java New Versions/005 Java 9 Multi-Release JAR Files & Compact Strings_en.srt
@@ -0,0 +1,740 @@
+1
+00:00:03,000 --> 00:00:07,000
+Let's review another feature that was released in Java nine.
+
+2
+00:00:07,000 --> 00:00:12,000
+It is called Multi-release jar Files in Java nine.
+
+3
+00:00:12,000 --> 00:00:18,000
+The concept of Multi-release jar files was introduced to address the challenge of supporting different
+
+4
+00:00:18,000 --> 00:00:23,000
+Java Standard Edition versions within a single Jar file.
+
+5
+00:00:23,000 --> 00:00:30,000
+This feature allows developers to include multiple versions of class files, each targeting a specific
+
+6
+00:00:30,000 --> 00:00:33,000
+Java Standard Edition release within the same jar.
+
+7
+00:00:34,000 --> 00:00:41,000
+This is particularly useful when creating libraries or applications that need to be compatible with
+
+8
+00:00:41,000 --> 00:00:42,000
+different Java versions.
+
+9
+00:00:43,000 --> 00:00:44,000
+How it works.
+
+10
+00:00:44,000 --> 00:00:49,000
+Basically, this is achieved because of the convention in the Jar file structure.
+
+11
+00:00:50,000 --> 00:00:57,000
+A multi-release Jar file is structured in a way that allows it to contain different versions of class
+
+12
+00:00:57,000 --> 00:01:01,000
+files for various Java Standard Edition releases.
+
+13
+00:01:01,000 --> 00:01:08,000
+The versions are organized in a directory structure within the jar, and you can see on the slide how
+
+14
+00:01:08,000 --> 00:01:11,000
+Multi-release jar may look like.
+
+15
+00:01:11,000 --> 00:01:19,000
+Each version specific directory nine, ten, etc. contains class files compiled for the corresponding
+
+16
+00:01:19,000 --> 00:01:22,000
+Java Standard Edition release.
+
+17
+00:01:22,000 --> 00:01:28,000
+When the application runs on a specific Java version, the Java runtime loads the class files from the
+
+18
+00:01:28,000 --> 00:01:31,000
+appropriate version specific directory.
+
+19
+00:01:31,000 --> 00:01:34,000
+Outside the versions directory.
+
+20
+00:01:34,000 --> 00:01:41,000
+There are fallback classes that are used when running on Java versions older than Java nine, or when
+
+21
+00:01:41,000 --> 00:01:45,000
+the Java runtime doesn't support Multi-release jars.
+
+22
+00:01:46,000 --> 00:01:52,000
+So what are use cases and when it is recommended to use Multi-release jar in Java?
+
+23
+00:01:53,000 --> 00:01:55,000
+Compatibility across Java versions.
+
+24
+00:01:55,000 --> 00:02:02,000
+Multi-release jars are useful when creating libraries or applications that need to be compatible with
+
+25
+00:02:02,000 --> 00:02:04,000
+different Java Standard Edition versions.
+
+26
+00:02:04,000 --> 00:02:11,000
+Developers can provide version specific implementations to leverage new features while ensuring compatibility
+
+27
+00:02:11,000 --> 00:02:13,000
+with all the Java runtimes.
+
+28
+00:02:14,000 --> 00:02:21,000
+Gradual migration developers can use Multi-release jars during a gradual migration to a newer Java Standard
+
+29
+00:02:21,000 --> 00:02:22,000
+Edition version.
+
+30
+00:02:23,000 --> 00:02:29,000
+This allows them to include new features for users on the latest Java version, while maintaining support
+
+31
+00:02:29,000 --> 00:02:31,000
+for users on older versions.
+
+32
+00:02:32,000 --> 00:02:38,000
+When building a jar, the build process will organize the class files into the appropriate directories.
+
+33
+00:02:38,000 --> 00:02:45,000
+Users running the application on Java nine or newer will benefit from the version specific implementations,
+
+34
+00:02:45,000 --> 00:02:50,000
+while users on older Java versions will use the fallback implementation.
+
+35
+00:02:51,000 --> 00:02:59,000
+Let's review example now consider a utility class designed for JDK seven and build for groovy seven
+
+36
+00:02:59,000 --> 00:03:00,000
+and higher.
+
+37
+00:03:01,000 --> 00:03:08,000
+While written in JDK seven, it checks for leap years using the Java one calendar API.
+
+38
+00:03:08,000 --> 00:03:16,000
+Later, when Java eight more concise data parsing becomes desirable, switching to JDK eight and higher
+
+39
+00:03:16,000 --> 00:03:20,000
+risks breaking compatibility with the original JIRA seven.
+
+40
+00:03:21,000 --> 00:03:28,000
+So starting from Gemini, you have opportunity to keep the original solution unchanged and create a
+
+41
+00:03:28,000 --> 00:03:30,000
+new version using the newer JDK.
+
+42
+00:03:31,000 --> 00:03:37,000
+Both versions are packaged together with a Gvm version nine or above.
+
+43
+00:03:37,000 --> 00:03:44,000
+Selecting the appropriate version at runtime, the given prefers the highest version it supports to
+
+44
+00:03:44,000 --> 00:03:46,000
+accommodate multiple versions.
+
+45
+00:03:46,000 --> 00:03:48,000
+A separate folder structure is required.
+
+46
+00:03:49,000 --> 00:03:56,000
+For example, creating a Java nine folder alongside Java and placing the new version of utility class
+
+47
+00:03:56,000 --> 00:03:57,000
+within it.
+
+48
+00:03:57,000 --> 00:04:02,000
+Take a look at the proposed source code structure on the screen.
+
+49
+00:04:02,000 --> 00:04:10,000
+While the inner logic of the new version can change, public method signatures must remain unchanged.
+
+50
+00:04:10,000 --> 00:04:15,000
+Add a new public APIs exclusive to a new version is disallowed.
+
+51
+00:04:16,000 --> 00:04:24,000
+Cross-compilation allows files to be compiled for earlier versions without installing separate GCC versions.
+
+52
+00:04:24,000 --> 00:04:31,000
+Old code is compiled for Java seven and new code is compiled for Java nine.
+
+53
+00:04:31,000 --> 00:04:34,000
+You can see examples of the commands on the slide.
+
+54
+00:04:35,000 --> 00:04:41,000
+This is Javac command that we learned already in first lessons of my course Java from zero to first
+
+55
+00:04:41,000 --> 00:04:46,000
+job, but it has new flags that we didn't learn before.
+
+56
+00:04:46,000 --> 00:04:49,000
+So let me explain this line in details.
+
+57
+00:04:49,000 --> 00:04:50,000
+Javac.
+
+58
+00:04:51,000 --> 00:04:53,000
+This is Java compiler command.
+
+59
+00:04:53,000 --> 00:05:01,000
+It is used to compile Java source code files into bytecode files that can be executed by the Java virtual
+
+60
+00:05:01,000 --> 00:05:01,000
+machine.
+
+61
+00:05:02,000 --> 00:05:05,000
+Double Dash release nine.
+
+62
+00:05:05,000 --> 00:05:10,000
+This option specifies the version of the Java platform to be used for compilation.
+
+63
+00:05:10,000 --> 00:05:13,000
+In this case it is set to Java nine.
+
+64
+00:05:13,000 --> 00:05:20,000
+It tells the compiler to generate class files that are compatible with Java nine and later versions.
+
+65
+00:05:20,000 --> 00:05:22,000
+Dash D classes.
+
+66
+00:05:22,000 --> 00:05:23,000
+Dash nine.
+
+67
+00:05:24,000 --> 00:05:29,000
+This option specifies the destination directory for the compiled class files.
+
+68
+00:05:29,000 --> 00:05:36,000
+In this example, it is set to classes dash nine, indicating that the compiled classes will be placed
+
+69
+00:05:36,000 --> 00:05:40,000
+in a directory named classes dash nine.
+
+70
+00:05:40,000 --> 00:05:46,000
+Then you specify the path to the Java source files that need to be compiled.
+
+71
+00:05:46,000 --> 00:05:52,000
+It uses a wildcard asterisk to include all Java files in the specified directory.
+
+72
+00:05:53,000 --> 00:05:58,000
+In this case, it's looking for Java source files in the specified directory.
+
+73
+00:05:59,000 --> 00:06:04,000
+On the slide you can see example of how you can create Multi-release jar.
+
+74
+00:06:05,000 --> 00:06:07,000
+Let me explain this line.
+
+75
+00:06:07,000 --> 00:06:08,000
+Jar.
+
+76
+00:06:08,000 --> 00:06:11,000
+This is Java archive tool command.
+
+77
+00:06:11,000 --> 00:06:15,000
+It is used to create and manipulate Java archive files.
+
+78
+00:06:15,000 --> 00:06:17,000
+I believe you are familiar with it.
+
+79
+00:06:18,000 --> 00:06:19,000
+Double dash create.
+
+80
+00:06:19,000 --> 00:06:23,000
+This option specifies that a new Jar file should be created.
+
+81
+00:06:24,000 --> 00:06:29,000
+Double dash file target slash Emre jar jar.
+
+82
+00:06:29,000 --> 00:06:34,000
+This option specifies the name and location of the jar file to be created.
+
+83
+00:06:34,000 --> 00:06:39,000
+In this case, it is set to target slash merger jar.
+
+84
+00:06:40,000 --> 00:06:42,000
+Double dash main dash class.
+
+85
+00:06:42,000 --> 00:06:45,000
+Comet boost.
+
+86
+00:06:45,000 --> 00:06:47,000
+Mr. jar demo dot app.
+
+87
+00:06:48,000 --> 00:06:54,000
+This option specifies the main class that should be executed when the Jar file is run.
+
+88
+00:06:54,000 --> 00:07:01,000
+In this example, the main class is Comicbooks Amir jar demo dot app.
+
+89
+00:07:02,000 --> 00:07:03,000
+There.
+
+90
+00:07:03,000 --> 00:07:04,000
+See pluses.
+
+91
+00:07:04,000 --> 00:07:06,000
+Space dot.
+
+92
+00:07:06,000 --> 00:07:13,000
+This option specifies that the contents of the classes directory, where the class files for the default
+
+93
+00:07:13,000 --> 00:07:16,000
+version are located, should be included in the jar file.
+
+94
+00:07:17,000 --> 00:07:22,000
+The dot at the end indicates the current directory within the Jar file.
+
+95
+00:07:23,000 --> 00:07:25,000
+Double dash release nine.
+
+96
+00:07:25,000 --> 00:07:29,000
+This option specifies the release version for the Jar file.
+
+97
+00:07:29,000 --> 00:07:35,000
+It indicates that the Jar file is intended for Java nine and later versions.
+
+98
+00:07:36,000 --> 00:07:40,000
+Dash C plus Dash nine space dot.
+
+99
+00:07:41,000 --> 00:07:47,000
+This option specifies that the contents of the classes dash nine directory, where the class files for
+
+100
+00:07:47,000 --> 00:07:52,000
+Java nine version are located, should also be included in the jar file.
+
+101
+00:07:53,000 --> 00:07:58,000
+The dot at the end indicates the current directory within the Jar file.
+
+102
+00:07:59,000 --> 00:08:06,000
+Execution of this command will make the content of the generated Jar file look like you can see on the
+
+103
+00:08:06,000 --> 00:08:07,000
+screen.
+
+104
+00:08:07,000 --> 00:08:15,000
+Creating a multi-release Jar file allows for a seamless integration of new features from later JDK versions,
+
+105
+00:08:15,000 --> 00:08:18,000
+while maintaining compatibility with older runtimes.
+
+106
+00:08:18,000 --> 00:08:25,000
+The ability to simultaneously support different JDK versions is valuable for libraries and applications
+
+107
+00:08:25,000 --> 00:08:28,000
+with diverse deployment environments.
+
+108
+00:08:28,000 --> 00:08:30,000
+This might be a useful feature.
+
+109
+00:08:30,000 --> 00:08:32,000
+Now you know about it.
+
+110
+00:08:32,000 --> 00:08:38,000
+Feel free to use it when there will be a business need in this and the meantime, we continue.
+
+111
+00:08:40,000 --> 00:08:43,000
+Let me explain you about compact string feature.
+
+112
+00:08:44,000 --> 00:08:50,000
+The compact string feature in Java nine is an enhancement aimed at reducing the memory footprint of
+
+113
+00:08:50,000 --> 00:08:52,000
+string objects.
+
+114
+00:08:52,000 --> 00:09:00,000
+Prior to Java nine, String and Java used a char array to store its character data.
+
+115
+00:09:00,000 --> 00:09:07,000
+In many cases, this was inefficient because many strings in real world applications use a limited set
+
+116
+00:09:07,000 --> 00:09:14,000
+of characters, often within the Ascii range 0 to 127.
+
+117
+00:09:14,000 --> 00:09:19,000
+To address the inefficiency, Java nine introduced the compact string feature.
+
+118
+00:09:20,000 --> 00:09:26,000
+The compact string feature improves the memory usage of string by introducing a memory efficient internal
+
+119
+00:09:26,000 --> 00:09:38,000
+representation for strings that primarily contains Latin one, ISO double 859 one characters, Latin
+
+120
+00:09:38,000 --> 00:09:46,000
+one characters covers the first 256 Unicode code points, which includes the Ascii character set.
+
+121
+00:09:47,000 --> 00:09:49,000
+So how does it work under the hood?
+
+122
+00:09:50,000 --> 00:09:58,000
+Two representations, let in one strings containing only Latin one characters, one byte per character
+
+123
+00:09:58,000 --> 00:10:01,000
+are represented using a byte array.
+
+124
+00:10:01,000 --> 00:10:06,000
+UTF 16 strings contain a non-Latin one.
+
+125
+00:10:06,000 --> 00:10:12,000
+Characters or supplementary characters required 2 or 4 bytes per character.
+
+126
+00:10:12,000 --> 00:10:17,000
+Continue to use the existing UTF 16 representation with a char array.
+
+127
+00:10:18,000 --> 00:10:22,000
+The second point to understand adaptive representation.
+
+128
+00:10:23,000 --> 00:10:29,000
+The Java runtime system dynamically chooses between the two representations based on the actual content
+
+129
+00:10:29,000 --> 00:10:30,000
+of the string.
+
+130
+00:10:30,000 --> 00:10:37,000
+If a string contains only less than one characters, it will use a more memory efficient Latin one representation.
+
+131
+00:10:38,000 --> 00:10:45,000
+This adaptive approach helps reduce memory consumption for strings that predominantly consists of Latin
+
+132
+00:10:45,000 --> 00:10:46,000
+one characters.
+
+133
+00:10:46,000 --> 00:10:49,000
+What benefits do we get from this feature?
+
+134
+00:10:50,000 --> 00:10:52,000
+First of all, reduced memory footprint.
+
+135
+00:10:52,000 --> 00:10:59,000
+Strings that primarily contain Latin one characters benefit from reduced memory usage, as each character
+
+136
+00:10:59,000 --> 00:11:02,000
+requires only one byte instead of two bytes.
+
+137
+00:11:03,000 --> 00:11:06,000
+The second advantage is backward compatibility.
+
+138
+00:11:06,000 --> 00:11:13,000
+The change is implemented in a way that is backward compatible insurance that existing code relying
+
+139
+00:11:13,000 --> 00:11:19,000
+on the UTF 16 representation of strings continues to function correctly.
+
+140
+00:11:19,000 --> 00:11:23,000
+Consider the following example for Java eight and earlier.
+
+141
+00:11:23,000 --> 00:11:30,000
+Such a simple string as hello Ascii will be stored as UTF 16 representation.
+
+142
+00:11:31,000 --> 00:11:41,000
+And since Java nine and later with compact string feature such string as Cafe will use Latin one representation
+
+143
+00:11:41,000 --> 00:11:46,000
+for characters within the ISO 859 one range.
+
+144
+00:11:47,000 --> 00:11:53,000
+In this example, the Latin one characters would use the more memory efficient byte array representation
+
+145
+00:11:53,000 --> 00:11:54,000
+in Java nine.
+
+146
+00:11:54,000 --> 00:11:58,000
+If the runtime determines it is more efficient.
+
+147
+00:11:58,000 --> 00:12:06,000
+Developers typically do not need to modify their code to take advantage of this feature, as it is implemented
+
+148
+00:12:06,000 --> 00:12:08,000
+transparently by the Java runtime.
+
+149
+00:12:09,000 --> 00:12:11,000
+This feature is enabled by default.
+
+150
+00:12:12,000 --> 00:12:16,000
+You can disable it if you wish by using the following Java parameters.
+
+151
+00:12:16,000 --> 00:12:22,000
+During the start of the Java Plus double x colon dash.
+
+152
+00:12:22,000 --> 00:12:23,000
+Compact strings.
+
+153
+00:12:24,000 --> 00:12:30,000
+Compact strings are part of ongoing efforts in Java to improve efficiency and reduce memory overhead
+
+154
+00:12:30,000 --> 00:12:33,000
+in various aspects of the platform.
+
+155
+00:12:33,000 --> 00:12:36,000
+But how does it work under the hood?
+
+156
+00:12:36,000 --> 00:12:41,000
+Because in case you would open source code of string class, you can just find that there is a byte
+
+157
+00:12:41,000 --> 00:12:45,000
+array property and there is no char array property.
+
+158
+00:12:46,000 --> 00:12:48,000
+You can also find compact strings.
+
+159
+00:12:48,000 --> 00:12:50,000
+Boolean flag.
+
+160
+00:12:50,000 --> 00:12:54,000
+So at the first glance the internal mechanism is not clear.
+
+161
+00:12:55,000 --> 00:13:02,000
+The internal representation of string objects in Java nine with compact strings is indeed more complex
+
+162
+00:13:02,000 --> 00:13:05,000
+than it may appear at first glance.
+
+163
+00:13:05,000 --> 00:13:12,000
+The implementation involves adaptive representation and aims to optimize memory usage based on the actual
+
+164
+00:13:12,000 --> 00:13:14,000
+content of the string.
+
+165
+00:13:14,000 --> 00:13:16,000
+Byte array value field.
+
+166
+00:13:16,000 --> 00:13:23,000
+The string class in Java nine introduces a byte array field named value to store the character data
+
+167
+00:13:23,000 --> 00:13:24,000
+for strings.
+
+168
+00:13:25,000 --> 00:13:28,000
+For strings that primarily contain Latin one characters.
+
+169
+00:13:29,000 --> 00:13:33,000
+Characters within the ISO 8859 one range.
+
+170
+00:13:34,000 --> 00:13:38,000
+This byte array directly holds the byte values of the characters.
+
+171
+00:13:39,000 --> 00:13:41,000
+Coding schemes.
+
+172
+00:13:41,000 --> 00:13:46,000
+Two coding schemes are used to interpret the data stored in the byte array.
+
+173
+00:13:47,000 --> 00:13:49,000
+Latin one coding scheme.
+
+174
+00:13:49,000 --> 00:13:54,000
+The byte values directly represent characters in the Latin one character set.
+
+175
+00:13:54,000 --> 00:13:57,000
+UTF 16 coding scheme.
+
+176
+00:13:57,000 --> 00:14:04,000
+When non-Latin one characters are supplementary, characters are present as separate UTF 16 representation
+
+177
+00:14:04,000 --> 00:14:07,000
+is used to handle these characters.
+
+178
+00:14:07,000 --> 00:14:09,000
+Adaptive approach.
+
+179
+00:14:09,000 --> 00:14:16,000
+The decision on whether to use the Latin one or UTF 16 representation is made adaptively based on the
+
+180
+00:14:16,000 --> 00:14:18,000
+actual content of the string.
+
+181
+00:14:19,000 --> 00:14:24,000
+If the string primarily contains Latin one characters, it benefits from the memory efficient byte array
+
+182
+00:14:24,000 --> 00:14:25,000
+representation.
+
+183
+00:14:26,000 --> 00:14:30,000
+If non-Latin one characters are present, the UTF 16 representation is used.
+
+184
+00:14:32,000 --> 00:14:32,000
+That's all.
+
+185
+00:14:32,000 --> 00:14:36,000
+What I wanted to share with you regarding compact string feature.
+
diff --git a/44 - Java New Versions/006 Java 9 Deprecated & Removed Features_en.srt b/44 - Java New Versions/006 Java 9 Deprecated & Removed Features_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..bbb5124618db142ae1cbb55a056982db4c3c4f08
--- /dev/null
+++ b/44 - Java New Versions/006 Java 9 Deprecated & Removed Features_en.srt
@@ -0,0 +1,796 @@
+1
+00:00:03,000 --> 00:00:08,000
+Let's talk about the next portion of updates in Java nine.
+
+2
+00:00:08,000 --> 00:00:14,000
+Java nine introduced the module system to improve the security, maintainability, and performance of
+
+3
+00:00:14,000 --> 00:00:15,000
+the JDK.
+
+4
+00:00:16,000 --> 00:00:23,000
+One aspect of this effort is to strongly encapsulate internal elements limiting access to them.
+
+5
+00:00:24,000 --> 00:00:31,000
+In this context, internal elements refers to non-public classes, methods and fields of Java.
+
+6
+00:00:31,000 --> 00:00:32,000
+Sun.
+
+7
+00:00:33,000 --> 00:00:34,000
+Sun.
+
+8
+00:00:34,000 --> 00:00:40,000
+Gdcc and org packages, but in which cases developers wanted to get access there.
+
+9
+00:00:40,000 --> 00:00:45,000
+What was the need to access those internals?
+
+10
+00:00:45,000 --> 00:00:52,000
+Developers might have needed to access internal elements of the JDK for various reasons, including
+
+11
+00:00:52,000 --> 00:00:53,000
+the following ones.
+
+12
+00:00:54,000 --> 00:00:56,000
+Legacy code compatibility.
+
+13
+00:00:56,000 --> 00:01:03,000
+Developers might have used internal APIs to achieve specific tasks before suitable standard replacements
+
+14
+00:01:03,000 --> 00:01:04,000
+were available.
+
+15
+00:01:04,000 --> 00:01:06,000
+Undocumented features.
+
+16
+00:01:06,000 --> 00:01:13,000
+Some developers may have utilized undocumented or unsupported features provided by internal APIs to
+
+17
+00:01:13,000 --> 00:01:17,000
+accomplish tasks not covered by public APIs.
+
+18
+00:01:17,000 --> 00:01:24,000
+The internal APIs might have exposed functionalities that were not officially documented or supported,
+
+19
+00:01:24,000 --> 00:01:27,000
+but very useful for specific scenarios.
+
+20
+00:01:27,000 --> 00:01:33,000
+One example of accessing functionalities not officially documented or supported through internal APIs
+
+21
+00:01:33,000 --> 00:01:38,000
+might involve using classes or methods from Sun Misc package.
+
+22
+00:01:38,000 --> 00:01:45,000
+In the past, developers occasionally turned to these internal elements for specific purposes, even
+
+23
+00:01:45,000 --> 00:01:51,000
+though they were not part of the public API and were subject to change without notice.
+
+24
+00:01:52,000 --> 00:02:00,000
+An example scenario could be manipulating or interacting with low level aspects of the gvm or the underlying
+
+25
+00:02:00,000 --> 00:02:00,000
+system.
+
+26
+00:02:00,000 --> 00:02:07,000
+If you want to learn more examples and understand what exactly from some misc package was used by developers,
+
+27
+00:02:07,000 --> 00:02:10,000
+most often I can provide you with some examples.
+
+28
+00:02:11,000 --> 00:02:12,000
+Some misc.
+
+29
+00:02:12,000 --> 00:02:13,000
+Unsafe.
+
+30
+00:02:13,000 --> 00:02:18,000
+Unsafe was a powerful class that provided low level unsafe operations.
+
+31
+00:02:18,000 --> 00:02:26,000
+Developers might have used it for tasks like memory, manipulation of heap storage, and other operations
+
+32
+00:02:26,000 --> 00:02:30,000
+not typically supported by high level Java APIs.
+
+33
+00:02:31,000 --> 00:02:37,000
+Sun mask, base 64 encoder and Sun mask base 64 decoder.
+
+34
+00:02:38,000 --> 00:02:45,000
+These classes were used for base64 encoding and decoding before the official Java.util base 64 class
+
+35
+00:02:45,000 --> 00:02:47,000
+was introduced in Java eight.
+
+36
+00:02:48,000 --> 00:02:56,000
+Some misc base64 encoder stream and some misc base64 decoder stream, similar to the above.
+
+37
+00:02:56,000 --> 00:03:00,000
+These classes provided streaming, base64 encoding and decoding.
+
+38
+00:03:01,000 --> 00:03:03,000
+Son misc launcher.
+
+39
+00:03:03,000 --> 00:03:08,000
+The launcher class played a role in the Jvm's launching process.
+
+40
+00:03:08,000 --> 00:03:15,000
+Developers might have used it to gain insights into the classpath or other launch related information.
+
+41
+00:03:16,000 --> 00:03:21,000
+Another reason to access GTK internals was performance optimization.
+
+42
+00:03:22,000 --> 00:03:28,000
+Access to internal elements might have been considered for performance optimization in specific cases,
+
+43
+00:03:28,000 --> 00:03:32,000
+where standard APIs introduced additional overhead.
+
+44
+00:03:32,000 --> 00:03:39,000
+Direct access to internal classes or methods might have been perceived as a way to achieve better performance
+
+45
+00:03:39,000 --> 00:03:40,000
+in certain situations.
+
+46
+00:03:41,000 --> 00:03:44,000
+Another reason is extended functionality.
+
+47
+00:03:44,000 --> 00:03:51,000
+Internal APIs sometimes provided extended or advanced functionalities that were not available through
+
+48
+00:03:51,000 --> 00:03:52,000
+the standard APIs.
+
+49
+00:03:53,000 --> 00:03:59,000
+Developers might have explored internal elements to extend or customize the behavior of certain components.
+
+50
+00:04:00,000 --> 00:04:02,000
+Third party library dependencies.
+
+51
+00:04:02,000 --> 00:04:09,000
+Some short party libraries or frameworks might have used internal APIs, and developers had to use illegal
+
+52
+00:04:09,000 --> 00:04:12,000
+access argument to maintain compatibility.
+
+53
+00:04:12,000 --> 00:04:19,000
+Dependency on libraries that had not yet migrated to using standard APIs might have required relaxed,
+
+54
+00:04:19,000 --> 00:04:25,000
+strong encapsulation, so the main goal of restricting access to internal elements was security and
+
+55
+00:04:25,000 --> 00:04:26,000
+maintainability.
+
+56
+00:04:27,000 --> 00:04:33,000
+Enhance the security and maintainability of the JDK by restricting access to internal elements and discourage
+
+57
+00:04:33,000 --> 00:04:38,000
+the use of internal elements, promoting migration to standard APIs.
+
+58
+00:04:38,000 --> 00:04:46,000
+So starting from Java nine, code access and internal elements via reflection will fail and developers
+
+59
+00:04:46,000 --> 00:04:48,000
+are advised to update such code.
+
+60
+00:04:49,000 --> 00:04:57,000
+On this slide, you can find different examples that will fail with either illegal access error or fail
+
+61
+00:04:57,000 --> 00:05:04,000
+due to inaccessible private field, or fail due to inaccessible protected method.
+
+62
+00:05:04,000 --> 00:05:09,000
+Now it is time to review items that were marked as deprecated in Java nine.
+
+63
+00:05:10,000 --> 00:05:17,000
+I explained Java deprecation mechanism in previous lessons so I wouldn't stop on this too much.
+
+64
+00:05:17,000 --> 00:05:21,000
+Let me know in case you have any questions on this matter.
+
+65
+00:05:22,000 --> 00:05:25,000
+Update API was marked as deprecated in Java nine.
+
+66
+00:05:25,000 --> 00:05:31,000
+The update API has been a part of Java since its early versions.
+
+67
+00:05:31,000 --> 00:05:38,000
+It was initially designed for creating outlets which are small Java applications embedded in web pages.
+
+68
+00:05:39,000 --> 00:05:45,000
+Over time, web technologies have evolved and the usage of Java applets has declined.
+
+69
+00:05:46,000 --> 00:05:52,000
+Modern web standards and browser security policies have moved away from supporting Java applets.
+
+70
+00:05:52,000 --> 00:06:00,000
+This deprecation is acknowledgement that the applet API is outdated, not secure, and not in alignment
+
+71
+00:06:00,000 --> 00:06:07,000
+with modern web standards for modern web development, as the technologies and approaches have superseded
+
+72
+00:06:07,000 --> 00:06:08,000
+Java applets.
+
+73
+00:06:08,000 --> 00:06:15,000
+Web technologies such as HTML5, JavaScript and others are commonly used for web applications.
+
+74
+00:06:16,000 --> 00:06:19,000
+So let's sum it up and understand why.
+
+75
+00:06:19,000 --> 00:06:24,000
+Applet API is deprecated and what stands behind this decision?
+
+76
+00:06:25,000 --> 00:06:27,000
+First of all, security concerns.
+
+77
+00:06:27,000 --> 00:06:31,000
+Applets have historically been a source of security vulnerabilities.
+
+78
+00:06:32,000 --> 00:06:39,000
+Deprecating and eventually removing the applet API aligns with the broader industry trend of phasing
+
+79
+00:06:39,000 --> 00:06:41,000
+out technologies with security concerns.
+
+80
+00:06:42,000 --> 00:06:45,000
+Focus on modern technologies.
+
+81
+00:06:45,000 --> 00:06:52,000
+The deprecation reflects Oracle's and the Java community's focus on modernizing the platform and aligning
+
+82
+00:06:52,000 --> 00:06:54,000
+with current industry practices.
+
+83
+00:06:55,000 --> 00:07:02,000
+On this slide you can see a list of classes, interfaces API elements of the standard Java API that
+
+84
+00:07:02,000 --> 00:07:04,000
+were marked as deprecated.
+
+85
+00:07:05,000 --> 00:07:12,000
+The next deprecation I want to talk about is related to concurrent mark sweep garbage collector in Java
+
+86
+00:07:12,000 --> 00:07:13,000
+nine.
+
+87
+00:07:13,000 --> 00:07:17,000
+The concurrent mark sweep garbage collector was deprecated.
+
+88
+00:07:17,000 --> 00:07:26,000
+See mass garbage collector was introduced in earlier versions of Java as low latency garbage collector.
+
+89
+00:07:26,000 --> 00:07:33,000
+It aimed to minimize the pause times experienced by applications, making it suitable for scenarios
+
+90
+00:07:33,000 --> 00:07:35,000
+where low latency is crucial.
+
+91
+00:07:36,000 --> 00:07:43,000
+While time as garbage collector achieved its goals of reducing pause times, it had certain limitations
+
+92
+00:07:43,000 --> 00:07:48,000
+and its performance characteristics were not ideal for all use cases.
+
+93
+00:07:48,000 --> 00:07:55,000
+The main limitations included fragmentation issues and the potential for longer pause times as heap
+
+94
+00:07:55,000 --> 00:07:56,000
+filled up.
+
+95
+00:07:56,000 --> 00:08:04,000
+With the deprecation of Cms's garbage collector Java developers were encouraged to explore alternative
+
+96
+00:08:04,000 --> 00:08:08,000
+garbage collectors such as Garbage First Garbage Collector G1.
+
+97
+00:08:08,000 --> 00:08:15,000
+Garbage collector was designed to provide a better overall performance and predictability compared to
+
+98
+00:08:15,000 --> 00:08:15,000
+CMS.
+
+99
+00:08:15,000 --> 00:08:17,000
+Garbage collector.
+
+100
+00:08:17,000 --> 00:08:24,000
+The G1 garbage collector was positioned as the long Tum replacement for CMS Garbage collector.
+
+101
+00:08:24,000 --> 00:08:33,000
+G1 is intended to offer improved garbage collection performance, reduced pause times, and better adaptability
+
+102
+00:08:33,000 --> 00:08:35,000
+to various application scenarios.
+
+103
+00:08:36,000 --> 00:08:41,000
+The next thing that was marked as deprecated in Java nine is Java Web Start.
+
+104
+00:08:41,000 --> 00:08:47,000
+Java Web Start was deprecated as part of the broader changes in Java starting from JDK nine.
+
+105
+00:08:47,000 --> 00:08:55,000
+Java Web Start was a technology developed by Sun Microsystems that allowed Java applications to be launched
+
+106
+00:08:55,000 --> 00:08:56,000
+and updated from the web.
+
+107
+00:08:57,000 --> 00:09:04,000
+It provided a way for users to run Java applications directly from a web browser, without the need
+
+108
+00:09:04,000 --> 00:09:05,000
+for manual installation.
+
+109
+00:09:06,000 --> 00:09:12,000
+This is a feature required for applets, but taking into account applets are deprecated too.
+
+110
+00:09:12,000 --> 00:09:15,000
+Web start is also deprecated.
+
+111
+00:09:15,000 --> 00:09:22,000
+This deprecation meant that Java Web Start was no longer recommended for use, and its future support
+
+112
+00:09:22,000 --> 00:09:23,000
+was uncertain.
+
+113
+00:09:24,000 --> 00:09:31,000
+The deprecation of Java Web Start was particularly relevant to Oracle JDK, as it was a technology associated
+
+114
+00:09:31,000 --> 00:09:33,000
+with Oracle's Java distribution.
+
+115
+00:09:34,000 --> 00:09:41,000
+Several factors contributed to the deprecation, including security concerns, changes in the web ecosystem,
+
+116
+00:09:41,000 --> 00:09:45,000
+and the need for a more modern and secure application deployment model.
+
+117
+00:09:46,000 --> 00:09:53,000
+One notable alternative is the use of standalone Java applications, or the adoption of other deployment
+
+118
+00:09:53,000 --> 00:09:55,000
+technologies and framework.
+
+119
+00:09:56,000 --> 00:10:02,000
+The next deprecation is related to Java Enterprise Edition and CORBA modules.
+
+120
+00:10:02,000 --> 00:10:11,000
+By the way, CORBA stands for Common Object Request Broker Architecture, including specific technologies
+
+121
+00:10:11,000 --> 00:10:23,000
+like Jax-ws that stands for Java API for XML Web Services, Jaxb that is Java architecture for XML binding,
+
+122
+00:10:23,000 --> 00:10:33,000
+Jaff Javabeans activation framework, common annotations, JTA Java Transaction API, among others,
+
+123
+00:10:33,000 --> 00:10:38,000
+is part of the broader changes in Java starting from JDK nine.
+
+124
+00:10:39,000 --> 00:10:46,000
+These changes involve the modularization of the Java platform and the move away from the monolithic
+
+125
+00:10:46,000 --> 00:10:48,000
+Java Enterprise Edition platform.
+
+126
+00:10:49,000 --> 00:10:55,000
+CORBA was a middleware standard that enabled communication between distributed objects.
+
+127
+00:10:55,000 --> 00:11:02,000
+The deprecation was driven by the desire to simplify the Java platform and move away from monolithic,
+
+128
+00:11:02,000 --> 00:11:05,000
+one size fits all approach.
+
+129
+00:11:05,000 --> 00:11:13,000
+The deprecation of Java Enterprise Edition in the JDK was accompanied by the transfer of Java Enterprise
+
+130
+00:11:13,000 --> 00:11:20,000
+Edition technologies to the Eclipse Foundation, where they were rebranded as Jakarta Enterprise Edition.
+
+131
+00:11:20,000 --> 00:11:29,000
+Jakarta EE is an open source set of specifications and technologies for enterprise Java, fostering
+
+132
+00:11:29,000 --> 00:11:32,000
+an open and vendor neutral ecosystem.
+
+133
+00:11:33,000 --> 00:11:42,000
+Jakarta EE became the natural successor for Java EE, providing a path for developers to continue building
+
+134
+00:11:42,000 --> 00:11:47,000
+enterprise applications using a more modern and modular approach.
+
+135
+00:11:48,000 --> 00:11:56,000
+Application is relying on the deprecated Java EE and CORBA modules needed to consider migration strategies.
+
+136
+00:11:56,000 --> 00:12:04,000
+The deprecation marked a significant shift in the approach to enterprise Java, emphasizing modularity,
+
+137
+00:12:04,000 --> 00:12:07,000
+flexibility, and community driven development.
+
+138
+00:12:07,000 --> 00:12:15,000
+Jakarta EE was it's open and collaborative model aimed to address the changing needs of the enterprise
+
+139
+00:12:15,000 --> 00:12:16,000
+Java community.
+
+140
+00:12:17,000 --> 00:12:23,000
+In my course, Java From zero to First Job, I already considered this update and we learn Jakarta API
+
+141
+00:12:24,000 --> 00:12:28,000
+and also in Java nine some previously deprecated sinks were removed.
+
+142
+00:12:29,000 --> 00:12:30,000
+What are they?
+
+143
+00:12:30,000 --> 00:12:31,000
+Let's review.
+
+144
+00:12:32,000 --> 00:12:33,000
+And the lesson about Java eight.
+
+145
+00:12:33,000 --> 00:12:41,000
+I told you that extension mechanism was marked as deprecated, and in Java nine it was already removed.
+
+146
+00:12:41,000 --> 00:12:46,000
+The same thing with rarely used garbage collector combinations.
+
+147
+00:12:46,000 --> 00:12:52,000
+In this lesson about Java eight, we learned which combinations are marked as deprecated, and in Java
+
+148
+00:12:52,000 --> 00:12:53,000
+nine they were removed.
+
+149
+00:12:54,000 --> 00:12:59,000
+So feel free to check lesson about Java eight if you want to remember the details.
+
+150
+00:12:59,000 --> 00:13:03,000
+Also J hat heap visualizer was removed.
+
+151
+00:13:03,000 --> 00:13:11,000
+J hat that stands for Java Heap Analysis Tool, was a tool included in the GCC that allowed developers
+
+152
+00:13:11,000 --> 00:13:16,000
+to perform heap dumps and analyze the contents of the Java heap.
+
+153
+00:13:17,000 --> 00:13:24,000
+It provided a web based interface for visualizing and exploring the heap dump data, helping developers
+
+154
+00:13:24,000 --> 00:13:31,000
+identify memory related issues such as memory leaks and inefficient memory usage.
+
+155
+00:13:31,000 --> 00:13:38,000
+With the introduction of improvements in the Java mission Control and Java flight recorder tools and
+
+156
+00:13:38,000 --> 00:13:45,000
+the evolution of the heap analysis landscape, it was decided to deprecate and subsequently remove J
+
+157
+00:13:45,000 --> 00:13:48,000
+hat from the JDK starting with Java nine.
+
+158
+00:13:48,000 --> 00:13:55,000
+Developers were encouraged to use alternative tools for heap dump analysis, including tools like Java,
+
+159
+00:13:55,000 --> 00:14:00,000
+mission control, visual VM, and third party profilers.
+
+160
+00:14:00,000 --> 00:14:06,000
+Java mission control, in particular, became a more comprehensive tool for monitoring, profiling,
+
+161
+00:14:06,000 --> 00:14:08,000
+and analyzing Java applications.
+
+162
+00:14:09,000 --> 00:14:15,000
+In Java nine, the feature known as Launch Time gray version selection was removed.
+
+163
+00:14:16,000 --> 00:14:23,000
+This feature allowed Java applications to specify a preferred gray version at lunchtime.
+
+164
+00:14:23,000 --> 00:14:30,000
+The removal of this feature meant that the selection of the gray version would no longer be determined
+
+165
+00:14:30,000 --> 00:14:33,000
+at runtime, based on launch parameters.
+
+166
+00:14:34,000 --> 00:14:38,000
+The lunchtime version selection feature had limitations and complexities.
+
+167
+00:14:38,000 --> 00:14:45,000
+It could lead to unintended behavior and potential compatibility issues in Java nine.
+
+168
+00:14:45,000 --> 00:14:53,000
+The feature was officially removed, and attempts to use the dash version launch parameter for selecting
+
+169
+00:14:53,000 --> 00:14:58,000
+the gray version would no longer have the intended effect.
+
+170
+00:14:58,000 --> 00:15:04,000
+Developers were advised to use other mechanisms for managing gray versions.
+
+171
+00:15:04,000 --> 00:15:11,000
+One common approach is to design applications to be compatible with a range of gray versions, ensuring
+
+172
+00:15:11,000 --> 00:15:16,000
+that they work well with the intended gray without relying on lunchtime versions.
+
+173
+00:15:16,000 --> 00:15:17,000
+Selection.
+
+174
+00:15:17,000 --> 00:15:24,000
+This feature is called Multi-release jar Files, and we already learned it in scope of this lesson.
+
+175
+00:15:25,000 --> 00:15:26,000
+In Java nine.
+
+176
+00:15:26,000 --> 00:15:31,000
+One significant change was the removal of the RT dot jar.
+
+177
+00:15:32,000 --> 00:15:38,000
+Runtime jar and tools dot jar from the internal structure of the JDK.
+
+178
+00:15:38,000 --> 00:15:45,000
+This change was part of the larger modularization effort known as Project Jigsaw, which.
+
+179
+00:15:46,000 --> 00:15:48,000
+Introduced the Java Platform Module system.
+
+180
+00:15:49,000 --> 00:15:56,000
+The primary goals were to enhance modularity, maintainability and security in the Java platform.
+
+181
+00:15:56,000 --> 00:16:04,000
+In previous Java versions, the Jar file contained the core classes and resources of the Java Runtime
+
+182
+00:16:04,000 --> 00:16:04,000
+Environment.
+
+183
+00:16:05,000 --> 00:16:10,000
+It was monolithic Jar file that included classes from the Java packages.
+
+184
+00:16:11,000 --> 00:16:11,000
+Tools.
+
+185
+00:16:11,000 --> 00:16:18,000
+Jar contained tools and utilities for developers such as compilers and other development related components.
+
+186
+00:16:19,000 --> 00:16:26,000
+Instead of relying on a single Jar file or key jar, Java nine introduced the concept of the module
+
+187
+00:16:26,000 --> 00:16:27,000
+path.
+
+188
+00:16:28,000 --> 00:16:34,000
+The JDK itself was modularized into a set of modules, each containing related functionality.
+
+189
+00:16:35,000 --> 00:16:42,000
+In GCC, you can find modules in game modes folder inside JDK distribution.
+
+190
+00:16:42,000 --> 00:16:47,000
+That's all what I wanted to review with you regarding Java nine release.
+
+191
+00:16:47,000 --> 00:16:50,000
+Let's recap what we have learned in this lesson.
+
+192
+00:16:51,000 --> 00:16:54,000
+We learned new features that were released in Java nine.
+
+193
+00:16:55,000 --> 00:17:01,000
+I explained you tools and features that were marked as deprecated in Java nine, and we learned what
+
+194
+00:17:01,000 --> 00:17:03,000
+was removed from Java Nai.
+
+195
+00:17:03,000 --> 00:17:10,000
+There was a lot of information, so in case you will have any questions, please post your questions
+
+196
+00:17:10,000 --> 00:17:12,000
+below the video and I will be happy to answer.
+
+197
+00:17:13,000 --> 00:17:14,000
+That's it.
+
+198
+00:17:14,000 --> 00:17:16,000
+Thanks a lot team for your attention.
+
+199
+00:17:16,000 --> 00:17:19,000
+Have a great day and see you in the next lesson.
+
diff --git "a/44 - Java New Versions/007 Java 10 \342\200\230var\342\200\231 variables (Type inference), Docker support, Flex Heap Size, etc_en.srt" "b/44 - Java New Versions/007 Java 10 \342\200\230var\342\200\231 variables (Type inference), Docker support, Flex Heap Size, etc_en.srt"
new file mode 100644
index 0000000000000000000000000000000000000000..e666a7d1d678c46cb45e77111cf7ab7323cf303f
--- /dev/null
+++ "b/44 - Java New Versions/007 Java 10 \342\200\230var\342\200\231 variables (Type inference), Docker support, Flex Heap Size, etc_en.srt"
@@ -0,0 +1,720 @@
+1
+00:00:05,000 --> 00:00:06,000
+Hello, Tim.
+
+2
+00:00:06,000 --> 00:00:10,000
+In this lesson we are going to learn everything about Java ten release.
+
+3
+00:00:11,000 --> 00:00:15,000
+Today we will learn new language features and APIs added to Java ten.
+
+4
+00:00:15,000 --> 00:00:18,000
+I will explain new JDK tools and features.
+
+5
+00:00:18,000 --> 00:00:21,000
+We will learn the things that were removed from Java ten.
+
+6
+00:00:21,000 --> 00:00:25,000
+Also, we will learn the things that become deprecated in Java ten.
+
+7
+00:00:25,000 --> 00:00:32,000
+And at the end of the lesson I will explain you how time based release versioning is going to work starting
+
+8
+00:00:32,000 --> 00:00:33,000
+from Java ten.
+
+9
+00:00:33,000 --> 00:00:38,000
+That's ensured the detailed agenda you can find on the slide.
+
+10
+00:00:38,000 --> 00:00:46,000
+As you can see, we will explore how Java ten makes coding less wordy with local variable type inference.
+
+11
+00:00:46,000 --> 00:00:53,000
+We'll also check out a handy method called or else throw from optional class, perfect for dealing with
+
+12
+00:00:53,000 --> 00:00:55,000
+possible errors in our code.
+
+13
+00:00:55,000 --> 00:01:03,000
+Moving on, we'll discover new tools and features added to Java since version nine from Docker Container
+
+14
+00:01:03,000 --> 00:01:10,000
+support to flexible heap size selection, we'll see how these features make Java even more powerful
+
+15
+00:01:10,000 --> 00:01:11,000
+and flexible.
+
+16
+00:01:11,000 --> 00:01:19,000
+Next, we'll explore the details of Java ten features like the Pearl full Garbage Collector for G1,
+
+17
+00:01:19,000 --> 00:01:21,000
+TLS, session hash, and more.
+
+18
+00:01:21,000 --> 00:01:27,000
+It might sound complex, but we'll break it down into simple parts, making it easy to understand and
+
+19
+00:01:27,000 --> 00:01:28,000
+use.
+
+20
+00:01:28,000 --> 00:01:30,000
+But wait, there is more.
+
+21
+00:01:30,000 --> 00:01:36,000
+We'll talk about some things Java said goodbye to like old options and components.
+
+22
+00:01:36,000 --> 00:01:43,000
+It's similar to tidying up your coding environment, making things simpler and more efficient.
+
+23
+00:01:43,000 --> 00:01:48,000
+We'll also touch on features that are on the way out called deprecated features.
+
+24
+00:01:49,000 --> 00:01:50,000
+Let's start our lesson.
+
+25
+00:01:51,000 --> 00:01:51,000
+Today.
+
+26
+00:01:51,000 --> 00:01:57,000
+I prepared theoretical and practical materials for you, but let's start from the practical demo of
+
+27
+00:01:57,000 --> 00:01:59,000
+the first feature straight away.
+
+28
+00:01:59,000 --> 00:02:04,000
+As always, all source code examples you will be able to find in attachments to the video.
+
+29
+00:02:05,000 --> 00:02:11,000
+Despite the huge amount of features and updates in Java ten, I can say that still a lot of them will
+
+30
+00:02:11,000 --> 00:02:16,000
+stay in the background and only some of them will impact us as developers.
+
+31
+00:02:16,000 --> 00:02:23,000
+I'm talking about features that introduce new syntax or new API, and most significant out of them in
+
+32
+00:02:23,000 --> 00:02:27,000
+Java ten is local variable type inference feature.
+
+33
+00:02:27,000 --> 00:02:28,000
+Let's review it.
+
+34
+00:02:29,000 --> 00:02:31,000
+I am in the file that is called Java ten.
+
+35
+00:02:31,000 --> 00:02:37,000
+I will run the code in order to explore with you console output wherever it would be required.
+
+36
+00:02:38,000 --> 00:02:45,000
+Java ten introduced the local variable type inference feature, allowing developers to declare local
+
+37
+00:02:45,000 --> 00:02:49,000
+variables without explicitly specifying their types.
+
+38
+00:02:49,000 --> 00:02:56,000
+This feature aims to reduce boilerplate code while maintaining Java's strong static typing.
+
+39
+00:02:57,000 --> 00:03:04,000
+With local variable type inference, you can use var keyword to declare variables and let the compiler
+
+40
+00:03:04,000 --> 00:03:08,000
+infer the types based on the assigned values.
+
+41
+00:03:08,000 --> 00:03:15,000
+This enhances code readability and conciseness, especially when dealing with complex generic types
+
+42
+00:03:15,000 --> 00:03:17,000
+or long type names.
+
+43
+00:03:17,000 --> 00:03:19,000
+Here you can see an example.
+
+44
+00:03:19,000 --> 00:03:25,000
+In the first example, you can see how I declare a list variable in a regular way like he already used
+
+45
+00:03:25,000 --> 00:03:26,000
+to.
+
+46
+00:03:26,000 --> 00:03:29,000
+There is a type declaration and then goes variable name.
+
+47
+00:03:29,000 --> 00:03:37,000
+In the second example, the compiler automatically infers that the variable names var has the type array
+
+48
+00:03:37,000 --> 00:03:42,000
+list parameterized by string based on the right hand side of the assignment.
+
+49
+00:03:42,000 --> 00:03:47,000
+And as you can see, we don't specify type of the variable.
+
+50
+00:03:47,000 --> 00:03:54,000
+It's important to note that while var is helpful in certain situations, it should be used judiciously.
+
+51
+00:03:55,000 --> 00:04:01,000
+Overuse of VAR can lead to less readable code, so it is recommended to use it when the type is clear
+
+52
+00:04:01,000 --> 00:04:05,000
+from the context, or when dealing with complex type declarations.
+
+53
+00:04:06,000 --> 00:04:14,000
+Once var variable was initialized with one data type, I can't assign a link to object of another data
+
+54
+00:04:14,000 --> 00:04:15,000
+type.
+
+55
+00:04:15,000 --> 00:04:22,000
+For example, I can't assign linked list parameterized by string to named var variable.
+
+56
+00:04:22,000 --> 00:04:27,000
+Also, I can't assign ArrayList parameterized with integer to names.
+
+57
+00:04:27,000 --> 00:04:28,000
+VAR variable needs.
+
+58
+00:04:29,000 --> 00:04:35,000
+Because after the first assignment, the compiler will recognize the type of the var variable and will
+
+59
+00:04:35,000 --> 00:04:42,000
+use the type to avoid cases when the link to the object of the non-compatible type is assigned to the
+
+60
+00:04:42,000 --> 00:04:42,000
+variable.
+
+61
+00:04:43,000 --> 00:04:48,000
+But as you can see, I can assign the reference to the new object of the same type.
+
+62
+00:04:48,000 --> 00:04:50,000
+ArrayList parameterized by string.
+
+63
+00:04:51,000 --> 00:04:54,000
+And now let's talk about limitations.
+
+64
+00:04:54,000 --> 00:05:01,000
+It is crucial to note that this feature is limited to local variables with initializers, it can't be
+
+65
+00:05:01,000 --> 00:05:03,000
+used for member variables.
+
+66
+00:05:03,000 --> 00:05:04,000
+Method parameters.
+
+67
+00:05:04,000 --> 00:05:05,000
+Return types.
+
+68
+00:05:05,000 --> 00:05:07,000
+Lambda expressions.
+
+69
+00:05:07,000 --> 00:05:15,000
+As the initializer is necessary for the compiler to infer the type accurately, this restriction ensures
+
+70
+00:05:15,000 --> 00:05:20,000
+that the compiler has sufficient information to determine the type of the variable.
+
+71
+00:05:20,000 --> 00:05:25,000
+Let's review some examples illustrating where the use of var is not allowed.
+
+72
+00:05:26,000 --> 00:05:32,000
+Even though var is convenient for local variables, it can't be used for method parameters.
+
+73
+00:05:32,000 --> 00:05:36,000
+The type must be explicitly declared in the method signature.
+
+74
+00:05:36,000 --> 00:05:43,000
+In the next example, you can see that var can't be used for member variables within a class.
+
+75
+00:05:43,000 --> 00:05:51,000
+Member variables require an explicit type declaration, so that means that you can't declare a class
+
+76
+00:05:51,000 --> 00:05:54,000
+property class field using the var keyword.
+
+77
+00:05:55,000 --> 00:06:00,000
+Even in lambda expressions, var can't be used for parameter types.
+
+78
+00:06:00,000 --> 00:06:06,000
+The type must be explicitly stated for lambda expression parameter or completely omitted.
+
+79
+00:06:09,000 --> 00:06:14,000
+Another important thing to mention that in Java, var variable needs to be initialized.
+
+80
+00:06:14,000 --> 00:06:18,000
+You can't just declare a var variable without initializing it.
+
+81
+00:06:18,000 --> 00:06:22,000
+You also can't initialize this variable with null value.
+
+82
+00:06:22,000 --> 00:06:26,000
+Also, you can't assign array to var variable.
+
+83
+00:06:26,000 --> 00:06:31,000
+In case of array initialization, you need an explicit target type.
+
+84
+00:06:32,000 --> 00:06:36,000
+So now you know the syntax and you know the rules.
+
+85
+00:06:36,000 --> 00:06:42,000
+But let's talk about practice when it is recommended to use var variable and when it is not recommended
+
+86
+00:06:42,000 --> 00:06:43,000
+to use it.
+
+87
+00:06:43,000 --> 00:06:46,000
+Use it when the type is obvious.
+
+88
+00:06:46,000 --> 00:06:52,000
+Use war when the type of the variable is obvious from the right hand side of the assignment.
+
+89
+00:06:52,000 --> 00:06:59,000
+For example, when initializing a variable with a literal value or a method call that returns a clear
+
+90
+00:06:59,000 --> 00:06:59,000
+type.
+
+91
+00:07:00,000 --> 00:07:03,000
+Use it in enhanced for loops.
+
+92
+00:07:03,000 --> 00:07:10,000
+Use var in enhanced for loops to simplify code, especially when dealing with collections.
+
+93
+00:07:10,000 --> 00:07:16,000
+Use var when dealing with complex generic types to reduce verbosity.
+
+94
+00:07:16,000 --> 00:07:23,000
+Avoid using var when the type is not immediately clear or when it might lead to confusion.
+
+95
+00:07:23,000 --> 00:07:29,000
+It's essential to maintain readability and make the code understandable to others.
+
+96
+00:07:29,000 --> 00:07:36,000
+Remember that while VAR can improve conciseness, it's essential to prioritize code readability and
+
+97
+00:07:36,000 --> 00:07:38,000
+maintainability.
+
+98
+00:07:38,000 --> 00:07:44,000
+Use it judiciously considering the context and the impact on code clarity.
+
+99
+00:07:44,000 --> 00:07:49,000
+So I believe we did a good overview of type inference.
+
+100
+00:07:49,000 --> 00:07:55,000
+In case you would have any questions, please let me know below the video and I will be happy to answer.
+
+101
+00:07:56,000 --> 00:07:58,000
+At the meantime, let's continue.
+
+102
+00:07:59,000 --> 00:08:00,000
+In Java ten.
+
+103
+00:08:00,000 --> 00:08:07,000
+The optional class, which is part of Java.util package, was enhanced with the or else throw method.
+
+104
+00:08:07,000 --> 00:08:13,000
+In my course Java from zero to first job, I have separate lesson dedicated to optional class only.
+
+105
+00:08:13,000 --> 00:08:18,000
+That's why we will not learn optional class in details in scope of this lesson.
+
+106
+00:08:19,000 --> 00:08:25,000
+Just to remind you that optional class is designed to represent an optional value, meaning a value
+
+107
+00:08:25,000 --> 00:08:27,000
+that may or may not be present.
+
+108
+00:08:27,000 --> 00:08:30,000
+The oil throw method was added in Java ten.
+
+109
+00:08:30,000 --> 00:08:37,000
+This method provides a way to retrieve the value from the optional instance if it is present, and if
+
+110
+00:08:37,000 --> 00:08:40,000
+not, it allows you to throw a specific exception.
+
+111
+00:08:41,000 --> 00:08:48,000
+In this example, if the optional value contains a non-null value, it will be returned by oil throw
+
+112
+00:08:48,000 --> 00:08:48,000
+method.
+
+113
+00:08:49,000 --> 00:08:56,000
+If the optional value is empty, an Illegalstateexception with a specified message value is not present
+
+114
+00:08:56,000 --> 00:08:56,000
+will be thrown.
+
+115
+00:08:57,000 --> 00:09:03,000
+This method is particularly useful in situations where you expect the value to be present, and if not,
+
+116
+00:09:03,000 --> 00:09:09,000
+you want to handle it by throwing a specific exception rather than using a default value.
+
+117
+00:09:09,000 --> 00:09:16,000
+Keep in mind that oil throw is part of the broader set of methods provided by the optional class to
+
+118
+00:09:16,000 --> 00:09:20,000
+handle optional values in a more expressive and concise manner.
+
+119
+00:09:21,000 --> 00:09:26,000
+Let's learn now API for creating Unmodifiable collections in Java ten.
+
+120
+00:09:26,000 --> 00:09:33,000
+As part of the APIs for creating Unmodifiable collections, the least copy of, set copy of and map
+
+121
+00:09:33,000 --> 00:09:42,000
+copy of methods were introduced and new methods to Unmodifiable list to Unmodifiable set and to Unmodifiable
+
+122
+00:09:42,000 --> 00:09:46,000
+map were added to the collector's class in the Java util stream package.
+
+123
+00:09:47,000 --> 00:09:50,000
+So let's review these methods and examples.
+
+124
+00:09:50,000 --> 00:09:58,000
+Leased copy of method creates an unmodifiable list containing the elements of the specified collection.
+
+125
+00:09:58,000 --> 00:10:02,000
+Everything is simple here and pretty straightforward.
+
+126
+00:10:02,000 --> 00:10:06,000
+About benefits and advantages of unmodifiable collections.
+
+127
+00:10:06,000 --> 00:10:11,000
+We already talked in previous lessons, so I wouldn't repeat myself.
+
+128
+00:10:11,000 --> 00:10:14,000
+Feel free to refer to previous lessons.
+
+129
+00:10:15,000 --> 00:10:18,000
+The similar methods exist in set and map type.
+
+130
+00:10:19,000 --> 00:10:28,000
+Regarding mascots from collectors class, let's reuse these examples to Unmodifiable list collects elements
+
+131
+00:10:28,000 --> 00:10:30,000
+into Unmodifiable list.
+
+132
+00:10:31,000 --> 00:10:34,000
+You have similar masses to get unmodifiable set and map.
+
+133
+00:10:34,000 --> 00:10:37,000
+Feel free to find source code examples in my demo file.
+
+134
+00:10:38,000 --> 00:10:44,000
+These additions simplify the creation of Unmodifiable collections in Java, providing more concise and
+
+135
+00:10:44,000 --> 00:10:50,000
+readable alternatives to achieve immutability, especially in the context of streams and collections.
+
+136
+00:10:51,000 --> 00:10:57,000
+They promote a more functional programming style by making it easier to create and work with immutable
+
+137
+00:10:57,000 --> 00:10:58,000
+data structures.
+
+138
+00:10:59,000 --> 00:11:02,000
+Let's talk about other features from Java ten release.
+
+139
+00:11:02,000 --> 00:11:09,000
+We'll learn improvements that are not directly related to new syntax, but still, these are important
+
+140
+00:11:09,000 --> 00:11:12,000
+features and updates that you can use.
+
+141
+00:11:12,000 --> 00:11:15,000
+Let's talk about Docker container support.
+
+142
+00:11:16,000 --> 00:11:22,000
+The Use Container support option is a command line option that was introduced in Java ten to address
+
+143
+00:11:22,000 --> 00:11:25,000
+issues related to container detection.
+
+144
+00:11:26,000 --> 00:11:33,000
+When running Java applications inside Docker containers, the JVM can detect certain container specific
+
+145
+00:11:33,000 --> 00:11:37,000
+configurations and adjust its behavior accordingly.
+
+146
+00:11:37,000 --> 00:11:43,000
+However, in some cases, users might want to disable this container support.
+
+147
+00:11:43,000 --> 00:11:50,000
+If you have never worked before with Docker and you don't know what it is on this stage of your learning,
+
+148
+00:11:50,000 --> 00:11:53,000
+let me briefly explain.
+
+149
+00:11:53,000 --> 00:12:00,000
+Docker is a platform that enables developers to build, ship, and run applications inside lightweight,
+
+150
+00:12:00,000 --> 00:12:01,000
+portable containers.
+
+151
+00:12:02,000 --> 00:12:08,000
+A container is a lightweight, standalone and executable software package that includes everything needed
+
+152
+00:12:08,000 --> 00:12:13,000
+to run an application, including the code, runtime libraries, and system tools.
+
+153
+00:12:13,000 --> 00:12:20,000
+Containers isolate applications from the underlying system and ensure consistency across different environments.
+
+154
+00:12:21,000 --> 00:12:29,000
+Disabling container support using US container support option can be useful in scenarios where the automatic
+
+155
+00:12:29,000 --> 00:12:36,000
+detection and adjustment of settings by the JVM are not desired or cause issues.
+
+156
+00:12:36,000 --> 00:12:43,000
+It provides users with more control over the jvm's behavior when running in containerized environments.
+
+157
+00:12:44,000 --> 00:12:49,000
+Now let's talk about another feature flexible heap size selection.
+
+158
+00:12:49,000 --> 00:12:57,000
+The addition of three new Gvm options in Java, namely initial Ram percentage, Max Ram percentage,
+
+159
+00:12:57,000 --> 00:13:04,000
+and mean Ram percentage, provides developers with more control over the allocation of system memory
+
+160
+00:13:04,000 --> 00:13:05,000
+for the Java heap.
+
+161
+00:13:05,000 --> 00:13:12,000
+These options allow users to define the initial, maximum, and minimum heap sizes as percentages of
+
+162
+00:13:12,000 --> 00:13:15,000
+the system's total available memory.
+
+163
+00:13:15,000 --> 00:13:21,000
+These options are beneficial in environments where the absolute heap size might be too restrictive or
+
+164
+00:13:21,000 --> 00:13:22,000
+too generous.
+
+165
+00:13:23,000 --> 00:13:29,000
+By setting the maximum heap size as a percentage of the available Ram, it allows for more adaptive
+
+166
+00:13:29,000 --> 00:13:35,000
+memory allocation in different environments without the need to specify an exact heap size.
+
+167
+00:13:36,000 --> 00:13:40,000
+The next new feature I want to talk about is application class data Sharing.
+
+168
+00:13:40,000 --> 00:13:49,000
+CDS application class data sharing is a feature that allows classes to be pre-processed and shared among
+
+169
+00:13:49,000 --> 00:13:55,000
+multiple Java virtual machines, instances to reduce startup time and memory footprint.
+
+170
+00:13:55,000 --> 00:14:01,000
+It leads to improved startup performance by pre-processing and sharing class data.
+
+171
+00:14:01,000 --> 00:14:08,000
+The time required for class loading and initialization during application startup is significantly reduced.
+
+172
+00:14:09,000 --> 00:14:11,000
+It also helped to reduce memory footprint.
+
+173
+00:14:12,000 --> 00:14:18,000
+Shared classes are memory mapped into the Java heap, reducing the overall memory footprint as multiple
+
+174
+00:14:18,000 --> 00:14:22,000
+JVM instances can share the same set of classes.
+
+175
+00:14:22,000 --> 00:14:25,000
+Class data sharing is enabled by default.
+
+176
+00:14:25,000 --> 00:14:28,000
+You can manually enable and disable this feature.
+
+177
+00:14:29,000 --> 00:14:33,000
+You can use the following command line options for diagnostic and debugging purposes.
+
+178
+00:14:34,000 --> 00:14:45,000
+Dash X share colon off to disable class data sharing and dash X share colon on to enable class data
+
+179
+00:14:45,000 --> 00:14:46,000
+sharing.
+
+180
+00:14:46,000 --> 00:14:52,000
+If class data sharing can't be enabled, Java prints an error message and exits.
+
diff --git a/44 - Java New Versions/007 Source-code-example-from-the-lesson.url b/44 - Java New Versions/007 Source-code-example-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..83c5ae7671857e5b6fcde3a390496d344ccb0b70
--- /dev/null
+++ b/44 - Java New Versions/007 Source-code-example-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/commit/3c7c1a0efcb4279a50b8f6265387f8d9593016fb
\ No newline at end of file
diff --git a/44 - Java New Versions/008 Java 10 Other improvements, Removals, Deprecations, Release Versioning_en.srt b/44 - Java New Versions/008 Java 10 Other improvements, Removals, Deprecations, Release Versioning_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..af3dcb82271eca3964cac637c4a7aa54eb091c83
--- /dev/null
+++ b/44 - Java New Versions/008 Java 10 Other improvements, Removals, Deprecations, Release Versioning_en.srt
@@ -0,0 +1,864 @@
+1
+00:00:02,000 --> 00:00:05,000
+There are also numerous of other improvements.
+
+2
+00:00:05,000 --> 00:00:12,000
+I will not go deep in details, because the area of applicability of the following improvements is relatively
+
+3
+00:00:12,000 --> 00:00:19,000
+lower than using of var keyword for type inference, for example, and in case I would dedicate 30 minutes
+
+4
+00:00:19,000 --> 00:00:24,000
+for each of these updates, I won't be able to finish the course at all.
+
+5
+00:00:25,000 --> 00:00:31,000
+So let's stick to the common sense and in case you will be interested in any specific topic, please
+
+6
+00:00:31,000 --> 00:00:35,000
+post a question below the video and I will elaborate more.
+
+7
+00:00:35,000 --> 00:00:40,000
+And in the case, I will see that there are a lot of questions about similar topic.
+
+8
+00:00:40,000 --> 00:00:42,000
+Then I will create a separate lesson.
+
+9
+00:00:43,000 --> 00:00:46,000
+So let's review improvements one by one.
+
+10
+00:00:47,000 --> 00:00:51,000
+System property to disable grey lost usage tracking.
+
+11
+00:00:52,000 --> 00:01:00,000
+Java then introduced the system property JDK dot disable lost usage tracking to disable the tracking
+
+12
+00:01:00,000 --> 00:01:04,000
+of the last usage timestamp for the Java runtime environment.
+
+13
+00:01:04,000 --> 00:01:11,000
+The last usage timestamp refers to the timestamp that indicates when the Java runtime environment was
+
+14
+00:01:11,000 --> 00:01:14,000
+last used, or accessed on a particular system.
+
+15
+00:01:15,000 --> 00:01:22,000
+It is a mechanism designed to track the usage patterns of the GRE to provide information about its recent
+
+16
+00:01:22,000 --> 00:01:23,000
+activity.
+
+17
+00:01:24,000 --> 00:01:32,000
+And for example, setting the value of this property to true as a system property when starting a Java
+
+18
+00:01:32,000 --> 00:01:39,000
+application can be useful in scenarios where the lost usage tracking is not needed, helping to reduce
+
+19
+00:01:39,000 --> 00:01:41,000
+overhead in certain environments.
+
+20
+00:01:42,000 --> 00:01:46,000
+Hashed passwords for out of the box, GMC's agent.
+
+21
+00:01:47,000 --> 00:01:54,000
+Gelatin enhances the security of the Java Management Extensions Gmax agent by using hashed passwords
+
+22
+00:01:54,000 --> 00:01:55,000
+for authentication.
+
+23
+00:01:56,000 --> 00:02:03,000
+Java Management Extensions is a Java technology that provides a standard way to manage and monitor Java
+
+24
+00:02:03,000 --> 00:02:04,000
+applications.
+
+25
+00:02:04,000 --> 00:02:11,000
+The Jmx technology includes a set of specifications, APIs, and tools for building, deploying, and
+
+26
+00:02:11,000 --> 00:02:14,000
+managing modular and scalable Java based solutions.
+
+27
+00:02:14,000 --> 00:02:18,000
+One key component of Gmax is the Jmx agent.
+
+28
+00:02:19,000 --> 00:02:23,000
+The improved security is crucial in enterprise applications.
+
+29
+00:02:23,000 --> 00:02:30,000
+This feature enables users to configure Gmax authentication with hashed passwords, adding an extra
+
+30
+00:02:30,000 --> 00:02:35,000
+layer of protection against unauthorized access to Jmx resources.
+
+31
+00:02:36,000 --> 00:02:40,000
+Add additional idle stop type checks to awk.
+
+32
+00:02:40,000 --> 00:02:43,000
+OMG CORBA orb.
+
+33
+00:02:43,000 --> 00:02:45,000
+String to object method.
+
+34
+00:02:46,000 --> 00:02:52,000
+Java ten adds additional type checks to the IDL stops generated by the previously mentioned method.
+
+35
+00:02:53,000 --> 00:02:56,000
+IDL stands for Interface Definition Language.
+
+36
+00:02:56,000 --> 00:03:03,000
+It is a language agnostic specification language used for defining interfaces that can be implemented
+
+37
+00:03:03,000 --> 00:03:05,000
+in various programming languages.
+
+38
+00:03:06,000 --> 00:03:13,000
+In the context of the Java programming language and CORBA that stands for Common Object Request Broker
+
+39
+00:03:13,000 --> 00:03:20,000
+Architecture, IDL is used to define the interface of distributed objects that can interact with each
+
+40
+00:03:20,000 --> 00:03:23,000
+other across different languages and platforms.
+
+41
+00:03:24,000 --> 00:03:31,000
+The enhanced type checks help ensure more reliable communication in distributed systems that use CORBA.
+
+42
+00:03:31,000 --> 00:03:38,000
+It reduces the risk of runtime errors related to incorrect type handling when using the string to object
+
+43
+00:03:38,000 --> 00:03:38,000
+method.
+
+44
+00:03:39,000 --> 00:03:45,000
+GEP 307 parallel full garbage collector for G1.
+
+45
+00:03:46,000 --> 00:03:51,000
+Just to remind you that GEP stands for Java Enhancement Proposal.
+
+46
+00:03:51,000 --> 00:04:00,000
+This GEP introduces parallelism for the full garbage collector phase in the garbage first garbage collector.
+
+47
+00:04:01,000 --> 00:04:02,000
+We learned about the garbage.
+
+48
+00:04:02,000 --> 00:04:05,000
+First garbage collector in the lesson about Java nine.
+
+49
+00:04:05,000 --> 00:04:13,000
+In scenarios where G1 is the chosen garbage collector, enabling parallelism for full garbage collector
+
+50
+00:04:13,000 --> 00:04:20,000
+can improve garbage collection performance, especially on machines with multiple processors, leading
+
+51
+00:04:20,000 --> 00:04:22,000
+to reduced pause times.
+
+52
+00:04:23,000 --> 00:04:27,000
+GEP 319 root certificates.
+
+53
+00:04:27,000 --> 00:04:35,000
+GEP 319 adds a set of root certificates to the CA certs keystore.
+
+54
+00:04:35,000 --> 00:04:41,000
+It addresses the need for maintaining an up to date set of root certificates in the Java platform's
+
+55
+00:04:41,000 --> 00:04:45,000
+default Keystore, known as CA certs.
+
+56
+00:04:46,000 --> 00:04:53,000
+Root certificates play a crucial role in establishing the trustworthiness of secure connections, such
+
+57
+00:04:53,000 --> 00:04:56,000
+as those establishing through Https.
+
+58
+00:04:57,000 --> 00:05:04,000
+Prior to Java ten, developers often had to manually update the CA certs keystore to include the latest
+
+59
+00:05:04,000 --> 00:05:07,000
+root certificates to ensure secure connections.
+
+60
+00:05:08,000 --> 00:05:15,000
+This process could be error prone and time consuming, with the constant evolution of security requirements.
+
+61
+00:05:15,000 --> 00:05:18,000
+Keeping the root certificates up to date is crucial.
+
+62
+00:05:18,000 --> 00:05:24,000
+This update simplifies the management of trusted root certificates, ensuring that Java applications
+
+63
+00:05:24,000 --> 00:05:27,000
+can securely communicate over Https.
+
+64
+00:05:27,000 --> 00:05:30,000
+With GEP 319.
+
+65
+00:05:30,000 --> 00:05:36,000
+Java applications benefit from a curated and regularly updated set of root certificates.
+
+66
+00:05:37,000 --> 00:05:43,000
+This simplifies the management of trusted certificates, providing a more secure foundation for Java
+
+67
+00:05:43,000 --> 00:05:48,000
+applications that rely on secure communication protocols like Https.
+
+68
+00:05:50,000 --> 00:05:56,000
+Negotiated finite field Diffie-Hellman ephemeral parameters for TLS.
+
+69
+00:05:56,000 --> 00:06:04,000
+Java ten introduces support for negotiating finite field Diffie-Hellman ephemeral parameters during
+
+70
+00:06:04,000 --> 00:06:05,000
+TLS handshake.
+
+71
+00:06:06,000 --> 00:06:13,000
+Diffie-Hellman is a key exchange algorithm used in secure communication protocols like TLS.
+
+72
+00:06:13,000 --> 00:06:19,000
+It allows two parties to agree on a shared secret over an untrusted network.
+
+73
+00:06:20,000 --> 00:06:24,000
+So what is finite field Diffie-Hellman ephemeral.
+
+74
+00:06:25,000 --> 00:06:29,000
+It involves using finite fields for the key exchange.
+
+75
+00:06:29,000 --> 00:06:36,000
+The ephemeral aspect means that the parameters used for key exchange are temporary and specific to each
+
+76
+00:06:36,000 --> 00:06:37,000
+session.
+
+77
+00:06:37,000 --> 00:06:44,000
+This feature enhances the security of TLS connections by enabling the negotiation of the mentioned parameters,
+
+78
+00:06:44,000 --> 00:06:49,000
+ensuring forward secrecy in the key exchange process.
+
+79
+00:06:49,000 --> 00:06:56,000
+During the TLS handshake, the client and server agree on cryptographic parameters, including the key
+
+80
+00:06:56,000 --> 00:06:58,000
+exchange method with Java Tans.
+
+81
+00:06:58,000 --> 00:07:04,000
+Support for finite field Diffie-Hellman ephemeral parameters.
+
+82
+00:07:04,000 --> 00:07:05,000
+Negotiation.
+
+83
+00:07:06,000 --> 00:07:12,000
+The TLS handshake can dynamically agree on these parameters, further strengthening the security of
+
+84
+00:07:12,000 --> 00:07:13,000
+the key exchange process.
+
+85
+00:07:14,000 --> 00:07:21,000
+The next update is Fearless Session Hash and Extended Master Secret extension support.
+
+86
+00:07:21,000 --> 00:07:28,000
+Java ten supports the TLS session Hash and Extended Master Secret extension enhances the security of
+
+87
+00:07:28,000 --> 00:07:30,000
+TLS connections.
+
+88
+00:07:30,000 --> 00:07:37,000
+The TLS Session Hash, an extended Master Secret extension support help protect against certain attacks,
+
+89
+00:07:37,000 --> 00:07:41,000
+improving the overall security of TLS communication.
+
+90
+00:07:42,000 --> 00:07:47,000
+The next feature is byte code generation for enhanced for loop.
+
+91
+00:07:47,000 --> 00:07:53,000
+Java ten enhances the bytecode generation for the enhanced for loop to improve performance.
+
+92
+00:07:53,000 --> 00:07:56,000
+The enhanced for loop, also known as the for each loop.
+
+93
+00:07:57,000 --> 00:08:04,000
+The optimized bytecode generation benefits code execution in enhanced for loops, making them more efficient,
+
+94
+00:08:04,000 --> 00:08:08,000
+especially in scenarios where performance is critical.
+
+95
+00:08:09,000 --> 00:08:12,000
+Javadocs support from multiple stylesheets.
+
+96
+00:08:12,000 --> 00:08:19,000
+Java ten adds support for using multiple stylesheets with Javadoc to customize the documentation's appearance.
+
+97
+00:08:20,000 --> 00:08:26,000
+This feature allows developers to create more visually appealing and tailored documentation by using
+
+98
+00:08:26,000 --> 00:08:30,000
+multiple stylesheets, improving the overall documentation experience.
+
+99
+00:08:31,000 --> 00:08:33,000
+They use multiple stylesheets and Javadoc.
+
+100
+00:08:33,000 --> 00:08:40,000
+Developers can specify them using the dash stylesheet file option when running the Javadoc tool.
+
+101
+00:08:41,000 --> 00:08:49,000
+The comment example that you can see on the screen tells Javadoc to use both stylesheet one dot CSS
+
+102
+00:08:49,000 --> 00:08:55,000
+and stylesheet two dot CSS when generating the documentation for my Java source code.
+
+103
+00:08:55,000 --> 00:08:56,000
+Java.
+
+104
+00:08:57,000 --> 00:09:04,000
+In your Java source code, use HTML tags and assigns a specified CSS classes to elements within Javadoc
+
+105
+00:09:04,000 --> 00:09:05,000
+commands.
+
+106
+00:09:06,000 --> 00:09:11,000
+The next improvement is command tag for summary of an API description.
+
+107
+00:09:12,000 --> 00:09:18,000
+Java ten introduces a new command tag for Javadoc to provide a summary of an API description.
+
+108
+00:09:19,000 --> 00:09:26,000
+The summary tag enhances documentation clarity by allowing developers to provide concise summaries for
+
+109
+00:09:26,000 --> 00:09:27,000
+API descriptions.
+
+110
+00:09:27,000 --> 00:09:34,000
+This can be particularly useful for quickly grasping the purpose of an API without delving into detailed
+
+111
+00:09:34,000 --> 00:09:35,000
+documentation.
+
+112
+00:09:35,000 --> 00:09:39,000
+I believe that we discussed all new features added in the Java ten.
+
+113
+00:09:39,000 --> 00:09:44,000
+Now it is time to discuss deprecated and removed items from Java ten release.
+
+114
+00:09:45,000 --> 00:09:47,000
+And let's start review of the removed items.
+
+115
+00:09:47,000 --> 00:09:53,000
+There are a lot of them, and I believe there is not a lot of sense of going deep in each removal.
+
+116
+00:09:53,000 --> 00:09:59,000
+Let's stick to the common sense, and in case you would be interested in some specific removed feature,
+
+117
+00:09:59,000 --> 00:10:03,000
+let me know in the comments below the video and I will elaborate more about it.
+
+118
+00:10:04,000 --> 00:10:11,000
+In Java ten, several features and APIs were removed to streamline the language, enhance security,
+
+119
+00:10:11,000 --> 00:10:14,000
+and encourage the adoption of modern practices.
+
+120
+00:10:14,000 --> 00:10:21,000
+This cleanup aligns with Java's commitment to evolution, ensuring that developers work with up to date
+
+121
+00:10:21,000 --> 00:10:22,000
+and efficient tools.
+
+122
+00:10:23,000 --> 00:10:27,000
+You can find the list of removed sinks from Java ten on the slide.
+
+123
+00:10:27,000 --> 00:10:35,000
+The removal of support for the old look and feel emphasizes Java's dedication to contemporary graphic
+
+124
+00:10:35,000 --> 00:10:37,000
+user interface design.
+
+125
+00:10:38,000 --> 00:10:43,000
+Developers are encouraged to embrace more visually appealing UI practices.
+
+126
+00:10:43,000 --> 00:10:50,000
+Additionally, the elimination of runtime methods for localized streams signals a move towards cleaner
+
+127
+00:10:50,000 --> 00:10:52,000
+stream handling alternatives.
+
+128
+00:10:53,000 --> 00:11:03,000
+Java effects undergoes notable changes with the removal of T2, K, Rasterizer ICU layout engine and
+
+129
+00:11:03,000 --> 00:11:05,000
+deprecated multimedia code.
+
+130
+00:11:06,000 --> 00:11:13,000
+Developers should explore the latest text rendering technologies and adopt supported multimedia APIs
+
+131
+00:11:13,000 --> 00:11:15,000
+for Java effects projects.
+
+132
+00:11:15,000 --> 00:11:22,000
+Security enhancements include the removal of deprecated security manager methods and fields, prompting
+
+133
+00:11:22,000 --> 00:11:25,000
+developers to transition to modern security practices.
+
+134
+00:11:26,000 --> 00:11:32,000
+The removal of policy tool encourages administrators to explore alternative approaches for configuring
+
+135
+00:11:32,000 --> 00:11:33,000
+Java security policies.
+
+136
+00:11:34,000 --> 00:11:41,000
+Java tends cleanup extends the documentation tools with the removal of the old standard doc.
+
+137
+00:11:41,000 --> 00:11:44,000
+Glad developers should migrate to new doc.
+
+138
+00:11:44,000 --> 00:11:51,000
+Glad implementation for generating documentation reflecting the industry's shift towards modern documentation
+
+139
+00:11:51,000 --> 00:11:52,000
+practices.
+
+140
+00:11:53,000 --> 00:12:00,000
+The removal of the native header generation tool emphasizes changes in native header generation practices.
+
+141
+00:12:00,000 --> 00:12:07,000
+Developers working with native methods should explore alternative approaches for generating native headers.
+
+142
+00:12:08,000 --> 00:12:15,000
+So we can say that Java tends removals aim to simplify, secure and modernize the language.
+
+143
+00:12:16,000 --> 00:12:23,000
+The evolving landscape encourages developers to stay informed about the latest practices and adopt updated
+
+144
+00:12:23,000 --> 00:12:25,000
+tools for efficient Java development.
+
+145
+00:12:26,000 --> 00:12:29,000
+Now let's talk about deprecated items.
+
+146
+00:12:29,000 --> 00:12:35,000
+Java ten introduces a deprecation of several features, signaling their eventual removal.
+
+147
+00:12:36,000 --> 00:12:42,000
+This deprecation aligns with Java's commitment to maintaining a streamlined and secure language, urging
+
+148
+00:12:42,000 --> 00:12:47,000
+developers to transition away from outdated or less secure functionalities.
+
+149
+00:12:47,000 --> 00:12:50,000
+As an MP monitoring support.
+
+150
+00:12:50,000 --> 00:12:51,000
+Deprecated for removal.
+
+151
+00:12:52,000 --> 00:12:59,000
+As an MP stands for Simple Network Management Protocol, it is an internet standard protocol for managing
+
+152
+00:12:59,000 --> 00:13:02,000
+and monitoring network devices and their functions.
+
+153
+00:13:03,000 --> 00:13:10,000
+The deprecation of SNMp monitoring support signifies Java's evolving approach to monitoring.
+
+154
+00:13:10,000 --> 00:13:17,000
+Developers are encouraged to explore alternative monitoring solutions that align with contemporary practices
+
+155
+00:13:17,000 --> 00:13:19,000
+for efficient and scalable monitoring.
+
+156
+00:13:20,000 --> 00:13:22,000
+Java security certificate.
+
+157
+00:13:22,000 --> 00:13:23,000
+Identity.
+
+158
+00:13:23,000 --> 00:13:23,000
+Identity.
+
+159
+00:13:23,000 --> 00:13:24,000
+Scope.
+
+160
+00:13:24,000 --> 00:13:26,000
+Signer APIs deprecated for removal.
+
+161
+00:13:27,000 --> 00:13:33,000
+The deprecation of these security APIs reflects Java's continuous improvement in security practices.
+
+162
+00:13:34,000 --> 00:13:40,000
+Developers should transition to newer security APIs and mechanisms, ensuring robust security implementations
+
+163
+00:13:40,000 --> 00:13:42,000
+in their applications.
+
+164
+00:13:43,000 --> 00:13:46,000
+Java security ACL API's deprecated for removal.
+
+165
+00:13:47,000 --> 00:13:54,000
+The deprecation of Java Security ACL APIs is part of the Java effort to modernize and standardize security
+
+166
+00:13:54,000 --> 00:13:56,000
+related functionalities.
+
+167
+00:13:56,000 --> 00:14:03,000
+Developers are advised to migrate to updated security APIs to maintain compatibility with evolving security
+
+168
+00:14:03,000 --> 00:14:04,000
+standards.
+
+169
+00:14:04,000 --> 00:14:09,000
+Java Security US policy API deprecated for removal.
+
+170
+00:14:09,000 --> 00:14:16,000
+The deprecation of Java Security Policy API signals a shift in the management of security policies.
+
+171
+00:14:16,000 --> 00:14:22,000
+Developers should explore alternative approaches for configuring and managing security policies to ensure
+
+172
+00:14:22,000 --> 00:14:25,000
+compatibility with future Java versions.
+
+173
+00:14:26,000 --> 00:14:32,000
+So the deprecation of these features underscores Java's commitment to maintaining a secure and efficient
+
+174
+00:14:32,000 --> 00:14:33,000
+language.
+
+175
+00:14:33,000 --> 00:14:37,000
+Developers are encouraged to proactively address these deprecations.
+
+176
+00:14:38,000 --> 00:14:44,000
+Adopting modern alternatives and staying aligned with best practices in security and monitoring.
+
+177
+00:14:45,000 --> 00:14:50,000
+And the last but not the least thing that I wanted to discuss with you in this lesson is time based
+
+178
+00:14:50,000 --> 00:14:52,000
+release versioning in Java.
+
+179
+00:14:53,000 --> 00:14:59,000
+The time based release version was introduced with the adoption of a predictable, time driven release
+
+180
+00:14:59,000 --> 00:15:01,000
+cadence for the Java platform.
+
+181
+00:15:01,000 --> 00:15:07,000
+This approach aims to provide more regular and frequent releases, enabling developers to access new
+
+182
+00:15:07,000 --> 00:15:11,000
+features and enhancements more predictably.
+
+183
+00:15:11,000 --> 00:15:17,000
+The key points of time based release versioning starting from Java ten includes the following ones.
+
+184
+00:15:18,000 --> 00:15:24,000
+Number one regular release schedule Java transition to a time driven release model.
+
+185
+00:15:24,000 --> 00:15:28,000
+Committing to releasing a new feature update every six months.
+
+186
+00:15:28,000 --> 00:15:34,000
+This predictable schedule helps developers plan for and adapt to changes more effectively.
+
+187
+00:15:34,000 --> 00:15:37,000
+Number two feature releases.
+
+188
+00:15:37,000 --> 00:15:43,000
+Each feature release, occurring every six months, introduces new enhancements, features, and improvements.
+
+189
+00:15:44,000 --> 00:15:51,000
+This contrasts with the previous model, where major releases were less frequent and feature driven.
+
+190
+00:15:51,000 --> 00:15:54,000
+The next point is long terms.
+
+191
+00:15:54,000 --> 00:15:55,000
+Support releases.
+
+192
+00:15:56,000 --> 00:16:01,000
+Periodically every three years, a long Tum support release is designated.
+
+193
+00:16:02,000 --> 00:16:08,000
+Altus releases receive extended support, including security updates and bug fixes for a more extended
+
+194
+00:16:08,000 --> 00:16:11,000
+period, typically for several years.
+
+195
+00:16:12,000 --> 00:16:19,000
+These releases are intended for enterprises and other users who prioritize stability over frequent feature
+
+196
+00:16:19,000 --> 00:16:20,000
+updates.
+
+197
+00:16:21,000 --> 00:16:23,000
+Incremental improvements.
+
+198
+00:16:23,000 --> 00:16:29,000
+The time based release model promotes a continuous flow of incremental improvements, allowing developers
+
+199
+00:16:29,000 --> 00:16:36,000
+to incorporate new features regularly without facing long waiting periods between major releases.
+
+200
+00:16:36,000 --> 00:16:38,000
+More predictable planning.
+
+201
+00:16:38,000 --> 00:16:45,000
+With a regular release schedule, developers can plan the adoption of new Java versions more proactively,
+
+202
+00:16:45,000 --> 00:16:50,000
+ensuring a smoother transition and reducing the likelihood of compatibility issues.
+
+203
+00:16:52,000 --> 00:16:53,000
+Transparent roadmap.
+
+204
+00:16:53,000 --> 00:17:00,000
+The adoption of time based releases also involves a more transparent approach to communicating the roadmap
+
+205
+00:17:00,000 --> 00:17:02,000
+for upcoming releases.
+
+206
+00:17:02,000 --> 00:17:09,000
+Developers can have better visibility into the features and enhancements planned for future releases.
+
+207
+00:17:10,000 --> 00:17:12,000
+That's all what I wanted to learn with you in this lesson.
+
+208
+00:17:12,000 --> 00:17:15,000
+Let's recap what we have learned from the lesson.
+
+209
+00:17:16,000 --> 00:17:20,000
+In this lesson, we learned everything you need to know about Java ten release.
+
+210
+00:17:20,000 --> 00:17:22,000
+We learned new features in Java ten.
+
+211
+00:17:22,000 --> 00:17:27,000
+I discussed with you features and APIs that were removed in Java ten.
+
+212
+00:17:27,000 --> 00:17:32,000
+Also, we reviewed the summary of features and elements that become deprecated in Java ten.
+
+213
+00:17:32,000 --> 00:17:38,000
+And at the end of the lesson, we learned time based release versioning starting from Java ten.
+
+214
+00:17:39,000 --> 00:17:40,000
+That's it for this lesson.
+
+215
+00:17:40,000 --> 00:17:42,000
+Thanks a lot for your attention.
+
+216
+00:17:42,000 --> 00:17:45,000
+Have a great day and see you in the next lesson.
+
diff --git a/44 - Java New Versions/009 Java 11 LTS Concept, New HTTP Client, String & Files API Updates_en.srt b/44 - Java New Versions/009 Java 11 LTS Concept, New HTTP Client, String & Files API Updates_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..9fb488d53f3afe5f50fa88df6dc99e5b2d3880f9
--- /dev/null
+++ b/44 - Java New Versions/009 Java 11 LTS Concept, New HTTP Client, String & Files API Updates_en.srt
@@ -0,0 +1,1172 @@
+1
+00:00:05,000 --> 00:00:06,000
+Hello Tim.
+
+2
+00:00:06,000 --> 00:00:11,000
+In this lesson we are going to learn updates from Java 11 release.
+
+3
+00:00:11,000 --> 00:00:18,000
+We are going to start the lesson from learning the LTS concept and understand what it means for Java
+
+4
+00:00:18,000 --> 00:00:20,000
+11 release.
+
+5
+00:00:20,000 --> 00:00:25,000
+Then we will follow our regular agenda for lessons dedicated to new Java releases.
+
+6
+00:00:26,000 --> 00:00:30,000
+We will learn new language features and APIs added to Java 11.
+
+7
+00:00:30,000 --> 00:00:33,000
+I will explain new JDK tools and features.
+
+8
+00:00:33,000 --> 00:00:37,000
+I will explain new things using code examples.
+
+9
+00:00:37,000 --> 00:00:43,000
+I will show you the things that were removed from Java 11 and that were marked as deprecated in this
+
+10
+00:00:43,000 --> 00:00:44,000
+release.
+
+11
+00:00:44,000 --> 00:00:49,000
+That's in short, the detailed agenda you can find on the slide.
+
+12
+00:00:49,000 --> 00:00:52,000
+As you can see, we have really a lot of things to learn today.
+
+13
+00:00:52,000 --> 00:00:54,000
+Let's start our lesson.
+
+14
+00:00:55,000 --> 00:01:01,000
+One of the most important things about Java 11 is that it is first long Tum support version.
+
+15
+00:01:01,000 --> 00:01:03,000
+Since Java eight.
+
+16
+00:01:03,000 --> 00:01:11,000
+Java 11 is a long terme support version, which means it receives extended support and updates for an
+
+17
+00:01:11,000 --> 00:01:14,000
+extended period compared to regular releases.
+
+18
+00:01:14,000 --> 00:01:21,000
+The LTS concept in software development, including Java, aims to provide a stable and reliable platform
+
+19
+00:01:21,000 --> 00:01:23,000
+for users and enterprises.
+
+20
+00:01:23,000 --> 00:01:29,000
+You know that migration to new version may be combined with some additional efforts.
+
+21
+00:01:29,000 --> 00:01:35,000
+Usually, this is not a big challenge with Java platform because Java ensures backward compatibility,
+
+22
+00:01:35,000 --> 00:01:43,000
+meaning that all code written once on Java will be executed on future versions of Java in the same way.
+
+23
+00:01:43,000 --> 00:01:50,000
+This statement in general true, and it costs significant popularity of Java among enterprises.
+
+24
+00:01:50,000 --> 00:01:57,000
+But even in Java, there are some removals that you need to be ready to address and refactor your code
+
+25
+00:01:57,000 --> 00:02:04,000
+accordingly, and to ensure stability and cost planning of investments into the support of the software
+
+26
+00:02:04,000 --> 00:02:05,000
+solutions.
+
+27
+00:02:05,000 --> 00:02:13,000
+Big enterprises prefer to use some stable versions and not update them very often to avoid unplanned
+
+28
+00:02:13,000 --> 00:02:15,000
+investments in migration.
+
+29
+00:02:15,000 --> 00:02:19,000
+That's what we have Java LTS versions for.
+
+30
+00:02:19,000 --> 00:02:28,000
+With Java 11 being an LTS version, it assures users of a predictable support timeline, typically spanning
+
+31
+00:02:28,000 --> 00:02:29,000
+several years.
+
+32
+00:02:29,000 --> 00:02:36,000
+Unlike Oracle did with Java version eight, the years of support are extended even when the original
+
+33
+00:02:36,000 --> 00:02:38,000
+duration of support expires.
+
+34
+00:02:39,000 --> 00:02:46,000
+During this period, the Java community commits to deliver an updates, security patches, and bug fixes,
+
+35
+00:02:46,000 --> 00:02:49,000
+ensuring the stability and security of the platform.
+
+36
+00:02:50,000 --> 00:02:56,000
+LTS versions are particularly suitable for organizations and businesses that prioritize a stable and
+
+37
+00:02:56,000 --> 00:02:58,000
+consistent environment.
+
+38
+00:02:58,000 --> 00:03:05,000
+They can rely on Java 11 for an extended period without the need to frequently update the newer versions,
+
+39
+00:03:05,000 --> 00:03:11,000
+which might introduce breaking changes or require significant adjustments to existing code bases, and
+
+40
+00:03:11,000 --> 00:03:17,000
+thus to avoid unexpected and unplanned investments in the software products.
+
+41
+00:03:17,000 --> 00:03:25,000
+In summary, Java 11 as an LTS version offers a reliable and well supported platform, making it a preferred
+
+42
+00:03:25,000 --> 00:03:32,000
+choice for enterprises and developers who prioritize stability and long tum maintenance of their Java
+
+43
+00:03:32,000 --> 00:03:33,000
+applications.
+
+44
+00:03:33,000 --> 00:03:37,000
+Today, we are going to have theoretical and practical part.
+
+45
+00:03:37,000 --> 00:03:42,000
+As always, I encourage you to check the source code of all examples that I'm going to share with you
+
+46
+00:03:42,000 --> 00:03:46,000
+in attachments to the lesson, in case you would have any questions.
+
+47
+00:03:46,000 --> 00:03:53,000
+As we'll keep our discussion going, don't hesitate to post your questions below the video and I will
+
+48
+00:03:53,000 --> 00:03:54,000
+be happy to answer.
+
+49
+00:03:54,000 --> 00:04:00,000
+Or in case you want me elaborate some topic in more details, you can make such requests below the video
+
+50
+00:04:00,000 --> 00:04:03,000
+and I will elaborate more on the topic requested.
+
+51
+00:04:04,000 --> 00:04:06,000
+So let me start screen sharing.
+
+52
+00:04:07,000 --> 00:04:10,000
+I opened the file that is called Java 11.
+
+53
+00:04:10,000 --> 00:04:14,000
+Here I prepared code examples related to new features in Java 11.
+
+54
+00:04:15,000 --> 00:04:21,000
+I will also run the code in order to explore the console output, as we will proceed with our examples.
+
+55
+00:04:21,000 --> 00:04:28,000
+Let's start review from such important and useful feature introduced in Java 11 as new Http client.
+
+56
+00:04:28,000 --> 00:04:36,000
+Java 11 introduced a new Http client API as a part of the Java.net Http package.
+
+57
+00:04:36,000 --> 00:04:44,000
+This API was in preview mode since Java nine, but in Java 11 it has been officially released.
+
+58
+00:04:44,000 --> 00:04:51,000
+This new Http client is designed to be more modern, flexible, and feature rich compared to the legacy
+
+59
+00:04:51,000 --> 00:04:53,000
+Http url connection.
+
+60
+00:04:53,000 --> 00:04:57,000
+Let's learn new Http client API by examples.
+
+61
+00:04:57,000 --> 00:05:01,000
+The first example is about creating an Http client object.
+
+62
+00:05:01,000 --> 00:05:03,000
+You can create an instance.
+
+63
+00:05:03,000 --> 00:05:08,000
+Of Http client using Http client new Http client factory method.
+
+64
+00:05:09,000 --> 00:05:12,000
+Now let's try to send get request.
+
+65
+00:05:13,000 --> 00:05:19,000
+The new Http client allows you to send a simple Get request synchronously and asynchronously.
+
+66
+00:05:19,000 --> 00:05:23,000
+Let's check first how to send request synchronously.
+
+67
+00:05:23,000 --> 00:05:27,000
+I create Http request object using http request builder.
+
+68
+00:05:27,000 --> 00:05:31,000
+I just specify URL for my request and that's it.
+
+69
+00:05:32,000 --> 00:05:35,000
+Because by default get request is created.
+
+70
+00:05:36,000 --> 00:05:41,000
+I encourage you to check the source code of builder interface, because this will help you to get more
+
+71
+00:05:41,000 --> 00:05:46,000
+information about API and understand how to build other types of requests.
+
+72
+00:05:47,000 --> 00:05:49,000
+You can find that using header method.
+
+73
+00:05:49,000 --> 00:05:53,000
+You can pass request headers or set timeout for requests.
+
+74
+00:05:53,000 --> 00:06:00,000
+So in general I can confirm that this is pretty helpful interface that will allow you to customize your
+
+75
+00:06:00,000 --> 00:06:02,000
+request as you want.
+
+76
+00:06:02,000 --> 00:06:10,000
+Then you just need to call send method on Http client object and pass the our request object and argument.
+
+77
+00:06:10,000 --> 00:06:13,000
+And the second argument is of type body handler.
+
+78
+00:06:14,000 --> 00:06:15,000
+Why it is needed.
+
+79
+00:06:16,000 --> 00:06:23,000
+The purpose of this object is to define how the response body should be processed or handled when receiving
+
+80
+00:06:23,000 --> 00:06:24,000
+an Http response.
+
+81
+00:06:25,000 --> 00:06:30,000
+There is body handler static class that contains static factory methods.
+
+82
+00:06:31,000 --> 00:06:36,000
+I also encourage you to check the source code of this class in order to be more familiar with other
+
+83
+00:06:36,000 --> 00:06:37,000
+body handlers.
+
+84
+00:06:37,000 --> 00:06:44,000
+There are different predefined implementations of the body handler interface available as constants
+
+85
+00:06:44,000 --> 00:06:49,000
+in the Http response body handlers class of string.
+
+86
+00:06:49,000 --> 00:06:54,000
+This handler converts the response body into a string of byte array.
+
+87
+00:06:54,000 --> 00:06:59,000
+This handler reads the response body into arbitrary of file.
+
+88
+00:06:59,000 --> 00:07:04,000
+This handler writes the response body to a file specified by the given path.
+
+89
+00:07:04,000 --> 00:07:12,000
+You can find handlers for file input stream and others, but in our case I will select the most regular
+
+90
+00:07:12,000 --> 00:07:16,000
+one handler that handles response body as string.
+
+91
+00:07:16,000 --> 00:07:23,000
+So sent message returns Http response object, and using this object I can get more information about
+
+92
+00:07:23,000 --> 00:07:24,000
+response.
+
+93
+00:07:24,000 --> 00:07:29,000
+For example, if there is a need, you can explore response headers too.
+
+94
+00:07:30,000 --> 00:07:33,000
+Later I will show you special API to work with headers.
+
+95
+00:07:33,000 --> 00:07:38,000
+Pay attention that in console we received 301 status code.
+
+96
+00:07:39,000 --> 00:07:48,000
+This status actually means that resource was moved permanently, but to where from google.com to three
+
+97
+00:07:48,000 --> 00:07:49,000
+w google.com.
+
+98
+00:07:50,000 --> 00:07:54,000
+Our browser usually handles such redirections automatically.
+
+99
+00:07:54,000 --> 00:08:00,000
+A little bit later in this lesson I will show you how to configure Http request object to handle redirects
+
+100
+00:08:00,000 --> 00:08:01,000
+automatically.
+
+101
+00:08:02,000 --> 00:08:06,000
+In case you want to send asynchronous request, you can also do so.
+
+102
+00:08:06,000 --> 00:08:08,000
+Just use message.
+
+103
+00:08:08,000 --> 00:08:15,000
+Send a sync of Http client object and taking into account that request will be executed asynchronously.
+
+104
+00:08:15,000 --> 00:08:19,000
+There is a need in API to handle this.
+
+105
+00:08:19,000 --> 00:08:27,000
+In this example you can see that send async returns your Completablefuture object parametrized by Http
+
+106
+00:08:27,000 --> 00:08:28,000
+response object.
+
+107
+00:08:29,000 --> 00:08:34,000
+We learned how to work with Completablefuture in the separate section about multi-threading.
+
+108
+00:08:34,000 --> 00:08:37,000
+That's why I wouldn't stop for too long on this.
+
+109
+00:08:38,000 --> 00:08:44,000
+But having the reference to the Completablefuture object, you can use its API to work with the response
+
+110
+00:08:44,000 --> 00:08:46,000
+once it will be received.
+
+111
+00:08:47,000 --> 00:08:50,000
+The next example is about a request customization.
+
+112
+00:08:50,000 --> 00:08:57,000
+I just told you that you can customize your request, and let me now present an example where I add
+
+113
+00:08:57,000 --> 00:09:01,000
+custom request header and set request timeout.
+
+114
+00:09:01,000 --> 00:09:03,000
+As you can see, there is nothing special.
+
+115
+00:09:04,000 --> 00:09:11,000
+I keep using the builder API to add header and set request duration in this particular case, in case
+
+116
+00:09:11,000 --> 00:09:18,000
+I will not receive response from the server within 10s http timeout exception will be thrown.
+
+117
+00:09:19,000 --> 00:09:22,000
+Another cool thing is built in support of handling cookies.
+
+118
+00:09:23,000 --> 00:09:28,000
+In the following example, I show how to work with cookies using new Http client.
+
+119
+00:09:29,000 --> 00:09:32,000
+In this example you can see how I create Cookie Manager.
+
+120
+00:09:33,000 --> 00:09:40,000
+Cookie manager is a class in the Java.net package that provides a simple in-memory cookie store.
+
+121
+00:09:40,000 --> 00:09:45,000
+It manages cookies and their associated policies for an Http client.
+
+122
+00:09:46,000 --> 00:09:49,000
+The cookie manager constructor takes two parameters.
+
+123
+00:09:49,000 --> 00:09:53,000
+The first parameter is an optional cookie store.
+
+124
+00:09:53,000 --> 00:09:59,000
+In this case, it is set to null, which means a default cookie store will be created by the cookie
+
+125
+00:09:59,000 --> 00:10:00,000
+manager.
+
+126
+00:10:00,000 --> 00:10:03,000
+The cookie store is where the cookies are stored.
+
+127
+00:10:03,000 --> 00:10:11,000
+Creating a custom cookie store involves implementing the Java.net Cookie Store interface, which defines
+
+128
+00:10:11,000 --> 00:10:14,000
+the methods for storing and retrieving cookies.
+
+129
+00:10:15,000 --> 00:10:21,000
+The second parameter is an implementation of the Cookie Policy interface, which defines the Cookie
+
+130
+00:10:21,000 --> 00:10:22,000
+Policy.
+
+131
+00:10:22,000 --> 00:10:30,000
+In this case, Cookie Policy accept all is used, which means the cookie manager will accept all incoming
+
+132
+00:10:30,000 --> 00:10:33,000
+cookies without any restrictions.
+
+133
+00:10:33,000 --> 00:10:39,000
+Cookie policy accept all is a constant defined in the Java.net package.
+
+134
+00:10:39,000 --> 00:10:44,000
+It represents a cookie Policy that accepts all cookies without any filtering.
+
+135
+00:10:44,000 --> 00:10:50,000
+When this policy is used, the cookie manager will store all incoming cookies, regardless of their
+
+136
+00:10:50,000 --> 00:10:52,000
+attributes or source.
+
+137
+00:10:53,000 --> 00:10:57,000
+Feel free to check cookie policies in the Cookie Policy interface.
+
+138
+00:10:57,000 --> 00:11:03,000
+In the source code you can find also accept none and accept a regional server policy.
+
+139
+00:11:04,000 --> 00:11:11,000
+The next thing that I do, I create Http request object and I set cookie manager as cookie handler.
+
+140
+00:11:11,000 --> 00:11:17,000
+After sending request, I can use cookie manager to get my cookie store and to extract cookies from
+
+141
+00:11:17,000 --> 00:11:17,000
+it.
+
+142
+00:11:18,000 --> 00:11:22,000
+Get cookies method returns list of Http cookie objects.
+
+143
+00:11:22,000 --> 00:11:29,000
+And taking into account this list, I can use for each method to process each element from this collection.
+
+144
+00:11:29,000 --> 00:11:35,000
+I just print each cookie to console and you can find them here in console output.
+
+145
+00:11:38,000 --> 00:11:41,000
+Also you can configure redirection policy in Http client.
+
+146
+00:11:41,000 --> 00:11:47,000
+Do you remember that in our previous examples we received 301 status code in response.
+
+147
+00:11:47,000 --> 00:11:51,000
+And our Http client didn't handle redirection.
+
+148
+00:11:51,000 --> 00:11:58,000
+Let me show you example of how we can handle cases like this and set up automatic redirection policy.
+
+149
+00:11:58,000 --> 00:12:03,000
+Basically, during the building of Http client object use follow redirects.
+
+150
+00:12:03,000 --> 00:12:06,000
+Build a method to set up redirect policy.
+
+151
+00:12:06,000 --> 00:12:09,000
+In this case I set up redirect.
+
+152
+00:12:09,000 --> 00:12:13,000
+Always feel free to check the redirect enum source code.
+
+153
+00:12:13,000 --> 00:12:20,000
+You will be able to find other redirect policies in there, like for example Neva and normal.
+
+154
+00:12:21,000 --> 00:12:27,000
+After configuring redirect policy, let's try to send the same request that we sent first time.
+
+155
+00:12:28,000 --> 00:12:32,000
+And as you can see this time I don't receive 301 status code.
+
+156
+00:12:32,000 --> 00:12:39,000
+In response I receive 200 status code because redirection was handled automatically based on the redirect
+
+157
+00:12:39,000 --> 00:12:40,000
+policy configured.
+
+158
+00:12:41,000 --> 00:12:45,000
+That's all what I wanted to share with you regarding new Http client.
+
+159
+00:12:45,000 --> 00:12:46,000
+Let's continue.
+
+160
+00:12:47,000 --> 00:12:52,000
+Let me share with you updates regarding new string methods in Java 11.
+
+161
+00:12:52,000 --> 00:12:59,000
+Several new methods were introduced to the Java.lang string class to enhance its functionality and make
+
+162
+00:12:59,000 --> 00:13:01,000
+common string operations more convenient.
+
+163
+00:13:02,000 --> 00:13:06,000
+I prepared examples of the new methods, so let's review them.
+
+164
+00:13:06,000 --> 00:13:10,000
+The first methods that we are going to review is repeat method.
+
+165
+00:13:11,000 --> 00:13:16,000
+The repeat method allows you to create a new string by repeating the original string a specified number
+
+166
+00:13:16,000 --> 00:13:17,000
+of times.
+
+167
+00:13:18,000 --> 00:13:23,000
+If this string is empty or count is zero, then the empty string is returned.
+
+168
+00:13:24,000 --> 00:13:26,000
+Everything is pretty straightforward.
+
+169
+00:13:26,000 --> 00:13:29,000
+Not so many things to talk about here.
+
+170
+00:13:29,000 --> 00:13:34,000
+In this example, you can see that Java word will be printed to console three times.
+
+171
+00:13:35,000 --> 00:13:37,000
+The next method is is bland.
+
+172
+00:13:38,000 --> 00:13:45,000
+That is Blanck Mass that checks if a string is empty or contains only whitespace characters.
+
+173
+00:13:45,000 --> 00:13:48,000
+Does this method look familiar to you?
+
+174
+00:13:48,000 --> 00:13:51,000
+I hope you remember is empty method.
+
+175
+00:13:51,000 --> 00:13:55,000
+So how these two methods are different in your opinion?
+
+176
+00:13:56,000 --> 00:14:02,000
+The Isblank method and Isempty method in the Java.lang.string class are used for checking whether a
+
+177
+00:14:02,000 --> 00:14:07,000
+string is empty, but they have different definitions of emptiness.
+
+178
+00:14:07,000 --> 00:14:15,000
+There is empty method checks if a string has length of zero, that is, if it contains no characters.
+
+179
+00:14:16,000 --> 00:14:24,000
+The Isblank method introduced in Java 11, checks if a string is empty or contains only whitespace characters.
+
+180
+00:14:24,000 --> 00:14:32,000
+It considers a string as blank if it has a length of zero, or if all its characters are whitespace
+
+181
+00:14:32,000 --> 00:14:36,000
+characters according to character is whitespace.
+
+182
+00:14:36,000 --> 00:14:37,000
+Masset.
+
+183
+00:14:37,000 --> 00:14:43,000
+Take a look at this example in case there is a string that contains only whitespace characters.
+
+184
+00:14:43,000 --> 00:14:50,000
+In case I call Isempty method, it will return false because the string actually contains whitespace
+
+185
+00:14:50,000 --> 00:14:52,000
+characters, right?
+
+186
+00:14:52,000 --> 00:14:56,000
+So it is not empty because there are characters.
+
+187
+00:14:56,000 --> 00:15:03,000
+But if I call Isblank method, it would return true because despite the fact that this string contains
+
+188
+00:15:03,000 --> 00:15:10,000
+characters, all these characters are whitespace and they don't deliver any meaningful information.
+
+189
+00:15:10,000 --> 00:15:13,000
+That's the main difference between these two methods.
+
+190
+00:15:14,000 --> 00:15:15,000
+Strip method.
+
+191
+00:15:16,000 --> 00:15:20,000
+The strip method removes leading and trailing white spaces from a string.
+
+192
+00:15:20,000 --> 00:15:26,000
+It is similar to trim, but it also considers Unicode whitespace characters.
+
+193
+00:15:26,000 --> 00:15:31,000
+So one more time, let me focus your attention on differences between these two methods.
+
+194
+00:15:31,000 --> 00:15:36,000
+The trim method removes leading and trailing Ascii spaces.
+
+195
+00:15:37,000 --> 00:15:43,000
+Those are characters with Unicode value less than or equal to u 20.
+
+196
+00:15:44,000 --> 00:15:49,000
+The street message removes leading and trailing white spaces, including Unicode.
+
+197
+00:15:49,000 --> 00:15:54,000
+White spaces like non-breaking spaces, not just Ascii spaces.
+
+198
+00:15:55,000 --> 00:16:02,000
+In most cases, when dealing with Ascii spaces, the difference between strip and trim may not be noticeable.
+
+199
+00:16:02,000 --> 00:16:09,000
+However, if your application needs to handle Unicode white spaces or non-breaking spaces, strip provides
+
+200
+00:16:09,000 --> 00:16:10,000
+a more comprehensive solution.
+
+201
+00:16:11,000 --> 00:16:18,000
+So in short, strip is Unicode aware and removes all Unicode white space characters, including non-breaking
+
+202
+00:16:18,000 --> 00:16:23,000
+spaces, while trim only removes Ascii spaces.
+
+203
+00:16:23,000 --> 00:16:29,000
+In this specific example, the difference between the two methods becomes apparent when dealing with
+
+204
+00:16:29,000 --> 00:16:33,000
+non-breaking spaces represented by Unicode characters.
+
+205
+00:16:33,000 --> 00:16:34,000
+And here an example.
+
+206
+00:16:34,000 --> 00:16:42,000
+You can see how a strip method removes Unicode white space characters, while trim method doesn't remove
+
+207
+00:16:42,000 --> 00:16:42,000
+them.
+
+208
+00:16:43,000 --> 00:16:48,000
+There are also two more similar methods strip leading and strip trailing.
+
+209
+00:16:49,000 --> 00:16:55,000
+These methods are part of the enhanced string manipulation capabilities introduced with introduction
+
+210
+00:16:55,000 --> 00:16:56,000
+of strip method.
+
+211
+00:16:57,000 --> 00:17:01,000
+The strip leading method is used to remove leading white spaces from a string.
+
+212
+00:17:02,000 --> 00:17:06,000
+The strip trailing method removes trailing white spaces from a string.
+
+213
+00:17:06,000 --> 00:17:09,000
+So what to use strip or trim method?
+
+214
+00:17:10,000 --> 00:17:16,000
+If you are using Java 11 or later and you want to remove leading and trailing white spaces, it is generally
+
+215
+00:17:16,000 --> 00:17:19,000
+recommended to use the street method.
+
+216
+00:17:19,000 --> 00:17:23,000
+It is more modern Unicode aware and provides a cleaner syntax.
+
+217
+00:17:24,000 --> 00:17:30,000
+If you are using an older version of Java that doesn't have the strip method, you can use stream to
+
+218
+00:17:30,000 --> 00:17:33,000
+achieve similar results with Ascii spaces.
+
+219
+00:17:33,000 --> 00:17:39,000
+However, keep in mind that it doesn't handle Unicode white spaces in the same way as street.
+
+220
+00:17:39,000 --> 00:17:39,000
+Method.
+
+221
+00:17:40,000 --> 00:17:41,000
+Lines.
+
+222
+00:17:41,000 --> 00:17:42,000
+Massive.
+
+223
+00:17:42,000 --> 00:17:50,000
+The lines method returns a stream of lines extracted from the stream, breaking it at line terminators.
+
+224
+00:17:50,000 --> 00:17:56,000
+And we already learned how to work with stream API in the section about Java collection framework of
+
+225
+00:17:56,000 --> 00:17:57,000
+my course.
+
+226
+00:17:57,000 --> 00:17:59,000
+Java from zero to first job.
+
+227
+00:17:59,000 --> 00:18:05,000
+In case you would have any particular question about stream API, let me know in the comments below
+
+228
+00:18:05,000 --> 00:18:06,000
+this video.
+
+229
+00:18:07,000 --> 00:18:09,000
+That's all regarding new methods in string.
+
+230
+00:18:10,000 --> 00:18:17,000
+These new methods provide more concise and expressive ways to work with strings, making common operations
+
+231
+00:18:17,000 --> 00:18:20,000
+simpler and more readable.
+
+232
+00:18:20,000 --> 00:18:24,000
+Now let's learn new file methods that were added in Java 11.
+
+233
+00:18:25,000 --> 00:18:34,000
+Java 11 introduced several new methods in the Java Newfile files utility class, which offer more convenient
+
+234
+00:18:34,000 --> 00:18:38,000
+and expressive ways to work with files and directories.
+
+235
+00:18:39,000 --> 00:18:42,000
+There are read string and write string methods.
+
+236
+00:18:43,000 --> 00:18:44,000
+Let's reuse them.
+
+237
+00:18:45,000 --> 00:18:48,000
+Let's start with red string mass at first.
+
+238
+00:18:48,000 --> 00:18:52,000
+This method reads the content of a file into a string.
+
+239
+00:18:52,000 --> 00:18:57,000
+It's a more concise alternative to reading file content using files.
+
+240
+00:18:57,000 --> 00:19:00,000
+Read all lines and then joining the lines.
+
+241
+00:19:01,000 --> 00:19:09,000
+As stated in the documentation, the files read string method uses UTF eight by default for decoding
+
+242
+00:19:09,000 --> 00:19:11,000
+from bytes to characters.
+
+243
+00:19:11,000 --> 00:19:17,000
+In addition to the default method, there is an overloaded version of read string that allows you to
+
+244
+00:19:17,000 --> 00:19:23,000
+specify the character set to be used for decoding the file's content.
+
+245
+00:19:23,000 --> 00:19:30,000
+The file's read string method, as well as overloaded version, handles the opening and closing of the
+
+246
+00:19:30,000 --> 00:19:32,000
+underlying file stream internally.
+
+247
+00:19:32,000 --> 00:19:38,000
+Therefore, there is no need to explicitly close the resources in your code.
+
+248
+00:19:38,000 --> 00:19:45,000
+The method ensures proper resource management and releases resources when the operation is complete,
+
+249
+00:19:45,000 --> 00:19:48,000
+or if an exception occurs.
+
+250
+00:19:48,000 --> 00:19:53,000
+And here you can find an example of reading text file and printing it to console.
+
+251
+00:19:54,000 --> 00:19:56,000
+The second method is write string.
+
+252
+00:19:57,000 --> 00:20:00,000
+This method writes a sequence of characters to a file.
+
+253
+00:20:01,000 --> 00:20:05,000
+It is a more concise alternative to writing file content using files.
+
+254
+00:20:05,000 --> 00:20:06,000
+Write method.
+
+255
+00:20:07,000 --> 00:20:07,000
+The files.
+
+256
+00:20:07,000 --> 00:20:13,000
+Write string method uses UTF eight by default for encoding the characters into bytes.
+
+257
+00:20:14,000 --> 00:20:20,000
+There is an overloaded version of write strings that allows you to specify the character set to be used
+
+258
+00:20:20,000 --> 00:20:23,000
+for encoding the characters into bytes.
+
+259
+00:20:23,000 --> 00:20:29,000
+The write string method in the Java Newer File Files class allows you to specify additional options
+
+260
+00:20:29,000 --> 00:20:32,000
+using standard open option.
+
+261
+00:20:32,000 --> 00:20:37,000
+These options provide more flexibility when writing to a file.
+
+262
+00:20:37,000 --> 00:20:40,000
+Let me make an overview of the available options.
+
+263
+00:20:40,000 --> 00:20:47,000
+First of all, I want to mention that standard open option is an enumeration that represents the various
+
+264
+00:20:47,000 --> 00:20:49,000
+options for opening a file.
+
+265
+00:20:49,000 --> 00:20:52,000
+Some of the commonly used options include.
+
+266
+00:20:52,000 --> 00:20:56,000
+Create creates file if it doesn't exist.
+
+267
+00:20:56,000 --> 00:21:00,000
+If the file already exists, this option has no effect.
+
+268
+00:21:00,000 --> 00:21:04,000
+Append appends the data to the end of the file.
+
+269
+00:21:04,000 --> 00:21:07,000
+If the file doesn't exist, it is created.
+
+270
+00:21:08,000 --> 00:21:09,000
+Truncate existing.
+
+271
+00:21:09,000 --> 00:21:14,000
+Truncate the file to zero size if it exists.
+
+272
+00:21:14,000 --> 00:21:19,000
+The file is not created if it doesn't exist, right?
+
+273
+00:21:19,000 --> 00:21:21,000
+Open the files for writing.
+
+274
+00:21:21,000 --> 00:21:23,000
+If the file doesn't exist, it is created.
+
+275
+00:21:24,000 --> 00:21:25,000
+Sync.
+
+276
+00:21:25,000 --> 00:21:31,000
+When this option is used, it forces any updates to the file to be written to the storage device immediately.
+
+277
+00:21:32,000 --> 00:21:39,000
+It ensures that both the file content and metadata are synchronized with the underlying storage device.
+
+278
+00:21:40,000 --> 00:21:41,000
+These sync.
+
+279
+00:21:41,000 --> 00:21:48,000
+This option forces only data related updates to be written to the storage device, not necessarily the
+
+280
+00:21:48,000 --> 00:21:49,000
+metadata.
+
+281
+00:21:49,000 --> 00:21:56,000
+While it ensures that file data is synchronized, it doesn't necessarily guarantee synchronization of
+
+282
+00:21:56,000 --> 00:22:03,000
+metadata like timestamps, permissions, etc. and based on the API defined, there is a variable length
+
+283
+00:22:03,000 --> 00:22:11,000
+argument of type standard open option, which means that you can pass multiple open options simultaneously
+
+284
+00:22:11,000 --> 00:22:13,000
+and combine them.
+
+285
+00:22:13,000 --> 00:22:19,000
+For example, you can pass create this sync and append options.
+
+286
+00:22:20,000 --> 00:22:22,000
+And here you can see simple example.
+
+287
+00:22:22,000 --> 00:22:31,000
+Basically I just need to pass pass as an argument string itself and standard open options in this case.
+
+288
+00:22:31,000 --> 00:22:35,000
+In case this pass can't be found it will be created.
+
+289
+00:22:35,000 --> 00:22:39,000
+And in case it exists text will be just added to the end.
+
+290
+00:22:40,000 --> 00:22:40,000
+That's all.
+
+291
+00:22:40,000 --> 00:22:43,000
+What I wanted to share with you regarding new files methods.
+
+292
+00:22:44,000 --> 00:22:49,000
+In case you would have any questions, please feel free to post your questions below the video and I
+
+293
+00:22:49,000 --> 00:22:51,000
+will be happy to answer.
+
diff --git a/44 - Java New Versions/009 Source-code-example-from-the-lesson.url b/44 - Java New Versions/009 Source-code-example-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..9b3a9fcf0672e8cde3c5a7790cdefe0ab1f1a80c
--- /dev/null
+++ b/44 - Java New Versions/009 Source-code-example-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/commit/8d81e594e84567ef760a1522db1b19193175a2ab
\ No newline at end of file
diff --git a/44 - Java New Versions/010 Java 11 Collection & Predicate API Updates, Nest-Based Access Control & more_en.srt b/44 - Java New Versions/010 Java 11 Collection & Predicate API Updates, Nest-Based Access Control & more_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..963dcf64bd2d8664dd96035ee73bc58137abc2a1
--- /dev/null
+++ b/44 - Java New Versions/010 Java 11 Collection & Predicate API Updates, Nest-Based Access Control & more_en.srt
@@ -0,0 +1,1068 @@
+1
+00:00:02,000 --> 00:00:08,000
+The next API updates that we are going to review is new method in collection interface.
+
+2
+00:00:08,000 --> 00:00:12,000
+I'm talking about two array method with int function parameter.
+
+3
+00:00:12,000 --> 00:00:16,000
+In Java 11, the collection interface was enhanced with a new method.
+
+4
+00:00:17,000 --> 00:00:24,000
+This method allows you to convert a collection into an array, specifying the array type using an int
+
+5
+00:00:24,000 --> 00:00:25,000
+function.
+
+6
+00:00:25,000 --> 00:00:32,000
+The int function is responsible for creating the target array based on the size of the collection.
+
+7
+00:00:32,000 --> 00:00:41,000
+The int function is a function interface that represents a function that takes an integer argument representing
+
+8
+00:00:41,000 --> 00:00:46,000
+the length of the array, and produces an array of the specified type.
+
+9
+00:00:46,000 --> 00:00:50,000
+The int function is a part of the Java.util function package.
+
+10
+00:00:51,000 --> 00:00:53,000
+Let's review an example of the array method.
+
+11
+00:00:54,000 --> 00:00:59,000
+In this example, we have a list of strings and then we need to convert it to a string array.
+
+12
+00:01:00,000 --> 00:01:03,000
+I wrote two lines that do the same thing.
+
+13
+00:01:03,000 --> 00:01:08,000
+In the first option I described int function as lambda expression.
+
+14
+00:01:08,000 --> 00:01:15,000
+In this way, you can see that functions takes size of the collection as an input argument and returns
+
+15
+00:01:15,000 --> 00:01:16,000
+array object.
+
+16
+00:01:16,000 --> 00:01:23,000
+In the second option I use another syntax, but it also leads me to the same result.
+
+17
+00:01:23,000 --> 00:01:29,000
+This is method reference and I specifies a reference to the constructor of string array type.
+
+18
+00:01:30,000 --> 00:01:35,000
+In the section about functional programming in Java in my course Java from zero to first job, we learned
+
+19
+00:01:35,000 --> 00:01:37,000
+more about method reference syntax.
+
+20
+00:01:37,000 --> 00:01:40,000
+That's why I wouldn't repeat myself.
+
+21
+00:01:40,000 --> 00:01:44,000
+But in case you have some questions, let me know in the comments below the video.
+
+22
+00:01:44,000 --> 00:01:52,000
+Before Java 11, the two array method only had the option to return an object array, and if you wanted
+
+23
+00:01:52,000 --> 00:01:56,000
+a specific type of array, you had to cast it manually.
+
+24
+00:01:56,000 --> 00:02:04,000
+The int function simplifies this process by allowing you to express the desired array type without casting.
+
+25
+00:02:04,000 --> 00:02:05,000
+Let's continue.
+
+26
+00:02:06,000 --> 00:02:12,000
+Let's discuss new methods that was added to predicate interface in Java 11.
+
+27
+00:02:12,000 --> 00:02:18,000
+The predicate not method is a static method added to the predicate interface in Java 11.
+
+28
+00:02:18,000 --> 00:02:25,000
+It provides a convenient way to create a new predicate that represents the negation logical, not of
+
+29
+00:02:25,000 --> 00:02:27,000
+the specified predicate.
+
+30
+00:02:27,000 --> 00:02:35,000
+This method helps simplify code when you need to negate a predicate without explicitly colons, and
+
+31
+00:02:35,000 --> 00:02:37,000
+negate method on the predicate instance.
+
+32
+00:02:38,000 --> 00:02:39,000
+Let's review the example.
+
+33
+00:02:40,000 --> 00:02:46,000
+I define an original predicate is greater than five, which checks if a number is greater than five.
+
+34
+00:02:46,000 --> 00:02:53,000
+Then I use the predicate not method to create a new predicate is not greater than five that negates
+
+35
+00:02:53,000 --> 00:02:55,000
+the original predicate.
+
+36
+00:02:55,000 --> 00:02:59,000
+Here you can see that I test both predicates using the test method.
+
+37
+00:03:00,000 --> 00:03:07,000
+There is not greater than five predicate is the negation of is greater than five if is greater than
+
+38
+00:03:07,000 --> 00:03:07,000
+five.
+
+39
+00:03:07,000 --> 00:03:15,000
+Returns true for a given input is not greater than five will return false for the same input, and vice
+
+40
+00:03:15,000 --> 00:03:15,000
+versa.
+
+41
+00:03:16,000 --> 00:03:23,000
+This not method provides a convenient way to create the negation of a predicate, without explicitly
+
+42
+00:03:23,000 --> 00:03:26,000
+calling the negate method on the predicate itself.
+
+43
+00:03:26,000 --> 00:03:30,000
+It improves code readability and conciseness.
+
+44
+00:03:31,000 --> 00:03:41,000
+The next thing that I want to review with you is JDK Enhancement Proposal 323, GEP 323, titled Local
+
+45
+00:03:41,000 --> 00:03:48,000
+Variable Syntax for Lambda Parameters, was introduced in Java 11 as a part of ongoing efforts to enhance
+
+46
+00:03:48,000 --> 00:03:52,000
+the expressiveness and conciseness of Java language.
+
+47
+00:03:53,000 --> 00:04:00,000
+This GEP focused on allowing the use of VAR in lambda expressions, enabling developers to declare the
+
+48
+00:04:00,000 --> 00:04:04,000
+types of lambda parameters more briefly.
+
+49
+00:04:04,000 --> 00:04:14,000
+The primary goal of GEP 323 was to enhance the language by allowing the use of VAR for the formal parameters
+
+50
+00:04:14,000 --> 00:04:17,000
+of implicitly typed lambda expressions.
+
+51
+00:04:17,000 --> 00:04:25,000
+This change aimed to simplify and reduce boilerplate code in certain situations, making the code more
+
+52
+00:04:25,000 --> 00:04:27,000
+concise while maintaining readability.
+
+53
+00:04:28,000 --> 00:04:35,000
+Here you can see examples of how you had to write before Java 11 and how you can write lambda expression
+
+54
+00:04:35,000 --> 00:04:37,000
+since Java 11.
+
+55
+00:04:37,000 --> 00:04:44,000
+GEP 323 was a step towards improving the conciseness and expressiveness of Java code.
+
+56
+00:04:44,000 --> 00:04:47,000
+By allowing the use of var in lambda parameters.
+
+57
+00:04:47,000 --> 00:04:53,000
+Developers gained more flexibility in writing lambda expressions, particularly in cases where explicit
+
+58
+00:04:53,000 --> 00:04:56,000
+type declarations seemed verbose.
+
+59
+00:04:56,000 --> 00:05:03,000
+This change contributed to a more streamlined and consistent use of var keyword in the Java language.
+
+60
+00:05:03,000 --> 00:05:09,000
+To be honest, in modern Java versions I don't specify neither var nor types at all.
+
+61
+00:05:09,000 --> 00:05:13,000
+Using just variables names just like this.
+
+62
+00:05:13,000 --> 00:05:16,000
+This makes my code even more readable.
+
+63
+00:05:16,000 --> 00:05:21,000
+Of course, only in case types of variables are obvious based on the context.
+
+64
+00:05:21,000 --> 00:05:24,000
+Otherwise I prefer to specify variable type.
+
+65
+00:05:24,000 --> 00:05:25,000
+Let's now review.
+
+66
+00:05:25,000 --> 00:05:28,000
+JDK Enhancement Proposal 181.
+
+67
+00:05:29,000 --> 00:05:38,000
+Jep 181, titled Nest based Access Control, was introduced as part of GCC 11 to improve the security
+
+68
+00:05:38,000 --> 00:05:41,000
+and maintainability of the Java platform.
+
+69
+00:05:41,000 --> 00:05:49,000
+This Jep introduced a new kind of access control context called Nests, which is a grouping of related
+
+70
+00:05:49,000 --> 00:05:56,000
+classes and interfaces that share the same access control checks before JDK 11.
+
+71
+00:05:56,000 --> 00:06:03,000
+Access control in Java relied on the class file structure and its relationship with packages.
+
+72
+00:06:03,000 --> 00:06:09,000
+However, certain classes like inner Class could have privileged access to the private members of their
+
+73
+00:06:09,000 --> 00:06:13,000
+enclosing classes, leading to potential security concerns.
+
+74
+00:06:14,000 --> 00:06:22,000
+Jep 181 aimed to enhance the existing access control mechanism by introducing a new access control context
+
+75
+00:06:22,000 --> 00:06:24,000
+based on nests.
+
+76
+00:06:24,000 --> 00:06:32,000
+The primary goals were better security, provide a more fine grained and secure access control mechanism,
+
+77
+00:06:32,000 --> 00:06:36,000
+reducing the risk of unintended access to private members.
+
+78
+00:06:36,000 --> 00:06:42,000
+Maintainability simplifies the implementation and maintenance of access control by introducing a more
+
+79
+00:06:42,000 --> 00:06:44,000
+robust and intuitive mechanism.
+
+80
+00:06:45,000 --> 00:06:52,000
+Before Java 11, inner classes had access to private members field methods of their enclosing classes
+
+81
+00:06:52,000 --> 00:06:53,000
+too.
+
+82
+00:06:53,000 --> 00:06:56,000
+So you may be wondering what's new.
+
+83
+00:06:56,000 --> 00:06:58,000
+Then is introduced.
+
+84
+00:06:58,000 --> 00:07:05,000
+While the behavior regarding access to private members remains similar, nest based access control introduces
+
+85
+00:07:05,000 --> 00:07:08,000
+a formalized concept of nest members.
+
+86
+00:07:08,000 --> 00:07:13,000
+The new feature formalizes the concept of a nest in the bytecode.
+
+87
+00:07:13,000 --> 00:07:20,000
+The nest host attribute is added to the class file structure, and the nest members attribute is added
+
+88
+00:07:20,000 --> 00:07:23,000
+to each class that is member of a nest.
+
+89
+00:07:24,000 --> 00:07:25,000
+So let's summarize key concepts.
+
+90
+00:07:25,000 --> 00:07:33,000
+Now Nests and nest is a new grouping construct introduced by this JDK enhancement proposal.
+
+91
+00:07:34,000 --> 00:07:41,000
+It consists of a set of classes and interfaces that have access to each other's private members, without
+
+92
+00:07:41,000 --> 00:07:43,000
+needing to use access checks.
+
+93
+00:07:43,000 --> 00:07:51,000
+Nest help maintain access control decisions based on runtime information, rather than relying solely
+
+94
+00:07:51,000 --> 00:07:52,000
+on the class file structure.
+
+95
+00:07:53,000 --> 00:07:54,000
+Nest host.
+
+96
+00:07:54,000 --> 00:08:00,000
+Within a nest, one class or interface is designated as the nest host.
+
+97
+00:08:00,000 --> 00:08:06,000
+The nest host is the primary member of the nest and is used for access control checks.
+
+98
+00:08:07,000 --> 00:08:09,000
+Next members.
+
+99
+00:08:09,000 --> 00:08:13,000
+All other classes and interfaces within the nest are considered.
+
+100
+00:08:13,000 --> 00:08:14,000
+Nest members.
+
+101
+00:08:15,000 --> 00:08:20,000
+Nest members can access each other's private members without additional access control checks.
+
+102
+00:08:21,000 --> 00:08:23,000
+Let's review the example now.
+
+103
+00:08:23,000 --> 00:08:25,000
+Consider the following example.
+
+104
+00:08:26,000 --> 00:08:33,000
+In this example, in a class one and in a class two are part of the same nest as nest example.
+
+105
+00:08:33,000 --> 00:08:39,000
+They can access the private field private field without requiring additional access checks.
+
+106
+00:08:40,000 --> 00:08:43,000
+What advantages do we receive in this case?
+
+107
+00:08:43,000 --> 00:08:51,000
+Enhanced security nests provide a more secure mechanism for access control, ensuring that only related
+
+108
+00:08:51,000 --> 00:08:55,000
+classes and interfaces can access each other's private members.
+
+109
+00:08:55,000 --> 00:08:57,000
+Maintainability.
+
+110
+00:08:57,000 --> 00:09:03,000
+The introduction of Nests simplifies the implementation of access control checks and makes the code
+
+111
+00:09:03,000 --> 00:09:05,000
+base more maintainable.
+
+112
+00:09:05,000 --> 00:09:08,000
+The Getnext host and Getnext members.
+
+113
+00:09:08,000 --> 00:09:17,000
+Methods introduced by GEP 181 are reflection methods that allow you to programmatically access the nest
+
+114
+00:09:17,000 --> 00:09:19,000
+host and nest members of a class.
+
+115
+00:09:19,000 --> 00:09:25,000
+I prepared a special example here to help you understand the concept of nest based access control.
+
+116
+00:09:26,000 --> 00:09:34,000
+Here I have a class with two inner classes and in main method I call get nest information for three
+
+117
+00:09:34,000 --> 00:09:39,000
+different classes for author class and for two inner classes.
+
+118
+00:09:39,000 --> 00:09:46,000
+And with the help of reflection and such new masses that were introduced in Java 11 as Get Nest Host
+
+119
+00:09:46,000 --> 00:09:50,000
+and Get nest members, I print information to console.
+
+120
+00:09:50,000 --> 00:09:53,000
+Here in console you can see the detailed console output.
+
+121
+00:09:54,000 --> 00:10:00,000
+So when I run this code, it prints information about the nest structure of the provided classes.
+
+122
+00:10:01,000 --> 00:10:08,000
+The introduction of Nests is backward compatible, meaning that classes compiled with GCC versions before
+
+123
+00:10:08,000 --> 00:10:11,000
+11 will continue to work without modification.
+
+124
+00:10:12,000 --> 00:10:18,000
+Nests rely on runtime information to make access control decisions, providing a more dynamic and flexible
+
+125
+00:10:18,000 --> 00:10:19,000
+approach.
+
+126
+00:10:20,000 --> 00:10:24,000
+Let's now review new tools and features that were introduced in Java 11.
+
+127
+00:10:25,000 --> 00:10:33,000
+One of the interesting ones is GCC Enhancement Proposal 330, titled Launch Single File Source Code
+
+128
+00:10:33,000 --> 00:10:34,000
+Programs.
+
+129
+00:10:34,000 --> 00:10:37,000
+Let me explain what it is about.
+
+130
+00:10:37,000 --> 00:10:45,000
+GEP 330 was introduced in Java 11 to simplify the execution of single file Java programs.
+
+131
+00:10:45,000 --> 00:10:51,000
+Before this enhancement, running such programs often required additional steps, including compiling
+
+132
+00:10:51,000 --> 00:10:53,000
+the code manually.
+
+133
+00:10:53,000 --> 00:11:00,000
+This GEP aimed to streamline the process, making it more convenient for developers to execute simple
+
+134
+00:11:00,000 --> 00:11:02,000
+single file Java programs.
+
+135
+00:11:03,000 --> 00:11:10,000
+As you may already know, in Java, traditional multi file applications are compiled into bytecode and
+
+136
+00:11:10,000 --> 00:11:12,000
+then executed using the Java command.
+
+137
+00:11:13,000 --> 00:11:20,000
+Single file programs, however, typically consist of a single source file with a main method and can
+
+138
+00:11:20,000 --> 00:11:22,000
+be executed without explicit compilation.
+
+139
+00:11:23,000 --> 00:11:28,000
+Prior to GEP 330, developers needed to perform manual compilation.
+
+140
+00:11:29,000 --> 00:11:37,000
+The primary goals of GEP 330 were to simplify the process of running single file Java programs without
+
+141
+00:11:37,000 --> 00:11:39,000
+the need for explicit compilation.
+
+142
+00:11:39,000 --> 00:11:44,000
+Provide a more straightforward and user friendly way to execute simple Java programs.
+
+143
+00:11:44,000 --> 00:11:48,000
+Among key features, it was to mention the following ones.
+
+144
+00:11:48,000 --> 00:11:57,000
+GEP 330 introduces the ability to run single file Java programs directly using the Java command, without
+
+145
+00:11:57,000 --> 00:11:59,000
+the need for explicit compilation.
+
+146
+00:11:59,000 --> 00:12:05,000
+When running a single file program with Java, the Java launcher implicitly compiles the source code
+
+147
+00:12:05,000 --> 00:12:07,000
+before executing it.
+
+148
+00:12:07,000 --> 00:12:10,000
+This eliminates the need for a separate compilation step.
+
+149
+00:12:11,000 --> 00:12:18,000
+On a Unix like systems, the shebang syntax can be used at the beginning of the source file to specify
+
+150
+00:12:18,000 --> 00:12:23,000
+the Java launcher, making the script executable directly.
+
+151
+00:12:23,000 --> 00:12:30,000
+The shebang syntax is a special syntax used at the beginning of script or source file on Unix like systems.
+
+152
+00:12:31,000 --> 00:12:38,000
+It starts with a characters hash sign exclamation mark, followed by the path to the interpreter that
+
+153
+00:12:38,000 --> 00:12:40,000
+should be used to execute the script.
+
+154
+00:12:41,000 --> 00:12:46,000
+The purpose of the shebang is to indicate which interpreter should be used for running the script.
+
+155
+00:12:47,000 --> 00:12:48,000
+Let's review examples.
+
+156
+00:12:48,000 --> 00:12:55,000
+Now consider the following example of a simple single file Java program that just prints Hello world
+
+157
+00:12:55,000 --> 00:12:56,000
+to console.
+
+158
+00:12:57,000 --> 00:12:59,000
+Was GB 330.
+
+159
+00:12:59,000 --> 00:13:05,000
+You can now run this program directly from Command prompt using the Java command.
+
+160
+00:13:05,000 --> 00:13:07,000
+Just type Java.
+
+161
+00:13:07,000 --> 00:13:08,000
+Hello world Java.
+
+162
+00:13:09,000 --> 00:13:16,000
+Alternatively, on the Unix like systems you can make the script executable with a shebang syntax like
+
+163
+00:13:16,000 --> 00:13:17,000
+I already mentioned.
+
+164
+00:13:17,000 --> 00:13:23,000
+You can create separate file and include in the first line instructions written on a shebang.
+
+165
+00:13:23,000 --> 00:13:24,000
+Syntax.
+
+166
+00:13:24,000 --> 00:13:31,000
+This will allow you to execute file directly as a script without calling Java command from terminal,
+
+167
+00:13:31,000 --> 00:13:33,000
+but instead just invoking script.
+
+168
+00:13:34,000 --> 00:13:36,000
+Let me explain you how to achieve this.
+
+169
+00:13:36,000 --> 00:13:40,000
+You create separate file like you can see on the screen.
+
+170
+00:13:40,000 --> 00:13:46,000
+The shebang string is used to specify how the script should be executed.
+
+171
+00:13:46,000 --> 00:13:50,000
+As you can see, there are specific instructions in the first line.
+
+172
+00:13:50,000 --> 00:13:52,000
+Let's break them down.
+
+173
+00:13:53,000 --> 00:13:54,000
+Hash sign.
+
+174
+00:13:54,000 --> 00:13:55,000
+Exclamation mark.
+
+175
+00:13:56,000 --> 00:13:58,000
+User bin env.
+
+176
+00:13:58,000 --> 00:14:00,000
+This is shebang prefix.
+
+177
+00:14:01,000 --> 00:14:05,000
+Java the interpreter or executable that should be used to run the script.
+
+178
+00:14:06,000 --> 00:14:08,000
+Double dash sauce 11.
+
+179
+00:14:08,000 --> 00:14:15,000
+An option passed to the Java command specifying the source version, in this case Java 11.
+
+180
+00:14:15,000 --> 00:14:22,000
+The shebang line tells the operating system which interpreter to use when running the script.
+
+181
+00:14:22,000 --> 00:14:28,000
+In this case, it specifies that the Java interpreter should be used, and it should interpret the source
+
+182
+00:14:28,000 --> 00:14:30,000
+code with a source version of 11.
+
+183
+00:14:31,000 --> 00:14:37,000
+When you have the shebang line in your script, you can make the script executable, and then you can
+
+184
+00:14:37,000 --> 00:14:42,000
+run it directly from the command line without explicitly using the Java command.
+
+185
+00:14:43,000 --> 00:14:50,000
+You can make the script executable with simple command C-H mode like you can see on the screen.
+
+186
+00:14:51,000 --> 00:14:55,000
+See chmod plus x helloworld.java.
+
+187
+00:14:56,000 --> 00:15:02,000
+And after that, you can simply run the script without calling Java program directly from terminal.
+
+188
+00:15:03,000 --> 00:15:06,000
+Hello world Java and the code will be executed.
+
+189
+00:15:07,000 --> 00:15:10,000
+Benefits of such improvement are obvious.
+
+190
+00:15:10,000 --> 00:15:17,000
+Developers can run single files Java programs directly using the Java command, simplifying the execution
+
+191
+00:15:17,000 --> 00:15:17,000
+process.
+
+192
+00:15:18,000 --> 00:15:25,000
+The need for explicit compilation is eliminated, reducing the boilerplate code required to run simple
+
+193
+00:15:25,000 --> 00:15:26,000
+programs.
+
+194
+00:15:26,000 --> 00:15:32,000
+Jep 330 is primarily designed for simple single file programs.
+
+195
+00:15:32,000 --> 00:15:38,000
+More complex applications may still require traditional compilation and execution processes.
+
+196
+00:15:38,000 --> 00:15:45,000
+While convenient for quick testing and prototyping, the feature is not replacement for traditional
+
+197
+00:15:45,000 --> 00:15:48,000
+compilation and packaging for larger projects.
+
+198
+00:15:49,000 --> 00:15:51,000
+Let's review the next tool.
+
+199
+00:15:51,000 --> 00:15:56,000
+Java Flight Recorder was officially introduced as a feature in Java 11.
+
+200
+00:15:56,000 --> 00:16:04,000
+The release of Java 11 marked the inclusion of Gf4 as an open source feature in Java platform.
+
+201
+00:16:05,000 --> 00:16:11,000
+Prior to Java 11, Java Flight Recorder was part of the Oracle JDK as a commercial feature.
+
+202
+00:16:12,000 --> 00:16:19,000
+With its inclusion in Java 11 and subsequent versions, G4 became available to a broader audience,
+
+203
+00:16:19,000 --> 00:16:22,000
+including users of OpenJDK distributions.
+
+204
+00:16:23,000 --> 00:16:30,000
+Developers could then take advantage of Java flight recorders, profiling and diagnostic capabilities
+
+205
+00:16:30,000 --> 00:16:32,000
+without requiring a separate commercial license.
+
+206
+00:16:33,000 --> 00:16:40,000
+The availability of Java flight recorder in Java 11 made it more accessible for developers to analyze
+
+207
+00:16:40,000 --> 00:16:43,000
+and optimize the performance of their Java applications.
+
+208
+00:16:44,000 --> 00:16:51,000
+The Java Flight Recorder is a data collection and profiling framework in the Java Virtual Machine that
+
+209
+00:16:51,000 --> 00:16:56,000
+provides detailed insights into the runtime behavior of Java applications.
+
+210
+00:16:56,000 --> 00:17:02,000
+It is designed for troubleshooting, performance analysis, and monitoring of Java applications in production
+
+211
+00:17:02,000 --> 00:17:03,000
+environments.
+
+212
+00:17:04,000 --> 00:17:10,000
+Gfaa collects various types of data during the execution of Java application.
+
+213
+00:17:10,000 --> 00:17:16,000
+This data includes information about thread activity, memory usage, garbage collection, events,
+
+214
+00:17:16,000 --> 00:17:20,000
+method profiling, input output operations, and more.
+
+215
+00:17:21,000 --> 00:17:27,000
+Java Flight Recorder is designed to impose minimal overhead on the application being monitored.
+
+216
+00:17:27,000 --> 00:17:35,000
+It achieves this by leveraging mechanisms that allow continuous logging, packed data collection with
+
+217
+00:17:35,000 --> 00:17:38,000
+minimal disruption to the application's performance.
+
+218
+00:17:39,000 --> 00:17:45,000
+Gfaa includes a set of command line tools for interacting with extracting information from the recorded
+
+219
+00:17:45,000 --> 00:17:46,000
+data.
+
+220
+00:17:47,000 --> 00:17:53,000
+These tools enable users to analyze recordings, extract specific events, and generate reports.
+
+221
+00:17:54,000 --> 00:18:01,000
+Java Flight Recorder is a powerful tool for diagnosing performance issues, analyzing runtime behavior,
+
+222
+00:18:01,000 --> 00:18:03,000
+and optimizing Java applications.
+
+223
+00:18:04,000 --> 00:18:11,000
+It enhances the observability of Java applications, allowing developers and operators to gain valuable
+
+224
+00:18:11,000 --> 00:18:18,000
+insights into the Jvm's internal workings without significant performance impact.
+
+225
+00:18:18,000 --> 00:18:24,000
+So team that were all updates and improvements that were released in Java 11 that I wanted to talk about
+
+226
+00:18:24,000 --> 00:18:31,000
+in details, but that doesn't mean that there are no more updates on these slides.
+
+227
+00:18:31,000 --> 00:18:34,000
+You can see more updates introduced in Java 11.
+
+228
+00:18:34,000 --> 00:18:41,000
+We don't review these not because they are not important, but most likely because we will not have
+
+229
+00:18:41,000 --> 00:18:45,000
+time to cover them all with the same level of details.
+
+230
+00:18:45,000 --> 00:18:52,000
+And another reason is that review of these improvements is not critically important for you to become
+
+231
+00:18:52,000 --> 00:18:58,000
+a professional engineer, because most of these changes are related with optimization of operations.
+
+232
+00:18:58,000 --> 00:19:02,000
+That happens on the background, on the low level.
+
+233
+00:19:02,000 --> 00:19:09,000
+And we reviewed with you API and tools that most likely you will interact with most often as a developer,
+
+234
+00:19:09,000 --> 00:19:11,000
+but still team.
+
+235
+00:19:11,000 --> 00:19:16,000
+I encourage you to pause the video and review the list of updates and improvements, and in case you
+
+236
+00:19:16,000 --> 00:19:23,000
+will be interested in some specific improvement or update, please do not hesitate to post your question
+
+237
+00:19:23,000 --> 00:19:26,000
+below the video and I will be happy to answer.
+
+238
+00:19:26,000 --> 00:19:32,000
+And of course, Java 11 release has a lot of items that were removed and that were deprecated.
+
+239
+00:19:33,000 --> 00:19:37,000
+And the similar things I want to say during the review of this slide.
+
+240
+00:19:38,000 --> 00:19:44,000
+Unfortunately, we will not reviewing details each deprecation within the scope of this lesson, but
+
+241
+00:19:44,000 --> 00:19:51,000
+I encourage you to press pause and read through the items that were removed and deprecated in Java 11.
+
+242
+00:19:51,000 --> 00:19:58,000
+And in case you would have any questions, post them below the video and I will elaborate more in case
+
+243
+00:19:58,000 --> 00:20:01,000
+will be a lot of questions about the same feature deprecation.
+
+244
+00:20:01,000 --> 00:20:06,000
+I would create a separate lesson, so feel free to explore this list.
+
+245
+00:20:06,000 --> 00:20:09,000
+You can find interesting things here.
+
+246
+00:20:09,000 --> 00:20:14,000
+Like for example, deprecation of Nashorn JavaScript engine from the Java Development Kit.
+
+247
+00:20:15,000 --> 00:20:22,000
+Nashorn was a JavaScript runtime that was introduced in Java eight as a replacement for the older Rhino
+
+248
+00:20:22,000 --> 00:20:22,000
+engine.
+
+249
+00:20:23,000 --> 00:20:30,000
+It was intended to provide improved performance and better compliance with the Ecmascript specification,
+
+250
+00:20:30,000 --> 00:20:37,000
+compared to the older Rhino JavaScript engine that was included in earlier versions of Java.
+
+251
+00:20:37,000 --> 00:20:44,000
+The Nashorn JavaScript engine was designed to enable the execution of JavaScript code within the Java
+
+252
+00:20:44,000 --> 00:20:45,000
+Virtual machine.
+
+253
+00:20:45,000 --> 00:20:53,000
+This capability allows developers to seamlessly integrate JavaScript and Java code, facilitating polyglot
+
+254
+00:20:53,000 --> 00:20:57,000
+programming and enhancing interoperability between the two languages.
+
+255
+00:20:58,000 --> 00:21:02,000
+Feel free to check other removals and deprecations on the slide.
+
+256
+00:21:02,000 --> 00:21:06,000
+That's all what I wanted to review with you in scope of this lesson.
+
+257
+00:21:06,000 --> 00:21:10,000
+Let's recap what we have learned today from the lesson.
+
+258
+00:21:11,000 --> 00:21:14,000
+We started lesson from understanding Lt's concept.
+
+259
+00:21:14,000 --> 00:21:17,000
+And what does it mean for Java 11?
+
+260
+00:21:17,000 --> 00:21:24,000
+Then during the lesson, we learned everything you need to know about Java 11 release.
+
+261
+00:21:24,000 --> 00:21:26,000
+We learned new features in Java 11.
+
+262
+00:21:26,000 --> 00:21:30,000
+We learned features and API updates on code examples.
+
+263
+00:21:30,000 --> 00:21:34,000
+I showed you features and APIs that were removed in Java 11.
+
+264
+00:21:34,000 --> 00:21:40,000
+Also, we removed summary of features and elements that become deprecated in Java 11.
+
+265
+00:21:41,000 --> 00:21:42,000
+That's it for this lesson.
+
+266
+00:21:42,000 --> 00:21:44,000
+Thanks a lot for your attention.
+
+267
+00:21:44,000 --> 00:21:47,000
+Have a great day and see you in the next lesson.
+
diff --git a/44 - Java New Versions/010 Source-code-example-from-the-lesson.url b/44 - Java New Versions/010 Source-code-example-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..9b3a9fcf0672e8cde3c5a7790cdefe0ab1f1a80c
--- /dev/null
+++ b/44 - Java New Versions/010 Source-code-example-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/commit/8d81e594e84567ef760a1522db1b19193175a2ab
\ No newline at end of file
diff --git a/44 - Java New Versions/011 Deprecated-Features-and-Options.url b/44 - Java New Versions/011 Deprecated-Features-and-Options.url
new file mode 100644
index 0000000000000000000000000000000000000000..19c71e3ee96241f9fabf1d30152862a6a23c0465
--- /dev/null
+++ b/44 - Java New Versions/011 Deprecated-Features-and-Options.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://cr.openjdk.org/~iris/se/12/latestSpec/api/deprecated-list.html
\ No newline at end of file
diff --git a/44 - Java New Versions/011 Java 12 CompactNumberFormat, Teeing Collector, String.indent(), transform()_en.srt b/44 - Java New Versions/011 Java 12 CompactNumberFormat, Teeing Collector, String.indent(), transform()_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..b876047299db404edb6a0c7d41106b3969d79586
--- /dev/null
+++ b/44 - Java New Versions/011 Java 12 CompactNumberFormat, Teeing Collector, String.indent(), transform()_en.srt
@@ -0,0 +1,1136 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello, Tim.
+
+2
+00:00:06,000 --> 00:00:11,000
+In this lesson we are going to learn all the details about Java 12 release.
+
+3
+00:00:12,000 --> 00:00:18,000
+If you are a student of my course Java from zero to first job, then you are already aware that we have
+
+4
+00:00:18,000 --> 00:00:23,000
+series of lessons where I share with you updates of new Java versions.
+
+5
+00:00:24,000 --> 00:00:31,000
+So in today's lesson, we'll stick to our regular agenda, the same we had for similar topic before.
+
+6
+00:00:31,000 --> 00:00:38,000
+When we learned other Java versions, we will learn new language features and APIs added to Java 12.
+
+7
+00:00:38,000 --> 00:00:41,000
+I will explain new GTK tools and features.
+
+8
+00:00:41,000 --> 00:00:44,000
+I will explain you things using code examples.
+
+9
+00:00:45,000 --> 00:00:51,000
+I will show you the things that were removed from Java 12 and that were marked as deprecated in Java
+
+10
+00:00:51,000 --> 00:00:51,000
+12.
+
+11
+00:00:52,000 --> 00:00:56,000
+That's in short, the detailed agenda you can find on the slide.
+
+12
+00:00:56,000 --> 00:00:59,000
+As you can see, we have really a lot of things to learn.
+
+13
+00:00:59,000 --> 00:01:01,000
+Let's start our lesson.
+
+14
+00:01:01,000 --> 00:01:06,000
+As always, today we are going to have theoretical and practical part of the lesson.
+
+15
+00:01:06,000 --> 00:01:13,000
+Of course, it is always better to learn new syntax and new API updates by real life examples.
+
+16
+00:01:13,000 --> 00:01:19,000
+Especially for this lesson, I prepared examples that you can find in attachments to the lesson.
+
+17
+00:01:19,000 --> 00:01:24,000
+So let me start screen sharing and review with you API updates.
+
+18
+00:01:24,000 --> 00:01:29,000
+All examples for this lesson are located in the file that is called Java 12.
+
+19
+00:01:30,000 --> 00:01:37,000
+Let me run the main method and explore console output together with you as we will go and remember him
+
+20
+00:01:37,000 --> 00:01:39,000
+in case something is not clear for you.
+
+21
+00:01:39,000 --> 00:01:44,000
+You don't need to wait, just pause your question below the video and I will be happy to answer.
+
+22
+00:01:44,000 --> 00:01:49,000
+Let's start and we'll start from compact number format.
+
+23
+00:01:49,000 --> 00:01:50,000
+Class overview.
+
+24
+00:01:51,000 --> 00:01:57,000
+In Java 12, the Compact Number format class was introduced to provide a way to format numbers in a
+
+25
+00:01:57,000 --> 00:02:00,000
+compact form based on the locale.
+
+26
+00:02:00,000 --> 00:02:03,000
+It is part of the Java Text package.
+
+27
+00:02:04,000 --> 00:02:11,000
+The purpose of this class is to represent a number in a more concise and readable manner, suitable
+
+28
+00:02:11,000 --> 00:02:13,000
+for display and limited space.
+
+29
+00:02:13,000 --> 00:02:17,000
+Let's review example of compact number format.
+
+30
+00:02:17,000 --> 00:02:22,000
+The compact number format class extends number format abstract class.
+
+31
+00:02:23,000 --> 00:02:32,000
+This type provides a get compact number instance method that allows you to specify both the locale and
+
+32
+00:02:32,000 --> 00:02:33,000
+the style.
+
+33
+00:02:33,000 --> 00:02:38,000
+The style parameter determines the level of compactness.
+
+34
+00:02:38,000 --> 00:02:41,000
+There are two styles, short and long.
+
+35
+00:02:42,000 --> 00:02:49,000
+When you invoke get compact number instance method and you don't specify locale, the default locale
+
+36
+00:02:49,000 --> 00:02:50,000
+is used.
+
+37
+00:02:51,000 --> 00:02:54,000
+And short style is used by default two.
+
+38
+00:02:54,000 --> 00:02:59,000
+You can find this in the source code of get compact number instance method.
+
+39
+00:02:59,000 --> 00:03:08,000
+In this example, the compact number format class is used to format a number in both the default locale
+
+40
+00:03:08,000 --> 00:03:12,000
+and a specific locale, the United States locale.
+
+41
+00:03:13,000 --> 00:03:19,000
+The get compact number instance method is called to obtain an instance of the compact number format
+
+42
+00:03:19,000 --> 00:03:20,000
+class.
+
+43
+00:03:20,000 --> 00:03:24,000
+For the sake of example, let's create some number of double data type.
+
+44
+00:03:24,000 --> 00:03:26,000
+Now we are ready to format number.
+
+45
+00:03:27,000 --> 00:03:33,000
+The format method is then used to format the given number in a compact form.
+
+46
+00:03:33,000 --> 00:03:40,000
+We print it to console, and we can see that default locale of my personal laptop is used, and you
+
+47
+00:03:40,000 --> 00:03:44,000
+can see shortened form of thousand word in Russian.
+
+48
+00:03:45,000 --> 00:03:52,000
+That's how in Russian you would write 2000 in the short form, which means the TCG in a regional language.
+
+49
+00:03:53,000 --> 00:03:59,000
+If you want to compare how regular number format instance would format the same number by default,
+
+50
+00:03:59,000 --> 00:04:07,000
+pay attention to the next line I got the reference to the number instance and formatted the same number,
+
+51
+00:04:07,000 --> 00:04:10,000
+and in console you can see what we received.
+
+52
+00:04:10,000 --> 00:04:16,000
+But in real program you shouldn't always rely on the default locale and style.
+
+53
+00:04:16,000 --> 00:04:23,000
+Let me create compact number format instance using us local and long style.
+
+54
+00:04:23,000 --> 00:04:29,000
+And after formatting you can see in console that it looks like 2000.
+
+55
+00:04:30,000 --> 00:04:37,000
+I hope that on this example, you understood what compact number format exists for and how to use it
+
+56
+00:04:37,000 --> 00:04:38,000
+on practice.
+
+57
+00:04:39,000 --> 00:04:40,000
+Let's continue.
+
+58
+00:04:41,000 --> 00:04:45,000
+Let's now review new string methods introduced in Java 12.
+
+59
+00:04:45,000 --> 00:04:52,000
+In Java 12, two new methods, indent and transform, were introduced in the string class to enhance
+
+60
+00:04:52,000 --> 00:04:55,000
+the functionality of working with strings.
+
+61
+00:04:55,000 --> 00:05:01,000
+The methods provide more flexibility and convenience when dealing with text manipulation.
+
+62
+00:05:01,000 --> 00:05:09,000
+The indent method is used to add a specified number of leading spaces to each line of a string.
+
+63
+00:05:09,000 --> 00:05:13,000
+It returns a new string with the added indentation.
+
+64
+00:05:14,000 --> 00:05:22,000
+The indent method in Java adjusts the indentation of each line in a string based on the argument passed
+
+65
+00:05:22,000 --> 00:05:23,000
+to it.
+
+66
+00:05:23,000 --> 00:05:28,000
+Let me explain you the behavior of the indent method step by step.
+
+67
+00:05:29,000 --> 00:05:36,000
+The first step, the string is conceptually separated into lines using the lines method, which was
+
+68
+00:05:36,000 --> 00:05:38,000
+introduced in Java 11.
+
+69
+00:05:38,000 --> 00:05:47,000
+The second step, each line is then adjusted based on the integer argument and passed to the mass at
+
+70
+00:05:47,000 --> 00:05:47,000
+indent.
+
+71
+00:05:48,000 --> 00:05:54,000
+If n is more than zero, then n spaces are inserted at the beginning of each line.
+
+72
+00:05:54,000 --> 00:06:02,000
+If n less than zero up to n whitespace characters are removed from the beginning of each line.
+
+73
+00:06:03,000 --> 00:06:10,000
+If a line does not contain sufficient whitespace, then all leading whitespace characters are removed.
+
+74
+00:06:10,000 --> 00:06:18,000
+If n equal to zero, the line remains unchanged, but line terminators are still normalized.
+
+75
+00:06:18,000 --> 00:06:24,000
+The third step, the resulting lines are concatenated and returned as a new string.
+
+76
+00:06:25,000 --> 00:06:32,000
+The method is useful for adjusting the visual indentation of text in a string, making it more readable
+
+77
+00:06:32,000 --> 00:06:36,000
+or conforming to a specific coding style.
+
+78
+00:06:36,000 --> 00:06:37,000
+And here you can see.
+
+79
+00:06:37,000 --> 00:06:38,000
+Example.
+
+80
+00:06:38,000 --> 00:06:46,000
+Hello world has new line character, so string will be separated by line separator and whitespace characters
+
+81
+00:06:46,000 --> 00:06:49,000
+will be added to the beginning of each line.
+
+82
+00:06:50,000 --> 00:06:52,000
+You can see the result in console output.
+
+83
+00:06:53,000 --> 00:06:54,000
+Let's review now.
+
+84
+00:06:54,000 --> 00:06:55,000
+Transform method.
+
+85
+00:06:56,000 --> 00:07:02,000
+The transform method is used to apply function to the string and produce a new string with the transformed
+
+86
+00:07:02,000 --> 00:07:03,000
+characters.
+
+87
+00:07:04,000 --> 00:07:07,000
+Basically, you can pass any function that you wish.
+
+88
+00:07:08,000 --> 00:07:14,000
+For example, I can pass functions that take string and returns amount of characters it contains.
+
+89
+00:07:14,000 --> 00:07:16,000
+Function should return string.
+
+90
+00:07:16,000 --> 00:07:23,000
+That's why I use integer to string here to convert integer object to string object.
+
+91
+00:07:23,000 --> 00:07:29,000
+And as you can see in example, I would just print amount of characters for Hello world string.
+
+92
+00:07:29,000 --> 00:07:32,000
+Or you can pass any existing function.
+
+93
+00:07:33,000 --> 00:07:36,000
+You can do it using method reference syntax to.
+
+94
+00:07:37,000 --> 00:07:44,000
+In the next example is the transform mass that is used in conjunction with a mass at reference string
+
+95
+00:07:44,000 --> 00:07:49,000
+to uppercase to convert each character in string to uppercase.
+
+96
+00:07:50,000 --> 00:07:58,000
+This new string methods in Java 12 provide concise ways to manipulate and format strings, making code
+
+97
+00:07:58,000 --> 00:07:59,000
+more readable.
+
+98
+00:08:00,000 --> 00:08:03,000
+Actually, there is not so many things to add here.
+
+99
+00:08:03,000 --> 00:08:04,000
+Let's continue.
+
+100
+00:08:05,000 --> 00:08:09,000
+The next API updates is in files class.
+
+101
+00:08:09,000 --> 00:08:11,000
+The new method was introduced.
+
+102
+00:08:11,000 --> 00:08:13,000
+It is called mismatch.
+
+103
+00:08:14,000 --> 00:08:15,000
+Let's review it now.
+
+104
+00:08:16,000 --> 00:08:22,000
+This method is designed to find and return the position of the first mismatched byte in the content
+
+105
+00:08:22,000 --> 00:08:27,000
+of two files, or minus one if there is no mismatch.
+
+106
+00:08:28,000 --> 00:08:29,000
+Here is an explanation of the method.
+
+107
+00:08:30,000 --> 00:08:37,000
+The method first checks if the two paths refer to the same file using the is same file method.
+
+108
+00:08:37,000 --> 00:08:44,000
+If they do, the method returns minus one, indicating that there is no mismatch.
+
+109
+00:08:44,000 --> 00:08:51,000
+If the paths do not refer to the same file, the method reads the contents of the file using input stream
+
+110
+00:08:51,000 --> 00:08:54,000
+and compares the bytes using arrays.
+
+111
+00:08:54,000 --> 00:08:55,000
+Mismatch.
+
+112
+00:08:55,000 --> 00:09:00,000
+It uses a buffer to read chunks of bytes from both files.
+
+113
+00:09:00,000 --> 00:09:04,000
+The size of buffer is defined by buffer size.
+
+114
+00:09:04,000 --> 00:09:11,000
+The mass that iterates through the files, comparing chunks of bytes until a mismatch is found, or
+
+115
+00:09:11,000 --> 00:09:14,000
+the end of the file is reached.
+
+116
+00:09:14,000 --> 00:09:17,000
+If a mismatch is found the mass.
+
+117
+00:09:17,000 --> 00:09:20,000
+It returns the position of the first mismatched byte.
+
+118
+00:09:20,000 --> 00:09:26,000
+If no mismatch is found before reaching the end of the files, it returns minus one.
+
+119
+00:09:26,000 --> 00:09:32,000
+The total read variable keeps track of the total number of bytes read from the files.
+
+120
+00:09:33,000 --> 00:09:40,000
+The method is using the input stream to read the files, and it is enclosed in a try with resources
+
+121
+00:09:40,000 --> 00:09:43,000
+statement to ensure that streams are properly closed after use.
+
+122
+00:09:44,000 --> 00:09:50,000
+This method is useful for comparing the content of two files efficiently and finding the position of
+
+123
+00:09:50,000 --> 00:09:52,000
+the first mismatch if there is one.
+
+124
+00:09:53,000 --> 00:09:54,000
+Let's review an example.
+
+125
+00:09:54,000 --> 00:10:01,000
+Now I create two parse objects with text files that exist in my project.
+
+126
+00:10:01,000 --> 00:10:08,000
+The files mismatch method is called with the two file paths, and the result is stored in the mismatch
+
+127
+00:10:08,000 --> 00:10:09,000
+position variable.
+
+128
+00:10:10,000 --> 00:10:18,000
+If mismatch position is minus one, it means that there is no mismatch and the files are identical.
+
+129
+00:10:18,000 --> 00:10:22,000
+Otherwise it prints the position where the files differ.
+
+130
+00:10:22,000 --> 00:10:29,000
+But in our case it will show that files are different starting from the zero index position, which
+
+131
+00:10:29,000 --> 00:10:32,000
+means that they are different from the beginning.
+
+132
+00:10:32,000 --> 00:10:34,000
+And this is true.
+
+133
+00:10:34,000 --> 00:10:37,000
+You can try to play with this method and create your own examples.
+
+134
+00:10:37,000 --> 00:10:41,000
+But in general I believe you understood how this method works.
+
+135
+00:10:42,000 --> 00:10:49,000
+The code is enclosed in a try catch block to handle potential input output exception if there is an
+
+136
+00:10:49,000 --> 00:10:51,000
+error reading the files.
+
+137
+00:10:52,000 --> 00:10:53,000
+Let's learn now.
+
+138
+00:10:53,000 --> 00:10:56,000
+Teen collectors that was introduced in Java 12.
+
+139
+00:10:57,000 --> 00:11:02,000
+The Teen Collector, introduced in Java 12, is a powerful addition to the collector's class.
+
+140
+00:11:03,000 --> 00:11:09,000
+It allows you to create a composite collector that combines the results of two downstream collectors,
+
+141
+00:11:09,000 --> 00:11:13,000
+and then merges those results using a specified function.
+
+142
+00:11:14,000 --> 00:11:20,000
+This is particularly useful for scenarios where you want to perform multiple aggregations on a stream
+
+143
+00:11:20,000 --> 00:11:23,000
+of elements, and combine the results in a single step.
+
+144
+00:11:24,000 --> 00:11:27,000
+Let's understand how the teen collector works.
+
+145
+00:11:27,000 --> 00:11:30,000
+Step number one collector creation.
+
+146
+00:11:30,000 --> 00:11:37,000
+During the collector creation, you provide two downstream collectors, downstream one and downstream
+
+147
+00:11:37,000 --> 00:11:41,000
+two and the merging function so-called merger.
+
+148
+00:11:42,000 --> 00:11:50,000
+The first downstream collector collects elements of type key into a result container of type R1.
+
+149
+00:11:51,000 --> 00:11:54,000
+Key is a type of input elements.
+
+150
+00:11:54,000 --> 00:12:01,000
+The second downstream collector collects the same elements into a result container of type R2.
+
+151
+00:12:02,000 --> 00:12:11,000
+The merge and function merge takes the results of the two collectors, R1 and R2, and combines them
+
+152
+00:12:11,000 --> 00:12:16,000
+into the final result of type R processing elements.
+
+153
+00:12:17,000 --> 00:12:23,000
+Each element passed to the resultant collector is processed by both downstream collectors downstream
+
+154
+00:12:23,000 --> 00:12:25,000
+one and downstream two.
+
+155
+00:12:26,000 --> 00:12:27,000
+Result merging.
+
+156
+00:12:28,000 --> 00:12:35,000
+The result obtained from the two downstream collectors are then merged using the specified merge function.
+
+157
+00:12:35,000 --> 00:12:36,000
+Collector.
+
+158
+00:12:36,000 --> 00:12:37,000
+Characteristics.
+
+159
+00:12:37,000 --> 00:12:43,000
+The resulting collector has characteristics based on the characteristics of the downstream collectors.
+
+160
+00:12:44,000 --> 00:12:50,000
+If both downstream collectors are unordered, the resulting collector is unordered.
+
+161
+00:12:50,000 --> 00:12:55,000
+If both are concurrent, the resulting collector is concurrent.
+
+162
+00:12:55,000 --> 00:12:57,000
+Let's review example now.
+
+163
+00:12:58,000 --> 00:13:00,000
+Imagine that we have a list of integers.
+
+164
+00:13:00,000 --> 00:13:07,000
+We create stream, and then the teen collector is used to find the minimum and maximum values from the
+
+165
+00:13:07,000 --> 00:13:08,000
+list of integers.
+
+166
+00:13:09,000 --> 00:13:15,000
+The first downstream collector collectors mean by finds the minimum value.
+
+167
+00:13:15,000 --> 00:13:22,000
+The second downstream collector collectors max by finds the maximum value.
+
+168
+00:13:22,000 --> 00:13:29,000
+The merge function combines the results into a custom result object containing both the minimum and
+
+169
+00:13:29,000 --> 00:13:31,000
+the maximum values.
+
+170
+00:13:32,000 --> 00:13:35,000
+Min and max variables are of type optional.
+
+171
+00:13:35,000 --> 00:13:43,000
+That's why I use optional API in order to get min and max values here, and then I print min and max
+
+172
+00:13:43,000 --> 00:13:44,000
+value to console.
+
+173
+00:13:45,000 --> 00:13:52,000
+This is a simple example, but it illustrates how the teen collector can be applied to solve real world
+
+174
+00:13:52,000 --> 00:13:58,000
+scenarios where you need to perform multiple aggregations simultaneously and combine the results.
+
+175
+00:13:58,000 --> 00:14:05,000
+I would say that these were major programming language and API updates that you can face with starting
+
+176
+00:14:05,000 --> 00:14:11,000
+using Java 12, but still there are lots more of other improvements and updates.
+
+177
+00:14:11,000 --> 00:14:13,000
+Let's review some of them.
+
+178
+00:14:13,000 --> 00:14:19,000
+We will not go deep in details, and I will try to keep it short in order to have time to review as
+
+179
+00:14:19,000 --> 00:14:21,000
+much as we can.
+
+180
+00:14:21,000 --> 00:14:27,000
+But in case you would have any additional questions, or in case you are interested in any Java update
+
+181
+00:14:27,000 --> 00:14:33,000
+in particular, just tell me in comments below the video and I will elaborate more.
+
+182
+00:14:33,000 --> 00:14:38,000
+And in case there will be a lot of similar requests, I will create a separate lesson.
+
+183
+00:14:39,000 --> 00:14:47,000
+Java 12 introduced a Microbenchmark suite, a set of micro benchmarks to aid in performance testing
+
+184
+00:14:47,000 --> 00:14:50,000
+and analysis of the Java Virtual Machine and libraries.
+
+185
+00:14:51,000 --> 00:14:55,000
+The benchmarks can be run by using the OpenJDK build system.
+
+186
+00:14:55,000 --> 00:15:04,000
+Once you have cloned the OpenJDK source code from the GitHub, you can run benchmarks by using make
+
+187
+00:15:04,000 --> 00:15:05,000
+test command.
+
+188
+00:15:06,000 --> 00:15:07,000
+Default class.
+
+189
+00:15:07,000 --> 00:15:15,000
+Data sharing archives provide improved startup performance by allowing the Gvm to use Pre-compiled classes
+
+190
+00:15:15,000 --> 00:15:17,000
+during initialization.
+
+191
+00:15:18,000 --> 00:15:25,000
+Java 12 includes support of Unicode 11, offering developers access to the latest Unicode character.
+
+192
+00:15:25,000 --> 00:15:27,000
+Standards and features.
+
+193
+00:15:28,000 --> 00:15:36,000
+The Posix spawn option on Linux allows processes to be spawned more efficiently, enhancing performance
+
+194
+00:15:36,000 --> 00:15:38,000
+and resource utilization.
+
+195
+00:15:38,000 --> 00:15:43,000
+Posix stands for Portable Operating System Interface.
+
+196
+00:15:43,000 --> 00:15:49,000
+It is a family of standards that defines the application programming interface for software compatible
+
+197
+00:15:49,000 --> 00:15:52,000
+with Unix like operating systems.
+
+198
+00:15:52,000 --> 00:15:59,000
+The Posix standards aim to ensure compatibility between different Unix like systems, allowing applications
+
+199
+00:15:59,000 --> 00:16:02,000
+to be easily ported across various platforms.
+
+200
+00:16:03,000 --> 00:16:11,000
+The Posix spawn option and Java 12 refers to an enhancement or optimization in the way Java on Linux
+
+201
+00:16:11,000 --> 00:16:13,000
+spawn new processes.
+
+202
+00:16:13,000 --> 00:16:23,000
+GEP 334 introduces the JVM constants API, providing a standard API to represent nominal descriptions
+
+203
+00:16:23,000 --> 00:16:27,000
+of key, class file and runtime artifacts.
+
+204
+00:16:28,000 --> 00:16:36,000
+Java 12 adds support for square characters related to the Japanese New ERA, ensuring accurate representation
+
+205
+00:16:36,000 --> 00:16:37,000
+in applications.
+
+206
+00:16:37,000 --> 00:16:44,000
+In Japan, the calendar system traditionally follows the errors of the reigning emperors.
+
+207
+00:16:44,000 --> 00:16:49,000
+When a new emperor ascends the throne, a new era begins.
+
+208
+00:16:49,000 --> 00:16:57,000
+The Japanese new era names are often represented using square characters, and proper rendering of the
+
+209
+00:16:57,000 --> 00:17:01,000
+square characters is important for accurate display.
+
+210
+00:17:02,000 --> 00:17:08,000
+Unicode provide specific characters for square representation, and Java 12 ensures proper support for
+
+211
+00:17:08,000 --> 00:17:12,000
+z square characters when dealing with Japanese era names.
+
+212
+00:17:13,000 --> 00:17:19,000
+That garbage collector in Java 12 enables the concurrent unloading of classes.
+
+213
+00:17:20,000 --> 00:17:22,000
+Improved memory management efficiency.
+
+214
+00:17:23,000 --> 00:17:30,000
+Java 12 allows the allocation of the old generation of the Java heap on alternate memory devices, offering
+
+215
+00:17:30,000 --> 00:17:33,000
+more flexibility in memory usage.
+
+216
+00:17:34,000 --> 00:17:36,000
+Improve detection in the hotspot.
+
+217
+00:17:36,000 --> 00:17:43,000
+JVM ensures accurate identification of Windows Server 2019 operating systems.
+
+218
+00:17:44,000 --> 00:17:52,000
+The extensive error reports, command line flag and hance's error reporting by providing more detailed
+
+219
+00:17:52,000 --> 00:17:54,000
+information during runtime.
+
+220
+00:17:54,000 --> 00:18:01,000
+The disallow and allow options for the Java Security Manager system property allow fine grained control
+
+221
+00:18:01,000 --> 00:18:03,000
+over security policies.
+
+222
+00:18:04,000 --> 00:18:11,000
+The group name option in the key tool utility allows developers to specify the algorithmic group name
+
+223
+00:18:11,000 --> 00:18:13,000
+when generating key pairs.
+
+224
+00:18:14,000 --> 00:18:21,000
+Java 12 introduces new security events in Java flight Recorder, enhancing the monitoring and analysis
+
+225
+00:18:21,000 --> 00:18:23,000
+of security related events.
+
+226
+00:18:23,000 --> 00:18:28,000
+And we already did an overview of Java flight recorder in previous lessons.
+
+227
+00:18:29,000 --> 00:18:38,000
+Developers can now customize Pkcs 12 Keystore generation in Java 12, providing more control over the
+
+228
+00:18:38,000 --> 00:18:39,000
+key generation process.
+
+229
+00:18:40,000 --> 00:18:50,000
+Java 12 includes chacha20 poorly certain of five TLS cipher suites, offering additional cryptographic
+
+230
+00:18:50,000 --> 00:18:52,000
+algorithms for secure communication.
+
+231
+00:18:53,000 --> 00:19:03,000
+Java 12 supports the DNS Canonicalize host name option in Krb five conf, enabling better integration
+
+232
+00:19:03,000 --> 00:19:05,000
+with DNS based host resolution.
+
+233
+00:19:06,000 --> 00:19:14,000
+The Jdbc tool in Java 12 with print module depth option reports transitive dependencies for a module,
+
+234
+00:19:14,000 --> 00:19:17,000
+helping in modular development.
+
+235
+00:19:18,000 --> 00:19:18,000
+That's all.
+
+236
+00:19:18,000 --> 00:19:23,000
+What I wanted to share with you regarding other improvements and updates in Java 12.
+
+237
+00:19:23,000 --> 00:19:27,000
+Let's now check items that were removed in Java 12.
+
+238
+00:19:27,000 --> 00:19:31,000
+So let me share with you a brief overview of items that were removed.
+
+239
+00:19:32,000 --> 00:19:42,000
+Java 12 removes the com sun Security warning class, indicating a move away from using internal non-standard
+
+240
+00:19:42,000 --> 00:19:45,000
+APIs related to security warnings.
+
+241
+00:19:46,000 --> 00:19:50,000
+AWP stands for Abstract Window Toolkit.
+
+242
+00:19:51,000 --> 00:19:57,000
+The finalized methods in the file input stream and file output stream classes are removed in Java 12.
+
+243
+00:19:57,000 --> 00:20:05,000
+The removal is part of the ongoing efforts to discourage reliance on finalization and promote the use
+
+244
+00:20:05,000 --> 00:20:08,000
+of try with resources for resource management.
+
+245
+00:20:09,000 --> 00:20:14,000
+Java 12 removes the finalized method in classes related to ZIP file handling.
+
+246
+00:20:14,000 --> 00:20:18,000
+Java ATL zip file inflator deflator.
+
+247
+00:20:18,000 --> 00:20:25,000
+This aligns with the deprecation of finalization methods in favor of better resource management practices.
+
+248
+00:20:25,000 --> 00:20:32,000
+Oracle produce builds in Java 12 no longer includes a year month vendor version string.
+
+249
+00:20:32,000 --> 00:20:37,000
+This change simplifies the versioning information in Oracle's Java builds.
+
+250
+00:20:38,000 --> 00:20:43,000
+Java 12 removes the GTE Cybertrust global root certificate.
+
+251
+00:20:44,000 --> 00:20:49,000
+Certificate removals are typically done for security reasons, such as when a certificate is considered
+
+252
+00:20:49,000 --> 00:20:51,000
+weak or vulnerable.
+
+253
+00:20:52,000 --> 00:21:00,000
+Java 12 removes support for specifying source, target, and release values of 6 or 1.6 in the Java
+
+254
+00:21:00,000 --> 00:21:01,000
+compiler.
+
+255
+00:21:01,000 --> 00:21:07,000
+This aligns with the ongoing evolution of the Java language and the encouragement to use more recent
+
+256
+00:21:07,000 --> 00:21:08,000
+language features.
+
+257
+00:21:09,000 --> 00:21:15,000
+These removals are part of the Java platform's continuous evolution, helping to enhance security,
+
+258
+00:21:15,000 --> 00:21:19,000
+deprecate outdated practices, and streamline the code base.
+
+259
+00:21:19,000 --> 00:21:26,000
+Developers are encouraged to stay updated on these changes when migrating or developing new applications,
+
+260
+00:21:27,000 --> 00:21:34,000
+and the only thing that is left for us to review in this lesson is deprecated items and API in Java
+
+261
+00:21:34,000 --> 00:21:35,000
+12.
+
+262
+00:21:35,000 --> 00:21:42,000
+As you know, Java Platform contains a lot of deprecated items and APIs with only one goal to ensure
+
+263
+00:21:42,000 --> 00:21:43,000
+backward compatibility.
+
+264
+00:21:43,000 --> 00:21:50,000
+That's why from version to version, the amount of deprecated items keeps growing, and not all deprecated
+
+265
+00:21:50,000 --> 00:21:52,000
+items have proper substitution.
+
+266
+00:21:53,000 --> 00:21:59,000
+In attachments, you can find the link to the list of all deprecated items in Java 12.
+
+267
+00:21:59,000 --> 00:22:06,000
+The list contains items that were deprecated before Java 12 and in Java 12 inclusively.
+
+268
+00:22:07,000 --> 00:22:13,000
+Like upload context interface that was deprecated in Java nine, but it is also in this list.
+
+269
+00:22:14,000 --> 00:22:22,000
+So this list contains items that become deprecated in Java 12 and before literally the whole list of
+
+270
+00:22:22,000 --> 00:22:23,000
+all Deprecations.
+
+271
+00:22:24,000 --> 00:22:30,000
+Take your time to look through the list and in case you will be interested about some particular deprecation,
+
+272
+00:22:30,000 --> 00:22:35,000
+please do not hesitate to post your question below the video and I will be happy to answer.
+
+273
+00:22:36,000 --> 00:22:37,000
+That's all.
+
+274
+00:22:37,000 --> 00:22:39,000
+What I wanted to discuss with you in this lesson.
+
+275
+00:22:40,000 --> 00:22:43,000
+Let's recap what we have learned in the lesson.
+
+276
+00:22:44,000 --> 00:22:44,000
+Today.
+
+277
+00:22:44,000 --> 00:22:49,000
+During the lesson, we learned everything you need to know about Java 12 release.
+
+278
+00:22:50,000 --> 00:22:52,000
+We learned new features in Java 12.
+
+279
+00:22:52,000 --> 00:22:56,000
+We learned features and API updates on code examples.
+
+280
+00:22:56,000 --> 00:23:00,000
+I showed you features and APIs that were removed in Java 12.
+
+281
+00:23:00,000 --> 00:23:06,000
+Also, we reviewed summary of features and elements that become deprecated in Java 12.
+
+282
+00:23:06,000 --> 00:23:07,000
+That's it.
+
+283
+00:23:07,000 --> 00:23:09,000
+Thanks a lot for your attention.
+
+284
+00:23:09,000 --> 00:23:12,000
+Have a great day and see you in the next lesson.
+
diff --git a/44 - Java New Versions/011 Source-code-example-from-the-lesson.url b/44 - Java New Versions/011 Source-code-example-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..6f11addd861530e2a067b8596e12ae69683a9175
--- /dev/null
+++ b/44 - Java New Versions/011 Source-code-example-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/commit/9fb5e5e937b752760f96934512ede37b41e59671
\ No newline at end of file
diff --git a/44 - Java New Versions/012 Java 13 Socket API, newFileSystem() method, ZGC Uncommit Unused Memory & others_en.srt b/44 - Java New Versions/012 Java 13 Socket API, newFileSystem() method, ZGC Uncommit Unused Memory & others_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..e41e31d4b9e4048d894df13d1ea4f7e8152a8239
--- /dev/null
+++ b/44 - Java New Versions/012 Java 13 Socket API, newFileSystem() method, ZGC Uncommit Unused Memory & others_en.srt
@@ -0,0 +1,932 @@
+1
+00:00:05,000 --> 00:00:06,000
+Hello, Tim.
+
+2
+00:00:06,000 --> 00:00:11,000
+In this lesson we are going to learn all the details about Java 13 release.
+
+3
+00:00:12,000 --> 00:00:18,000
+In today's lesson, we will stick to our regular agenda the same way as for similar topic dedicated
+
+4
+00:00:18,000 --> 00:00:20,000
+to Java release updates.
+
+5
+00:00:20,000 --> 00:00:24,000
+We will learn new language features and APIs added to Java 13.
+
+6
+00:00:25,000 --> 00:00:28,000
+I will explain new JDK tools and features.
+
+7
+00:00:28,000 --> 00:00:35,000
+I will show you the things that were removed from Java Setien and that were marked as deprecated in
+
+8
+00:00:35,000 --> 00:00:36,000
+Java 13.
+
+9
+00:00:36,000 --> 00:00:41,000
+That's in short the detailed agenda you can find on the slide.
+
+10
+00:00:41,000 --> 00:00:44,000
+As you can see, we have really a lot of things to learn.
+
+11
+00:00:45,000 --> 00:00:46,000
+Let's start our lesson.
+
+12
+00:00:47,000 --> 00:00:50,000
+Let me make a brief overview of Java 13.
+
+13
+00:00:51,000 --> 00:00:56,000
+Java Standard Edition 13 was released in September 2019.
+
+14
+00:00:56,000 --> 00:01:02,000
+Java 18 didn't release updates in Java syntax or significant updates of existing APIs.
+
+15
+00:01:02,000 --> 00:01:07,000
+Thus, developers are not impacted significantly with this release.
+
+16
+00:01:07,000 --> 00:01:15,000
+But this doesn't mean that there are no any other updates that improves Java as a platform or optimize
+
+17
+00:01:15,000 --> 00:01:18,000
+existing operations on the background.
+
+18
+00:01:18,000 --> 00:01:26,000
+And based on agenda that you already saw, you may understand that there are a lot of updates and improvements.
+
+19
+00:01:26,000 --> 00:01:32,000
+That's why let me make an overview of the most important and interesting updates based on my opinion.
+
+20
+00:01:32,000 --> 00:01:39,000
+Will not be able to review all improvements as deep and details as possible, but at least we'll try
+
+21
+00:01:39,000 --> 00:01:42,000
+to review details of some updates.
+
+22
+00:01:42,000 --> 00:01:48,000
+In case you will be interested in some specific update, please do not hesitate to post your questions
+
+23
+00:01:48,000 --> 00:01:51,000
+below the video and I will be happy to answer.
+
+24
+00:01:51,000 --> 00:01:56,000
+And in case there will be multiple similar questions, I will create an additional lesson.
+
+25
+00:01:56,000 --> 00:02:01,000
+So let's start review of new features and improvements one by one.
+
+26
+00:02:01,000 --> 00:02:13,000
+Let's start from the review of the Java Enhancement Proposal 353 GEP 353, titled Re-implement the Legacy
+
+27
+00:02:13,000 --> 00:02:16,000
+Socket API, was proposed for Java 13.
+
+28
+00:02:17,000 --> 00:02:25,000
+This Java enhancement proposal aimed to reimplement the underlying socket API to address some long standing
+
+29
+00:02:25,000 --> 00:02:29,000
+issues and improve the maintainability and performance of the existing code.
+
+30
+00:02:30,000 --> 00:02:37,000
+The Legacy Socket API in Java was seen as having accumulated technical debt and design limitations.
+
+31
+00:02:37,000 --> 00:02:45,000
+The goal of GEP 353 was to provide a more modern and sustainable implementations that could better support
+
+32
+00:02:45,000 --> 00:02:48,000
+evolving network and requirements.
+
+33
+00:02:48,000 --> 00:02:52,000
+The key objectives of this GEP include.
+
+34
+00:02:52,000 --> 00:02:59,000
+Maintain compatibility ensures that the new implementation maintains compatibility with existing applications
+
+35
+00:02:59,000 --> 00:03:02,000
+using the Legacy Socket API.
+
+36
+00:03:02,000 --> 00:03:09,000
+Improve maintainability, refactor and re-implement the existing code base to make it more maintainable
+
+37
+00:03:09,000 --> 00:03:10,000
+and modular.
+
+38
+00:03:10,000 --> 00:03:17,000
+Enhance performance, address performance bottlenecks, and improve the efficiency of the socket API
+
+39
+00:03:17,000 --> 00:03:19,000
+for better overall performance.
+
+40
+00:03:20,000 --> 00:03:21,000
+Enable new features.
+
+41
+00:03:22,000 --> 00:03:27,000
+Lays the groundwork for future enhancements and features related to networking in Java.
+
+42
+00:03:27,000 --> 00:03:32,000
+In the Java setting, release the underlying implementation for the Java.
+
+43
+00:03:32,000 --> 00:03:33,000
+Net socket and Java.
+
+44
+00:03:33,000 --> 00:03:36,000
+Net service socket APIs has been replaced.
+
+45
+00:03:37,000 --> 00:03:44,000
+Every effort has been made to ensure compatibility between the old and new implementations.
+
+46
+00:03:44,000 --> 00:03:52,000
+However, it is possible that existing code relies on unspecified behavior, especially in corner cases
+
+47
+00:03:52,000 --> 00:03:57,000
+where the old and new implementations may behave differently.
+
+48
+00:03:57,000 --> 00:04:08,000
+To address this, the JDK includes the old implementation known as plain socket impl or the plain implementation,
+
+49
+00:04:08,000 --> 00:04:11,000
+allowing such code to continue running.
+
+50
+00:04:11,000 --> 00:04:17,000
+You can select the old implementation by running with the system property JDK.
+
+51
+00:04:17,000 --> 00:04:21,000
+Net use plain socket impl set to true.
+
+52
+00:04:21,000 --> 00:04:26,000
+This can be done using the command line option gcc.
+
+53
+00:04:26,000 --> 00:04:29,000
+Net use plain socket impl equal true.
+
+54
+00:04:30,000 --> 00:04:37,000
+Alternatively, the property can be configured in the GCC network configuration file located in Java
+
+55
+00:04:37,000 --> 00:04:39,000
+home conf.
+
+56
+00:04:39,000 --> 00:04:40,000
+Net properties.
+
+57
+00:04:41,000 --> 00:04:48,000
+It is important to note that the old implementation and the system property to select it will be removed
+
+58
+00:04:48,000 --> 00:04:49,000
+in a future release.
+
+59
+00:04:49,000 --> 00:04:57,000
+Therefore, it is recommended to update and test your code to ensure compatibility with new implementation
+
+60
+00:04:57,000 --> 00:04:58,000
+for long terme support.
+
+61
+00:04:59,000 --> 00:05:09,000
+The next thing that I would like to review with you is Java Enhancement Proposal 351 GEP 351, titled
+
+62
+00:05:09,000 --> 00:05:11,000
+Ggc.
+
+63
+00:05:11,000 --> 00:05:16,000
+Uncommit unused memory was targeted for the Java 13 release.
+
+64
+00:05:17,000 --> 00:05:24,000
+This Java enhancement proposal focused on improving the memory management capabilities of the Z Garbage
+
+65
+00:05:24,000 --> 00:05:30,000
+Collector, which is low latency garbage collector introduced in Java 11.
+
+66
+00:05:30,000 --> 00:05:40,000
+The main goal of GEP 351 was to enhance the memory footprint of Ggc by allowing the Java Virtual Machine
+
+67
+00:05:40,000 --> 00:05:44,000
+to uncommit memory that is no longer needed.
+
+68
+00:05:44,000 --> 00:05:52,000
+Uncommitted memory means that the JVM can return memory to the operating system when it determines that
+
+69
+00:05:52,000 --> 00:05:58,000
+certain regions of heap memory are no longer in active use by the application.
+
+70
+00:05:58,000 --> 00:06:02,000
+Key aspects of GEP 351 include.
+
+71
+00:06:03,000 --> 00:06:04,000
+Memory.
+
+72
+00:06:04,000 --> 00:06:11,000
+Uncommit enables a JVM to uncommit release unused memory back to the operating system.
+
+73
+00:06:12,000 --> 00:06:14,000
+Reduced footprint.
+
+74
+00:06:14,000 --> 00:06:22,000
+Improve the overall memory footprint of Java applications using GCC by returning unused memory to the
+
+75
+00:06:22,000 --> 00:06:22,000
+system.
+
+76
+00:06:23,000 --> 00:06:25,000
+Dynamic adaptation.
+
+77
+00:06:25,000 --> 00:06:32,000
+Implement the mechanism for the JVM to dynamically adapt and adjust the amount of committed memory based
+
+78
+00:06:32,000 --> 00:06:35,000
+on the actual memory requirements of the application.
+
+79
+00:06:36,000 --> 00:06:38,000
+Improved resource utilization.
+
+80
+00:06:39,000 --> 00:06:46,000
+Enhance the efficiency of memory usage in GCC, particularly in scenarios where applications experience
+
+81
+00:06:46,000 --> 00:06:48,000
+varying memory demands.
+
+82
+00:06:49,000 --> 00:06:56,000
+The GC in Java was enhanced to improve memory management by returning unused heap memory to the operating
+
+83
+00:06:56,000 --> 00:06:57,000
+system.
+
+84
+00:06:57,000 --> 00:07:03,000
+This improvement is particularly beneficial for applications and environments where a memory footprint
+
+85
+00:07:03,000 --> 00:07:04,000
+is a critical concern.
+
+86
+00:07:05,000 --> 00:07:11,000
+Let's understand key details of this enhancement enabled by default.
+
+87
+00:07:11,000 --> 00:07:17,000
+The feature to return unused heap memory to the operating system is enabled by default in Xjc.
+
+88
+00:07:18,000 --> 00:07:20,000
+Explicit disabling.
+
+89
+00:07:20,000 --> 00:07:26,000
+It can be explicitly disabled using the command line option Z Uncommit.
+
+90
+00:07:27,000 --> 00:07:34,000
+Limitation on shrinking heap memory will not be uncommitted to the extent that the heap size would shrink
+
+91
+00:07:34,000 --> 00:07:39,000
+below the minimum heap size that is set by Zms property.
+
+92
+00:07:39,000 --> 00:07:46,000
+If the minimum heap size is configured to be equal to the maximum heap size, which is Zmax property,
+
+93
+00:07:46,000 --> 00:07:49,000
+this feature will be implicitly disabled.
+
+94
+00:07:50,000 --> 00:07:58,000
+And commit delay configuration and on commit delay can be configured using the option Z and commit delay
+
+95
+00:07:58,000 --> 00:08:00,000
+equal to amount of seconds.
+
+96
+00:08:00,000 --> 00:08:04,000
+The default delay is set to 300 seconds.
+
+97
+00:08:04,000 --> 00:08:11,000
+This delay specifies the duration for which memory should remain unused before it becomes eligible for
+
+98
+00:08:11,000 --> 00:08:12,000
+uncommitted.
+
+99
+00:08:12,000 --> 00:08:19,000
+By providing these configurable options, Java users have the flexibility to adjust the behavior of
+
+100
+00:08:19,000 --> 00:08:22,000
+Xhgc based on their specific requirements.
+
+101
+00:08:23,000 --> 00:08:30,000
+These enhancements aim to make Xhgc more adaptable to different application scenarios, allowing for
+
+102
+00:08:30,000 --> 00:08:33,000
+better control of the memory usage and footprint.
+
+103
+00:08:33,000 --> 00:08:39,000
+It is recommended to refer to the official documentation or release notes for the specific Java version,
+
+104
+00:08:39,000 --> 00:08:43,000
+to get the most accurate and up to date information on these features.
+
+105
+00:08:44,000 --> 00:08:50,000
+The next improvement is related to new methods in File systems class in Java 13.
+
+106
+00:08:50,000 --> 00:08:56,000
+The file systems new file system method was introduced to the File systems class.
+
+107
+00:08:57,000 --> 00:09:03,000
+This method is designed to create a new file system written in a file system object, based on the provided
+
+108
+00:09:03,000 --> 00:09:07,000
+paths and the map of configuration properties.
+
+109
+00:09:08,000 --> 00:09:15,000
+This method makes use of specialized providers that create pseudo file systems, where the contents
+
+110
+00:09:15,000 --> 00:09:19,000
+of one or more files is treated as a file system.
+
+111
+00:09:20,000 --> 00:09:23,000
+For example, when we're dealing with archives.
+
+112
+00:09:24,000 --> 00:09:28,000
+Let me make an overview of the method and its overloaded versions.
+
+113
+00:09:29,000 --> 00:09:32,000
+Pay attention to method signatures that you can see on the screen.
+
+114
+00:09:33,000 --> 00:09:35,000
+Let's review parameters now.
+
+115
+00:09:35,000 --> 00:09:42,000
+Pass a pass object representing the location or reference point for creating the new file system.
+
+116
+00:09:43,000 --> 00:09:44,000
+Env.
+
+117
+00:09:44,000 --> 00:09:47,000
+A map containing configuration properties.
+
+118
+00:09:47,000 --> 00:09:53,000
+This map is used to customize the behavior of the file system creation process.
+
+119
+00:09:53,000 --> 00:10:01,000
+Lord, a class loader that can be used to load additional classes or resources during the file system
+
+120
+00:10:01,000 --> 00:10:02,000
+creation process.
+
+121
+00:10:03,000 --> 00:10:11,000
+Witch hunt type file system is a method returns a file system object representing the new file system
+
+122
+00:10:11,000 --> 00:10:19,000
+exception Ioexception thrown if an input output error occurs during the creation of the file system.
+
+123
+00:10:20,000 --> 00:10:27,000
+This method allows the creation of a new file system based on the specified path and configuration properties.
+
+124
+00:10:27,000 --> 00:10:34,000
+The env parameter provides a way to customize the file system creation process by passing various configuration
+
+125
+00:10:34,000 --> 00:10:36,000
+options as key value pairs.
+
+126
+00:10:37,000 --> 00:10:43,000
+The Classloader parameter provides the ability to specify a class loader that the file system provider
+
+127
+00:10:43,000 --> 00:10:46,000
+can use during the file system creation process.
+
+128
+00:10:47,000 --> 00:10:53,000
+This can be useful in scenarios where additional classes or resources need to be loaded from a specific
+
+129
+00:10:53,000 --> 00:10:55,000
+class loader context.
+
+130
+00:10:56,000 --> 00:10:59,000
+Pay attention to example on the screen with zip archive.
+
+131
+00:11:00,000 --> 00:11:07,000
+In this example, a new file system is created based on a zip file archive zip.
+
+132
+00:11:07,000 --> 00:11:14,000
+The env map is used to specify the create property with the value true, to indicate that a new file
+
+133
+00:11:14,000 --> 00:11:16,000
+system should be created.
+
+134
+00:11:16,000 --> 00:11:23,000
+The exact configuration options that can be provided in the env map may vary depending on the underlying
+
+135
+00:11:23,000 --> 00:11:25,000
+file system provider.
+
+136
+00:11:25,000 --> 00:11:32,000
+For zip file systems, the create property is commonly used to indicate whether a new file system should
+
+137
+00:11:32,000 --> 00:11:33,000
+be created.
+
+138
+00:11:33,000 --> 00:11:39,000
+As always, it is recommended to refer to the official Java documentation for the specific version you
+
+139
+00:11:39,000 --> 00:11:39,000
+are using.
+
+140
+00:11:39,000 --> 00:11:44,000
+To get the most accurate and up to date information about the file systems.
+
+141
+00:11:44,000 --> 00:11:46,000
+New file system mask.
+
+142
+00:11:46,000 --> 00:11:48,000
+Let's continue.
+
+143
+00:11:48,000 --> 00:11:56,000
+In Java 13, the soft max heap size flag was introduced as a manageable command line option.
+
+144
+00:11:56,000 --> 00:12:03,000
+This flag specifically interacts with the Z garbage collector, and aims to control the growth of the
+
+145
+00:12:03,000 --> 00:12:08,000
+heap in situations where resource usage is a concern.
+
+146
+00:12:08,000 --> 00:12:11,000
+Let's review key details about this flag.
+
+147
+00:12:12,000 --> 00:12:20,000
+The soft max heap size flag is used to set a soft limit on the heap size that the Z garbage collector
+
+148
+00:12:20,000 --> 00:12:21,000
+can reach.
+
+149
+00:12:21,000 --> 00:12:30,000
+This flag only has an effect when the Z garbage collector is enabled using the use Xjc option.
+
+150
+00:12:30,000 --> 00:12:38,000
+When set, the garbage collector will strive not to grow the heap beyond the specified size unless it's
+
+151
+00:12:38,000 --> 00:12:42,000
+necessary to do so to prevent an out-of-memory error.
+
+152
+00:12:42,000 --> 00:12:51,000
+The soft max heap size can't be set to a value greater than the maximum heap size, which is set by
+
+153
+00:12:51,000 --> 00:12:52,000
+Zmax property.
+
+154
+00:12:53,000 --> 00:13:01,000
+If not set on the command line, it defaults to a value equal to the maximum heap size being manageable.
+
+155
+00:13:01,000 --> 00:13:04,000
+Its value can be adjusted at runtime.
+
+156
+00:13:04,000 --> 00:13:14,000
+This can be done using GCmG with the command VM, set flag, soft max heap size or through the hotspot,
+
+157
+00:13:14,000 --> 00:13:22,000
+and Max bin GCmG is a command line utility provided by Java Virtual Machine that allows you to interact
+
+158
+00:13:22,000 --> 00:13:24,000
+with the running Java process.
+
+159
+00:13:24,000 --> 00:13:30,000
+It is part of the Java Management Extensions technology, and is particularly useful for performing
+
+160
+00:13:30,000 --> 00:13:35,000
+various diagnostic and management tasks on a Java application.
+
+161
+00:13:36,000 --> 00:13:43,000
+Let's talk about use cases and understand when soft max heap size flag may be useful.
+
+162
+00:13:43,000 --> 00:13:50,000
+This flag can be useful in situations where resource usage is a concern, and you want to control the
+
+163
+00:13:50,000 --> 00:13:56,000
+heap footprint, while retaining the capability to handle temporary increases in heap space requirements.
+
+164
+00:13:57,000 --> 00:14:05,000
+In environments using a concurrent garbage collector like GC, setting a soft max heap size can be beneficial
+
+165
+00:14:05,000 --> 00:14:11,000
+to maintain a smaller heap, encouraging the garbage collector to collect garbage more aggressively.
+
+166
+00:14:12,000 --> 00:14:17,000
+This makes the application more resilient to sudden increases in the allocation rate.
+
+167
+00:14:18,000 --> 00:14:24,000
+As you already know, there are still much more updates and improvements in Java 16 release.
+
+168
+00:14:25,000 --> 00:14:31,000
+On the slides, you can see other improvements and updates that were released in Java 16 version.
+
+169
+00:14:32,000 --> 00:14:38,000
+As I mentioned, unfortunately, we will not have time to review in details each update, and probably
+
+170
+00:14:38,000 --> 00:14:42,000
+it doesn't have a lot of sense on this stage of education.
+
+171
+00:14:43,000 --> 00:14:45,000
+Feel free to pause the video to explore the slide.
+
+172
+00:14:46,000 --> 00:14:52,000
+Also, feel free to ask questions below the video in case you are interested about some specific update,
+
+173
+00:14:52,000 --> 00:14:55,000
+and I will be happy to elaborate more.
+
+174
+00:14:56,000 --> 00:15:03,000
+Let's briefly review removed items from Java 13, in case you would be interested about history of any
+
+175
+00:15:03,000 --> 00:15:10,000
+specific feature or option, please let me know in comments below the video and I will be happy to answer.
+
+176
+00:15:11,000 --> 00:15:14,000
+Removal of toolkit system property.
+
+177
+00:15:15,000 --> 00:15:23,000
+The toolkit system property, which was used to specify the toolkit implementation, has been removed.
+
+178
+00:15:24,000 --> 00:15:27,000
+Removal of runtime trace methods.
+
+179
+00:15:27,000 --> 00:15:30,000
+Certain runtime trace methods have been removed.
+
+180
+00:15:30,000 --> 00:15:34,000
+These methods were related to tracing and monitoring capabilities.
+
+181
+00:15:35,000 --> 00:15:40,000
+Project 1.4 socket impl implementations no longer supported.
+
+182
+00:15:41,000 --> 00:15:43,000
+Removal of VM option.
+
+183
+00:15:43,000 --> 00:15:44,000
+Aggressive ops.
+
+184
+00:15:45,000 --> 00:15:48,000
+The VM option Aggressive Ops has been removed.
+
+185
+00:15:48,000 --> 00:15:54,000
+This option was related to enabling various aggressive performance optimizations.
+
+186
+00:15:54,000 --> 00:16:00,000
+While the specific details of the optimizations enabled by this option were not always clearly documented,
+
+187
+00:16:00,000 --> 00:16:07,000
+it typically included a set of aggressive settings aimed at improving the runtime performance of the
+
+188
+00:16:07,000 --> 00:16:08,000
+Java virtual machine.
+
+189
+00:16:09,000 --> 00:16:16,000
+Some of the aggressive optimizations that were commonly associated with aggressive ops include inlining,
+
+190
+00:16:16,000 --> 00:16:26,000
+loop unrolling, dead code elimination, code hoisting, scalar replacement, loop fusion, duplicated
+
+191
+00:16:26,000 --> 00:16:35,000
+RCA services no longer supported by sun gas provider, removal of T-Systems, Deutsche Telekom root
+
+192
+00:16:35,000 --> 00:16:37,000
+CA to certificate.
+
+193
+00:16:38,000 --> 00:16:41,000
+Removal of two DocuSign root CA certificates.
+
+194
+00:16:41,000 --> 00:16:45,000
+Removal of two Comodo Root CA certificates.
+
+195
+00:16:45,000 --> 00:16:57,000
+Removal of the internal Com sun net SSL package only used for compatibility with legacy GHC 1.0 applications.
+
+196
+00:16:57,000 --> 00:17:05,000
+Removal of experimental Fips 140 compliant mode from sun GHC provider.
+
+197
+00:17:06,000 --> 00:17:09,000
+Removal of old features from Javadoc tool.
+
+198
+00:17:10,000 --> 00:17:13,000
+Certain old features have been removed from the Javadoc tool.
+
+199
+00:17:13,000 --> 00:17:20,000
+This could include deprecated or outdated functionalities like for example, deprecated tags, deprecated
+
+200
+00:17:20,000 --> 00:17:24,000
+options, deprecated HTML or formatting features, and others.
+
+201
+00:17:25,000 --> 00:17:29,000
+Let's now review things that become deprecated in Java 13.
+
+202
+00:17:30,000 --> 00:17:34,000
+Deprecated and unsupported swing motif look and feel on macOS.
+
+203
+00:17:35,000 --> 00:17:41,000
+The swing motif look and feel on macOS has been deprecated and is no longer supported.
+
+204
+00:17:41,000 --> 00:17:46,000
+Developers are encouraged to use the Aqua Look and Feel on macOS.
+
+205
+00:17:46,000 --> 00:17:50,000
+Deprecated are make tool for removal.
+
+206
+00:17:50,000 --> 00:17:56,000
+The are make tool, which is used for generating stop and skeleton files for remote objects, has been
+
+207
+00:17:56,000 --> 00:17:57,000
+deprecated.
+
+208
+00:17:57,000 --> 00:18:00,000
+It is marked for removal in future releases.
+
+209
+00:18:01,000 --> 00:18:02,000
+Deprecated Java options.
+
+210
+00:18:02,000 --> 00:18:03,000
+Verify.
+
+211
+00:18:03,000 --> 00:18:04,000
+None and no.
+
+212
+00:18:04,000 --> 00:18:05,000
+Verify.
+
+213
+00:18:06,000 --> 00:18:06,000
+The general options.
+
+214
+00:18:06,000 --> 00:18:07,000
+Verify.
+
+215
+00:18:07,000 --> 00:18:10,000
+None and no verify have been deprecated.
+
+216
+00:18:10,000 --> 00:18:14,000
+These options were related to class file verification.
+
+217
+00:18:15,000 --> 00:18:22,000
+The verify none and no verify Java options were related to class file verification, specifically controlling
+
+218
+00:18:22,000 --> 00:18:27,000
+the verification process performed by the Java Virtual Machine when loading classes.
+
+219
+00:18:27,000 --> 00:18:34,000
+Class file verification is a process where the JVM checks the integrity and safety of the bytecode before
+
+220
+00:18:34,000 --> 00:18:40,000
+executing it, to ensure that it adheres the Java language specifications.
+
+221
+00:18:40,000 --> 00:18:45,000
+Deprecated Java Security cert APIs used for removal.
+
+222
+00:18:45,000 --> 00:18:45,000
+True.
+
+223
+00:18:46,000 --> 00:18:52,000
+This indicates that these APIs are targeted for removal in future releases.
+
+224
+00:18:52,000 --> 00:18:57,000
+Developers are advised to use Java Security CERT package instead.
+
+225
+00:18:57,000 --> 00:19:00,000
+That's all what I wanted to review with you in this lesson.
+
+226
+00:19:00,000 --> 00:19:04,000
+Let's recap what we have learned from the lesson today.
+
+227
+00:19:04,000 --> 00:19:08,000
+During the lesson, we learned everything you need to know about Java 13.
+
+228
+00:19:09,000 --> 00:19:11,000
+We learned new features in Java 13.
+
+229
+00:19:11,000 --> 00:19:15,000
+I showed you features and APIs that were removed in Java 13.
+
+230
+00:19:16,000 --> 00:19:21,000
+Also, we reviewed summary of features and elements that become deprecated in Java 13.
+
+231
+00:19:22,000 --> 00:19:23,000
+That's it.
+
+232
+00:19:23,000 --> 00:19:24,000
+Thanks a lot for your attention.
+
+233
+00:19:24,000 --> 00:19:27,000
+Have a great day and see you in the next lesson.
+
diff --git a/44 - Java New Versions/013 Java 14 Switch expressions, Currency Format, Helpful NullPointerExceptions_en.srt b/44 - Java New Versions/013 Java 14 Switch expressions, Currency Format, Helpful NullPointerExceptions_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..4ce90e8b60c4fe0fa609472a8446bb51c8ff0b89
--- /dev/null
+++ b/44 - Java New Versions/013 Java 14 Switch expressions, Currency Format, Helpful NullPointerExceptions_en.srt
@@ -0,0 +1,904 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello, Tim.
+
+2
+00:00:06,000 --> 00:00:09,000
+In this lesson we'll talk about Java 14.
+
+3
+00:00:10,000 --> 00:00:16,000
+Continuing series of lessons about new Java versions will stick to our regular agenda.
+
+4
+00:00:16,000 --> 00:00:21,000
+Namely, we'll learn new language features and APIs added to Java 14.
+
+5
+00:00:21,000 --> 00:00:25,000
+First I will explain new JDK tools and features.
+
+6
+00:00:25,000 --> 00:00:32,000
+Then I will show you the things that were removed from Java 14 and that were marked as deprecated in
+
+7
+00:00:32,000 --> 00:00:33,000
+this version.
+
+8
+00:00:33,000 --> 00:00:38,000
+After this lesson, you will know everything you need to know about Java 14.
+
+9
+00:00:38,000 --> 00:00:43,000
+The detailed agenda of the lesson you can see on the slides.
+
+10
+00:00:44,000 --> 00:00:45,000
+Let's start our lesson.
+
+11
+00:00:46,000 --> 00:00:54,000
+Unfortunately or fortunately, Java 14 release doesn't introduce a lot of changes in the syntax and
+
+12
+00:00:54,000 --> 00:00:58,000
+Java APIs that will impact developers during the development.
+
+13
+00:00:58,000 --> 00:01:06,000
+Similar to the previous release, most of changes are happened on the background to optimize background
+
+14
+00:01:06,000 --> 00:01:12,000
+operations, and thus they don't impact APIs that we usually use during the development.
+
+15
+00:01:12,000 --> 00:01:19,000
+But still, there are few features that I would like to show you on demo on code examples.
+
+16
+00:01:19,000 --> 00:01:23,000
+So let me start screen sharing and explain user features.
+
+17
+00:01:23,000 --> 00:01:29,000
+As always, you can find source code with examples from the lesson in attachments to the video.
+
+18
+00:01:29,000 --> 00:01:34,000
+I am going to start the demo from the review of the features that was introduced as a result of Java
+
+19
+00:01:34,000 --> 00:01:40,000
+Enhancement Proposal 361, titled Switch Expressions.
+
+20
+00:01:40,000 --> 00:01:44,000
+This feature was in preview in Java 12.
+
+21
+00:01:44,000 --> 00:01:48,000
+Java 13 and finally in Java 14.
+
+22
+00:01:48,000 --> 00:01:50,000
+It was officially included to GCC.
+
+23
+00:01:50,000 --> 00:01:51,000
+Distribution.
+
+24
+00:01:51,000 --> 00:01:57,000
+The primary goal of this Java enhancement proposal was to enhance the traditional switch statement,
+
+25
+00:01:57,000 --> 00:02:01,000
+making it more expressive and less error prone.
+
+26
+00:02:02,000 --> 00:02:06,000
+Let's review the key points about switch expressions in Java 14.
+
+27
+00:02:06,000 --> 00:02:08,000
+Arrow syntax.
+
+28
+00:02:08,000 --> 00:02:13,000
+Switch expressions use a new arrow syntax instead of the traditional colon.
+
+29
+00:02:13,000 --> 00:02:18,000
+This makes the syntax more consistent with lambda expressions.
+
+30
+00:02:18,000 --> 00:02:20,000
+Multiple labels.
+
+31
+00:02:20,000 --> 00:02:29,000
+Switch expressions allow grouping multiple labels together, reducing redundancy in code like you can
+
+32
+00:02:29,000 --> 00:02:30,000
+see in this example.
+
+33
+00:02:30,000 --> 00:02:39,000
+When I need to map days of the week with the status of weekday or weekend expression value.
+
+34
+00:02:39,000 --> 00:02:46,000
+Switch expressions return a value, making them more suitable for assignments and method calls like
+
+35
+00:02:46,000 --> 00:02:48,000
+in this example.
+
+36
+00:02:48,000 --> 00:02:56,000
+Pay attention that since Java 14, I can assign the result of switch expression to the variable day
+
+37
+00:02:56,000 --> 00:02:57,000
+name.
+
+38
+00:02:57,000 --> 00:03:05,000
+This is very helpful and provides better experience when you need to return some value from switch statement.
+
+39
+00:03:06,000 --> 00:03:12,000
+These enhancements simplifies the syntax and makes switch statements more versatile and expressive.
+
+40
+00:03:12,000 --> 00:03:19,000
+In Java programming, they offer a more concise and readable way to handle multiple conditions based
+
+41
+00:03:19,000 --> 00:03:20,000
+on a single value.
+
+42
+00:03:21,000 --> 00:03:27,000
+Let's review now Java Enhancement Proposals 358 titled Helpful null Pointer Exceptions.
+
+43
+00:03:28,000 --> 00:03:35,000
+It is a Java enhancement proposal that aims to improve the debugging experience by providing more detailed
+
+44
+00:03:35,000 --> 00:03:38,000
+information when a null pointer exception occurs.
+
+45
+00:03:38,000 --> 00:03:46,000
+This enhancement was targeted for Java 14 prior to Java Enhancement Proposal 358.
+
+46
+00:03:46,000 --> 00:03:53,000
+When a null pointer exception was thrown, the error message only indicated that a null reference was
+
+47
+00:03:53,000 --> 00:03:54,000
+found.
+
+48
+00:03:54,000 --> 00:04:01,000
+This information was often not sufficient for developers to quickly identify the root cause of the issue.
+
+49
+00:04:01,000 --> 00:04:10,000
+Jep 358 addressed this by enhancing the error messages associated with null pointer exceptions, so
+
+50
+00:04:10,000 --> 00:04:16,000
+key points of this Jep are more descriptive error messages.
+
+51
+00:04:16,000 --> 00:04:23,000
+When a null pointer exception is thrown, the error message now includes more details about which variable
+
+52
+00:04:23,000 --> 00:04:24,000
+was null.
+
+53
+00:04:24,000 --> 00:04:31,000
+It provides information about the name of the variable or field that was accessed and caused the exception.
+
+54
+00:04:32,000 --> 00:04:35,000
+Let's review examples of more informative error message.
+
+55
+00:04:35,000 --> 00:04:41,000
+I created a variable of type string and initialized it with null value.
+
+56
+00:04:41,000 --> 00:04:45,000
+And then I tried to call method on this reference.
+
+57
+00:04:45,000 --> 00:04:51,000
+Of course I would catch null pointer exception, but pay attention to the error message here instead
+
+58
+00:04:51,000 --> 00:04:56,000
+of just telling that the reason no point exception in some specific line.
+
+59
+00:04:56,000 --> 00:05:03,000
+Error message also contains the details about which method invocation caused null pointer exception
+
+60
+00:05:03,000 --> 00:05:12,000
+in this particular case, and we can see that Colin Lang's method of string type can't be invoked because
+
+61
+00:05:12,000 --> 00:05:15,000
+now string variable is now.
+
+62
+00:05:15,000 --> 00:05:20,000
+Another improvement is enhanced root cause information.
+
+63
+00:05:20,000 --> 00:05:27,000
+The enhanced error message aimed to include information about the entire chain of mass of field accesses
+
+64
+00:05:27,000 --> 00:05:30,000
+that led to null pointer exception.
+
+65
+00:05:30,000 --> 00:05:35,000
+This helps trace the origin of the null value more easily.
+
+66
+00:05:36,000 --> 00:05:39,000
+To demonstrate this, let's consider another example.
+
+67
+00:05:39,000 --> 00:05:45,000
+Imagine that I have a list of strings or any other objects that contains null property.
+
+68
+00:05:45,000 --> 00:05:52,000
+The main thing in this example that I can have chain of methods, invocation and Java will help me to
+
+69
+00:05:52,000 --> 00:05:56,000
+identify which exact part of invocation chain returned me.
+
+70
+00:05:56,000 --> 00:06:04,000
+Now in this example I intentionally added null string to the list, and then I get the first element
+
+71
+00:06:04,000 --> 00:06:08,000
+from the list and try to call length method on the retrieved object.
+
+72
+00:06:08,000 --> 00:06:12,000
+Let's take a look how error message will look like in this case.
+
+73
+00:06:12,000 --> 00:06:18,000
+In this case I will see in console which particular method invocation returned the null.
+
+74
+00:06:19,000 --> 00:06:27,000
+Here you can see that get method returned now, which caused null pointer exception when invoking length
+
+75
+00:06:27,000 --> 00:06:27,000
+method.
+
+76
+00:06:28,000 --> 00:06:34,000
+This improvements were designed to simplify the debugging process, making it easier for developers
+
+77
+00:06:34,000 --> 00:06:41,000
+to identify the specific null reference that caused the exception by providing more context in the error
+
+78
+00:06:41,000 --> 00:06:42,000
+messages.
+
+79
+00:06:42,000 --> 00:06:50,000
+Jep 358 aimed to enhance the overall developer experience when dealing with null pointer exceptions.
+
+80
+00:06:51,000 --> 00:06:56,000
+The next improvement that I wanted to demo you is accounting currency format support.
+
+81
+00:06:57,000 --> 00:07:02,000
+Java 14 introduced improved support for accounting currency formatting.
+
+82
+00:07:02,000 --> 00:07:09,000
+This enhancement aimed to provide more accurate and flexible formatting of monetary values according
+
+83
+00:07:09,000 --> 00:07:11,000
+to accounting standards.
+
+84
+00:07:12,000 --> 00:07:16,000
+In this example, I create object of United States locale.
+
+85
+00:07:16,000 --> 00:07:23,000
+I create instance of a currency type using factory method get instance of currency type.
+
+86
+00:07:23,000 --> 00:07:28,000
+Now I can create number format for United States locale.
+
+87
+00:07:28,000 --> 00:07:31,000
+Why locale is needed here.
+
+88
+00:07:31,000 --> 00:07:38,000
+Just to remind you that in different locales, there are different rules about which separators to use
+
+89
+00:07:38,000 --> 00:07:46,000
+to separate digits within a number and its fractional part, whether it's comma or point.
+
+90
+00:07:46,000 --> 00:07:54,000
+Then I set the currency to the number format object and configure maximum of fractional digits.
+
+91
+00:07:54,000 --> 00:07:58,000
+And now I am ready to format string and print it to console.
+
+92
+00:07:58,000 --> 00:08:05,000
+Pay attention how million, thousands and fractional part are divided with commas and dot.
+
+93
+00:08:06,000 --> 00:08:10,000
+This approach may vary depending on the local use set.
+
+94
+00:08:11,000 --> 00:08:17,000
+Let's continue and review other improvements that were introduced as a part of Java 14 release.
+
+95
+00:08:18,000 --> 00:08:23,000
+Let me make a brief overview of other improvements introduced in Java 14.
+
+96
+00:08:23,000 --> 00:08:29,000
+In case you will be interested in some specific improvement, please do not hesitate to ask your question
+
+97
+00:08:29,000 --> 00:08:31,000
+below the video and I will be happy to answer.
+
+98
+00:08:32,000 --> 00:08:39,000
+Clarify the specification of readable by channel, read method and related methods.
+
+99
+00:08:39,000 --> 00:08:45,000
+This improvement focused on clarifying the specification of the readable by channel read method and
+
+100
+00:08:45,000 --> 00:08:46,000
+related methods.
+
+101
+00:08:46,000 --> 00:08:53,000
+The goal was to ensure a better consistency and understanding of the behavior of these methods.
+
+102
+00:08:53,000 --> 00:08:58,000
+Jep 365 Xhgc on windows.
+
+103
+00:08:58,000 --> 00:09:07,000
+Jep 365 extended the support of the Z Garbage Collector to the windows operating system.
+
+104
+00:09:07,000 --> 00:09:15,000
+Xhgc is a low latency garbage collector designed to keep post times low and predictable, making it
+
+105
+00:09:15,000 --> 00:09:17,000
+suitable for large heaps.
+
+106
+00:09:17,000 --> 00:09:22,000
+Jep 364 Xhgc on macOS.
+
+107
+00:09:23,000 --> 00:09:34,000
+Similar to Jep 365, Jep 364 extended Xhgc support, but specifically for the macOS operating system.
+
+108
+00:09:34,000 --> 00:09:41,000
+This allowed developers on macOS to take advantage of Xhgc low latency garbage collection.
+
+109
+00:09:42,000 --> 00:09:44,000
+Parallel garbage collector improvements.
+
+110
+00:09:45,000 --> 00:09:52,000
+Java 14 included enhancements to the parallel garbage collector to improve its performance and scalability.
+
+111
+00:09:52,000 --> 00:09:58,000
+These improvements aimed to make parallel garbage collection more efficient and responsive.
+
+112
+00:09:59,000 --> 00:10:04,000
+Jep 345 Numa aware memory allocation for G1.
+
+113
+00:10:05,000 --> 00:10:08,000
+This Jep focused on enhancing the garbage.
+
+114
+00:10:08,000 --> 00:10:15,000
+First garbage collector to be aware of non-uniform memory access architecture.
+
+115
+00:10:15,000 --> 00:10:23,000
+It aimed to improve memory allocation strategies on Numa systems for better performance and few words
+
+116
+00:10:23,000 --> 00:10:25,000
+about Numa architecture.
+
+117
+00:10:26,000 --> 00:10:33,000
+Non-uniform Memory Access is a computer architecture design used in multiprocessor systems, where the
+
+118
+00:10:33,000 --> 00:10:39,000
+memory access time depends on the memory location relative to the processor.
+
+119
+00:10:39,000 --> 00:10:47,000
+In a Numa system, processors are grouped together with their own local memory, and these groups are
+
+120
+00:10:47,000 --> 00:10:48,000
+interconnected.
+
+121
+00:10:48,000 --> 00:10:56,000
+Each processor can access its local memory more quickly than it can access the memory associated with
+
+122
+00:10:56,000 --> 00:10:58,000
+other processors in the system.
+
+123
+00:10:59,000 --> 00:11:03,000
+Jep 349 GFR Event Streaming.
+
+124
+00:11:04,000 --> 00:11:12,000
+Jep 349 introduced the Java Flight Recorder Event Streaming, allowing continuous monitoring and analysis
+
+125
+00:11:12,000 --> 00:11:14,000
+of Java applications.
+
+126
+00:11:14,000 --> 00:11:20,000
+This improvement enabled more flexible and real time access to GFR data.
+
+127
+00:11:21,000 --> 00:11:28,000
+Weak named curves in TLS cert pass and signed jar disabled by default.
+
+128
+00:11:28,000 --> 00:11:36,000
+This security related improvement disabled the use of weak named elliptic curve cryptography algorithms
+
+129
+00:11:36,000 --> 00:11:38,000
+in TLS.
+
+130
+00:11:38,000 --> 00:11:42,000
+CERT pass and signed Jar files by default.
+
+131
+00:11:42,000 --> 00:11:48,000
+It aimed to make security practices more reliable and strong.
+
+132
+00:11:48,000 --> 00:11:51,000
+Weak named curves refer to.
+
+133
+00:11:51,000 --> 00:11:58,000
+Elliptic curve cryptography, curves that are considered to have vulnerabilities or insufficient security
+
+134
+00:11:58,000 --> 00:12:03,000
+strengths, making them sensitive to certain types of attacks.
+
+135
+00:12:03,000 --> 00:12:11,000
+In the context of cryptographic algorithms, the terms weak indicates that these curves may not provide
+
+136
+00:12:11,000 --> 00:12:16,000
+an adequate level of security against modern cryptographic attacks.
+
+137
+00:12:16,000 --> 00:12:22,000
+Apache Santuario library updated to version 2.1.4.
+
+138
+00:12:23,000 --> 00:12:29,000
+Java 14 updated the Apache Santa Aria XML Security Library to version 2.1.4.
+
+139
+00:12:29,000 --> 00:12:36,000
+This update included bug fixes, improvements, and potentially new features related to XML security.
+
+140
+00:12:37,000 --> 00:12:41,000
+Allow discoverable Java plugins to be invoked by default.
+
+141
+00:12:42,000 --> 00:12:50,000
+This Jep allowed discoverable Java compiler plugins to be invoked by default, simplifying the plugin
+
+142
+00:12:50,000 --> 00:12:52,000
+activation process for developers.
+
+143
+00:12:53,000 --> 00:12:59,000
+New message to Sox content handler for handling XML declaration.
+
+144
+00:12:59,000 --> 00:13:04,000
+Java 14 introduced a new method to the simple API for XML.
+
+145
+00:13:04,000 --> 00:13:10,000
+Sox content handler interface for handling XML declarations.
+
+146
+00:13:11,000 --> 00:13:17,000
+This provided a standardized way to deal with XML declaration events during parsing.
+
+147
+00:13:17,000 --> 00:13:23,000
+But as you know, there is much more improvements were released in Java 14.
+
+148
+00:13:23,000 --> 00:13:26,000
+You can find list of other improvements on the screen.
+
+149
+00:13:26,000 --> 00:13:33,000
+I decided to not make the detailed overview of each of these, because we will not have enough time
+
+150
+00:13:33,000 --> 00:13:39,000
+in the lesson to cover all of them, and there is not a lot of business value in spending time for learning
+
+151
+00:13:39,000 --> 00:13:47,000
+this, because these things are related to improvements that happen outside of your control, and you
+
+152
+00:13:47,000 --> 00:13:49,000
+can't influence them in any way.
+
+153
+00:13:49,000 --> 00:13:54,000
+Feel free to press the video on pause to be able to read through the slides.
+
+154
+00:13:54,000 --> 00:14:02,000
+Once you are done, you can resume the video and let me remind you that in case you have questions regarding
+
+155
+00:14:02,000 --> 00:14:09,000
+any of the listed improvements, please pose the question below the video and I will elaborate more.
+
+156
+00:14:09,000 --> 00:14:14,000
+As always, there are some removed features and options in new JDK.
+
+157
+00:14:14,000 --> 00:14:19,000
+This is not happening without prior deprecation of feature or options.
+
+158
+00:14:19,000 --> 00:14:26,000
+Thus, it shouldn't come as a surprise for developers because they were warned in previous versions.
+
+159
+00:14:26,000 --> 00:14:31,000
+So let's review the summary of all things that were removed in Java 14.
+
+160
+00:14:32,000 --> 00:14:36,000
+The Sun Neo CSS map system property was removed.
+
+161
+00:14:36,000 --> 00:14:43,000
+This property was used to specify a character set mapping file, and its removal reflects a move away
+
+162
+00:14:43,000 --> 00:14:47,000
+from relying on internal and undocumented properties.
+
+163
+00:14:48,000 --> 00:14:53,000
+The Netscape JavaScript JS object get window method was removed.
+
+164
+00:14:53,000 --> 00:15:00,000
+This method was part of the Java plugin, which has been deprecated and removed from modern browsers.
+
+165
+00:15:00,000 --> 00:15:07,000
+Java Plugin is a technology that allowed Java applets to interact with JavaScript in web browsers.
+
+166
+00:15:07,000 --> 00:15:14,000
+The removal is in line with the deprecation and eventual removal of the Java plugin from web browsers.
+
+167
+00:15:15,000 --> 00:15:23,000
+Jep 363 was introduced to remove the concurrent mark and sweep garbage collector.
+
+168
+00:15:24,000 --> 00:15:32,000
+CMS was deprecated in JDK nine, and its removal in JDK 14 aimed to simplify the garbage collection
+
+169
+00:15:32,000 --> 00:15:40,000
+landscape and encourage users to migrate to more modern garbage collectors like G1 or Z GC.
+
+170
+00:15:41,000 --> 00:15:45,000
+Deprecated Java security ACL APIs were removed.
+
+171
+00:15:46,000 --> 00:15:53,000
+These APIs were part of the access control list functionality, and their removal suggests a shift towards
+
+172
+00:15:53,000 --> 00:15:56,000
+more modern security mechanisms.
+
+173
+00:15:56,000 --> 00:16:03,000
+The removal of the default key to calc value was introduced to improve security practices.
+
+174
+00:16:04,000 --> 00:16:11,000
+Previously, key tool command used the RSA algorithm by default, but this was removed to encourage
+
+175
+00:16:11,000 --> 00:16:17,000
+users to explicitly specify the key algorithm promoting awareness of security choices.
+
+176
+00:16:18,000 --> 00:16:29,000
+GEP 367 aimed to remove the pack 200 tools, and API pack 200 was a tool used for Jar file compression,
+
+177
+00:16:29,000 --> 00:16:34,000
+and its removal indicates a move away from this compression format.
+
+178
+00:16:34,000 --> 00:16:40,000
+The removal is a part of the ongoing efforts to simplify and streamline the JDK.
+
+179
+00:16:41,000 --> 00:16:48,000
+This removals are often driven by factors such as deprecation, security concerns, or the introduction
+
+180
+00:16:48,000 --> 00:16:49,000
+of more modern alternatives.
+
+181
+00:16:50,000 --> 00:16:55,000
+It's important for developers to be aware of such changes when upgrading to a new version.
+
+182
+00:16:55,000 --> 00:17:00,000
+And of course, there are items that were deprecated in this version.
+
+183
+00:17:00,000 --> 00:17:01,000
+Let's review them.
+
+184
+00:17:02,000 --> 00:17:08,000
+The thread suspend method and the thread resume method were deprecated for removal.
+
+185
+00:17:08,000 --> 00:17:16,000
+These methods were used to suspend and resume the execution of a thread, but they were inherently unsafe
+
+186
+00:17:16,000 --> 00:17:21,000
+and could lead to deadlock scenarios due to their problematic nature.
+
+187
+00:17:21,000 --> 00:17:27,000
+They were marked for removal in future releases, and as windows Style mask.
+
+188
+00:17:27,000 --> 00:17:34,000
+Texture background is a constant representing a style mask from Mac OS window, it was deprecated,
+
+189
+00:17:34,000 --> 00:17:38,000
+indicating that it is no longer recommended for use.
+
+190
+00:17:38,000 --> 00:17:45,000
+Developers were encouraged to use alternative styles or approaches in their Mac OS applications.
+
+191
+00:17:45,000 --> 00:17:56,000
+Jep 366 aimed to deprecate the combination of the parallel scavenge young collector with the serial
+
+192
+00:17:56,000 --> 00:17:58,000
+old old collector.
+
+193
+00:17:58,000 --> 00:18:05,000
+This combination was deprecated due its limited use and the availability of more efficient garbage collection
+
+194
+00:18:05,000 --> 00:18:06,000
+configurations.
+
+195
+00:18:07,000 --> 00:18:08,000
+Legacy.
+
+196
+00:18:08,000 --> 00:18:12,000
+Elliptic curves in the Java security package were deprecated for removal.
+
+197
+00:18:12,000 --> 00:18:14,000
+The charm legacy.
+
+198
+00:18:14,000 --> 00:18:21,000
+Elliptic curves refers to specific elliptic curve cryptography algorithms that were part of the Java
+
+199
+00:18:21,000 --> 00:18:25,000
+security package in the Java Standard Edition platform.
+
+200
+00:18:25,000 --> 00:18:33,000
+Elliptic curve cryptography is a public key cryptography technique that uses the mathematics or elliptic
+
+201
+00:18:33,000 --> 00:18:35,000
+curves for secure key exchange.
+
+202
+00:18:35,000 --> 00:18:42,000
+These curves were considered outdated and their deprecation signaled the intent to remove them in future
+
+203
+00:18:42,000 --> 00:18:43,000
+releases.
+
+204
+00:18:44,000 --> 00:18:50,000
+Developers were encouraged to use modern elliptic curves for cryptographic operations.
+
+205
+00:18:50,000 --> 00:18:57,000
+The Oracle and crypto provider in the Java Cryptography extension was deprecated for removal.
+
+206
+00:18:57,000 --> 00:19:01,000
+This provider included cryptographic algorithms and services.
+
+207
+00:19:01,000 --> 00:19:08,000
+Its deprecation indicated that it was no longer recommended, and users were advised to migrate to alternative
+
+208
+00:19:08,000 --> 00:19:09,000
+providers.
+
+209
+00:19:09,000 --> 00:19:18,000
+GEP 362 deprecated the Solaris and Sparc ports of the GCC, meaning that future releases might remove
+
+210
+00:19:18,000 --> 00:19:20,000
+support for these platforms.
+
+211
+00:19:21,000 --> 00:19:27,000
+The deprecation was driven by the decrease in usage and maintenance costs associated with these specific
+
+212
+00:19:27,000 --> 00:19:28,000
+ports.
+
+213
+00:19:28,000 --> 00:19:36,000
+The Solaris and Sparc ports of the GCC were specific implementations of the GCC, tailored to run on
+
+214
+00:19:36,000 --> 00:19:43,000
+the Solaris operating system, and the Sparc, which stands for Scalable Processor Architecture.
+
+215
+00:19:43,000 --> 00:19:46,000
+Processor architectures.
+
+216
+00:19:46,000 --> 00:19:54,000
+These ports were designed to provide Java support for systems running Solaris on Sparc based hardware.
+
+217
+00:19:54,000 --> 00:19:55,000
+That's all.
+
+218
+00:19:55,000 --> 00:19:57,000
+What I wanted to review with you today.
+
+219
+00:19:57,000 --> 00:20:02,000
+In this lesson, let's recap what we have learned from the lesson today.
+
+220
+00:20:02,000 --> 00:20:06,000
+During the lesson, we learned everything you need to know about Java for teens release.
+
+221
+00:20:07,000 --> 00:20:12,000
+We learned new features in Java 14 and also we saw code examples.
+
+222
+00:20:12,000 --> 00:20:16,000
+I showed you features and APIs that were removed in Java 14.
+
+223
+00:20:17,000 --> 00:20:22,000
+Also, we reviewed summary of features and elements that become deprecated in Java 14.
+
+224
+00:20:23,000 --> 00:20:24,000
+That's it.
+
+225
+00:20:24,000 --> 00:20:25,000
+Thanks a lot for your attention.
+
+226
+00:20:25,000 --> 00:20:28,000
+Have a great day and see you in the next lesson.
+
diff --git a/44 - Java New Versions/013 Source-code-example-from-the-lesson.url b/44 - Java New Versions/013 Source-code-example-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..e9b752d9b136e9e2764d8e1cc35995809f196c52
--- /dev/null
+++ b/44 - Java New Versions/013 Source-code-example-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/commit/93442631c8cf9774b0a434197cff89cfaa9c751e
\ No newline at end of file
diff --git a/44 - Java New Versions/014 Java 15 Text Blocks, Hidden Classes, new String methods_en.srt b/44 - Java New Versions/014 Java 15 Text Blocks, Hidden Classes, new String methods_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..31ee17b3a7f2c891ee9b0a5bd8b7b2f92a21e2cf
--- /dev/null
+++ b/44 - Java New Versions/014 Java 15 Text Blocks, Hidden Classes, new String methods_en.srt
@@ -0,0 +1,1184 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello, Tim.
+
+2
+00:00:06,000 --> 00:00:09,000
+In this lesson we'll talk about Java 15.
+
+3
+00:00:09,000 --> 00:00:15,000
+Continuing series of lessons about Java version will stick to our regular agenda.
+
+4
+00:00:15,000 --> 00:00:20,000
+Namely, we will learn new language features and APIs added to Java 15.
+
+5
+00:00:20,000 --> 00:00:24,000
+I will explain new JDK tools and features on code examples.
+
+6
+00:00:25,000 --> 00:00:32,000
+Then I will show you the things that were removed from Java 15 and that were marked as deprecated in
+
+7
+00:00:32,000 --> 00:00:33,000
+this version.
+
+8
+00:00:33,000 --> 00:00:38,000
+After this lesson, you will know everything you need to know about Java 15.
+
+9
+00:00:38,000 --> 00:00:42,000
+The detailed agenda of the lesson you can see on the slides.
+
+10
+00:00:43,000 --> 00:00:44,000
+Let's start our lesson.
+
+11
+00:00:45,000 --> 00:00:50,000
+The day, we are going to have practical examples in order to review some features that were released
+
+12
+00:00:50,000 --> 00:00:51,000
+in Java 15.
+
+13
+00:00:51,000 --> 00:00:57,000
+As always, you will be able to find source code examples from the lesson in attachments to the video.
+
+14
+00:00:57,000 --> 00:01:02,000
+In case you will have any questions during the lesson, please do not hesitate to post your questions
+
+15
+00:01:02,000 --> 00:01:05,000
+below the video and I will be happy to answer.
+
+16
+00:01:06,000 --> 00:01:11,000
+And I'm going to start from the features that I consider one of the most useful in this release.
+
+17
+00:01:12,000 --> 00:01:19,000
+This feature had been anticipated by the developer community for several versions, as all developers
+
+18
+00:01:19,000 --> 00:01:24,000
+felt a need for it, and finally it was released in Java 15.
+
+19
+00:01:25,000 --> 00:01:27,000
+I am talking about text blocks feature.
+
+20
+00:01:28,000 --> 00:01:30,000
+Let me explain you what it is about.
+
+21
+00:01:31,000 --> 00:01:40,000
+Java enhancement proposals 378, also known as text blocks, was introduced in Java 13 as a preview
+
+22
+00:01:40,000 --> 00:01:45,000
+feature and became a standard feature only in Java 15.
+
+23
+00:01:45,000 --> 00:01:52,000
+It aims to simplify the writing of multiple string literals in Java, instead of concatenating strings
+
+24
+00:01:52,000 --> 00:02:00,000
+with the plus operator or using escape character like backslash n, you can now create multiple strings
+
+25
+00:02:00,000 --> 00:02:01,000
+more easily.
+
+26
+00:02:01,000 --> 00:02:04,000
+It will be easier for you to understand the challenge.
+
+27
+00:02:04,000 --> 00:02:11,000
+On example, pay attention to a simple example using traditional string concatenation.
+
+28
+00:02:11,000 --> 00:02:13,000
+Is it familiar to you?
+
+29
+00:02:13,000 --> 00:02:21,000
+You create string object and then you carefully track when to add new line character, where to close
+
+30
+00:02:21,000 --> 00:02:23,000
+double quotes and open them again.
+
+31
+00:02:24,000 --> 00:02:28,000
+Depending on the string length it can be time consuming.
+
+32
+00:02:28,000 --> 00:02:32,000
+And of course it will be perfect to come up with easier API.
+
+33
+00:02:33,000 --> 00:02:40,000
+With the introduction of text blocks in Java 15, you can achieve the same result more concisely.
+
+34
+00:02:41,000 --> 00:02:43,000
+Take a look at the second example.
+
+35
+00:02:43,000 --> 00:02:50,000
+In this example, the triple double quotes are used to define the start and the end of the text block.
+
+36
+00:02:51,000 --> 00:02:58,000
+Within text blocks, we can incorporate new lines and quotes freely eliminating the need to escape line
+
+37
+00:02:58,000 --> 00:02:59,000
+breaks.
+
+38
+00:03:00,000 --> 00:03:08,000
+This flexibility enables us to seamlessly include literal fragments of HTML, Json, SQL, or any other
+
+39
+00:03:08,000 --> 00:03:12,000
+necessary content in a more elegant and readable manner.
+
+40
+00:03:12,000 --> 00:03:19,000
+In the resulting string, the base indentation and the first new line are excluded.
+
+41
+00:03:20,000 --> 00:03:26,000
+Fortunately, proper code indentation is still achievable when using text blocks.
+
+42
+00:03:26,000 --> 00:03:35,000
+To accomplish this, a portion of the indentation is recognized as part of the source code, while another
+
+43
+00:03:35,000 --> 00:03:39,000
+portion is considered part of the text block.
+
+44
+00:03:39,000 --> 00:03:47,000
+The compiler identifies the minimum indentation in all non-empty lines and shifts the entire text block
+
+45
+00:03:47,000 --> 00:03:49,000
+to the left accordingly.
+
+46
+00:03:50,000 --> 00:03:53,000
+Let's review example of this HTML block.
+
+47
+00:03:54,000 --> 00:04:01,000
+In this case, the minimum indentation will be equal to 12 spaces and one tab character.
+
+48
+00:04:02,000 --> 00:04:08,000
+That's why this amount of whitespace characters will be considered as part of the source code, and
+
+49
+00:04:08,000 --> 00:04:10,000
+text will be moved to the left.
+
+50
+00:04:11,000 --> 00:04:17,000
+If you need to adjust the view of your text and to add some spaces, you can do it.
+
+51
+00:04:17,000 --> 00:04:21,000
+Pay attention to the HTML block two variable.
+
+52
+00:04:21,000 --> 00:04:28,000
+You can see that I added more spaces to the first line, but still the minimum indentation will be 12
+
+53
+00:04:28,000 --> 00:04:31,000
+spaces and one tab character.
+
+54
+00:04:32,000 --> 00:04:33,000
+In the console output.
+
+55
+00:04:33,000 --> 00:04:40,000
+You can see that there are more spaces in the first line, and HTML tag is moved to the right.
+
+56
+00:04:41,000 --> 00:04:45,000
+Or you can adjust indentation in another way.
+
+57
+00:04:45,000 --> 00:04:52,000
+For example, in text block two, you can see how I decreased minimum indentation by moving triple double
+
+58
+00:04:52,000 --> 00:04:54,000
+quotes to the left.
+
+59
+00:04:55,000 --> 00:04:56,000
+That's it.
+
+60
+00:04:56,000 --> 00:05:01,000
+After this, all string will be moved to the right on three spaces.
+
+61
+00:05:01,000 --> 00:05:08,000
+It is a difference between minimum indentation set by triple double quotes and text.
+
+62
+00:05:08,000 --> 00:05:13,000
+I hope that with these examples it is clear how it works.
+
+63
+00:05:13,000 --> 00:05:19,000
+But in case you have any questions, ask your question below the video please and I will be happy to
+
+64
+00:05:19,000 --> 00:05:19,000
+answer.
+
+65
+00:05:20,000 --> 00:05:24,000
+Let's talk now about escaping inside text blocks.
+
+66
+00:05:24,000 --> 00:05:31,000
+Within text blocks, there is no need to escape double quotes except in one specific scenario.
+
+67
+00:05:31,000 --> 00:05:38,000
+If we wish to use three double quotes consequently within our text block, we can achieve this by escaping
+
+68
+00:05:38,000 --> 00:05:42,000
+one of them like you can see in this example.
+
+69
+00:05:43,000 --> 00:05:45,000
+Managing line terminators.
+
+70
+00:05:45,000 --> 00:05:50,000
+In most cases, new lines do not require escaping inside text blocks.
+
+71
+00:05:51,000 --> 00:05:59,000
+However, it is important to note that even if a source file uses a windows line endings, which is
+
+72
+00:05:59,000 --> 00:06:06,000
+backslash R, backslash n text blocks will only terminate lines with new lines.
+
+73
+00:06:06,000 --> 00:06:07,000
+Backslash n.
+
+74
+00:06:08,000 --> 00:06:13,000
+If carriage returns, backslash R's are needed.
+
+75
+00:06:13,000 --> 00:06:16,000
+They must be explicitly added to the text block.
+
+76
+00:06:16,000 --> 00:06:23,000
+In this example, the text block will be terminated with both backslash r and backslash n.
+
+77
+00:06:24,000 --> 00:06:31,000
+Sometimes, when dealing with lengthy lines of text in source code, we may want to enhance readability.
+
+78
+00:06:31,000 --> 00:06:38,000
+Starting from Java 14, preview and escape sequence allows us to ignore a new line.
+
+79
+00:06:38,000 --> 00:06:39,000
+Pay attention.
+
+80
+00:06:39,000 --> 00:06:46,000
+Here I put backslash and in console all text block goes in one line.
+
+81
+00:06:46,000 --> 00:06:52,000
+We can use this trick when we want to save some space in the source code, but we still need to have
+
+82
+00:06:52,000 --> 00:06:54,000
+all string in one line.
+
+83
+00:06:55,000 --> 00:07:02,000
+As you can see, this results in a string literal equivalent to a normal non-interrupted string.
+
+84
+00:07:03,000 --> 00:07:11,000
+Let's learn how to deal with spaces in text blocks, while the compiler disregards trailing spaces in
+
+85
+00:07:11,000 --> 00:07:18,000
+text blocks and use escape sequence backslash s that was introduced in Java 14.
+
+86
+00:07:18,000 --> 00:07:21,000
+Preview allows us to escape a space.
+
+87
+00:07:21,000 --> 00:07:26,000
+The compiler will retain any spaces preceding the escaped space.
+
+88
+00:07:27,000 --> 00:07:29,000
+Pay attention that in the text block six.
+
+89
+00:07:29,000 --> 00:07:32,000
+Object in both lines.
+
+90
+00:07:32,000 --> 00:07:39,000
+In the source code, I have five spaces at the end of the line, but in the console output these spaces
+
+91
+00:07:39,000 --> 00:07:47,000
+are saved only for the second line, because I used special escape sequence to retain all spaces.
+
+92
+00:07:48,000 --> 00:07:49,000
+Is that clear?
+
+93
+00:07:49,000 --> 00:07:56,000
+Text blocks in Java provide a cleaner and more readable way to define multi-line strings, improving
+
+94
+00:07:56,000 --> 00:07:59,000
+the overall code maintainability.
+
+95
+00:07:59,000 --> 00:08:02,000
+Let's continue and review other updates and improvements.
+
+96
+00:08:04,000 --> 00:08:08,000
+Java 15 introduced three new methods to the string class.
+
+97
+00:08:08,000 --> 00:08:13,000
+They are formatted strip, indent, and translate escapes.
+
+98
+00:08:14,000 --> 00:08:18,000
+These methods enhance the capabilities of working with strings.
+
+99
+00:08:18,000 --> 00:08:23,000
+Let's review them on examples and understand how they work.
+
+100
+00:08:23,000 --> 00:08:28,000
+The formatted method is an enhancement to the existing string format method.
+
+101
+00:08:29,000 --> 00:08:36,000
+It simplifies the process of formatting strings by allowing you to embed format specifiers directly
+
+102
+00:08:36,000 --> 00:08:37,000
+in the string.
+
+103
+00:08:38,000 --> 00:08:46,000
+In this example, percent sign S is a placeholder for string values, and the formatted method replaces
+
+104
+00:08:46,000 --> 00:08:49,000
+these placeholders with the provided values.
+
+105
+00:08:49,000 --> 00:08:56,000
+Feel free to check lesson about strings, where we learned string formatting and other placeholders
+
+106
+00:08:56,000 --> 00:08:57,000
+from my course.
+
+107
+00:08:57,000 --> 00:08:59,000
+Java from zero to first job.
+
+108
+00:09:00,000 --> 00:09:07,000
+The key motivation of this method is to have more object oriented format of this method, because I
+
+109
+00:09:07,000 --> 00:09:14,000
+believe you remember that previously we could use static format method, but now we can call method
+
+110
+00:09:14,000 --> 00:09:18,000
+on a specific string object strip ident method.
+
+111
+00:09:19,000 --> 00:09:27,000
+Strip ident method is designed to ease the handling of multi-line strings, particularly those defined
+
+112
+00:09:27,000 --> 00:09:28,000
+using text blocks.
+
+113
+00:09:29,000 --> 00:09:35,000
+It removes common leading indentation from all lines of the string from the beginning of the string
+
+114
+00:09:35,000 --> 00:09:38,000
+and from the end of the string, making it more readable.
+
+115
+00:09:39,000 --> 00:09:41,000
+Let's take a look at example.
+
+116
+00:09:41,000 --> 00:09:44,000
+I have line with indentations.
+
+117
+00:09:44,000 --> 00:09:45,000
+Pay attention.
+
+118
+00:09:45,000 --> 00:09:53,000
+There are spaces at the beginning of the line and at the end, and after calling strip ident, I don't
+
+119
+00:09:53,000 --> 00:09:54,000
+have spaces.
+
+120
+00:09:55,000 --> 00:09:57,000
+That's how it works.
+
+121
+00:09:57,000 --> 00:09:58,000
+Let's continue.
+
+122
+00:09:59,000 --> 00:10:04,000
+The translate escapes mascot is used to handle escape sequences in a string.
+
+123
+00:10:05,000 --> 00:10:12,000
+It interprets escape sequences within the string and replaces them with their actual characters.
+
+124
+00:10:12,000 --> 00:10:15,000
+Take a look at example in the string.
+
+125
+00:10:15,000 --> 00:10:22,000
+I have escaped newline character, and in case I would print this line to console, there will not be
+
+126
+00:10:22,000 --> 00:10:25,000
+any new line because this character is escaped.
+
+127
+00:10:25,000 --> 00:10:33,000
+But in case I call translate escape method, I see the new line in the console output.
+
+128
+00:10:33,000 --> 00:10:40,000
+The translated string will replace the escaped an with an actual new line character.
+
+129
+00:10:40,000 --> 00:10:48,000
+Translate escapes helps in interpreting escape sequences, allowing the application to work with user
+
+130
+00:10:48,000 --> 00:10:53,000
+provided input in a way that aligns with the user's intent.
+
+131
+00:10:53,000 --> 00:11:00,000
+It ensures that escape sequences are replaced with their corresponding characters and Hansen the usability
+
+132
+00:11:00,000 --> 00:11:01,000
+of the input.
+
+133
+00:11:02,000 --> 00:11:09,000
+It's important to note that these methods provide more convenience and readability, especially in scenarios
+
+134
+00:11:09,000 --> 00:11:15,000
+involving formatted strings, multi-line text blocks, and escape sequences.
+
+135
+00:11:15,000 --> 00:11:19,000
+Let's learn such features as hidden classes in Java 15.
+
+136
+00:11:20,000 --> 00:11:28,000
+Java Enhancement proposals 371, titled Hidden Classes, was introduced in Java 15 as a feature aimed
+
+137
+00:11:28,000 --> 00:11:33,000
+at improving the security and efficiency of the Java platform.
+
+138
+00:11:33,000 --> 00:11:42,000
+This GEP primarily addresses the use of reflection, which can potentially introduce security vulnerabilities
+
+139
+00:11:42,000 --> 00:11:45,000
+and ensure performance overhead.
+
+140
+00:11:45,000 --> 00:11:53,000
+In Java, reflection allows for dynamic inspection and modification of classes, methods, fields,
+
+141
+00:11:53,000 --> 00:11:56,000
+and other program elements at the runtime.
+
+142
+00:11:57,000 --> 00:12:03,000
+Just to remind you that in my course Java, from zero to first job, we have separate lesson dedicated
+
+143
+00:12:03,000 --> 00:12:05,000
+to reflection API.
+
+144
+00:12:05,000 --> 00:12:07,000
+Feel free to check it if you wish.
+
+145
+00:12:08,000 --> 00:12:16,000
+However, unrestricted use of reflection can be a security concern and it may have a performance implications
+
+146
+00:12:16,000 --> 00:12:20,000
+due to the need for runtime checks and security manager checks.
+
+147
+00:12:21,000 --> 00:12:28,000
+Hidden classes are those that can't be directly accessed by bytecode or other classes.
+
+148
+00:12:29,000 --> 00:12:35,000
+So we can summarize the main goals of GEP 371 as follows.
+
+149
+00:12:35,000 --> 00:12:43,000
+Security enhancement introduce a mechanism to create a classes that are not discoverable by the usual
+
+150
+00:12:43,000 --> 00:12:51,000
+means, making it more challenging for malicious code to exploit reflective access to sensitive classes.
+
+151
+00:12:51,000 --> 00:12:59,000
+Number two performance improvement minimize the overhead associated with the reflective operations by
+
+152
+00:12:59,000 --> 00:13:05,000
+avoiding certain checks and simplifying the process of creating classes at runtime.
+
+153
+00:13:05,000 --> 00:13:09,000
+Let's review key features of GEP 371.
+
+154
+00:13:10,000 --> 00:13:14,000
+So new kind of class called Hidden classes is introduced.
+
+155
+00:13:15,000 --> 00:13:20,000
+These classes are not discoverable through typical reflection mechanisms.
+
+156
+00:13:21,000 --> 00:13:27,000
+Class lookup mechanism introduces a new lookup mechanism for creating hidden classes.
+
+157
+00:13:28,000 --> 00:13:36,000
+The defined hidden class method is more flexible than the existing mechanisms and allows for greater
+
+158
+00:13:36,000 --> 00:13:38,000
+control over class creation.
+
+159
+00:13:38,000 --> 00:13:39,000
+Package.
+
+160
+00:13:39,000 --> 00:13:40,000
+Private access.
+
+161
+00:13:41,000 --> 00:13:48,000
+Hidden classes can access package private members of their defining class and other classes in the same
+
+162
+00:13:48,000 --> 00:13:54,000
+package, even if the usual access control rules would prevent such access.
+
+163
+00:13:54,000 --> 00:13:56,000
+Security impact.
+
+164
+00:13:56,000 --> 00:14:04,000
+Enhances security by making it more difficult for malicious code to access and manipulate classes through
+
+165
+00:14:04,000 --> 00:14:05,000
+reflection.
+
+166
+00:14:05,000 --> 00:14:09,000
+The hidden class can't serve as a super class.
+
+167
+00:14:09,000 --> 00:14:13,000
+Field type, return type, or parameter type.
+
+168
+00:14:13,000 --> 00:14:19,000
+Code within the hidden class can be directly used without dependent on the class object.
+
+169
+00:14:20,000 --> 00:14:23,000
+And now let's take a look at example.
+
+170
+00:14:24,000 --> 00:14:31,000
+In this line, I obtain a lookup object with private access to the class Java 15.
+
+171
+00:14:31,000 --> 00:14:35,000
+It uses the private lookup in method from.
+
+172
+00:14:35,000 --> 00:14:42,000
+The method handles class to create a lookup object with access privileges to the specified class.
+
+173
+00:14:43,000 --> 00:14:51,000
+The lookup object in Java is part of the Java Lang invoke package, and is used in the method handle
+
+174
+00:14:51,000 --> 00:14:52,000
+mechanism.
+
+175
+00:14:52,000 --> 00:14:59,000
+It provides a way to perform low level operations on masses and fields, including dynamic method invocation,
+
+176
+00:14:59,000 --> 00:15:07,000
+access to private members, and the ability to create method handles for both static and virtual methods.
+
+177
+00:15:08,000 --> 00:15:13,000
+Then I need to get bytecode of any class that I want to use in my example.
+
+178
+00:15:13,000 --> 00:15:19,000
+In this specific example, I created a separate method to convert class to byte array.
+
+179
+00:15:19,000 --> 00:15:21,000
+Let's understand how it works.
+
+180
+00:15:22,000 --> 00:15:23,000
+I get the class name.
+
+181
+00:15:23,000 --> 00:15:24,000
+I create.
+
+182
+00:15:24,000 --> 00:15:29,000
+Pass to a class file by replacing dots in the full class name with file separators.
+
+183
+00:15:30,000 --> 00:15:36,000
+Then I get resource as input stream and I have separate method to convert input stream to byte array.
+
+184
+00:15:37,000 --> 00:15:42,000
+Optionally you can use I o utils from Apache Commons I o library.
+
+185
+00:15:42,000 --> 00:15:47,000
+In this case, you can convert input stream into byte array with one simple method.
+
+186
+00:15:48,000 --> 00:15:51,000
+After that you can define hidden class.
+
+187
+00:15:51,000 --> 00:15:58,000
+You call define hidden class method on the lookup object and you use three arguments to define hidden
+
+188
+00:15:58,000 --> 00:15:59,000
+class.
+
+189
+00:16:00,000 --> 00:16:05,000
+First of all, it is byte, then initialize flag.
+
+190
+00:16:05,000 --> 00:16:10,000
+If true, then the class will be initialized and then class options.
+
+191
+00:16:10,000 --> 00:16:17,000
+Class option is an enumeration introduced in Java 15 as part of the Java Lang invoke package.
+
+192
+00:16:17,000 --> 00:16:23,000
+It is specifically associated with the lookup class, and is used in the define hidden class method
+
+193
+00:16:23,000 --> 00:16:27,000
+to specify options for creating hidden classes.
+
+194
+00:16:27,000 --> 00:16:32,000
+There are two options Nestmate and strong.
+
+195
+00:16:32,000 --> 00:16:40,000
+Nursemaid specifies that a hidden class should be added to the nest of a lookup class as a nest mate.
+
+196
+00:16:41,000 --> 00:16:49,000
+A hidden nursemaid class has access to the private members of all classes and interfaces in the same
+
+197
+00:16:49,000 --> 00:16:49,000
+nest.
+
+198
+00:16:50,000 --> 00:16:52,000
+What about strong option?
+
+199
+00:16:53,000 --> 00:17:00,000
+Strong specifies that the hidden class has a strong relationship with the class loader, marked as it's
+
+200
+00:17:00,000 --> 00:17:01,000
+defined in loader.
+
+201
+00:17:01,000 --> 00:17:09,000
+Strong means that the hidden class may be unloaded only if it's defined in loader, is not reachable,
+
+202
+00:17:09,000 --> 00:17:12,000
+and may be reclaimed by a garbage collector.
+
+203
+00:17:13,000 --> 00:17:19,000
+If you are student of my course Java from zero to first job, then you are familiar with the concept
+
+204
+00:17:19,000 --> 00:17:24,000
+of nest based access control as it was introduced in Java 11.
+
+205
+00:17:25,000 --> 00:17:28,000
+Because I explained it in the lesson about Java 11.
+
+206
+00:17:29,000 --> 00:17:33,000
+So I believe you understand what does nest mate is.
+
+207
+00:17:34,000 --> 00:17:38,000
+As you see the create hidden class you need to have byte array.
+
+208
+00:17:38,000 --> 00:17:42,000
+You can get this byte array in different ways.
+
+209
+00:17:42,000 --> 00:17:48,000
+You can create a code that compiles the source code and you take byte array from it.
+
+210
+00:17:48,000 --> 00:17:53,000
+Or you can read class as a resource and convert it into a byte array.
+
+211
+00:17:53,000 --> 00:17:55,000
+There are different options.
+
+212
+00:17:55,000 --> 00:18:03,000
+Having reference to a hidden class, you can create instances of the class, get methods, and invoke
+
+213
+00:18:03,000 --> 00:18:03,000
+methods.
+
+214
+00:18:04,000 --> 00:18:09,000
+Hidden classes are not meant to be a replacement for regular classes.
+
+215
+00:18:09,000 --> 00:18:15,000
+They're intended for specialized use cases involving dynamic class generation.
+
+216
+00:18:15,000 --> 00:18:23,000
+Care should be taken when using hidden classes, as they introduce a level of complexity, and can have
+
+217
+00:18:23,000 --> 00:18:25,000
+implications on code maintainability.
+
+218
+00:18:26,000 --> 00:18:33,000
+And just for the sake of example, I print the class name to console and here it is printed to console.
+
+219
+00:18:33,000 --> 00:18:35,000
+Want to use them.
+
+220
+00:18:35,000 --> 00:18:37,000
+And what are use cases?
+
+221
+00:18:37,000 --> 00:18:43,000
+Dynamic code generation frameworks and libraries can benefit from hidden classes to improve performance
+
+222
+00:18:43,000 --> 00:18:44,000
+and security.
+
+223
+00:18:45,000 --> 00:18:52,000
+Hidden classes are also useful in cases where runtime code generation is necessary, and the resulting
+
+224
+00:18:52,000 --> 00:18:55,000
+classes need to be hidden from reflection.
+
+225
+00:18:55,000 --> 00:18:58,000
+That's all regarding hidden classes.
+
+226
+00:18:58,000 --> 00:19:02,000
+If you have some questions, please post your question below the video.
+
+227
+00:19:03,000 --> 00:19:11,000
+Also I believe you are already familiar with is empty method that we used on string object minor but
+
+228
+00:19:11,000 --> 00:19:14,000
+still interesting update in Java 15.
+
+229
+00:19:14,000 --> 00:19:19,000
+The default is empty method was introduced in char sequence interface.
+
+230
+00:19:20,000 --> 00:19:26,000
+With this default method, any class implementing the char sequence interface automatically inherits
+
+231
+00:19:26,000 --> 00:19:32,000
+the is empty method, and it can be called on instances of those classes.
+
+232
+00:19:32,000 --> 00:19:40,000
+I believe these are key updates regarding Java API in Java 15 that we as developers will interact with.
+
+233
+00:19:41,000 --> 00:19:45,000
+But that doesn't mean that Nasional's was released.
+
+234
+00:19:46,000 --> 00:19:52,000
+On this slide, you can see other improvements and updates that were released in Java 15.
+
+235
+00:19:52,000 --> 00:19:58,000
+Most of them are related with optimization of existing features and processes on the background.
+
+236
+00:19:58,000 --> 00:20:02,000
+Feel free to pause the video and look through the slide.
+
+237
+00:20:03,000 --> 00:20:09,000
+And in case you are interested in some specific improvement or update, just let me know in the comments
+
+238
+00:20:09,000 --> 00:20:17,000
+below the video and I will elaborate more in case there will be a lot of questions regarding some specific
+
+239
+00:20:17,000 --> 00:20:21,000
+update, I will create a separate lesson in addition to this one.
+
+240
+00:20:21,000 --> 00:20:22,000
+Let's continue.
+
+241
+00:20:23,000 --> 00:20:26,000
+In each Java version, something is removed.
+
+242
+00:20:26,000 --> 00:20:30,000
+Let's review now what was removed in Java 15.
+
+243
+00:20:31,000 --> 00:20:38,000
+The Solaris specific Soflo SLA socket option, which was deprecated earlier, has been removed.
+
+244
+00:20:39,000 --> 00:20:43,000
+This option was specific to Solaris operating systems.
+
+245
+00:20:43,000 --> 00:20:49,000
+The remote method invocation static stub compiler has been removed.
+
+246
+00:20:50,000 --> 00:20:55,000
+Armik was used to generate stop classes for remote objects in RMI.
+
+247
+00:20:56,000 --> 00:21:02,000
+This deprecated constant RMI connector server credential types has been removed.
+
+248
+00:21:02,000 --> 00:21:07,000
+This constant was related to credential types in RMI connector Server.
+
+249
+00:21:08,000 --> 00:21:12,000
+The Nashorn JavaScript engine has been completely removed.
+
+250
+00:21:13,000 --> 00:21:20,000
+Nashorn was deprecated in Java 11, and its removal is a part of the ongoing efforts to migrate to the
+
+251
+00:21:20,000 --> 00:21:23,000
+Growl virtual machine JavaScript engine.
+
+252
+00:21:24,000 --> 00:21:33,000
+The command line option use adaptive GC boundary is now considered obsolete and has been removed.
+
+253
+00:21:33,000 --> 00:21:36,000
+This option was related to garbage collection.
+
+254
+00:21:36,000 --> 00:21:40,000
+The Komodo root CA certificate has been removed.
+
+255
+00:21:40,000 --> 00:21:48,000
+Certificates are periodically updated in Java for security reasons, and this removal reflects changes
+
+256
+00:21:48,000 --> 00:21:50,000
+in the trusted certificate authorities.
+
+257
+00:21:51,000 --> 00:21:57,000
+The DocuSign root CA certificate has been removed similar to the Comodo certificate.
+
+258
+00:21:57,000 --> 00:22:01,000
+This removal reflects changes in trusted certificate authorities.
+
+259
+00:22:02,000 --> 00:22:10,000
+The deprecated implementation of the GATT peer certificate chain method in the SSL session interface
+
+260
+00:22:10,000 --> 00:22:12,000
+has been retired.
+
+261
+00:22:12,000 --> 00:22:16,000
+It is advisable to use an alternative method or approach.
+
+262
+00:22:17,000 --> 00:22:23,000
+The Commission and SSL internal SSL provider name has been removed.
+
+263
+00:22:23,000 --> 00:22:30,000
+This is part of the ongoing efforts to migrate from internal APIs to standardized APIs and improve security.
+
+264
+00:22:31,000 --> 00:22:34,000
+There are also various deprecated items in Java 15.
+
+265
+00:22:35,000 --> 00:22:38,000
+Let me give a brief overview of what was deprecated.
+
+266
+00:22:39,000 --> 00:22:45,000
+Remote method invocation activation has been deprecated, indicating that it is a feature that will
+
+267
+00:22:45,000 --> 00:22:47,000
+be removed in future releases.
+
+268
+00:22:47,000 --> 00:22:54,000
+Developers are advised to migrate away from the RMI activation and explore alternative solutions.
+
+269
+00:22:55,000 --> 00:23:01,000
+The constant and S window style mask textures background has been deprecated.
+
+270
+00:23:02,000 --> 00:23:09,000
+This constant was related to the style mask for windows in the macOS GUI toolkit.
+
+271
+00:23:10,000 --> 00:23:15,000
+Developers are encouraged to use alternative approaches for window styling.
+
+272
+00:23:15,000 --> 00:23:19,000
+The command line option force pneuma has been deprecated.
+
+273
+00:23:19,000 --> 00:23:25,000
+This option was related to forcing the non-uniform memory access memory model.
+
+274
+00:23:25,000 --> 00:23:28,000
+What it is we learned in the previous lesson.
+
+275
+00:23:28,000 --> 00:23:33,000
+Users are advised to review and update their configurations accordingly.
+
+276
+00:23:34,000 --> 00:23:41,000
+Biased locking has been disabled by default, and the associated flags related to biased locking have
+
+277
+00:23:41,000 --> 00:23:42,000
+been deprecated.
+
+278
+00:23:43,000 --> 00:23:50,000
+Biased locking was a feature aimed at improving the performance of uncontended locks.
+
+279
+00:23:50,000 --> 00:23:56,000
+The deprecation signals is advised locking may be removed in future releases.
+
+280
+00:23:56,000 --> 00:24:05,000
+The Native Son EQ, which stands for Sun Elliptic Curve implementation, has been disabled by default.
+
+281
+00:24:05,000 --> 00:24:12,000
+This is part of ongoing efforts to improve security and move towards standardized cryptographic APIs.
+
+282
+00:24:12,000 --> 00:24:16,000
+Users are encouraged to use alternative cryptographic providers.
+
+283
+00:24:17,000 --> 00:24:23,000
+The content Signer APIs, which were previously deprecated, have been marked with full removal.
+
+284
+00:24:23,000 --> 00:24:24,000
+True.
+
+285
+00:24:25,000 --> 00:24:30,000
+This indicates that these APIs are deprecated and will be removed in a future release.
+
+286
+00:24:31,000 --> 00:24:35,000
+Developers should migrate to alternative APIs for sign in content.
+
+287
+00:24:36,000 --> 00:24:38,000
+That's all what I wanted to share with you today.
+
+288
+00:24:38,000 --> 00:24:42,000
+In this lesson, let's recap what we have learned today.
+
+289
+00:24:43,000 --> 00:24:43,000
+The day.
+
+290
+00:24:43,000 --> 00:24:48,000
+During the lesson, we learned everything you need to know about Java 15 release.
+
+291
+00:24:49,000 --> 00:24:53,000
+We learned new features in Java 15 and also we saw code examples.
+
+292
+00:24:54,000 --> 00:24:58,000
+I showed you features and APIs that were removed in Java 15.
+
+293
+00:24:59,000 --> 00:25:04,000
+Also, we reviewed summary of features and elements that become deprecated in Java 15.
+
+294
+00:25:05,000 --> 00:25:06,000
+That's it.
+
+295
+00:25:06,000 --> 00:25:07,000
+Thanks a lot for your attention.
+
+296
+00:25:08,000 --> 00:25:10,000
+Have a great day and see you in the next lesson.
+
diff --git a/44 - Java New Versions/014 Source-code-example-from-the-lesson.url b/44 - Java New Versions/014 Source-code-example-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..1fb9acfdc7144bfa868e96fe4224b36f22af017d
--- /dev/null
+++ b/44 - Java New Versions/014 Source-code-example-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/commit/302780157b23432ef2aa404561491b4ecf145287
\ No newline at end of file
diff --git a/44 - Java New Versions/015 Java 16 JEP 395 - Records_en.srt b/44 - Java New Versions/015 Java 16 JEP 395 - Records_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..81def6b5e28929d79b7e0e0fc19a5141b8c4ff86
--- /dev/null
+++ b/44 - Java New Versions/015 Java 16 JEP 395 - Records_en.srt
@@ -0,0 +1,936 @@
+1
+00:00:05,000 --> 00:00:06,000
+Hello, Tim.
+
+2
+00:00:06,000 --> 00:00:09,000
+In this lesson we'll talk about Java 16.
+
+3
+00:00:09,000 --> 00:00:15,000
+Continuing series of lessons about new Java versions will stick to our regular agenda.
+
+4
+00:00:15,000 --> 00:00:20,000
+Namely, we'll learn new language features and APIs added to Java 16.
+
+5
+00:00:20,000 --> 00:00:25,000
+I will explain new JDK tools and features on code examples.
+
+6
+00:00:25,000 --> 00:00:32,000
+Then I will show you the things that were removed from Java 16 and that were marked as deprecated in
+
+7
+00:00:32,000 --> 00:00:33,000
+this version.
+
+8
+00:00:33,000 --> 00:00:38,000
+After the lesson, you will know everything you need to know about Java 16.
+
+9
+00:00:38,000 --> 00:00:42,000
+The detailed agenda of the lesson you can see on the slides.
+
+10
+00:00:42,000 --> 00:00:44,000
+Let's start our lesson.
+
+11
+00:00:44,000 --> 00:00:51,000
+One of the key and the most significant features that was released in Java 16 is Java Enhancement Proposal
+
+12
+00:00:51,000 --> 00:00:55,000
+395, titled records.
+
+13
+00:00:55,000 --> 00:01:02,000
+This feature was in preview mode since Java 14, but finally it was officially released and added to
+
+14
+00:01:02,000 --> 00:01:04,000
+the JDK.
+
+15
+00:01:04,000 --> 00:01:11,000
+I would say that this is one of the expected features of Java 16, and that's why we are going to learn
+
+16
+00:01:11,000 --> 00:01:12,000
+it in details.
+
+17
+00:01:13,000 --> 00:01:21,000
+So Java Enhancement Proposal 395, titled records, was introduced in Java 16 as part of project Amber.
+
+18
+00:01:22,000 --> 00:01:26,000
+If you never heard about Project Umbra, let me tell you what it is.
+
+19
+00:01:27,000 --> 00:01:35,000
+The goal of Project Umbra is to explore and incubate smaller, productivity oriented Java language features
+
+20
+00:01:35,000 --> 00:01:42,000
+that have been accepted as candidate Java enhancement proposals in the OpenJDK GEP process.
+
+21
+00:01:43,000 --> 00:01:51,000
+Records are new kind of class in Java that aim to simplify the creation of immutable data carrying classes,
+
+22
+00:01:52,000 --> 00:01:55,000
+their restricted form of a class.
+
+23
+00:01:55,000 --> 00:02:04,000
+Just like an enum, the transmission of a mutable data among objects is a common task in many Java applications.
+
+24
+00:02:04,000 --> 00:02:12,000
+Before Java 16, accomplishing this task required you to create an immutable class involving boilerplate
+
+25
+00:02:12,000 --> 00:02:13,000
+fields and masses.
+
+26
+00:02:14,000 --> 00:02:20,000
+With the introduction of Java 16, we can now address these issues using records.
+
+27
+00:02:20,000 --> 00:02:29,000
+Frequently, we create classes solely to store data such as database results, query outcomes, or information
+
+28
+00:02:29,000 --> 00:02:30,000
+from a service.
+
+29
+00:02:30,000 --> 00:02:35,000
+So basically very often we still use simple data structures in Java.
+
+30
+00:02:35,000 --> 00:02:42,000
+In numerous instances this data is immutable, ensuring data validity without synchronization.
+
+31
+00:02:43,000 --> 00:02:47,000
+To achieve this, we create data classes following next rules.
+
+32
+00:02:48,000 --> 00:02:53,000
+Private final fields for each piece of data getters for each field.
+
+33
+00:02:53,000 --> 00:02:57,000
+A public constructor with a corresponding argument for each field.
+
+34
+00:02:57,000 --> 00:03:01,000
+An equal method that returns true for objects of the same class.
+
+35
+00:03:01,000 --> 00:03:08,000
+When all fields match, a hash code matches that returns the same value when all fields match at toString
+
+36
+00:03:08,000 --> 00:03:14,000
+method that includes the class name and each field along with its corresponding value.
+
+37
+00:03:14,000 --> 00:03:19,000
+While this accomplishes our objective, there are two drawbacks.
+
+38
+00:03:19,000 --> 00:03:27,000
+The first one, the presence of excessive boilerplate code, which generates new code for each field.
+
+39
+00:03:27,000 --> 00:03:29,000
+hashCode to string getters.
+
+40
+00:03:29,000 --> 00:03:30,000
+Methods.
+
+41
+00:03:31,000 --> 00:03:39,000
+Despite IDs automating the generation of many of these classes this fall short in updating our classes
+
+42
+00:03:39,000 --> 00:03:42,000
+automatically when we add a new field.
+
+43
+00:03:42,000 --> 00:03:51,000
+For instance, if we introduce a new field updating our equals method, hashCode method becomes necessary
+
+44
+00:03:51,000 --> 00:03:53,000
+to incorporate this new field.
+
+45
+00:03:53,000 --> 00:03:54,000
+Right?
+
+46
+00:03:54,000 --> 00:04:01,000
+And the second drawback it is not obvious from the first glance the true purpose of the class.
+
+47
+00:04:01,000 --> 00:04:09,000
+Users of our code may think that this is real object with data and behavior, but in reality this is
+
+48
+00:04:09,000 --> 00:04:16,000
+pure data structure, and we need so much code just to represent the state of the type with two fields.
+
+49
+00:04:17,000 --> 00:04:23,000
+A more effective approach would be to explicitly declare our class as a data class.
+
+50
+00:04:23,000 --> 00:04:29,000
+Since Java 16, we can replace our repetitive data classes with records.
+
+51
+00:04:30,000 --> 00:04:35,000
+Records are immutable data classes that require only the type and name of fields.
+
+52
+00:04:36,000 --> 00:04:43,000
+The Java compiler generates the equals hash code and the string methods, along with the private final
+
+53
+00:04:43,000 --> 00:04:45,000
+fields and public constructor.
+
+54
+00:04:45,000 --> 00:04:52,000
+So we can say that records have specific goals and address specific use cases.
+
+55
+00:04:52,000 --> 00:04:54,000
+Let's review them one by one.
+
+56
+00:04:54,000 --> 00:04:56,000
+Conciseness and readability.
+
+57
+00:04:57,000 --> 00:05:04,000
+The primary goal of records is to provide a more concise and readable syntax for creating data carrying
+
+58
+00:05:04,000 --> 00:05:05,000
+classes.
+
+59
+00:05:05,000 --> 00:05:13,000
+This helps reduce boilerplate code, making the code base cleaner and easier to understand.
+
+60
+00:05:14,000 --> 00:05:23,000
+Immutable data records are inherently immutable, meaning their fields can't be modified after creation.
+
+61
+00:05:23,000 --> 00:05:27,000
+This immutability is enforced by making the fields final.
+
+62
+00:05:28,000 --> 00:05:34,000
+This is particularly useful when dealing with data that should not be changed once it is set.
+
+63
+00:05:35,000 --> 00:05:37,000
+Automatic masses.
+
+64
+00:05:37,000 --> 00:05:44,000
+Records automatically generate masses like equals, hashCode and toString based on the fields defined
+
+65
+00:05:44,000 --> 00:05:45,000
+in the record.
+
+66
+00:05:46,000 --> 00:05:52,000
+This automation reduces the need for developers to write repetitive and error prone code, improving
+
+67
+00:05:52,000 --> 00:05:55,000
+both productivity and code reliability.
+
+68
+00:05:56,000 --> 00:05:58,000
+Readability in APIs.
+
+69
+00:05:58,000 --> 00:06:05,000
+Records are well suited for representing data transfer objects and other simple data structures.
+
+70
+00:06:05,000 --> 00:06:13,000
+They are concise syntax and automatic message generation makes them particularly useful in API design,
+
+71
+00:06:13,000 --> 00:06:16,000
+where clear and expressive code is essential.
+
+72
+00:06:17,000 --> 00:06:25,000
+Interoperability with existing code records can extend other classes and interfaces, allowing them
+
+73
+00:06:25,000 --> 00:06:29,000
+to be seamlessly integrated into existing code bases.
+
+74
+00:06:29,000 --> 00:06:37,000
+This feature ensures that records can be adapted gradually without disrupting existing structures.
+
+75
+00:06:37,000 --> 00:06:46,000
+Overall, records aim to make Java coding more straightforward and less verbose, especially in scenarios
+
+76
+00:06:46,000 --> 00:06:51,000
+where classes are primarily used for holding and transporting data.
+
+77
+00:06:51,000 --> 00:06:59,000
+Their design aligns with modern programming practices and encourages the use of immutable data structures.
+
+78
+00:07:00,000 --> 00:07:05,000
+Today, we are going to have practical examples in order to review some features that were released
+
+79
+00:07:05,000 --> 00:07:06,000
+in Java 16.
+
+80
+00:07:07,000 --> 00:07:12,000
+As always, you will be able to find source code examples from the lesson in attachments to the video.
+
+81
+00:07:12,000 --> 00:07:18,000
+In case you will have any questions during the lesson, please do not hesitate to post your questions
+
+82
+00:07:18,000 --> 00:07:21,000
+below the video and I will be happy to answer.
+
+83
+00:07:22,000 --> 00:07:25,000
+Let's start review from the demo of rackets.
+
+84
+00:07:26,000 --> 00:07:30,000
+The first thing that we need to learn is how to create records.
+
+85
+00:07:30,000 --> 00:07:38,000
+Records provide a concise syntax for declaring classes that are primarily used to store data.
+
+86
+00:07:38,000 --> 00:07:42,000
+You can declare a record using the record keyword.
+
+87
+00:07:42,000 --> 00:07:46,000
+In this example, I create a record of user type.
+
+88
+00:07:46,000 --> 00:07:49,000
+Now I can create instances of this type.
+
+89
+00:07:50,000 --> 00:07:55,000
+The great object of record type, you can use new keyword and constructor.
+
+90
+00:07:55,000 --> 00:08:00,000
+You would need to initialize all fields during the object instantiation.
+
+91
+00:08:00,000 --> 00:08:05,000
+Here you can see examples of how I create three objects.
+
+92
+00:08:05,000 --> 00:08:11,000
+I create two objects that have the same state and the state object would have different state.
+
+93
+00:08:11,000 --> 00:08:14,000
+This is needed for the following demo examples.
+
+94
+00:08:15,000 --> 00:08:20,000
+As we already discussed, a lot of methods are generated automatically.
+
+95
+00:08:21,000 --> 00:08:28,000
+Records automatically generate methods such as equals, hashCode and toString based on the fields defined
+
+96
+00:08:28,000 --> 00:08:29,000
+in the record.
+
+97
+00:08:29,000 --> 00:08:32,000
+This helps reduce boilerplate code.
+
+98
+00:08:32,000 --> 00:08:34,000
+Let me demo this.
+
+99
+00:08:34,000 --> 00:08:42,000
+Let's print the console user one and you can see that not default to string method is here because I
+
+100
+00:08:42,000 --> 00:08:48,000
+don't see type name hashCode like it is usually printed by default.
+
+101
+00:08:48,000 --> 00:08:52,000
+In case toString method is inherited from object class.
+
+102
+00:08:52,000 --> 00:09:00,000
+I see customized text output which proves that I have custom overridden toString method.
+
+103
+00:09:01,000 --> 00:09:07,000
+Now let me prove you that equals method is on place and it works as expected.
+
+104
+00:09:08,000 --> 00:09:13,000
+In the next two lines, I compare user one, user two, and user three.
+
+105
+00:09:13,000 --> 00:09:20,000
+As you can see, user one and user two are equal and user one is not equal to user three.
+
+106
+00:09:21,000 --> 00:09:23,000
+That is what we expected.
+
+107
+00:09:23,000 --> 00:09:29,000
+And we can come to conclusion that logical comparison of objects is on place.
+
+108
+00:09:29,000 --> 00:09:36,000
+Also, automatically we receive greater masses, but names of methods are not started with get.
+
+109
+00:09:37,000 --> 00:09:42,000
+Instead, names of methods are the same as names of properties.
+
+110
+00:09:42,000 --> 00:09:51,000
+From one side it is great, but from another side this may cause additional confusion in existing frameworks
+
+111
+00:09:51,000 --> 00:09:54,000
+that rely on some stable Java naming convention.
+
+112
+00:09:55,000 --> 00:10:00,000
+So this is the sink that I am not so excited about.
+
+113
+00:10:00,000 --> 00:10:05,000
+But we'll talk about this when we'll talk about records disadvantages.
+
+114
+00:10:06,000 --> 00:10:11,000
+Another important thing that you need to remember is that objects of record type are immutable.
+
+115
+00:10:12,000 --> 00:10:20,000
+Records are inherently mutable, meaning their fields can't be modified after the record is created.
+
+116
+00:10:20,000 --> 00:10:24,000
+This is enforced by making the fields final.
+
+117
+00:10:24,000 --> 00:10:31,000
+That's why there is no sense in having setters masses, because anyway, we will not be able to update
+
+118
+00:10:31,000 --> 00:10:34,000
+the state of the object after its creation.
+
+119
+00:10:34,000 --> 00:10:41,000
+Even despite we have a lot of things autogenerated for us, we still have opportunity to customize methods
+
+120
+00:10:41,000 --> 00:10:43,000
+and declare our own methods.
+
+121
+00:10:43,000 --> 00:10:48,000
+Let me uncomment another example of user class and related demo code.
+
+122
+00:10:54,000 --> 00:11:01,000
+And will overwrite the string method and will declare some custom methods that tells the full name of
+
+123
+00:11:01,000 --> 00:11:02,000
+user.
+
+124
+00:11:03,000 --> 00:11:06,000
+As you can see, I have custom string representation.
+
+125
+00:11:06,000 --> 00:11:14,000
+I added some text and used parentheses and get full name returns first and last name of the specific
+
+126
+00:11:14,000 --> 00:11:15,000
+user.
+
+127
+00:11:15,000 --> 00:11:20,000
+Let me rerun the program and we will see the effect of these changes.
+
+128
+00:11:21,000 --> 00:11:28,000
+After rerunning the code, you can see that the string method prints output in different format than
+
+129
+00:11:28,000 --> 00:11:32,000
+before, and we can see the full name of user one.
+
+130
+00:11:32,000 --> 00:11:39,000
+Another cool feature that we shouldn't forget about is that records can implement interfaces like regular
+
+131
+00:11:39,000 --> 00:11:40,000
+types.
+
+132
+00:11:40,000 --> 00:11:48,000
+In this example, you can see that I made my user type comparable, and in case sorting will be applied
+
+133
+00:11:48,000 --> 00:11:53,000
+to user objects, they will be sorted according to email addresses.
+
+134
+00:11:56,000 --> 00:12:00,000
+I created list added the user one and user three.
+
+135
+00:12:01,000 --> 00:12:11,000
+I printed users before the sorting and you can see that user with Smith at email.com goes first and
+
+136
+00:12:11,000 --> 00:12:20,000
+then I sort the collection and after sorting you can see that user with though at email.com goes first.
+
+137
+00:12:20,000 --> 00:12:28,000
+GEP 395 brings a more concise and readable syntax for creating data carrying classes in Java.
+
+138
+00:12:28,000 --> 00:12:34,000
+Reducing the amount of boilerplate code traditionally required for such classes.
+
+139
+00:12:34,000 --> 00:12:38,000
+So we did an overview of records type.
+
+140
+00:12:38,000 --> 00:12:42,000
+Let's summarize all these restrictions on one slide.
+
+141
+00:12:43,000 --> 00:12:47,000
+A record class declaration doesn't have an extends clause.
+
+142
+00:12:47,000 --> 00:12:52,000
+The superclass of record class is always Java land record.
+
+143
+00:12:53,000 --> 00:13:01,000
+Similar to how the superclass of an enum class is always Java land enum, even though normal class can
+
+144
+00:13:01,000 --> 00:13:05,000
+explicitly extend its implicit superclass object.
+
+145
+00:13:05,000 --> 00:13:12,000
+A record can't explicitly extend any class, even its implicit superclass record.
+
+146
+00:13:13,000 --> 00:13:18,000
+But you saw on examples that nothing prevents us from implementation of an interface.
+
+147
+00:13:19,000 --> 00:13:24,000
+A record class is implicitly final and can't be abstract.
+
+148
+00:13:24,000 --> 00:13:32,000
+This restrictions emphasize that the API of a record class is defined solely by its state description,
+
+149
+00:13:32,000 --> 00:13:36,000
+and can't be enhanced later by another class.
+
+150
+00:13:37,000 --> 00:13:41,000
+The fields derived from the record components are final.
+
+151
+00:13:41,000 --> 00:13:49,000
+This restrictions embodies the immutable by default policy that is widely applicable for data carrier
+
+152
+00:13:49,000 --> 00:13:50,000
+classes.
+
+153
+00:13:50,000 --> 00:13:57,000
+A record class can't explicitly declare instance fields and can't contain instance initializers.
+
+154
+00:13:58,000 --> 00:14:05,000
+These restrictions ensure that the record header alone defines the state of a record value.
+
+155
+00:14:05,000 --> 00:14:13,000
+That means that you can't declare initialization block and initialize properties of the record there.
+
+156
+00:14:14,000 --> 00:14:22,000
+By the way, initialization blocks are forbidden in records, and also declaration of non-static fields
+
+157
+00:14:22,000 --> 00:14:24,000
+is forbidden in records too.
+
+158
+00:14:24,000 --> 00:14:26,000
+But you can declare static fields.
+
+159
+00:14:26,000 --> 00:14:28,000
+No problems with that.
+
+160
+00:14:29,000 --> 00:14:37,000
+Any explicit declarations of a member that would otherwise be automatically derived must match the type
+
+161
+00:14:37,000 --> 00:14:45,000
+of the automatically derived member exactly, disregarding any annotations on the explicit declaration.
+
+162
+00:14:45,000 --> 00:14:53,000
+Any explicit implementation of accessors or the equals or hashCode methods should be careful to preserve
+
+163
+00:14:53,000 --> 00:14:56,000
+the semantic invariance of the record class.
+
+164
+00:14:57,000 --> 00:15:01,000
+A rigorous class can't declare native methods.
+
+165
+00:15:01,000 --> 00:15:08,000
+If a record class could declare a native method, then the behavior of the record class would by definition,
+
+166
+00:15:08,000 --> 00:15:14,000
+depend on external state rather than the record class explicit state.
+
+167
+00:15:15,000 --> 00:15:21,000
+No class was native methods is likely to be a good candidate for migration to a record.
+
+168
+00:15:22,000 --> 00:15:27,000
+So what I would recommend use or not to use records really often.
+
+169
+00:15:27,000 --> 00:15:33,000
+I would say that records is really cool feature and the same as with all other features.
+
+170
+00:15:33,000 --> 00:15:36,000
+You need to know where it is applicable the best.
+
+171
+00:15:37,000 --> 00:15:44,000
+Unfortunately, so far records are applicable in limited range of business use cases because of their
+
+172
+00:15:44,000 --> 00:15:45,000
+disadvantages.
+
+173
+00:15:46,000 --> 00:15:49,000
+Let's review these advantages of records.
+
+174
+00:15:49,000 --> 00:15:54,000
+Number one limited integration with other frameworks.
+
+175
+00:15:54,000 --> 00:15:57,000
+And this is the biggest disadvantage in my opinion.
+
+176
+00:15:57,000 --> 00:16:00,000
+Just think about original purpose of records.
+
+177
+00:16:00,000 --> 00:16:07,000
+They are supposed to be used for data structures that won't be changed in Java web application.
+
+178
+00:16:07,000 --> 00:16:16,000
+This is a perfect use case for data transfer objects and being able to use it in different GPA implementations,
+
+179
+00:16:17,000 --> 00:16:20,000
+but you can't because of different reasons.
+
+180
+00:16:20,000 --> 00:16:28,000
+No setters methods, no default constructor naming convention for getter methods are different and don't
+
+181
+00:16:28,000 --> 00:16:30,000
+start with get methods.
+
+182
+00:16:30,000 --> 00:16:33,000
+Fields are final and others.
+
+183
+00:16:33,000 --> 00:16:38,000
+So based on today, using records with other frameworks is challenging.
+
+184
+00:16:39,000 --> 00:16:46,000
+Probably this will be changed in the future when frameworks will find a way to adjust their API's for
+
+185
+00:16:46,000 --> 00:16:47,000
+records.
+
+186
+00:16:47,000 --> 00:16:54,000
+But until this is not done, do not forget about Lombok library that provides you with this flexibility
+
+187
+00:16:54,000 --> 00:16:57,000
+in code generation for different classes.
+
+188
+00:16:57,000 --> 00:17:02,000
+If you don't remember what a Lombok is, let me briefly remind you.
+
+189
+00:17:03,000 --> 00:17:10,000
+Lombok is a Java library that simplifies and reduces boilerplate code in Java classes by automatically
+
+190
+00:17:10,000 --> 00:17:16,000
+generating common methods such as getters, setters, constructors, and more.
+
+191
+00:17:17,000 --> 00:17:24,000
+It provides annotations that, when applied to class fields or methods, triggers the automatic generation
+
+192
+00:17:24,000 --> 00:17:27,000
+of the corresponding code during compilation.
+
+193
+00:17:27,000 --> 00:17:35,000
+It is commonly used in projects to streamline the creation of Java beans, data transfer objects, and
+
+194
+00:17:35,000 --> 00:17:42,000
+other classes with straightforward structures, enabling developers to focus on high level logic and
+
+195
+00:17:42,000 --> 00:17:43,000
+reducing code.
+
+196
+00:17:43,000 --> 00:17:44,000
+Verbosity.
+
+197
+00:17:44,000 --> 00:17:49,000
+Number two designed to work with small amount of data.
+
+198
+00:17:49,000 --> 00:17:51,000
+Somebody would argue that.
+
+199
+00:17:51,000 --> 00:17:52,000
+But let me explain.
+
+200
+00:17:53,000 --> 00:17:58,000
+The examples of records are perfect when you have 2 or 3 fields in the record.
+
+201
+00:17:59,000 --> 00:18:03,000
+But imagine you need to create instance with hundreds of fields.
+
+202
+00:18:04,000 --> 00:18:11,000
+And such data structures exist in enterprise applications time to time, and we are in the situation
+
+203
+00:18:11,000 --> 00:18:16,000
+where we don't have any framework that would populate the data automatically.
+
+204
+00:18:16,000 --> 00:18:24,000
+And from another side, we are also in this situation where we need to initialize all the fields during
+
+205
+00:18:24,000 --> 00:18:32,000
+the object instantiation using generated constructor, and there is no way as mason some field because
+
+206
+00:18:32,000 --> 00:18:38,000
+there are no setters methods and we can't initialize some fields later.
+
+207
+00:18:39,000 --> 00:18:45,000
+This is not flexible at all and this can be easily treated as significant disadvantage.
+
+208
+00:18:46,000 --> 00:18:49,000
+Another disadvantage is limited flexibility.
+
+209
+00:18:49,000 --> 00:18:55,000
+Records are designed for a specific use case to model immutable data structures.
+
+210
+00:18:55,000 --> 00:19:02,000
+If your class requires more complex behavior or mutability, a traditional class might be more suitable.
+
+211
+00:19:03,000 --> 00:19:06,000
+An ability to extend other classes.
+
+212
+00:19:06,000 --> 00:19:12,000
+Records can't extend other classes, limiting their inheritance capabilities.
+
+213
+00:19:12,000 --> 00:19:20,000
+If you need to inherit behavior from a non interface class, you will need to use other mechanisms like
+
+214
+00:19:20,000 --> 00:19:21,000
+composition.
+
+215
+00:19:22,000 --> 00:19:24,000
+Immutable fields only.
+
+216
+00:19:24,000 --> 00:19:32,000
+All fields in the record are implicitly final, making them immutable, while immutability is often
+
+217
+00:19:32,000 --> 00:19:32,000
+desirable.
+
+218
+00:19:32,000 --> 00:19:36,000
+There are cases where mutable fields might be necessary.
+
+219
+00:19:37,000 --> 00:19:41,000
+In such cases, a traditional class with mutable fields may be more appropriate.
+
+220
+00:19:42,000 --> 00:19:45,000
+Records are public and final by default.
+
+221
+00:19:46,000 --> 00:19:54,000
+Records are implicitly public and final, and attempts to change this default behavior can lead to complications.
+
+222
+00:19:54,000 --> 00:20:00,000
+If you need a non-final or non-public class, you might need to use a traditional class.
+
+223
+00:20:01,000 --> 00:20:04,000
+Limited control over components.
+
+224
+00:20:04,000 --> 00:20:11,000
+While the automatic generation of components fields is convenient, it might be limiting if you need
+
+225
+00:20:11,000 --> 00:20:18,000
+more control over how components are different, especially in cases where additional logic is needed
+
+226
+00:20:18,000 --> 00:20:20,000
+during construction.
+
+227
+00:20:21,000 --> 00:20:25,000
+So I showed you records from different sites.
+
+228
+00:20:25,000 --> 00:20:28,000
+I showed you advantages of records.
+
+229
+00:20:28,000 --> 00:20:32,000
+We discussed limitations and its disadvantages.
+
+230
+00:20:32,000 --> 00:20:39,000
+I believe that after all this, you know everything you need to know about records and how to work with
+
+231
+00:20:39,000 --> 00:20:42,000
+them on practice efficiently.
+
+232
+00:20:43,000 --> 00:20:49,000
+But in case you have any questions, please post your question below the video and I will be happy to
+
+233
+00:20:49,000 --> 00:20:49,000
+answer.
+
+234
+00:20:50,000 --> 00:20:51,000
+Let's continue.
+
diff --git a/44 - Java New Versions/015 Source-code-example-from-the-lesson.url b/44 - Java New Versions/015 Source-code-example-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..47167d265b7e2eb566497c16775a544731580fb1
--- /dev/null
+++ b/44 - Java New Versions/015 Source-code-example-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/commit/050a58104e84e1d83a010e8cfb147ad5d3e3f570
\ No newline at end of file
diff --git a/44 - Java New Versions/016 Java 16 instanceof, Day Period Support, Stream.toList() & others_en.srt b/44 - Java New Versions/016 Java 16 instanceof, Day Period Support, Stream.toList() & others_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..c6ad11deceb4746e9d734ee55a9a98348512fa05
--- /dev/null
+++ b/44 - Java New Versions/016 Java 16 instanceof, Day Period Support, Stream.toList() & others_en.srt
@@ -0,0 +1,1032 @@
+1
+00:00:03,000 --> 00:00:10,000
+The next improvements that we are going to view is a static members in inner classes.
+
+2
+00:00:10,000 --> 00:00:16,000
+Previously, you didn't have right to declare static fields in a non-static inner type.
+
+3
+00:00:17,000 --> 00:00:25,000
+So in case you declare a static variable inside inner class before Java 16, you would get a compilation
+
+4
+00:00:25,000 --> 00:00:26,000
+error.
+
+5
+00:00:26,000 --> 00:00:28,000
+Take a look at this example.
+
+6
+00:00:28,000 --> 00:00:32,000
+This line would cause compilation error before Java 16.
+
+7
+00:00:33,000 --> 00:00:38,000
+Since Java 16, you are allowed to declare fields like this.
+
+8
+00:00:38,000 --> 00:00:45,000
+Also, since Java 16, you can declare static methods in inner non-static classes.
+
+9
+00:00:46,000 --> 00:00:54,000
+In Java 16 developers relaxed this restriction in order to allow an inner class to declare members that
+
+10
+00:00:54,000 --> 00:00:57,000
+are either explicitly or implicitly static.
+
+11
+00:00:57,000 --> 00:01:03,000
+In particular, this allows an inner class to declare a static member that is a record class.
+
+12
+00:01:04,000 --> 00:01:11,000
+Pay attention that it was always possible to declare a static final variables constants in inner non-static
+
+13
+00:01:11,000 --> 00:01:14,000
+classes, even before Java 16.
+
+14
+00:01:14,000 --> 00:01:15,000
+Let's move on.
+
+15
+00:01:16,000 --> 00:01:24,000
+Now let's talk about Jep 394 and discuss pattern matching, for instance, of operator.
+
+16
+00:01:25,000 --> 00:01:33,000
+GEP 394, titled Pattern Matching, for instance of, was introduced in Java 16 as a part of Project
+
+17
+00:01:33,000 --> 00:01:34,000
+Panama.
+
+18
+00:01:34,000 --> 00:01:37,000
+If you are not familiar with the project, Panama is.
+
+19
+00:01:37,000 --> 00:01:39,000
+Let me briefly explain.
+
+20
+00:01:39,000 --> 00:01:46,000
+Project Panama in Java is an effort to improve the connection between Java and native code, particularly
+
+21
+00:01:46,000 --> 00:01:53,000
+when dealing with non-java libraries and APIs written in languages like C and C plus plus.
+
+22
+00:01:53,000 --> 00:01:59,000
+The project aims to make it easier and more efficient for Java applications to interact with native
+
+23
+00:01:59,000 --> 00:02:05,000
+code, enabling seamless integration of native libraries into Java programs.
+
+24
+00:02:05,000 --> 00:02:12,000
+This helps developers leverage existing native code and libraries without sacrificing performance,
+
+25
+00:02:12,000 --> 00:02:20,000
+making it simpler to work with system level resources and functionality from within Java applications.
+
+26
+00:02:21,000 --> 00:02:30,000
+Project Panama is part of the larger OpenJDK initiative to enhance Java's capabilities and interoperability
+
+27
+00:02:30,000 --> 00:02:32,000
+with other languages and platforms.
+
+28
+00:02:33,000 --> 00:02:37,000
+So let's get back to improvements of instance of operator.
+
+29
+00:02:38,000 --> 00:02:44,000
+Take a look at instance of operator in action like we used it before Java 16.
+
+30
+00:02:44,000 --> 00:02:51,000
+Let's imagine we have some object and we need to check whether it is compatible with string type or
+
+31
+00:02:51,000 --> 00:02:51,000
+no.
+
+32
+00:02:51,000 --> 00:02:56,000
+And in case it is compatible, instance of operator returns true.
+
+33
+00:02:57,000 --> 00:03:02,000
+And inside the if block we cast object to string manually.
+
+34
+00:03:03,000 --> 00:03:11,000
+The current GEP extends the instance of operator to simplify the common code pattern of checking that
+
+35
+00:03:11,000 --> 00:03:15,000
+type of an object and then casting it to that type.
+
+36
+00:03:15,000 --> 00:03:17,000
+We spotted marching.
+
+37
+00:03:17,000 --> 00:03:23,000
+This check and cast can be combined into a single, more concise expression.
+
+38
+00:03:23,000 --> 00:03:30,000
+Pay attention that in the second example I add variable name after the type, and in case test string
+
+39
+00:03:30,000 --> 00:03:37,000
+object is string, then I can use this reference inside if block to get access to string object.
+
+40
+00:03:38,000 --> 00:03:44,000
+Like you can see in this example, I just print its length to console using string specific method,
+
+41
+00:03:44,000 --> 00:03:48,000
+just to prove you that the same object was casted to string object type.
+
+42
+00:03:49,000 --> 00:03:53,000
+Existing code that uses the traditional instance of syntax remains valid.
+
+43
+00:03:54,000 --> 00:04:00,000
+Pattern matching provides a more expressive alternative, but it doesn't deprecate or remove the traditional
+
+44
+00:04:00,000 --> 00:04:01,000
+syntax.
+
+45
+00:04:02,000 --> 00:04:09,000
+Pattern matching improves the readability of code, especially in scenarios where type checks and casts
+
+46
+00:04:09,000 --> 00:04:10,000
+are common.
+
+47
+00:04:11,000 --> 00:04:12,000
+Pay attention to this example.
+
+48
+00:04:12,000 --> 00:04:16,000
+I do casting and if check in one line.
+
+49
+00:04:17,000 --> 00:04:19,000
+Jep 394.
+
+50
+00:04:20,000 --> 00:04:28,000
+Introduction of pattern matching for Instanceof is part of a broader effort to enhance Java's expressiveness
+
+51
+00:04:28,000 --> 00:04:31,000
+and reduce boilerplate code.
+
+52
+00:04:31,000 --> 00:04:37,000
+It provides a more concise and readable syntax for common type checking scenarios, improving the overall
+
+53
+00:04:37,000 --> 00:04:39,000
+developer experience.
+
+54
+00:04:40,000 --> 00:04:47,000
+The next improvement is related with invocation of default methods on proxy instances when using reflection
+
+55
+00:04:47,000 --> 00:04:50,000
+using invocation handler interface.
+
+56
+00:04:50,000 --> 00:04:58,000
+So let me show you how you can invoke default masses on proxy instances via reflection.
+
+57
+00:04:58,000 --> 00:05:02,000
+Pay attention to this example and let's review it line by line.
+
+58
+00:05:03,000 --> 00:05:04,000
+Object proxy.
+
+59
+00:05:04,000 --> 00:05:06,000
+Equal to proxy.
+
+60
+00:05:06,000 --> 00:05:08,000
+New proxy instance.
+
+61
+00:05:08,000 --> 00:05:15,000
+This lines creates a dynamic proxy instance using the new proxy instance method.
+
+62
+00:05:15,000 --> 00:05:18,000
+It takes multiple parameters.
+
+63
+00:05:18,000 --> 00:05:26,000
+Parameter number one Classloader plus loader dot get system class loader is used to obtain the system
+
+64
+00:05:26,000 --> 00:05:27,000
+class loader.
+
+65
+00:05:28,000 --> 00:05:35,000
+Parameter number two is an array of interfaces that the proxy should implement.
+
+66
+00:05:35,000 --> 00:05:42,000
+In this case, it is an array containing the default message on proxy Dharma interface.
+
+67
+00:05:42,000 --> 00:05:45,000
+You can find it in the same file below.
+
+68
+00:05:45,000 --> 00:05:48,000
+It has just one default method.
+
+69
+00:05:48,000 --> 00:05:50,000
+Parameter number three.
+
+70
+00:05:50,000 --> 00:05:57,000
+Invocation handler, an implementation of the invocation handler interfaces provided as lambda expression.
+
+71
+00:05:58,000 --> 00:06:02,000
+This handler intercepts method calls on the proxy.
+
+72
+00:06:02,000 --> 00:06:05,000
+So let's review this lambda expression.
+
+73
+00:06:05,000 --> 00:06:09,000
+This lambda expression represents the invocation handlers.
+
+74
+00:06:09,000 --> 00:06:10,000
+Invoke method.
+
+75
+00:06:11,000 --> 00:06:12,000
+Proxy variable.
+
+76
+00:06:12,000 --> 00:06:15,000
+The proxy instance method variable.
+
+77
+00:06:15,000 --> 00:06:17,000
+The method being invoked.
+
+78
+00:06:18,000 --> 00:06:21,000
+Arguments the arguments passed to the method.
+
+79
+00:06:22,000 --> 00:06:25,000
+Let's review the next if block.
+
+80
+00:06:25,000 --> 00:06:30,000
+This if block checks if the invoked method is a default method.
+
+81
+00:06:30,000 --> 00:06:32,000
+Using is default.
+
+82
+00:06:33,000 --> 00:06:38,000
+If it is a default method, it invokes the default method using invocation handler.
+
+83
+00:06:38,000 --> 00:06:40,000
+Invoke default.
+
+84
+00:06:40,000 --> 00:06:45,000
+And as you can see, this method was introduced only in Java 16.
+
+85
+00:06:46,000 --> 00:06:51,000
+If the method is not a default method, it simply returns is a proxy instance.
+
+86
+00:06:52,000 --> 00:06:53,000
+Proxy Getclass get method.
+
+87
+00:06:54,000 --> 00:07:00,000
+Get text gets the get text message from the proxy class using reflection.
+
+88
+00:07:01,000 --> 00:07:08,000
+And you remember that get text is the only one default method in our default method on proxy Dharma
+
+89
+00:07:08,000 --> 00:07:09,000
+interface.
+
+90
+00:07:09,000 --> 00:07:16,000
+And then I just invoke the get text method on the proxy and prints the result to console.
+
+91
+00:07:16,000 --> 00:07:21,000
+So this example demonstrates the creation of a dynamic proxy instance.
+
+92
+00:07:21,000 --> 00:07:25,000
+Implementing the default method on proxy demo interface.
+
+93
+00:07:25,000 --> 00:07:34,000
+The invocation handler intercepts method calls on the proxy and for default methods uses invocation
+
+94
+00:07:34,000 --> 00:07:37,000
+handler invoke default to invoke them.
+
+95
+00:07:37,000 --> 00:07:43,000
+Finally, it invokes the get text method on the proxy and prints the result.
+
+96
+00:07:44,000 --> 00:07:51,000
+The ability to invoke default methods from the proxy instances in Java 16, facilitated by the invocation
+
+97
+00:07:51,000 --> 00:07:51,000
+handler.
+
+98
+00:07:51,000 --> 00:07:53,000
+Invoke default method.
+
+99
+00:07:53,000 --> 00:08:00,000
+Addresses scenarios where you want to create dynamic proxies for interfaces with default methods, and
+
+100
+00:08:00,000 --> 00:08:03,000
+control the behavior of these default methods.
+
+101
+00:08:04,000 --> 00:08:06,000
+Once this feature may be applicable.
+
+102
+00:08:06,000 --> 00:08:11,000
+Let's imagine you develop your own framework for aspect oriented programming.
+
+103
+00:08:12,000 --> 00:08:18,000
+If you want to learn more about aspect oriented programming, feel free to check the section about AOP
+
+104
+00:08:18,000 --> 00:08:19,000
+in my course.
+
+105
+00:08:19,000 --> 00:08:20,000
+Java from Zero to First Job.
+
+106
+00:08:21,000 --> 00:08:29,000
+But just to remind you that AOP framework can be implemented using reflection and this API will become
+
+107
+00:08:29,000 --> 00:08:30,000
+in handy.
+
+108
+00:08:31,000 --> 00:08:36,000
+You can also use dynamic proxies to have mocks for test purposes.
+
+109
+00:08:36,000 --> 00:08:43,000
+Again, if you need to develop your own framework for mock testing, you would need this feature too.
+
+110
+00:08:43,000 --> 00:08:49,000
+In case you would have any questions, please do not hesitate to ask your question below the video and
+
+111
+00:08:49,000 --> 00:08:51,000
+I will be happy to answer.
+
+112
+00:08:51,000 --> 00:08:53,000
+At the meantime, let's continue.
+
+113
+00:08:54,000 --> 00:08:58,000
+The next improvement is related to the date time formatter.
+
+114
+00:08:58,000 --> 00:09:01,000
+Day period support is added.
+
+115
+00:09:01,000 --> 00:09:09,000
+The B symbol in the date time formatter for day period support allows for more expressive formatting
+
+116
+00:09:09,000 --> 00:09:14,000
+of time, particularly for distinguishing between different periods of the day.
+
+117
+00:09:14,000 --> 00:09:17,000
+You will understand it better on example.
+
+118
+00:09:17,000 --> 00:09:20,000
+In this example we have two different times.
+
+119
+00:09:20,000 --> 00:09:30,000
+One is in the morning, which is 7:30 a.m. and one is in the evening, which is 8:45 p.m..
+
+120
+00:09:30,000 --> 00:09:40,000
+The date time formatter is set to use the h b pattern, which includes the hour in am PM format along
+
+121
+00:09:40,000 --> 00:09:49,000
+with the day period symbol B when we format the times using this formatter, the output might look like.
+
+122
+00:09:49,000 --> 00:09:50,000
+You can see in console.
+
+123
+00:09:51,000 --> 00:09:56,000
+You can see that it is seven in the morning and eight in the evening.
+
+124
+00:09:57,000 --> 00:10:03,000
+This demonstrates how the B symbol in the pattern can be used to provide a more descriptive representation
+
+125
+00:10:03,000 --> 00:10:07,000
+of the time, indicating whether it is the morning or evening.
+
+126
+00:10:08,000 --> 00:10:15,000
+This also can help you to improve user experience, and since Java 16 you have an API for this.
+
+127
+00:10:16,000 --> 00:10:19,000
+The next API update happened in stream API.
+
+128
+00:10:20,000 --> 00:10:24,000
+New method to list was added taking into account.
+
+129
+00:10:24,000 --> 00:10:31,000
+This is one of the most popular terminal methods that developers usually terminate string with, and
+
+130
+00:10:31,000 --> 00:10:37,000
+instead of using collectors to list method, it is simpler just to invoke the list methods straight
+
+131
+00:10:37,000 --> 00:10:39,000
+away on stream.
+
+132
+00:10:39,000 --> 00:10:41,000
+Let's review the example.
+
+133
+00:10:41,000 --> 00:10:50,000
+In this simple example, I create a list of seasons, and then I show two examples before Java 16 and
+
+134
+00:10:50,000 --> 00:10:51,000
+since Java 16.
+
+135
+00:10:52,000 --> 00:10:59,000
+If I want to make some transformation of objects in the stream, like in this case, I want to make
+
+136
+00:10:59,000 --> 00:11:04,000
+all strings uppercase, and then I want to collect stream back to the list.
+
+137
+00:11:04,000 --> 00:11:09,000
+Previously I needed to call collect method and pass collector there.
+
+138
+00:11:10,000 --> 00:11:15,000
+And as you can see, since Java 16 I can simply call the list method and that's it.
+
+139
+00:11:16,000 --> 00:11:25,000
+Let's review some other interesting Java enhancement proposals that were released in Java 16 Jep 392
+
+140
+00:11:25,000 --> 00:11:26,000
+package and two.
+
+141
+00:11:27,000 --> 00:11:32,000
+Introduces a new tool for packaging self-contained Java applications.
+
+142
+00:11:32,000 --> 00:11:38,000
+The tool is designed to replace the existing Java Packager tool, which has been removed.
+
+143
+00:11:38,000 --> 00:11:44,000
+The new packaging tool is more modular and provides improved support for native packaging format on
+
+144
+00:11:44,000 --> 00:11:46,000
+various platforms.
+
+145
+00:11:46,000 --> 00:11:52,000
+For example, from now on, it will be easier for you to create an installer of your Java application
+
+146
+00:11:52,000 --> 00:11:54,000
+for windows or macOS.
+
+147
+00:11:55,000 --> 00:12:01,000
+GEP 396 strongly encapsulate JDK internals by default.
+
+148
+00:12:02,000 --> 00:12:08,000
+It enhances the encapsulation of JDK internals by making stronger encapsulation the default.
+
+149
+00:12:08,000 --> 00:12:16,000
+This means that internal APIs, which were previously accessible, are now more strongly encapsulated
+
+150
+00:12:16,000 --> 00:12:17,000
+by default.
+
+151
+00:12:17,000 --> 00:12:23,000
+This aims to improve the long tum maintainability and security of the Java platform.
+
+152
+00:12:23,000 --> 00:12:34,000
+GEP 390 warnings for value based classes introduces compiler warnings for inappropriate use of value
+
+153
+00:12:34,000 --> 00:12:35,000
+based classes.
+
+154
+00:12:35,000 --> 00:12:37,000
+What are value based classes?
+
+155
+00:12:38,000 --> 00:12:45,000
+A value based class in Java is a class whose instances are intended to represent values rather than
+
+156
+00:12:45,000 --> 00:12:46,000
+entities.
+
+157
+00:12:46,000 --> 00:12:53,000
+These classes are designed to be immutable with their equality determined solely by their state.
+
+158
+00:12:54,000 --> 00:13:01,000
+The concept of value based classes was introduced as part of Project Valhalla, to enhance support for
+
+159
+00:13:01,000 --> 00:13:04,000
+value types in the Java programming language.
+
+160
+00:13:05,000 --> 00:13:11,000
+Examples of value based classes in Java include the string class and the wrapper classes for primitive
+
+161
+00:13:11,000 --> 00:13:14,000
+types like integer or double.
+
+162
+00:13:14,000 --> 00:13:22,000
+Instances of these classes represent values and their immutability, ensures predictability and simplifies
+
+163
+00:13:22,000 --> 00:13:24,000
+reasoning about their behavior.
+
+164
+00:13:25,000 --> 00:13:28,000
+Another question is what is Project Valhalla?
+
+165
+00:13:29,000 --> 00:13:36,000
+Project Valhalla is an ongoing initiative by the Java community to explore and introduce value types
+
+166
+00:13:36,000 --> 00:13:40,000
+and generic specialization into the Java programming language.
+
+167
+00:13:41,000 --> 00:13:48,000
+Value types aim to provide a more efficient representation of data by enabling developers to create
+
+168
+00:13:48,000 --> 00:13:55,000
+a lightweight, immutable, and performance oriented classes that act as values rather than objects.
+
+169
+00:13:56,000 --> 00:14:05,000
+So this GEP helps developers identify potential misuse of value based classes through compiler warnings.
+
+170
+00:14:05,000 --> 00:14:13,000
+While the GEP documentation doesn't specify specific cases that trigger warnings, we can discuss general
+
+171
+00:14:13,000 --> 00:14:18,000
+scenarios where misuse might occur, leading to compiler warnings.
+
+172
+00:14:18,000 --> 00:14:20,000
+Mutable value based classes.
+
+173
+00:14:21,000 --> 00:14:27,000
+Creating value based classes that are intended to be immutable but have mutable fields can be treated
+
+174
+00:14:27,000 --> 00:14:32,000
+as misuse, as inappropriate use of equals and hashCode.
+
+175
+00:14:33,000 --> 00:14:39,000
+Providing custom implementation for equals and hashCode that don't adhere to the value based semantics
+
+176
+00:14:39,000 --> 00:14:42,000
+can be also treated as misuse.
+
+177
+00:14:42,000 --> 00:14:45,000
+Incorrect use of annotations.
+
+178
+00:14:45,000 --> 00:14:51,000
+Applying annotations that conflict with the immutability or value based nature of the class.
+
+179
+00:14:51,000 --> 00:14:54,000
+Value based class with inheritance.
+
+180
+00:14:54,000 --> 00:14:59,000
+Incorrectly designed and value based classes in an inheritance hierarchy.
+
+181
+00:15:00,000 --> 00:15:05,000
+The next improvement is GEP 380 Unix domain sockets.
+
+182
+00:15:06,000 --> 00:15:13,000
+It adds support for Unix domain sockets to the socket channel and server socket channel APIs.
+
+183
+00:15:14,000 --> 00:15:20,000
+Unix domain sockets are a communication mechanism between processes on the same operating system, providing
+
+184
+00:15:20,000 --> 00:15:25,000
+a fast and efficient inter-process communication channel.
+
+185
+00:15:25,000 --> 00:15:30,000
+GEP 376 Xhgc.
+
+186
+00:15:30,000 --> 00:15:37,000
+Concurrent stack processing improves the Z garbage collector by introducing concurrent processing of
+
+187
+00:15:37,000 --> 00:15:45,000
+reference objects, which reduces the impact of garbage collection pauses on application response times.
+
+188
+00:15:46,000 --> 00:15:54,000
+This enhancement is part of ongoing efforts to make Xhgc even more suitable for low latency applications.
+
+189
+00:15:55,000 --> 00:15:59,000
+GEP 387 Elastic Matter Space.
+
+190
+00:16:00,000 --> 00:16:04,000
+First of all, let's remember what meta space memory is.
+
+191
+00:16:04,000 --> 00:16:11,000
+Meta space is a memory management area introduced in Java eight as a replacement for the traditional
+
+192
+00:16:11,000 --> 00:16:13,000
+permanent generation space.
+
+193
+00:16:13,000 --> 00:16:20,000
+Meta space is responsible for holding metadata about classes and methods in a Java application.
+
+194
+00:16:21,000 --> 00:16:28,000
+Unlike the Palm Jam space, which had a fixed size and could lead to issues like out-of-memory error
+
+195
+00:16:28,000 --> 00:16:35,000
+when full meta space is designed to dynamically adjust its size based on application demand.
+
+196
+00:16:36,000 --> 00:16:39,000
+And now let's get back to the GEP description.
+
+197
+00:16:39,000 --> 00:16:47,000
+This GEP enhances the Metaspace memory management in the Hot Spot virtual machine by introducing the
+
+198
+00:16:47,000 --> 00:16:49,000
+concept of elastic Metaspace.
+
+199
+00:16:49,000 --> 00:16:57,000
+This allows the Metaspace to efficiently handle memory requirements in dynamic and changing workloads,
+
+200
+00:16:57,000 --> 00:17:02,000
+preventing issues such as excessive memory usage during application startup.
+
+201
+00:17:03,000 --> 00:17:09,000
+Besides all what we have already learned, there are more improvements and updates in Java 16.
+
+202
+00:17:09,000 --> 00:17:12,000
+Feel free to pause the video to look through the slide.
+
+203
+00:17:13,000 --> 00:17:18,000
+In case you are interested in some specific update or improvement, feel free to let me know below the
+
+204
+00:17:18,000 --> 00:17:20,000
+video and I will elaborate more.
+
+205
+00:17:21,000 --> 00:17:27,000
+And in case there will be a lot of requests about the same thing, I will create a new lesson.
+
+206
+00:17:27,000 --> 00:17:32,000
+Once you are done with checking the list of other improvements, we resume the video.
+
+207
+00:17:33,000 --> 00:17:37,000
+Now let's review things that were removed in Java 16.
+
+208
+00:17:37,000 --> 00:17:42,000
+The class Java AWT pier fixer has been removed.
+
+209
+00:17:43,000 --> 00:17:50,000
+This class was part of the Abstract Window Toolkit and was used for certain platform specific fixes.
+
+210
+00:17:50,000 --> 00:17:58,000
+Its removal suggests that the need for such a class or its functionality is no longer relevant or necessary
+
+211
+00:17:58,000 --> 00:18:00,000
+in the context of Java 16.
+
+212
+00:18:00,000 --> 00:18:08,000
+The experimental ahead of time compilation feature and the Growl Just in Time compiler have been removed.
+
+213
+00:18:08,000 --> 00:18:14,000
+These features were experimental and not officially supported in previous versions.
+
+214
+00:18:14,000 --> 00:18:21,000
+The removal indicates a change in focus or a decision to deprecate these features due to various considerations,
+
+215
+00:18:21,000 --> 00:18:25,000
+including stability and performance concerns.
+
+216
+00:18:25,000 --> 00:18:32,000
+Tracing flags is deprecated in previous Java versions are now considered obsolete, and developers are
+
+217
+00:18:32,000 --> 00:18:37,000
+encouraged to replace them with equivalent options in the unified login framework.
+
+218
+00:18:38,000 --> 00:18:44,000
+This change aligns with the ongoing effort to improve and unify the login system in the Java Virtual
+
+219
+00:18:44,000 --> 00:18:45,000
+Machine.
+
+220
+00:18:45,000 --> 00:18:52,000
+Root certificates with 1024 bit keys have been removed from the Java Trust Store.
+
+221
+00:18:53,000 --> 00:19:00,000
+This is a security enhancement, as the use of stronger cryptographic keys is recommended to ensure
+
+222
+00:19:00,000 --> 00:19:03,000
+the security of the SSL TLS communications.
+
+223
+00:19:04,000 --> 00:19:04,000
+Legacy.
+
+224
+00:19:04,000 --> 00:19:09,000
+Elliptic curves that were considered weak or deprecated have been removed.
+
+225
+00:19:09,000 --> 00:19:17,000
+This removal aims to improve the security of cryptographic operations involving elliptic curves by discouraging
+
+226
+00:19:17,000 --> 00:19:21,000
+the use of insecure of outdated curve algorithms.
+
+227
+00:19:22,000 --> 00:19:27,000
+The time zone identifier US Pacific Nui has been removed.
+
+228
+00:19:27,000 --> 00:19:35,000
+This change aligns with updates to the time zone database and may reflect correct lessons or adjustments
+
+229
+00:19:35,000 --> 00:19:36,000
+to time zone definitions.
+
+230
+00:19:37,000 --> 00:19:41,000
+And of course, there are some things that were deprecated in Java 16.
+
+231
+00:19:41,000 --> 00:19:43,000
+Let's review them now.
+
+232
+00:19:44,000 --> 00:19:49,000
+Several masses in the Threadgroup class have been terminally deprecated.
+
+233
+00:19:49,000 --> 00:19:57,000
+These methods include stop destroy is destroyed set daemon and is daemon.
+
+234
+00:19:58,000 --> 00:19:59,000
+Terminally deprecated.
+
+235
+00:19:59,000 --> 00:20:00,000
+Means the.
+
+236
+00:20:00,000 --> 00:20:05,000
+These methods are deprecated with the intent to be removed in future versions of Java.
+
+237
+00:20:06,000 --> 00:20:14,000
+The usage of these methods is discouraged due to the inherent risks and potential for causing instability
+
+238
+00:20:14,000 --> 00:20:15,000
+in concurrent programs.
+
+239
+00:20:16,000 --> 00:20:21,000
+Certain parts of the signal chaining API have been deprecated.
+
+240
+00:20:21,000 --> 00:20:28,000
+This likely includes masses of functionality related to handling signals in the Java virtual machine.
+
+241
+00:20:28,000 --> 00:20:36,000
+Deprecation suggests that there are alternative approaches or improvements planned for this area, and
+
+242
+00:20:36,000 --> 00:20:40,000
+developers are encouraged to migrate to the recommended alternatives.
+
+243
+00:20:41,000 --> 00:20:49,000
+The Java Security CERT APIs that represent distinguished names as a principal or string objects have
+
+244
+00:20:49,000 --> 00:20:51,000
+been deprecated.
+
+245
+00:20:51,000 --> 00:20:58,000
+DNS are used in X509 certificates to identify the subject or issue.
+
+246
+00:20:59,000 --> 00:21:06,000
+This deprecation might be part of an effort to improve or modernize the representation of DNS in the
+
+247
+00:21:06,000 --> 00:21:13,000
+security related APIs, and developers are advised to use alternative methods or classes.
+
+248
+00:21:14,000 --> 00:21:14,000
+That's all.
+
+249
+00:21:14,000 --> 00:21:17,000
+What I wanted to share with you today in the lesson.
+
+250
+00:21:18,000 --> 00:21:20,000
+Let's recap what we have learned today.
+
+251
+00:21:21,000 --> 00:21:21,000
+Today.
+
+252
+00:21:21,000 --> 00:21:26,000
+During the lesson, we learned everything you need to know about Java 16 release.
+
+253
+00:21:26,000 --> 00:21:31,000
+We learned new features in Java 16 and also we saw code examples.
+
+254
+00:21:31,000 --> 00:21:36,000
+I showed you features and APIs that were removed in Java 16.
+
+255
+00:21:36,000 --> 00:21:42,000
+Also, we reviewed summary of features and elements that become deprecated in Java 16.
+
+256
+00:21:42,000 --> 00:21:43,000
+That's it.
+
+257
+00:21:43,000 --> 00:21:45,000
+Thanks a lot for your attention.
+
+258
+00:21:45,000 --> 00:21:48,000
+Have a great day and see you in the next lesson.
+
diff --git a/44 - Java New Versions/016 Source-code-example-from-the-lesson.url b/44 - Java New Versions/016 Source-code-example-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..47167d265b7e2eb566497c16775a544731580fb1
--- /dev/null
+++ b/44 - Java New Versions/016 Source-code-example-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/commit/050a58104e84e1d83a010e8cfb147ad5d3e3f570
\ No newline at end of file
diff --git a/44 - Java New Versions/017 Java 17 Sealed Classes & other improvements_en.srt b/44 - Java New Versions/017 Java 17 Sealed Classes & other improvements_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..b2c5c65567f80aca1710b061a82949419bb8f79c
--- /dev/null
+++ b/44 - Java New Versions/017 Java 17 Sealed Classes & other improvements_en.srt
@@ -0,0 +1,1168 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello, Tim.
+
+2
+00:00:06,000 --> 00:00:09,000
+In this lesson we will talk about Java 17.
+
+3
+00:00:10,000 --> 00:00:16,000
+Continuing series of lessons about new Java versions will stick to our regular agenda.
+
+4
+00:00:16,000 --> 00:00:21,000
+Namely, we'll learn new language features and APIs added to Java 17.
+
+5
+00:00:21,000 --> 00:00:26,000
+I will explain new JDK tools and features on code examples.
+
+6
+00:00:26,000 --> 00:00:33,000
+Then I will show you the things that were removed from Java 17 and that were marked as deprecated in
+
+7
+00:00:33,000 --> 00:00:34,000
+this version.
+
+8
+00:00:35,000 --> 00:00:40,000
+After this lesson, you will know everything you need to know about Java 17.
+
+9
+00:00:40,000 --> 00:00:44,000
+The detailed agenda of the lesson you can see on the slides.
+
+10
+00:00:45,000 --> 00:00:46,000
+Let's start our lesson.
+
+11
+00:00:47,000 --> 00:00:53,000
+And before we jump to learning the details of Java Seventeens release, it is important to mention that
+
+12
+00:00:53,000 --> 00:00:57,000
+Java 17 is a long charm release.
+
+13
+00:00:57,000 --> 00:01:02,000
+We already learned LTS concept in multiple lessons before.
+
+14
+00:01:02,000 --> 00:01:05,000
+That's why I wouldn't stop on this too much.
+
+15
+00:01:05,000 --> 00:01:13,000
+But important thing to add is that since Java 17, there will be shorter intervals between LTS versions.
+
+16
+00:01:13,000 --> 00:01:22,000
+I believe you remember that the previous LTS version was Java 11, and since Java 17 there is a plan
+
+17
+00:01:22,000 --> 00:01:29,000
+to release LTS version each two years, taking into account six months release cadence.
+
+18
+00:01:29,000 --> 00:01:34,000
+The next long Tum support version will be Java 21.
+
+19
+00:01:34,000 --> 00:01:38,000
+So that was a side note about Long Tum support release.
+
+20
+00:01:38,000 --> 00:01:40,000
+And now we can continue.
+
+21
+00:01:40,000 --> 00:01:46,000
+Today we are going to have practical examples in order to review some features that were released in
+
+22
+00:01:46,000 --> 00:01:47,000
+Java 17.
+
+23
+00:01:47,000 --> 00:01:53,000
+As always, you will be able to find source code examples from the lesson in attachments to the video.
+
+24
+00:01:53,000 --> 00:01:58,000
+In case you will have any questions during the lesson, please do not hesitate to post your questions
+
+25
+00:01:58,000 --> 00:02:01,000
+below the video and I will be happy to answer.
+
+26
+00:02:02,000 --> 00:02:06,000
+And the first feature that I would like to demo today is Sealed Classes.
+
+27
+00:02:07,000 --> 00:02:13,000
+This is one of the most important features in Java 17 and one of the most anticipated.
+
+28
+00:02:13,000 --> 00:02:16,000
+That's why let's review it in details.
+
+29
+00:02:16,000 --> 00:02:24,000
+Java Enhancement Proposal 409, in Java 17 introduces enhancements to sealed classes.
+
+30
+00:02:25,000 --> 00:02:30,000
+Sealed classes restrict which other classes may extend them.
+
+31
+00:02:30,000 --> 00:02:38,000
+The feature was available in preview mode since Java 15, but in Java 17, the Sealed classes feature
+
+32
+00:02:38,000 --> 00:02:42,000
+is refined to provide more flexibility and usability.
+
+33
+00:02:42,000 --> 00:02:48,000
+Sealed classes are types that explicitly specify the classes allowed to extend them.
+
+34
+00:02:49,000 --> 00:02:54,000
+This helps in creating a more controlled and predictable class hierarchy.
+
+35
+00:02:55,000 --> 00:02:58,000
+Let's review the demo that I prepared for the lesson.
+
+36
+00:02:58,000 --> 00:03:03,000
+We'll start from creating sealed class and permit subclasses.
+
+37
+00:03:03,000 --> 00:03:07,000
+At the beginning, let's create sealed class.
+
+38
+00:03:07,000 --> 00:03:11,000
+In our example, I define sealed class with name shape.
+
+39
+00:03:12,000 --> 00:03:13,000
+Everything is simple.
+
+40
+00:03:14,000 --> 00:03:18,000
+You just need to add sealed keyword before class definition.
+
+41
+00:03:18,000 --> 00:03:19,000
+And that's it.
+
+42
+00:03:20,000 --> 00:03:23,000
+Sealed classes are the same as regular classes.
+
+43
+00:03:23,000 --> 00:03:26,000
+You can extend them from other classes.
+
+44
+00:03:26,000 --> 00:03:32,000
+You can implement interfaces as usual, but on top of that you can specify which classes are allowed
+
+45
+00:03:32,000 --> 00:03:34,000
+to extend the current one.
+
+46
+00:03:35,000 --> 00:03:40,000
+This is done using the permits keyword followed by the name of the allowed subclass.
+
+47
+00:03:40,000 --> 00:03:45,000
+The only one restriction in the syntax that you should remember about permits.
+
+48
+00:03:45,000 --> 00:03:50,000
+Keyword should go after extends and after implements declarations.
+
+49
+00:03:50,000 --> 00:03:57,000
+In the same way, you can declare interfaces and list types that are allowed to implement interface.
+
+50
+00:03:57,000 --> 00:04:03,000
+As you can see in this example, I already created different classes and here you need to understand
+
+51
+00:04:03,000 --> 00:04:07,000
+few important restrictions for permitted classes.
+
+52
+00:04:07,000 --> 00:04:12,000
+All permitted subclasses must belong to the same module as the sealed class.
+
+53
+00:04:13,000 --> 00:04:20,000
+Every permitted subclass must explicitly extend the sealed class, and you can see in our example I
+
+54
+00:04:20,000 --> 00:04:28,000
+extend the superclass and implement interface for the sake of the demo two, and the last but not the
+
+55
+00:04:28,000 --> 00:04:29,000
+least restriction.
+
+56
+00:04:29,000 --> 00:04:35,000
+Every permitted subclass must be either final or non sealed or sealed.
+
+57
+00:04:35,000 --> 00:04:38,000
+And here you can see all three examples.
+
+58
+00:04:38,000 --> 00:04:43,000
+Final class means that it is not allowed to extend this class.
+
+59
+00:04:43,000 --> 00:04:48,000
+Non sealed class means that the class is open for extension.
+
+60
+00:04:48,000 --> 00:04:52,000
+And regarding sealed classes, you are already aware.
+
+61
+00:04:52,000 --> 00:04:57,000
+We need to declare a list of permitted classes for extension and permitted classes need to extend the
+
+62
+00:04:57,000 --> 00:04:58,000
+superclass.
+
+63
+00:04:58,000 --> 00:05:01,000
+That's why I created one more class.
+
+64
+00:05:02,000 --> 00:05:04,000
+My recommendation for you.
+
+65
+00:05:04,000 --> 00:05:10,000
+Take my source code example or open your IDE and try to create sealed classes.
+
+66
+00:05:11,000 --> 00:05:17,000
+After creation of few sealed classes, interfaces, implementations and extensions, you will understand
+
+67
+00:05:17,000 --> 00:05:18,000
+how it works.
+
+68
+00:05:19,000 --> 00:05:25,000
+So in case it looks a little bit complicated for you, just play with different variations in your IDE.
+
+69
+00:05:26,000 --> 00:05:34,000
+Let me uncomment this line and we will see compilation error in this line, because custom shape two
+
+70
+00:05:34,000 --> 00:05:35,000
+is not permitted.
+
+71
+00:05:35,000 --> 00:05:36,000
+Subtype of shape.
+
+72
+00:05:37,000 --> 00:05:43,000
+And as always, in case there will be any questions, please do not hesitate to ask your questions below
+
+73
+00:05:43,000 --> 00:05:45,000
+the video and I will be happy to answer.
+
+74
+00:05:45,000 --> 00:05:47,000
+Let's continue.
+
+75
+00:05:47,000 --> 00:05:53,000
+Let's review other Java enhancement proposals that were released in Java 17.
+
+76
+00:05:53,000 --> 00:05:56,000
+Java Enhancement Proposal 306.
+
+77
+00:05:56,000 --> 00:06:00,000
+Restore always strict floating point semantics.
+
+78
+00:06:00,000 --> 00:06:08,000
+The primary goal of this Jep is to bring Java's floating point arithmetic, in strict compliance with
+
+79
+00:06:08,000 --> 00:06:12,000
+the IEEE 754 standard.
+
+80
+00:06:13,000 --> 00:06:20,000
+This standard defines the rules and formats for representing and performing arithmetic on floating point
+
+81
+00:06:20,000 --> 00:06:20,000
+numbers.
+
+82
+00:06:21,000 --> 00:06:28,000
+Historically, Java has allowed some relaxation in certain floating point operations to enhance performance.
+
+83
+00:06:28,000 --> 00:06:36,000
+However, this GEP aims to revert to always strict floating point semantics for better consistency and
+
+84
+00:06:36,000 --> 00:06:38,000
+adherence to the standard.
+
+85
+00:06:39,000 --> 00:06:44,000
+The interesting thing is that you may not even notice the difference at the beginning.
+
+86
+00:06:44,000 --> 00:06:53,000
+The impact of GEP 306 is more likely to be observed in edge cases or complex mathematical operations,
+
+87
+00:06:53,000 --> 00:06:58,000
+where floating point precision and rounding behavior play a crucial role.
+
+88
+00:06:58,000 --> 00:07:00,000
+The next improvement.
+
+89
+00:07:00,000 --> 00:07:06,000
+Java Enhancement proposals 356 enhanced pseudorandom number generators.
+
+90
+00:07:07,000 --> 00:07:13,000
+This GEP introduces new interfaces and implementations for pseudorandom number generators.
+
+91
+00:07:14,000 --> 00:07:18,000
+It provides additional flexibility and features for generating random numbers.
+
+92
+00:07:18,000 --> 00:07:26,000
+Developers now have more control over the selection of pseudo random number generator algorithm, and
+
+93
+00:07:26,000 --> 00:07:30,000
+can choose the one that best fits their requirements.
+
+94
+00:07:30,000 --> 00:07:38,000
+The enhanced interfaces allow specifying seed values, string positions, and other parameters given
+
+95
+00:07:38,000 --> 00:07:42,000
+finer control over the random number generation process.
+
+96
+00:07:42,000 --> 00:07:49,000
+The new interfaces and implementations may come with additional features and capabilities that go beyond
+
+97
+00:07:49,000 --> 00:07:55,000
+the basic random number generation, providing a more comprehensive set of functionalities.
+
+98
+00:07:55,000 --> 00:08:05,000
+Developers can explore and utilize the new interfaces and implementations introduced by Jep 356 to tailor
+
+99
+00:08:05,000 --> 00:08:11,000
+the random number generation process according to their specific needs, leading to enhanced control
+
+100
+00:08:11,000 --> 00:08:15,000
+and functionality in applications relying on random numbers.
+
+101
+00:08:15,000 --> 00:08:21,000
+Java Enhancement Proposal 382 new macOS rendering pipeline.
+
+102
+00:08:22,000 --> 00:08:27,000
+It replaces the existing rendering pipeline on macOS with the metal framework.
+
+103
+00:08:27,000 --> 00:08:31,000
+In the context of graphics programming and Java applications.
+
+104
+00:08:31,000 --> 00:08:38,000
+By rendering, pipeline refers to the series of stages and processes involved in converting graphical
+
+105
+00:08:38,000 --> 00:08:41,000
+data into pixels on the screen.
+
+106
+00:08:41,000 --> 00:08:48,000
+The rendering pipeline is responsible for taking graphical elements such as shapes, textures, and
+
+107
+00:08:48,000 --> 00:08:54,000
+other visual components, and transforming them into a final image that can be displayed on the screen.
+
+108
+00:08:55,000 --> 00:09:00,000
+As a result, we got improved graphics performance and compatibility on macOS.
+
+109
+00:09:00,000 --> 00:09:08,000
+Also, Jep 382 lead us to better integration with modern macOS graphics technologies.
+
+110
+00:09:08,000 --> 00:09:13,000
+The next improvement is Java Enhancement Proposal 391.
+
+111
+00:09:13,000 --> 00:09:16,000
+macOS Aarch64 port.
+
+112
+00:09:17,000 --> 00:09:27,000
+The primary purpose of Jep 391 is to introduce port support for macOS on the arch Arm64 architecture.
+
+113
+00:09:28,000 --> 00:09:42,000
+The Aarch64 architecture, also known as Arm64 or Armv8-a, is a 64 bit extension of the ARM architecture.
+
+114
+00:09:42,000 --> 00:09:52,000
+ARM Acorn Risk Machine is a family of reduced instruction set computing architectures for computer processors,
+
+115
+00:09:52,000 --> 00:09:55,000
+initially developed by ARM Holdings.
+
+116
+00:09:55,000 --> 00:10:07,000
+Arch 64 is architecture used in Armv8-a processors, supporting 64 bit memory addressing and instructions.
+
+117
+00:10:07,000 --> 00:10:17,000
+Apple's M1, M1 Pro, and M1 Max processors found in the MacBook air, MacBook Pro, and Mac mini models
+
+118
+00:10:17,000 --> 00:10:20,000
+use the Aarch64 architecture.
+
+119
+00:10:20,000 --> 00:10:23,000
+These devices run on Mac OS.
+
+120
+00:10:24,000 --> 00:10:31,000
+Aarch64 is well supported by various Linux distributions, making it a common choice for servers and
+
+121
+00:10:31,000 --> 00:10:32,000
+embedded systems.
+
+122
+00:10:33,000 --> 00:10:40,000
+This GEP enables Java applications to run on macOS devices using the Aarch64 architecture.
+
+123
+00:10:41,000 --> 00:10:48,000
+We can say that as a benefit of this GEP, we got increased platform support, particularly relevant
+
+124
+00:10:48,000 --> 00:10:51,000
+for Apple Silicon based Macs.
+
+125
+00:10:51,000 --> 00:10:59,000
+The adoption of Aarch64 architecture is growing across a wide range of devices and platforms due to
+
+126
+00:10:59,000 --> 00:11:06,000
+its energy efficiency, performance capabilities, and support for a diverse set of applications.
+
+127
+00:11:07,000 --> 00:11:12,000
+The next Java enhancement proposal is GEP 415.
+
+128
+00:11:12,000 --> 00:11:16,000
+Implement context specific Deserialization filters.
+
+129
+00:11:16,000 --> 00:11:26,000
+The primary purpose of GEP 415 is to enhance the Deserialization filters introduced in GEP 290.
+
+130
+00:11:26,000 --> 00:11:32,000
+It achieves this by introducing a configurable JVM wide filter factory.
+
+131
+00:11:32,000 --> 00:11:38,000
+This enhancement provides a more dynamic and context specific approach to deserialization filters in
+
+132
+00:11:38,000 --> 00:11:39,000
+Java.
+
+133
+00:11:39,000 --> 00:11:47,000
+GEP 415, which introduces context specific Deserialization filters in Java, is applicable in scenarios
+
+134
+00:11:47,000 --> 00:11:54,000
+where Java applications need to deserialize data, and there is a requirement for enhanced security
+
+135
+00:11:54,000 --> 00:11:57,000
+and dynamic adaptability in the filtering process.
+
+136
+00:11:58,000 --> 00:12:05,000
+When an application receives data from untrusted sources, such as over the network or from external
+
+137
+00:12:05,000 --> 00:12:05,000
+storage.
+
+138
+00:12:05,000 --> 00:12:09,000
+The Deserialization process can be vulnerable to attacks.
+
+139
+00:12:10,000 --> 00:12:14,000
+GEP 415 is applicable in such cases.
+
+140
+00:12:14,000 --> 00:12:22,000
+The implement context specific filters that investigate and explore the incoming data and ensure that
+
+141
+00:12:22,000 --> 00:12:25,000
+only trusted classes are deserialized.
+
+142
+00:12:26,000 --> 00:12:33,000
+This improvement also useful in applications running in multi-tenant environments where multiple tenants
+
+143
+00:12:33,000 --> 00:12:36,000
+share the same application instance.
+
+144
+00:12:36,000 --> 00:12:40,000
+It might be necessary to apply different deserialization filters for each tenant.
+
+145
+00:12:41,000 --> 00:12:49,000
+The impact of GEP 415 is enabling the implementation of Deserialization filters that can be dynamically
+
+146
+00:12:49,000 --> 00:12:52,000
+configured based on the execution context.
+
+147
+00:12:53,000 --> 00:13:00,000
+This context specific filtering allows for more granular control over the deserialization process by
+
+148
+00:13:00,000 --> 00:13:04,000
+introducing a configurable JVM wide filter factory.
+
+149
+00:13:04,000 --> 00:13:11,000
+Jep 415 enhances security by providing developers with the ability to define Deserialization filters
+
+150
+00:13:11,000 --> 00:13:15,000
+specific to different execution contexts.
+
+151
+00:13:15,000 --> 00:13:22,000
+This improved control helps prevent security vulnerabilities associated with deserialization of untrusted
+
+152
+00:13:22,000 --> 00:13:23,000
+data.
+
+153
+00:13:23,000 --> 00:13:29,000
+Besides all what we have already learned, there are more improvements and updates in Java 17.
+
+154
+00:13:29,000 --> 00:13:32,000
+Feel free to pause the video to look through the slide.
+
+155
+00:13:33,000 --> 00:13:39,000
+In case you are interested in some specific update or improvement, feel free to let me know below the
+
+156
+00:13:39,000 --> 00:13:41,000
+video and I will elaborate more.
+
+157
+00:13:41,000 --> 00:13:48,000
+And in case there will be a lot of requests about the same thing, I will create a new lesson.
+
+158
+00:13:48,000 --> 00:13:52,000
+Once you are done with checking the list of other improvements.
+
+159
+00:13:52,000 --> 00:13:54,000
+Resume the video.
+
+160
+00:13:54,000 --> 00:13:57,000
+And of course usually removed API's.
+
+161
+00:13:57,000 --> 00:14:01,000
+Options and features are part of new Java release notes too.
+
+162
+00:14:02,000 --> 00:14:04,000
+Let's review now removed items.
+
+163
+00:14:05,000 --> 00:14:11,000
+Java Enhancement Proposal 403 strongly encapsulate JDK internals.
+
+164
+00:14:12,000 --> 00:14:20,000
+Jep 403 aimed to make stronger the encapsulation of internal APIs within the JDK.
+
+165
+00:14:20,000 --> 00:14:27,000
+The goal was to make internal APIs inaccessible by default, limiting their usage to JDK components
+
+166
+00:14:27,000 --> 00:14:28,000
+only.
+
+167
+00:14:28,000 --> 00:14:37,000
+Jep 403 marks a significant step in the ongoing effort to making stronger the encapsulation of JDK and
+
+168
+00:14:37,000 --> 00:14:40,000
+channels by removing the illegal access flag.
+
+169
+00:14:41,000 --> 00:14:48,000
+The illegal access flag was introduced as a transitional mechanism in JDK nine to ease the migration
+
+170
+00:14:48,000 --> 00:14:55,000
+to the modular system, specifically during the transition from the monolithic class pass to the modular
+
+171
+00:14:55,000 --> 00:14:56,000
+system.
+
+172
+00:14:56,000 --> 00:15:03,000
+The removal of the illegal access flag means that the platform will no longer recognize this flag,
+
+173
+00:15:03,000 --> 00:15:07,000
+and any attempt to use it will be ignored.
+
+174
+00:15:07,000 --> 00:15:13,000
+If the flag is present in the command line, a message will be issued to the console notifying users
+
+175
+00:15:13,000 --> 00:15:16,000
+about the discontinuation of the flag.
+
+176
+00:15:16,000 --> 00:15:23,000
+The intention behind this change is to reinforce the strong encapsulation of internal APIs within the
+
+177
+00:15:23,000 --> 00:15:24,000
+JDK.
+
+178
+00:15:24,000 --> 00:15:31,000
+The Illegal access flag was a temporary measure to allow developers to migrate existing code bases gradually.
+
+179
+00:15:32,000 --> 00:15:39,000
+However, relying on this flag became discouraged as it provided a workaround for using internal APIs
+
+180
+00:15:39,000 --> 00:15:46,000
+that were not part of the public API and therefore not intended for general use.
+
+181
+00:15:47,000 --> 00:15:47,000
+Removed.
+
+182
+00:15:47,000 --> 00:15:51,000
+Telia company Sonera class two CA certificate.
+
+183
+00:15:51,000 --> 00:15:55,000
+This refers to the removal of a specific certificate.
+
+184
+00:15:55,000 --> 00:16:00,000
+Authority certificate belonging to Telia Company.
+
+185
+00:16:00,000 --> 00:16:08,000
+Sonera class two case are entities that issue digital certificates, and their certificates are used
+
+186
+00:16:08,000 --> 00:16:10,000
+in various security protocols.
+
+187
+00:16:10,000 --> 00:16:17,000
+If you follow my lessons about Java new versions updates, then you already know that in each release
+
+188
+00:16:17,000 --> 00:16:21,000
+some certificates are removed because of the security reasons.
+
+189
+00:16:21,000 --> 00:16:27,000
+Removal may be due to expiration, security concerns, or changes in trust policies.
+
+190
+00:16:28,000 --> 00:16:37,000
+Removal of sun misc unsafe define anonymous class the removal of sun misc unsafe define anonymous class
+
+191
+00:16:37,000 --> 00:16:40,000
+involves eliminating a message from the sun.
+
+192
+00:16:40,000 --> 00:16:42,000
+Misc unsafe class.
+
+193
+00:16:42,000 --> 00:16:46,000
+This method allowed the creation of anonymous class dynamically.
+
+194
+00:16:47,000 --> 00:16:54,000
+The removal effects code that relied on the ability to define anonymous classes using some misc unsafe
+
+195
+00:16:54,000 --> 00:16:55,000
+class.
+
+196
+00:16:55,000 --> 00:17:00,000
+Such code may need to be refactored or adjusted to use alternative approaches.
+
+197
+00:17:01,000 --> 00:17:08,000
+The use of some misc unsafe is discouraged due to its association with unsafe operations.
+
+198
+00:17:09,000 --> 00:17:15,000
+Removing this method aligns with ongoing efforts to limit the use of unsafe practices in Java.
+
+199
+00:17:16,000 --> 00:17:22,000
+Java Enhancement Proposal 407 remove RMI activation.
+
+200
+00:17:23,000 --> 00:17:32,000
+GEP 407 aimed to remove the Remote Method Invocation activation system, which allowed the activation
+
+201
+00:17:32,000 --> 00:17:35,000
+of objects in a distributed system.
+
+202
+00:17:35,000 --> 00:17:42,000
+RMI activation was considered outdated and its relevance had reduced over time.
+
+203
+00:17:43,000 --> 00:17:48,000
+Modern distributed computing practices often favor alternative approaches.
+
+204
+00:17:49,000 --> 00:17:57,000
+RMI activation has security implications to removing it, streamlines the RMI subsystem, and promotes
+
+205
+00:17:57,000 --> 00:18:00,000
+more secure and modern alternatives.
+
+206
+00:18:00,000 --> 00:18:08,000
+Developers who were relying on RMI activation can explore alternative approaches such as explicit object
+
+207
+00:18:08,000 --> 00:18:15,000
+instantiation, lazy loading, or other distributed activation mechanisms offered by modern frameworks
+
+208
+00:18:15,000 --> 00:18:16,000
+and technologies.
+
+209
+00:18:17,000 --> 00:18:24,000
+Java Enhancement Proposal 410 removes the experimental art and JIT compiler.
+
+210
+00:18:25,000 --> 00:18:33,000
+GEP 410 focused on removing the experimental ahead of time and just in time compiler implementations
+
+211
+00:18:33,000 --> 00:18:35,000
+from the GCC.
+
+212
+00:18:35,000 --> 00:18:39,000
+These compilers translate Java bytecode into machine code.
+
+213
+00:18:40,000 --> 00:18:48,000
+Aot and JIT compilers were labeled as experimental features, indicating that they were not considered
+
+214
+00:18:48,000 --> 00:18:50,000
+stable or fully supported.
+
+215
+00:18:51,000 --> 00:18:55,000
+Developers use an experimental Aot or JIT.
+
+216
+00:18:55,000 --> 00:19:01,000
+Compilers need to be aware that these features are no longer available in Java 17.
+
+217
+00:19:01,000 --> 00:19:08,000
+The removal is likely due to the experimental nature of these features, and the need to simplify the
+
+218
+00:19:08,000 --> 00:19:11,000
+maintenance and development efforts within the GCC.
+
+219
+00:19:12,000 --> 00:19:17,000
+It indicates a shift away from these experimental compiler options.
+
+220
+00:19:18,000 --> 00:19:24,000
+Developers seeking similar compilation capabilities may explore third party tools or frameworks that
+
+221
+00:19:24,000 --> 00:19:28,000
+specialize in Aot or JIT compilation.
+
+222
+00:19:28,000 --> 00:19:35,000
+Additionally, traditional JIT compilation, which is well established and widely used approach, remains
+
+223
+00:19:35,000 --> 00:19:37,000
+available in the GCC.
+
+224
+00:19:38,000 --> 00:19:44,000
+In summary, this removals and deprecations in Java 17 are in line with the broader goals of improving
+
+225
+00:19:44,000 --> 00:19:52,000
+security, stability and maintainability while discouraging the use of outdated or experimental features.
+
+226
+00:19:52,000 --> 00:19:59,000
+Developers should review their code bases and update their applications accordingly to adapt to these
+
+227
+00:19:59,000 --> 00:20:00,000
+changes.
+
+228
+00:20:00,000 --> 00:20:04,000
+Let's review items that were deprecated in Java 17.
+
+229
+00:20:05,000 --> 00:20:08,000
+Java Enhancement Proposals 398.
+
+230
+00:20:08,000 --> 00:20:11,000
+Deprecated the applet API for removal.
+
+231
+00:20:12,000 --> 00:20:20,000
+Jep 398 proposes a deprecation of the applet API, with the intention of removing it in future releases.
+
+232
+00:20:21,000 --> 00:20:28,000
+The applet API was historically used for developing Java applets, which were small applications typically
+
+233
+00:20:28,000 --> 00:20:30,000
+embedded within web browsers.
+
+234
+00:20:31,000 --> 00:20:37,000
+The deprecation of the applet API signifies that the API is considered obsolete, and will likely be
+
+235
+00:20:37,000 --> 00:20:39,000
+removed in subsequent Java releases.
+
+236
+00:20:40,000 --> 00:20:43,000
+This deprecation is driven by several factors.
+
+237
+00:20:43,000 --> 00:20:47,000
+Number one decline in applet usage.
+
+238
+00:20:47,000 --> 00:20:53,000
+The use of Java applets has significantly declined over the years due to the changes in web technologies
+
+239
+00:20:53,000 --> 00:20:58,000
+and security concerns associated with browser plugins.
+
+240
+00:20:58,000 --> 00:21:06,000
+Number two, modern web standards and point number three modern web development practices favor other
+
+241
+00:21:06,000 --> 00:21:09,000
+technologies over Java applets.
+
+242
+00:21:09,000 --> 00:21:15,000
+Deprecating the applet API aligns with the shift towards contemporary web standards.
+
+243
+00:21:16,000 --> 00:21:22,000
+Java Enhancement Proposal 411 deprecated the Security Manager for removal.
+
+244
+00:21:22,000 --> 00:21:30,000
+Jep 411 proposes the deprecation of the Security Manager with the intention of removing it in future
+
+245
+00:21:30,000 --> 00:21:31,000
+releases.
+
+246
+00:21:31,000 --> 00:21:38,000
+The Security Manager is a component responsible for enforcing security policies within Java applications.
+
+247
+00:21:39,000 --> 00:21:46,000
+Risks addressed by the security manager, especially related to applets, have significantly decreased,
+
+248
+00:21:47,000 --> 00:21:51,000
+and it can't address many current security challenges.
+
+249
+00:21:51,000 --> 00:21:54,000
+The deprecation is motivated by the following factors.
+
+250
+00:21:55,000 --> 00:21:57,000
+Complexity and maintenance.
+
+251
+00:21:57,000 --> 00:22:02,000
+The security manager introduces complexity and maintenance overhead and deprecating.
+
+252
+00:22:02,000 --> 00:22:06,000
+It allows for simplification of the security model within Java.
+
+253
+00:22:07,000 --> 00:22:09,000
+Security concerns.
+
+254
+00:22:09,000 --> 00:22:15,000
+Modern security practices may involve alternative mechanisms that better address contemporary security
+
+255
+00:22:15,000 --> 00:22:16,000
+challenges.
+
+256
+00:22:17,000 --> 00:22:22,000
+Deprecate triple D, E, S and RC4 in Kerberos.
+
+257
+00:22:23,000 --> 00:22:31,000
+The deprecation of triple G, E, S, and Arc4 in Kerberos involves marking these cryptographic algorithms
+
+258
+00:22:31,000 --> 00:22:35,000
+as deprecated in the Kerberos security protocol.
+
+259
+00:22:36,000 --> 00:22:47,000
+Triple D is also known as TDA that stands for Triple Data Encryption Algorithm is a symmetric key encryption
+
+260
+00:22:47,000 --> 00:22:48,000
+algorithm.
+
+261
+00:22:48,000 --> 00:22:56,000
+It is an extension of the original D, E, s that stands for Data Encryption Standard algorithm, but
+
+262
+00:22:56,000 --> 00:23:02,000
+involves applying the D s algorithm three times to each data block.
+
+263
+00:23:02,000 --> 00:23:09,000
+Each block is encrypted with one key, decrypted with another key, and then encrypt it again with a
+
+264
+00:23:09,000 --> 00:23:10,000
+set key.
+
+265
+00:23:11,000 --> 00:23:19,000
+Arc4 is a symmetric stream cipher algorithm designed by Ron Rivest in 1987.
+
+266
+00:23:19,000 --> 00:23:26,000
+It is widely used for its simplicity and speed in generating a stream of pseudo random bits.
+
+267
+00:23:26,000 --> 00:23:33,000
+This deprecation is based on the need to address security vulnerabilities associated with all the cryptographic
+
+268
+00:23:33,000 --> 00:23:34,000
+algorithms.
+
+269
+00:23:35,000 --> 00:23:44,000
+Triple G, S, and Arc4 are considered less secure, and deprecating them encourages the use of stronger
+
+270
+00:23:44,000 --> 00:23:47,000
+and more modern encryption techniques.
+
+271
+00:23:47,000 --> 00:23:51,000
+Deprecate the socket implementation factory mechanism.
+
+272
+00:23:51,000 --> 00:23:57,000
+This mechanism allows applications to set a factory for creating socket implementations.
+
+273
+00:23:58,000 --> 00:24:01,000
+This deprecation is motivated by the following things.
+
+274
+00:24:01,000 --> 00:24:03,000
+Simplification of socket configuration.
+
+275
+00:24:04,000 --> 00:24:10,000
+Encouraging the use of more standardized and straightforward socket configuration approaches.
+
+276
+00:24:11,000 --> 00:24:12,000
+Maintainability.
+
+277
+00:24:12,000 --> 00:24:17,000
+Simplifying the maintenance and evolution of socket related features within the GCC.
+
+278
+00:24:18,000 --> 00:24:23,000
+Deprecate JVM TI heap functions 1.0.
+
+279
+00:24:24,000 --> 00:24:34,000
+The deprecation of JVM TI t stands for two interface heap functions 1.0 involves marking these heap
+
+280
+00:24:34,000 --> 00:24:39,000
+related functions as deprecated within the Jvmti interface.
+
+281
+00:24:40,000 --> 00:24:47,000
+Developers using the deprecated GMT heap functions should transition to alternative interfaces or newer
+
+282
+00:24:47,000 --> 00:24:50,000
+versions of the GMT interface.
+
+283
+00:24:51,000 --> 00:24:51,000
+That's all.
+
+284
+00:24:51,000 --> 00:24:54,000
+What I wanted to review with you in this lesson.
+
+285
+00:24:54,000 --> 00:24:57,000
+Let's recap what we have learned today.
+
+286
+00:24:58,000 --> 00:25:04,000
+Today during the lesson, we learned everything you need to know about Java 17 release.
+
+287
+00:25:05,000 --> 00:25:10,000
+We learned new features in Java 17 and also we saw code examples.
+
+288
+00:25:10,000 --> 00:25:14,000
+I showed you features and APIs that were removed in Java 17.
+
+289
+00:25:15,000 --> 00:25:21,000
+Also, we reviewed summary of features and elements that become deprecated in Java 17.
+
+290
+00:25:21,000 --> 00:25:22,000
+That's it.
+
+291
+00:25:22,000 --> 00:25:24,000
+Thanks a lot for your attention.
+
+292
+00:25:24,000 --> 00:25:27,000
+Have a great day and see you in the next lesson.
+
diff --git a/44 - Java New Versions/017 Source-code-example-from-the-lesson.url b/44 - Java New Versions/017 Source-code-example-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..c9fd9835aa40683569ea999d23813175d3046cb2
--- /dev/null
+++ b/44 - Java New Versions/017 Source-code-example-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/commit/14ed22191e1e032b903b7082dddce64f2fe02f41
\ No newline at end of file
diff --git a/44 - Java New Versions/018 Java 18.html b/44 - Java New Versions/018 Java 18.html
new file mode 100644
index 0000000000000000000000000000000000000000..d771c4f3245f342057845c2ca6c5ad2fd4eab2a2
--- /dev/null
+++ b/44 - Java New Versions/018 Java 18.html
@@ -0,0 +1,176 @@
+
+
+
+
+
+ Java 18
+
+
+
+
+
+
+
Java 18
+
Java 18, released by Oracle in March 2022, introduced a number of enhancements and new features aimed at improving developer productivity, performance, and the overall platform's capabilities. Here are the key updates and features of Java 18 with detailed explanations and examples:
1. UTF-8 by Default (JEP 400)
This update ensures that UTF-8 is the default charset for the Java standard APIs, regardless of the operating system.
Benefits:
Example:
import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardOpenOption;
+
+public class UTF8DefaultExample {
+ public static void main(String[] args) throws Exception {
+ Path path = Path.of("example.txt");
+ Files.writeString(path, "This is a UTF-8 encoded string.", StandardOpenOption.CREATE);
+ String content = Files.readString(path);
+ System.out.println(content);
+ }
+}This code guarantees UTF-8 encoding without needing to specify it explicitly.
2. Simple Web Server (JEP 408)
A minimal HTTP server has been added for prototyping, testing, and development purposes. It is not intended for production use.
Features:
Example:
import com.sun.net.httpserver.HttpServer;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+
+public class SimpleWebServerExample {
+ public static void main(String[] args) throws IOException {
+ HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0);
+ server.createContext("/", exchange -> {
+ String response = "Hello, Java 18!";
+ exchange.sendResponseHeaders(200, response.getBytes().length);
+ exchange.getResponseBody().write(response.getBytes());
+ exchange.close();
+ });
+ server.start();
+ System.out.println("Server started on http://localhost:8080");
+ }
+}This starts a simple web server accessible at http://localhost:8080.
3. Code Snippets in Java API Documentation (JEP 413)
This enhancement improves the usability of API documentation by introducing standard annotations and conventions for including code snippets.
Benefits:
Example: The @snippet tag in Javadoc allows embedding of examples:
/**
+ * A utility class for string manipulations.
+ * {@snippet :
+ * String reversed = StringUtils.reverse("hello");
+ * System.out.println(reversed); // olleh
+ * }
+ */
+public class StringUtils {
+ public static String reverse(String input) {
+ return new StringBuilder(input).reverse().toString();
+ }
+}This snippet is validated during documentation generation, ensuring correctness.
4. Deprecation of Finalization (JEP 421)
The finalize method has been deprecated to improve JVM performance and reliability.
Alternatives:
Example:
import java.lang.ref.Cleaner;
+
+public class CleanerExample {
+ private static final Cleaner cleaner = Cleaner.create();
+
+ static class Resource implements AutoCloseable {
+ private final Cleaner.Cleanable cleanable;
+
+ Resource() {
+ cleanable = cleaner.register(this, () -> System.out.println("Resource cleaned up!"));
+ }
+
+ @Override
+ public void close() {
+ cleanable.clean();
+ }
+ }
+
+ public static void main(String[] args) {
+ try (Resource resource = new Resource()) {
+ System.out.println("Using resource.");
+ }
+ }
+}This approach avoids the pitfalls of finalize and offers better control.
5. Vector API (Third Incubator, JEP 417)
The Vector API enables developers to write vectorized computations for better performance on modern CPUs.
Example:
import jdk.incubator.vector.FloatVector;
+import jdk.incubator.vector.VectorSpecies;
+
+public class VectorAPIExample {
+ static final VectorSpecies<Float> SPECIES = FloatVector.SPECIES_256;
+
+ public static void main(String[] args) {
+ float[] a = {1.0f, 2.0f, 3.0f, 4.0f};
+ float[] b = {5.0f, 6.0f, 7.0f, 8.0f};
+ float[] c = new float[4];
+
+ FloatVector va = FloatVector.fromArray(SPECIES, a, 0);
+ FloatVector vb = FloatVector.fromArray(SPECIES, b, 0);
+ FloatVector vc = va.add(vb);
+ vc.intoArray(c, 0);
+
+ for (float value : c) {
+ System.out.println(value);
+ }
+ }
+}This computes vector addition, leveraging SIMD capabilities for performance gains.
6. Pattern Matching for switch (Second Preview, JEP 420)
Pattern matching has been extended in switch statements to simplify type-safe operations.
Example:
public class PatternMatchingSwitchExample {
+ static String formatter(Object obj) {
+ return switch (obj) {
+ case Integer i -> "Integer: " + i;
+ case String s -> "String: " + s;
+ case null -> "Null value";
+ default -> "Unknown type";
+ };
+ }
+
+ public static void main(String[] args) {
+ System.out.println(formatter(42));
+ System.out.println(formatter("hello"));
+ System.out.println(formatter(null));
+ }
+}Pattern matching enhances readability and reduces boilerplate code.
7. Foreign Function and Memory API (Second Incubator, JEP 419)
This API enables interaction with native code and memory outside the Java heap, replacing the traditional JNI.
Example:
import jdk.incubator.foreign.MemorySegment;
+import jdk.incubator.foreign.MemoryAccess;
+
+public class ForeignMemoryExample {
+ public static void main(String[] args) {
+ try (MemorySegment segment = MemorySegment.allocateNative(4)) {
+ MemoryAccess.setInt(segment, 0, 42);
+ int value = MemoryAccess.getInt(segment, 0);
+ System.out.println("Value: " + value);
+ }
+ }
+}This example demonstrates safe and efficient memory operations.
Conclusion
Java 18 builds upon its predecessors with key improvements in usability, performance, and language features. These updates ensure Java remains a robust and modern platform for developers.
+
+
+
+
diff --git a/44 - Java New Versions/019 Java 19.html b/44 - Java New Versions/019 Java 19.html
new file mode 100644
index 0000000000000000000000000000000000000000..6c78294e7e9d7bd2dda2c2086a913d41a71ba97a
--- /dev/null
+++ b/44 - Java New Versions/019 Java 19.html
@@ -0,0 +1,139 @@
+
+
+
+
+
+ Java 19
+
+
+
+
+
+
+
Java 19
+
Java 19, released by Oracle in September 2022, introduced several innovative features and enhancements, continuing the evolution of the Java platform. Here is a detailed breakdown of the key updates and features of Java 19 with examples:
1. Virtual Threads (Preview, JEP 425)
Virtual threads provide lightweight, high-performance threads, making concurrent programming more scalable and efficient.
Benefits:
Simplifies writing, maintaining, and observing concurrent applications.
Reduces resource overhead compared to traditional platform threads.
Example:
import java.util.concurrent.Executors;
+
+public class VirtualThreadsExample {
+ public static void main(String[] args) {
+ try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
+ for (int i = 0; i < 10; i++) {
+ executor.submit(() -> {
+ System.out.println("Running in virtual thread: " + Thread.currentThread());
+ });
+ }
+ }
+ }
+}This example creates multiple virtual threads for concurrent tasks.
2. Structured Concurrency (Incubator, JEP 428)
Structured concurrency simplifies error handling and cancellation in multithreaded applications by grouping related tasks.
Benefits:
Example:
import java.util.concurrent.*;
+
+public class StructuredConcurrencyExample {
+ public static void main(String[] args) throws InterruptedException, ExecutionException {
+ try (var scope = new StructuredTaskScope.ShutdownOnFailure()) {
+ Future<String> task1 = scope.fork(() -> "Result from task 1");
+ Future<String> task2 = scope.fork(() -> "Result from task 2");
+
+ scope.join(); // Wait for all tasks
+ scope.throwIfFailed(); // Propagate exceptions if any
+
+ System.out.println(task1.resultNow());
+ System.out.println(task2.resultNow());
+ }
+ }
+}This demonstrates managing related tasks under a single structured scope.
3. Pattern Matching for switch (Third Preview, JEP 427)
Pattern matching in switch has been further refined, adding more expressive power and type safety.
Example:
public class SwitchPatternMatchingExample {
+ static String handleShape(Object shape) {
+ return switch (shape) {
+ case String s -> "String with length: " + s.length();
+ case Integer i when i > 0 -> "Positive Integer: " + i;
+ case null -> "Null value";
+ default -> "Unhandled type";
+ };
+ }
+
+ public static void main(String[] args) {
+ System.out.println(handleShape("Hello"));
+ System.out.println(handleShape(42));
+ System.out.println(handleShape(null));
+ }
+}This example showcases complex conditions and type matching in a switch statement.
4. Foreign Function and Memory API (Preview, JEP 424)
This API enables Java programs to efficiently interact with native code and off-heap memory, improving over JNI.
Example:
import jdk.incubator.foreign.*;
+import jdk.incubator.foreign.MemorySegment;
+
+public class ForeignFunctionExample {
+ public static void main(String[] args) {
+ try (MemorySegment segment = MemorySegment.allocateNative(4)) {
+ MemoryAccess.setInt(segment, 0, 1234);
+ int value = MemoryAccess.getInt(segment, 0);
+ System.out.println("Value: " + value);
+ }
+ }
+}This code demonstrates efficient and safe memory access using the Foreign Function and Memory API.
5. Vector API (Fourth Incubator, JEP 426)
The Vector API allows developers to leverage SIMD (Single Instruction, Multiple Data) instructions for improved performance in data processing tasks.
Example:
import jdk.incubator.vector.*;
+
+public class VectorAPIExample {
+ public static void main(String[] args) {
+ float[] array1 = {1.0f, 2.0f, 3.0f, 4.0f};
+ float[] array2 = {5.0f, 6.0f, 7.0f, 8.0f};
+ float[] result = new float[4];
+
+ FloatVector vector1 = FloatVector.fromArray(FloatVector.SPECIES_128, array1, 0);
+ FloatVector vector2 = FloatVector.fromArray(FloatVector.SPECIES_128, array2, 0);
+ FloatVector sum = vector1.add(vector2);
+ sum.intoArray(result, 0);
+
+ for (float v : result) {
+ System.out.println(v);
+ }
+ }
+}This code performs vectorized addition for better performance on supported hardware.
6. Linux/RISC-V Port (JEP 422)
Java 19 introduces a port of the JDK to the Linux/RISC-V architecture, expanding its support for modern hardware platforms.
Impact:
Conclusion
Java 19 reinforces the platform's modernity and adaptability with enhancements to performance, concurrency, native interoperability, and developer productivity. These updates ensure Java remains a top choice for building scalable and efficient applications.
+
+
+
+
diff --git a/44 - Java New Versions/020 Java 20.html b/44 - Java New Versions/020 Java 20.html
new file mode 100644
index 0000000000000000000000000000000000000000..e9c51757cd3145259e6436a19aab676bc2fab2b8
--- /dev/null
+++ b/44 - Java New Versions/020 Java 20.html
@@ -0,0 +1,162 @@
+
+
+
+
+
+ Java 20
+
+
+
+
+
+
+
Java 20
+
Java 20, released by Oracle in March 2023, continues to expand the capabilities of the Java platform with significant features and enhancements. Below is a comprehensive guide to the key updates and features in Java 20, complete with examples:
1. Scoped Values (Incubator, JEP 429)
Scoped Values provide an alternative to thread-local variables, enabling a simpler and safer way to share data with threads.
Benefits:
Example:
import jdk.incubator.concurrent.ScopedValue;
+
+public class ScopedValuesExample {
+ private static final ScopedValue<String> SCOPED_VALUE = ScopedValue.newInstance();
+
+ public static void main(String[] args) {
+ ScopedValue.where(SCOPED_VALUE, "Hello from ScopedValue")
+ .run(() -> {
+ System.out.println(SCOPED_VALUE.get());
+ });
+ }
+}This example demonstrates how a ScopedValue can safely share data with threads.
2. Virtual Threads (Second Preview, JEP 436)
Building on the first preview in Java 19, the second preview of Virtual Threads adds minor refinements to enhance developer experience.
Example:
import java.util.concurrent.Executors;
+
+public class VirtualThreadsPreviewExample {
+ public static void main(String[] args) {
+ try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
+ for (int i = 0; i < 5; i++) {
+ executor.submit(() -> {
+ System.out.println("Running in virtual thread: " + Thread.currentThread());
+ });
+ }
+ }
+ }
+}This code demonstrates concurrent execution using virtual threads.
3. Structured Concurrency (Second Incubator, JEP 437)
The second incubator of Structured Concurrency further simplifies task coordination and lifecycle management.
Example:
import java.util.concurrent.*;
+
+public class StructuredConcurrencyExample {
+ public static void main(String[] args) throws InterruptedException, ExecutionException {
+ try (var scope = new StructuredTaskScope.ShutdownOnFailure()) {
+ Future<String> task1 = scope.fork(() -> "Task 1 result");
+ Future<String> task2 = scope.fork(() -> "Task 2 result");
+
+ scope.join();
+ scope.throwIfFailed();
+
+ System.out.println(task1.resultNow());
+ System.out.println(task2.resultNow());
+ }
+ }
+}This example shows the simplified handling of related tasks in a structured scope.
4. Record Patterns (Second Preview, JEP 432)
Record patterns in Java 20 allow deconstruction of record values for more concise and readable code.
Example:
record Point(int x, int y) {}
+
+public class RecordPatternExample {
+ static String processPoint(Object obj) {
+ return switch (obj) {
+ case Point(int x, int y) -> "Point at (" + x + ", " + y + ")";
+ default -> "Unknown object";
+ };
+ }
+
+ public static void main(String[] args) {
+ System.out.println(processPoint(new Point(3, 5)));
+ }
+}This code showcases pattern matching with records in switch expressions.
5. Pattern Matching for switch (Fourth Preview, JEP 433)
Enhancements to pattern matching for switch in Java 20 make the feature more powerful and expressive.
Example:
public class SwitchPatternMatchingExample {
+ static String handleShape(Object shape) {
+ return switch (shape) {
+ case String s -> "String with length: " + s.length();
+ case Integer i when i > 0 -> "Positive Integer: " + i;
+ case null -> "Null value";
+ default -> "Unhandled type";
+ };
+ }
+
+ public static void main(String[] args) {
+ System.out.println(handleShape("Hello"));
+ System.out.println(handleShape(42));
+ System.out.println(handleShape(null));
+ }
+}This demonstrates advanced pattern matching capabilities in switch statements.
6. Foreign Function and Memory API (Second Preview, JEP 434)
The second preview of this API offers better interoperability with native code and off-heap memory management.
Example:
import jdk.incubator.foreign.*;
+
+public class ForeignFunctionExample {
+ public static void main(String[] args) {
+ try (MemorySegment segment = MemorySegment.allocateNative(4)) {
+ MemoryAccess.setInt(segment, 0, 5678);
+ int value = MemoryAccess.getInt(segment, 0);
+ System.out.println("Value: " + value);
+ }
+ }
+}This example demonstrates efficient memory management using the Foreign Function and Memory API.
7. Vector API (Fifth Incubator, JEP 438)
The Vector API continues to evolve, enabling high-performance data processing using vectorized operations.
Example:
import jdk.incubator.vector.*;
+
+public class VectorAPIExample {
+ public static void main(String[] args) {
+ float[] a = {1.0f, 2.0f, 3.0f, 4.0f};
+ float[] b = {5.0f, 6.0f, 7.0f, 8.0f};
+ float[] result = new float[4];
+
+ FloatVector vectorA = FloatVector.fromArray(FloatVector.SPECIES_128, a, 0);
+ FloatVector vectorB = FloatVector.fromArray(FloatVector.SPECIES_128, b, 0);
+ FloatVector sum = vectorA.add(vectorB);
+ sum.intoArray(result, 0);
+
+ for (float v : result) {
+ System.out.println(v);
+ }
+ }
+}This code shows vectorized arithmetic for enhanced performance.
Conclusion
Java 20 continues the platform's commitment to improving developer productivity and application performance. With innovations in concurrency, pattern matching, native interoperability, and vectorized computation, Java 20 is well-equipped for modern software development needs.
+
+
+
+
diff --git a/44 - Java New Versions/021 Java 21.html b/44 - Java New Versions/021 Java 21.html
new file mode 100644
index 0000000000000000000000000000000000000000..6c33e04d28477110e72dae552d9d02d44382d09c
--- /dev/null
+++ b/44 - Java New Versions/021 Java 21.html
@@ -0,0 +1,144 @@
+
+
+
+
+
+ Java 21
+
+
+
+
+
+
+
Java 21
+
Java 21, released by Oracle in September 2023, introduces several key updates and improvements that enhance developer productivity and performance. Below is a detailed guide to the major updates and features in Java 21, accompanied by examples.
1. Virtual Threads (Stable, JEP 444)
Virtual Threads, initially previewed in Java 19 and 20, are now stable. This feature makes thread management in Java highly efficient, allowing applications to handle many concurrent tasks effortlessly.
Example:
import java.util.concurrent.Executors;
+
+public class VirtualThreadsExample {
+ public static void main(String[] args) {
+ try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
+ for (int i = 0; i < 10; i++) {
+ executor.submit(() -> {
+ System.out.println("Running in: " + Thread.currentThread());
+ });
+ }
+ }
+ }
+}This code demonstrates the simplicity of managing concurrency with virtual threads.
2. Sequenced Collections (JEP 431)
The new SequencedCollection interface provides a uniform way to handle collections with a defined encounter order, such as SequencedSet and SequencedMap.
Example:
import java.util.LinkedHashMap;
+import java.util.SequencedMap;
+
+public class SequencedCollectionsExample {
+ public static void main(String[] args) {
+ SequencedMap<String, Integer> map = new LinkedHashMap<>()
+ .sequenced();
+ map.put("One", 1);
+ map.put("Two", 2);
+ map.put("Three", 3);
+
+ System.out.println("First entry: " + map.firstEntry());
+ System.out.println("Last entry: " + map.lastEntry());
+ }
+}This code demonstrates the usage of sequenced collections to retrieve ordered elements.
3. String Templates (Preview, JEP 430)
String Templates simplify string interpolation by embedding expressions directly in string literals.
Example:
import static java.util.template.Templates.*;
+
+public class StringTemplatesExample {
+ public static void main(String[] args) {
+ int x = 5;
+ int y = 10;
+
+ var template = STR."The sum of \{x} and \{y} is \{x + y}";
+ System.out.println(template);
+ }
+}This code shows the new and concise way to construct strings dynamically.
4. Record Patterns (Standard, JEP 440)
Record Patterns, now finalized, simplify working with record types in switch statements and pattern matching.
Example:
record Point(int x, int y) {}
+
+public class RecordPatternsExample {
+ public static void main(String[] args) {
+ Object obj = new Point(3, 4);
+
+ String result = switch (obj) {
+ case Point(int x, int y) -> "Point at (" + x + ", " + y + ")";
+ default -> "Unknown type";
+ };
+
+ System.out.println(result);
+ }
+}This example demonstrates the ease of deconstructing record types in pattern matching.
5. Pattern Matching for switch (Standard, JEP 441)
Pattern matching for switch is now finalized, adding flexibility and conciseness to switch statements.
Example:
public class PatternMatchingSwitchExample {
+ public static void main(String[] args) {
+ Object obj = "Hello, World!";
+
+ String result = switch (obj) {
+ case String s when s.length() > 5 -> "Long String: " + s;
+ case String s -> "Short String: " + s;
+ case null -> "Null value";
+ default -> "Unhandled type";
+ };
+
+ System.out.println(result);
+ }
+}This demonstrates the expressive power of pattern matching for switch.
6. Unnamed Classes and Instance Main Methods (Preview, JEP 445)
This feature allows quick and compact prototyping by introducing unnamed classes and instance main methods.
Example:
public class MainExample {
+ public void main() {
+ System.out.println("Instance main method example");
+ }
+}Run this file directly without requiring a static main method.
7. Foreign Function and Memory API (Third Preview, JEP 442)
The Foreign Function and Memory API reaches its third preview, improving interoperability with native code and memory management.
Example:
import jdk.incubator.foreign.*;
+
+public class ForeignMemoryExample {
+ public static void main(String[] args) {
+ try (MemorySegment segment = MemorySegment.allocateNative(8)) {
+ MemoryAccess.setLong(segment, 0, 123456789L);
+ System.out.println("Value: " + MemoryAccess.getLong(segment, 0));
+ }
+ }
+}This code demonstrates efficient native memory access.
Conclusion
Java 21 solidifies many features introduced in prior releases while introducing new tools to simplify and enhance modern application development. With improvements in concurrency, pattern matching, and native interoperability, Java 21 ensures developers have a robust and flexible platform for future innovation.
+
+
+
+
diff --git a/44 - Java New Versions/external-links.txt b/44 - Java New Versions/external-links.txt
new file mode 100644
index 0000000000000000000000000000000000000000..7eb414674185231d73c0c6c9cb0790c9df1db8f6
--- /dev/null
+++ b/44 - Java New Versions/external-links.txt
@@ -0,0 +1,39 @@
+
+001 Source-code-example-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/commit/040f22477c4b9d4d33c2be9d5a385821c6b866e6
+
+002 Source-code-example-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/commit/e53e759c361aedca987fd1a24f9fc2e3a1cb3d63
+
+003 Source-code-example-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/commit/e53e759c361aedca987fd1a24f9fc2e3a1cb3d63
+
+007 Source-code-example-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/commit/3c7c1a0efcb4279a50b8f6265387f8d9593016fb
+
+009 Source-code-example-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/commit/8d81e594e84567ef760a1522db1b19193175a2ab
+
+010 Source-code-example-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/commit/8d81e594e84567ef760a1522db1b19193175a2ab
+
+011 Source-code-example-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/commit/9fb5e5e937b752760f96934512ede37b41e59671
+
+011 Deprecated-Features-and-Options
+https://cr.openjdk.org/~iris/se/12/latestSpec/api/deprecated-list.html
+
+013 Source-code-example-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/commit/93442631c8cf9774b0a434197cff89cfaa9c751e
+
+014 Source-code-example-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/commit/302780157b23432ef2aa404561491b4ecf145287
+
+015 Source-code-example-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/commit/050a58104e84e1d83a010e8cfb147ad5d3e3f570
+
+016 Source-code-example-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/commit/050a58104e84e1d83a010e8cfb147ad5d3e3f570
+
+017 Source-code-example-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/commit/14ed22191e1e032b903b7082dddce64f2fe02f41
diff --git a/46 - Databases Overview and Environment Setup/001 Intro to SQL and Databases Section.html b/46 - Databases Overview and Environment Setup/001 Intro to SQL and Databases Section.html
new file mode 100644
index 0000000000000000000000000000000000000000..51ba9517f0a749ee8f1428629ea9ecc5929de82c
--- /dev/null
+++ b/46 - Databases Overview and Environment Setup/001 Intro to SQL and Databases Section.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Intro to SQL and Databases Section
+
+
+
+
+
+
+
Intro to SQL and Databases Section
+
Hello team,
The sections about databases and SQL are required in order you can understand JDBC, Because JDBC stands for Java Database Connectivity, and exists primarily for executing SQL statements in the database. That's why it is so important to learn Databases and SQL before we start learn JDBC.
In acse you are familiar with relational databases and SQL, you can skip sections related to the databases and SQL, and jump directly to JDBC topic. But still, I recommend you to watch sections about databases because they are full of practical examples, tips and trics.
Enjoy lessons!
Regards,
Andrey
+
+
+
+
diff --git a/46 - Databases Overview and Environment Setup/002 Databases Overview - Part 1_en.srt b/46 - Databases Overview and Environment Setup/002 Databases Overview - Part 1_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..79a19d83c42dfef6300fa0a841e295b924e5c6eb
--- /dev/null
+++ b/46 - Databases Overview and Environment Setup/002 Databases Overview - Part 1_en.srt
@@ -0,0 +1,1252 @@
+1
+00:00:05,000 --> 00:00:06,000
+Hello, dear students.
+
+2
+00:00:06,000 --> 00:00:09,000
+Today we start super important topic.
+
+3
+00:00:09,000 --> 00:00:17,000
+We start learning of databases and structured query language to be able to interact with data in databases.
+
+4
+00:00:17,000 --> 00:00:19,000
+We have a lot of things to learn.
+
+5
+00:00:19,000 --> 00:00:24,000
+But today we're going to hold an overview of databases in order.
+
+6
+00:00:24,000 --> 00:00:30,000
+You could understand some basics before we move on with more complex topics today.
+
+7
+00:00:30,000 --> 00:00:33,000
+In our lesson, we're going to learn a lot of things.
+
+8
+00:00:33,000 --> 00:00:39,000
+Most of them important for engineers and software architects, because all architects should be aware
+
+9
+00:00:39,000 --> 00:00:46,000
+about different types of databases, in which case what kind of database is applicable better and what
+
+10
+00:00:46,000 --> 00:00:50,000
+the advantages and disadvantages of different databases.
+
+11
+00:00:50,000 --> 00:00:55,000
+We're going to start from the simple topics like what database is?
+
+12
+00:00:55,000 --> 00:00:59,000
+And gradually we'll get the more advanced topics and concepts.
+
+13
+00:01:00,000 --> 00:01:02,000
+We're going to learn different types of databases.
+
+14
+00:01:03,000 --> 00:01:07,000
+I'll explain you what's relational databases are and when they are applicable.
+
+15
+00:01:07,000 --> 00:01:12,000
+And also, we'll discuss different types of non relational databases.
+
+16
+00:01:12,000 --> 00:01:19,000
+Separately, we'll discuss centralized and distributed databases as we progress with lesson rules and
+
+17
+00:01:19,000 --> 00:01:22,000
+advantages and disadvantages of different types of databases.
+
+18
+00:01:23,000 --> 00:01:25,000
+We have a lot of things to learn.
+
+19
+00:01:25,000 --> 00:01:27,000
+Let's start our lesson.
+
+20
+00:01:28,000 --> 00:01:33,000
+Let's understand, first of all, why do we need databases and what is their purposes?
+
+21
+00:01:33,000 --> 00:01:39,000
+Imagine that you have application no matter whether it's a web application, desktop or mobile.
+
+22
+00:01:39,000 --> 00:01:41,000
+You can run your application.
+
+23
+00:01:41,000 --> 00:01:42,000
+You can stop it.
+
+24
+00:01:43,000 --> 00:01:48,000
+And when your application up and running again, you need to restore its state.
+
+25
+00:01:48,000 --> 00:01:51,000
+For example, information about registered users.
+
+26
+00:01:52,000 --> 00:01:54,000
+Information about their purchases.
+
+27
+00:01:54,000 --> 00:01:56,000
+Information about the goods that you sell.
+
+28
+00:01:56,000 --> 00:02:03,000
+It depends on what kind of application you have, but usually in all applications, there are some data
+
+29
+00:02:03,000 --> 00:02:08,000
+that need to be stored persistently, and you need to have some persistent storage where you can access
+
+30
+00:02:08,000 --> 00:02:09,000
+this data.
+
+31
+00:02:09,000 --> 00:02:10,000
+Does it make sense?
+
+32
+00:02:11,000 --> 00:02:18,000
+So usually your application is a combination of some goods that knows how to process data and some persistent
+
+33
+00:02:18,000 --> 00:02:24,000
+storage of data because storing a lot of the things that application memory is not good practice.
+
+34
+00:02:24,000 --> 00:02:26,000
+Let's try to think why.
+
+35
+00:02:26,000 --> 00:02:30,000
+Imagine that all information is stored in the app memory.
+
+36
+00:02:30,000 --> 00:02:36,000
+In this case, you can lose all program related data once application is stopped.
+
+37
+00:02:36,000 --> 00:02:37,000
+It is not secure.
+
+38
+00:02:38,000 --> 00:02:42,000
+You can add additional level of security to the data stored in the app.
+
+39
+00:02:43,000 --> 00:02:48,000
+Regular developer may easily read some security passwords or other sensitive information.
+
+40
+00:02:49,000 --> 00:02:56,000
+Besides that, we can't take advantage of replication of the beat to secure data from losing it because
+
+41
+00:02:56,000 --> 00:02:57,000
+of any accident.
+
+42
+00:02:58,000 --> 00:03:05,000
+Usually, memory for the process for our application is limited and it is significantly less than we
+
+43
+00:03:05,000 --> 00:03:13,000
+have physical memory on the hard drive because to run applications we use from memory in case you want,
+
+44
+00:03:13,000 --> 00:03:16,000
+learn more about memory management for Java applications.
+
+45
+00:03:17,000 --> 00:03:22,000
+Please check my Zen Most Complete Java course, where I have separate lessons about memory management.
+
+46
+00:03:23,000 --> 00:03:27,000
+One more point against this this is against leopard architecture pattern.
+
+47
+00:03:28,000 --> 00:03:33,000
+In a separate lesson, we're going to learn in detail what their architecture is, but I will briefly
+
+48
+00:03:33,000 --> 00:03:40,000
+explain you as a context where architecture implements separation of concerns, having separate persistence,
+
+49
+00:03:40,000 --> 00:03:46,000
+their database there, and business logic that gives you tons of advantages.
+
+50
+00:03:46,000 --> 00:03:51,000
+The most obvious are you can develop and improve each layer independently.
+
+51
+00:03:51,000 --> 00:03:54,000
+You can isolate the impact of one layer on another one.
+
+52
+00:03:55,000 --> 00:03:57,000
+You can work in parallel on different layers with your team.
+
+53
+00:03:58,000 --> 00:04:02,000
+And these are just some of them have an all app data stored in the app.
+
+54
+00:04:03,000 --> 00:04:08,000
+It is absolutely not the best way to address requirements of data storage in the app.
+
+55
+00:04:09,000 --> 00:04:13,000
+So that's why you should never rely on certain data inside the app.
+
+56
+00:04:13,000 --> 00:04:15,000
+But what you should do instead.
+
+57
+00:04:15,000 --> 00:04:22,000
+It is recommended to use separate applications designed and created specifically for storing data and
+
+58
+00:04:22,000 --> 00:04:24,000
+navigation inside this data.
+
+59
+00:04:25,000 --> 00:04:27,000
+I'm on advantages of databases.
+
+60
+00:04:27,000 --> 00:04:34,000
+It is worse mansions in next one's manages, large amounts of data and database source, and manages
+
+61
+00:04:34,000 --> 00:04:39,000
+a large amount of data that is updated literally on daily basis.
+
+62
+00:04:39,000 --> 00:04:46,000
+This would not be possible using any asset to imagine the Excel spreadsheet that contains a lot of DApps
+
+63
+00:04:46,000 --> 00:04:53,000
+that are logical connected to each other, but contains is a duplicate of data or just not mapped data
+
+64
+00:04:53,000 --> 00:04:55,000
+as it is hard to update at once.
+
+65
+00:04:55,000 --> 00:05:02,000
+And then what logical mistakes when operating on the data separate program layer that can be developed
+
+66
+00:05:02,000 --> 00:05:07,000
+and improved separately in case there is a question of performance improvements.
+
+67
+00:05:07,000 --> 00:05:10,000
+You don't need to track record of your app.
+
+68
+00:05:10,000 --> 00:05:13,000
+You can apply optimizations directly on the database layer.
+
+69
+00:05:14,000 --> 00:05:20,000
+If for some reasons you decided to change the database, you don't need to update your application court.
+
+70
+00:05:21,000 --> 00:05:24,000
+You can substitute database independently was savings.
+
+71
+00:05:24,000 --> 00:05:32,000
+The same interface of interaction was database security stored database, and the separate service was
+
+72
+00:05:32,000 --> 00:05:33,000
+restricted access.
+
+73
+00:05:34,000 --> 00:05:39,000
+Only users who has log in and password to access this database was granted.
+
+74
+00:05:39,000 --> 00:05:45,000
+Rights can access be great users and grant specific permissions only.
+
+75
+00:05:45,000 --> 00:05:52,000
+For example, you may have different users who married the data from separate tables who can't adjust
+
+76
+00:05:52,000 --> 00:05:53,000
+a new rule of data.
+
+77
+00:05:54,000 --> 00:05:59,000
+There are also another set of configurations that we are going to learn in this course, having data
+
+78
+00:05:59,000 --> 00:06:06,000
+stored separately and even in a separate server, we can avoid data corruption in case our server is
+
+79
+00:06:06,000 --> 00:06:07,000
+hog or down.
+
+80
+00:06:08,000 --> 00:06:14,000
+Data integrity and consistency are worth of data anomalies with the help of special restrictions and
+
+81
+00:06:14,000 --> 00:06:22,000
+the database layer data integrity databases make sure that the data is accurate and consistent in database
+
+82
+00:06:23,000 --> 00:06:31,000
+API providers, so databases ensure that there is an API to interact with their databases from program
+
+83
+00:06:31,000 --> 00:06:36,000
+code and the amount of operations it is provided through research aggregate.
+
+84
+00:06:36,000 --> 00:06:38,000
+And the data is amazing.
+
+85
+00:06:38,000 --> 00:06:43,000
+Can you imagine querying your Microsoft Excel file to get aggregated?
+
+86
+00:06:43,000 --> 00:06:50,000
+The amount of my salary of all employees who works more than five years and company, including employees
+
+87
+00:06:50,000 --> 00:06:58,000
+who already left company in the past and employees from its subsidiaries who successfully deliver three
+
+88
+00:06:58,000 --> 00:07:05,000
+or more projects and also return each call not just a string value, but in different types.
+
+89
+00:07:06,000 --> 00:07:13,000
+For example, return, that's no numbers and date values as value of date, time and so on.
+
+90
+00:07:14,000 --> 00:07:20,000
+It is hard for me to imagine performance such operations was excel, especially in multi-threaded manner,
+
+91
+00:07:21,000 --> 00:07:27,000
+with different concurrent requests, especially performance requests from different points of world
+
+92
+00:07:27,000 --> 00:07:33,000
+accessing the nearest Excel file that is synchronized with other faiths across the globe.
+
+93
+00:07:33,000 --> 00:07:36,000
+Do feel the power of databases.
+
+94
+00:07:36,000 --> 00:07:36,000
+Not yet.
+
+95
+00:07:37,000 --> 00:07:38,000
+I believe you do.
+
+96
+00:07:39,000 --> 00:07:46,000
+I believe now you understood why we need databases and why we can't substitute them with other programs.
+
+97
+00:07:46,000 --> 00:07:51,000
+Always approach where we just store all app related data in app memory.
+
+98
+00:07:52,000 --> 00:07:55,000
+So now in this, let's come up with specific definitions.
+
+99
+00:07:56,000 --> 00:07:59,000
+I believe now nine goals of database and use cases.
+
+100
+00:07:59,000 --> 00:08:03,000
+It will be easier for you to understand these definitions.
+
+101
+00:08:04,000 --> 00:08:11,000
+Database is an organized collection of data stored and accessed electronically from a computer system
+
+102
+00:08:11,000 --> 00:08:18,000
+is a definition clear for you, so the database itself is a collection of interrelated data.
+
+103
+00:08:19,000 --> 00:08:26,000
+First, the full database is a data, and you already understand that this might be an application related
+
+104
+00:08:26,000 --> 00:08:27,000
+data.
+
+105
+00:08:27,000 --> 00:08:34,000
+It ensures expect the behavior of your app and in some cases contains enough information to restore
+
+106
+00:08:34,000 --> 00:08:36,000
+state of the system when needed.
+
+107
+00:08:37,000 --> 00:08:40,000
+Database is an organized collection.
+
+108
+00:08:40,000 --> 00:08:48,000
+All data is organized into specific data structures dependent on the database type approach for structuring
+
+109
+00:08:48,000 --> 00:08:53,000
+this information may be different, but in all cases they're strictly defined through rules.
+
+110
+00:08:54,000 --> 00:08:59,000
+And the goal to organize different data for the common part and two similar kinds of data.
+
+111
+00:09:00,000 --> 00:09:06,000
+For example, you can store information about the user and the database through with the specific attributes
+
+112
+00:09:06,000 --> 00:09:11,000
+only, and these attributes are used for storing of all other user related information.
+
+113
+00:09:12,000 --> 00:09:18,000
+The same connection of one information with another information imagines that each user has its own
+
+114
+00:09:19,000 --> 00:09:27,000
+order, history and the way how connection between this data is organized is the same for all users,
+
+115
+00:09:27,000 --> 00:09:32,000
+but very often engineers and people use terms as synonyms.
+
+116
+00:09:32,000 --> 00:09:36,000
+They are database and database management system.
+
+117
+00:09:37,000 --> 00:09:42,000
+Very often when people say database, they refer to database management system.
+
+118
+00:09:43,000 --> 00:09:45,000
+And this is one more definition for today.
+
+119
+00:09:46,000 --> 00:09:52,000
+The database management system is a software that interacts with and users applications and the database
+
+120
+00:09:52,000 --> 00:09:57,000
+itself to capture, store, retrieve and analyze the data.
+
+121
+00:09:57,000 --> 00:10:05,000
+We can see very important aspect of the beams, so bolster data may be accessed electronically from
+
+122
+00:10:05,000 --> 00:10:12,000
+a computer system as there is a specific software that provides us with ability to interact with stored
+
+123
+00:10:12,000 --> 00:10:13,000
+data.
+
+124
+00:10:13,000 --> 00:10:17,000
+We have discussed already that we can interact with databases.
+
+125
+00:10:17,000 --> 00:10:18,000
+We are API.
+
+126
+00:10:18,000 --> 00:10:24,000
+Zentrum DB AMS includes a user of the database and other application programs.
+
+127
+00:10:25,000 --> 00:10:30,000
+It provides an interface between the data and the software application.
+
+128
+00:10:30,000 --> 00:10:37,000
+The DB MS software additionally encompasses the core facilities provided to administers a database.
+
+129
+00:10:37,000 --> 00:10:41,000
+The sum total of the database is a DBA MS.
+
+130
+00:10:41,000 --> 00:10:46,000
+And the associated applications can be referred to as database system.
+
+131
+00:10:46,000 --> 00:10:54,000
+Often, the term database is also used loosely to refer to any of the DB, a mass, the database system
+
+132
+00:10:55,000 --> 00:10:58,000
+or an application associated with the database.
+
+133
+00:10:58,000 --> 00:11:04,000
+Now we're going to review different types of databases, the different pros and cons of each type of
+
+134
+00:11:04,000 --> 00:11:05,000
+database.
+
+135
+00:11:05,000 --> 00:11:12,000
+We're not going to run each database type and details now, but I want you to be aware of about differences
+
+136
+00:11:12,000 --> 00:11:18,000
+between them, at least on the high level, because this will help you to understand better what you
+
+137
+00:11:18,000 --> 00:11:24,000
+want to learn in depth and what kind of database is better applicable in some specific cases.
+
+138
+00:11:25,000 --> 00:11:31,000
+And the first is the most common classification is based on the way how data is organized inside the
+
+139
+00:11:31,000 --> 00:11:31,000
+database.
+
+140
+00:11:32,000 --> 00:11:33,000
+Zero two.
+
+141
+00:11:33,000 --> 00:11:40,000
+The most popular database types relational and non relational, or, in other words, no sequel.
+
+142
+00:11:40,000 --> 00:11:43,000
+We're going to start from the relational databases.
+
+143
+00:11:43,000 --> 00:11:48,000
+Relational databases have been around since the 1970s.
+
+144
+00:11:48,000 --> 00:11:57,000
+But why these type of databases called relational z is because the way they store it in the DB, because
+
+145
+00:11:57,000 --> 00:12:02,000
+all data is stored in different tables that relates to each other.
+
+146
+00:12:02,000 --> 00:12:10,000
+Each table has rows and columns, and very often one table has a reference to another tables, and all
+
+147
+00:12:10,000 --> 00:12:13,000
+the tables have reference to another tables.
+
+148
+00:12:13,000 --> 00:12:20,000
+So to extract data from relational databases very often, you need to query multiple tables at once.
+
+149
+00:12:21,000 --> 00:12:22,000
+How does it look like?
+
+150
+00:12:23,000 --> 00:12:29,000
+Let me make an example of relational database without diving deep in specifics, but just to make you
+
+151
+00:12:29,000 --> 00:12:35,000
+understand how it looks like the help you understand what relational databases are.
+
+152
+00:12:36,000 --> 00:12:37,000
+Let's consider the next example.
+
+153
+00:12:38,000 --> 00:12:39,000
+Imagine you develop.
+
+154
+00:12:39,000 --> 00:12:43,000
+A Twitter application was a similar one, and you have always POS.
+
+155
+00:12:44,000 --> 00:12:50,000
+That means you already have at least two tables, users and POS, and there is a connection between
+
+156
+00:12:50,000 --> 00:12:51,000
+them.
+
+157
+00:12:51,000 --> 00:12:58,000
+I wouldn't bother you too much with details, because are different types of connections between tables.
+
+158
+00:12:58,000 --> 00:13:01,000
+We're going to learn them and details in the separate lesson.
+
+159
+00:13:01,000 --> 00:13:04,000
+Right now, I want to just in the stands a year.
+
+160
+00:13:05,000 --> 00:13:06,000
+What else do we have?
+
+161
+00:13:06,000 --> 00:13:11,000
+Each post may have comments, so we should have common stable.
+
+162
+00:13:11,000 --> 00:13:17,000
+Each comment is connected with a specific post and with a specific user who posted that comment.
+
+163
+00:13:18,000 --> 00:13:20,000
+We already have three tables and so on.
+
+164
+00:13:21,000 --> 00:13:26,000
+Having these connections between different tables, I can query information I need.
+
+165
+00:13:26,000 --> 00:13:34,000
+For example, get all comments ever of user or get all comments for specific posts with user names of
+
+166
+00:13:34,000 --> 00:13:35,000
+officers and so on.
+
+167
+00:13:36,000 --> 00:13:36,000
+Is that clear?
+
+168
+00:13:38,000 --> 00:13:44,000
+To create, update and manage relational database, we use special programs that are called relational
+
+169
+00:13:44,000 --> 00:13:46,000
+database management systems.
+
+170
+00:13:46,000 --> 00:13:50,000
+There is also specific syntax of querying data from tables.
+
+171
+00:13:50,000 --> 00:13:51,000
+I'm talking about SQL.
+
+172
+00:13:52,000 --> 00:13:54,000
+This stands for structured query language.
+
+173
+00:13:55,000 --> 00:13:59,000
+It is a language that allows it to perform operations with data in database.
+
+174
+00:14:00,000 --> 00:14:06,000
+This language allows you to create different queries, including queries to create, read, update and
+
+175
+00:14:06,000 --> 00:14:07,000
+read data.
+
+176
+00:14:07,000 --> 00:14:10,000
+Relational databases are very reliable.
+
+177
+00:14:10,000 --> 00:14:14,000
+It is easy to support transactions with these databases.
+
+178
+00:14:14,000 --> 00:14:21,000
+We're going to talk about transactions and such requirements to transactions as automaticity, consistency,
+
+179
+00:14:21,000 --> 00:14:23,000
+isolation and durability in a separate lesson.
+
+180
+00:14:24,000 --> 00:14:31,000
+I will elaborate more about transactions in a separate lesson, but now I just want to understand this
+
+181
+00:14:31,000 --> 00:14:37,000
+jump, at least on the higher level, because I'm going to use a different lesson to understand this
+
+182
+00:14:37,000 --> 00:14:37,000
+concept.
+
+183
+00:14:37,000 --> 00:14:41,000
+You can keep example of money transaction in your hat.
+
+184
+00:14:41,000 --> 00:14:44,000
+I transfer money on my own from one account to another.
+
+185
+00:14:44,000 --> 00:14:50,000
+Account specific amount of money was removed from my account to proceed with the transaction.
+
+186
+00:14:50,000 --> 00:14:55,000
+But after that, it appears that another account is not valid anymore.
+
+187
+00:14:55,000 --> 00:14:57,000
+This is just an example.
+
+188
+00:14:57,000 --> 00:15:01,000
+Probably another credit card has been explored in a perfect world.
+
+189
+00:15:01,000 --> 00:15:04,000
+I would check this before even stock transaction.
+
+190
+00:15:04,000 --> 00:15:07,000
+But still, this example is easy to understand.
+
+191
+00:15:08,000 --> 00:15:13,000
+So the favor of the second part of the transaction doesn't mean that they lost my money.
+
+192
+00:15:14,000 --> 00:15:21,000
+All transaction is rolled back to its original state, as it was before the transaction, and I received
+
+193
+00:15:21,000 --> 00:15:22,000
+my money back.
+
+194
+00:15:23,000 --> 00:15:29,000
+Or you can imagine another example when you requested money in ATM, and some error happens when ATM
+
+195
+00:15:29,000 --> 00:15:31,000
+tried to cash out your money.
+
+196
+00:15:32,000 --> 00:15:34,000
+Then the now is the concept of transaction.
+
+197
+00:15:35,000 --> 00:15:43,000
+So relational databases were developed to support transactions to keep all data in all tables, inconsistent
+
+198
+00:15:43,000 --> 00:15:45,000
+state ensuring data integrity.
+
+199
+00:15:46,000 --> 00:15:49,000
+This is one of the advantages of relational databases.
+
+200
+00:15:50,000 --> 00:15:55,000
+Another important thing to mention here is that this type of relational databases is the most popular
+
+201
+00:15:55,000 --> 00:16:00,000
+nowadays across all over the world because of its relative simplicity.
+
+202
+00:16:00,000 --> 00:16:07,000
+Good performance was not a big amount of data design principles of data structuring and data organization,
+
+203
+00:16:07,000 --> 00:16:11,000
+which make data easy to research and operate on.
+
+204
+00:16:11,000 --> 00:16:15,000
+These are just a few reasons of popularity of such databases.
+
+205
+00:16:15,000 --> 00:16:20,000
+So, most likely during your life, you're going to work with relational databases.
+
+206
+00:16:21,000 --> 00:16:27,000
+Also, if you work with mobile development because of objective reasons computing power, it is hard
+
+207
+00:16:27,000 --> 00:16:30,000
+to deploy other type of databases on mobile devices.
+
+208
+00:16:31,000 --> 00:16:38,000
+So most likely, if you are working with mobile app development, you will use also sequel like this
+
+209
+00:16:38,000 --> 00:16:45,000
+relational database for mobile phones as examples of relational databases that are popular nowadays,
+
+210
+00:16:45,000 --> 00:16:46,000
+you can find on the sly.
+
+211
+00:16:47,000 --> 00:16:51,000
+They are my SQL money and be all equal.
+
+212
+00:16:51,000 --> 00:17:01,000
+Microsoft SQL Server, Oracle DB, IBM DB to you skill like H-2B and these are just some of them.
+
+213
+00:17:01,000 --> 00:17:06,000
+As you may already understand, we're going to learn the relational databases in discourse in depth.
+
+214
+00:17:07,000 --> 00:17:13,000
+The core principles that we are going to learn from relational database design and Modlin SQL language
+
+215
+00:17:13,000 --> 00:17:17,000
+and operators, all of this will be applied to each relational database.
+
+216
+00:17:18,000 --> 00:17:22,000
+Also, there are a subset of relational database that are located in cloud.
+
+217
+00:17:23,000 --> 00:17:28,000
+A cloud database refers to any database that's designed to run in the cloud.
+
+218
+00:17:28,000 --> 00:17:36,000
+Like Azure cloud based applications, cloud databases offer flexibility and scalability, along with
+
+219
+00:17:36,000 --> 00:17:37,000
+high availability.
+
+220
+00:17:38,000 --> 00:17:45,000
+Cloud databases are also often low maintenance, since many are offered with software as a service model
+
+221
+00:17:46,000 --> 00:17:50,000
+or like it's sometimes referred database as a service.
+
+222
+00:17:50,000 --> 00:17:57,000
+But basically, the same principles apply to all relational databases may be applied to these databases.
+
+223
+00:17:57,000 --> 00:18:05,000
+Some of them are Microsoft Azure SQL Database, Amazon Relational Database Service Oracle Autonomous
+
+224
+00:18:05,000 --> 00:18:06,000
+Database.
+
+225
+00:18:07,000 --> 00:18:14,000
+Knowing all this, let's try to identify advantages and disadvantages of relational databases to understand.
+
+226
+00:18:14,000 --> 00:18:15,000
+One, we have to use them.
+
+227
+00:18:16,000 --> 00:18:18,000
+And one shouldn't rely on them.
+
+228
+00:18:19,000 --> 00:18:24,000
+And one advantage of relational databases versus dimension simplicity.
+
+229
+00:18:24,000 --> 00:18:30,000
+Yes, I would call this has advantage of relational databases that made them so popular.
+
+230
+00:18:30,000 --> 00:18:33,000
+You have tables and the relations between tables.
+
+231
+00:18:33,000 --> 00:18:34,000
+This is logical.
+
+232
+00:18:34,000 --> 00:18:36,000
+This is easy to understand.
+
+233
+00:18:37,000 --> 00:18:44,000
+This is easier to support and work with structured data and data accuracy in the relational databases.
+
+234
+00:18:44,000 --> 00:18:50,000
+We have strict schema definition for each model, and each row in our database follows the same format.
+
+235
+00:18:50,000 --> 00:18:51,000
+And this is great.
+
+236
+00:18:52,000 --> 00:18:57,000
+This decreases probability of data inconsistency and decrease probability of potential errors.
+
+237
+00:18:57,000 --> 00:19:01,000
+One will perform bulk operations on all dataset.
+
+238
+00:19:01,000 --> 00:19:08,000
+Relational database design includes rules from set theory, normal forms for database normalization,
+
+239
+00:19:08,000 --> 00:19:12,000
+relational algebra and lots more encapsulation.
+
+240
+00:19:12,000 --> 00:19:18,000
+We can hide changes, Zoho data change and other details of internal database structure with the help
+
+241
+00:19:18,000 --> 00:19:19,000
+of use.
+
+242
+00:19:20,000 --> 00:19:24,000
+Also, we can take advantage of storage routines security.
+
+243
+00:19:24,000 --> 00:19:30,000
+With the help of database management system, we can control access to specific tables or make them
+
+244
+00:19:30,000 --> 00:19:31,000
+completely confidential.
+
+245
+00:19:32,000 --> 00:19:36,000
+We can control user permissions and grounds or revoke different types of permissions.
+
+246
+00:19:37,000 --> 00:19:43,000
+For example, I can grant a developers user access only to read data from a specific table only.
+
+247
+00:19:44,000 --> 00:19:50,000
+Performance enhancing or relational database view in terms of performance.
+
+248
+00:19:50,000 --> 00:19:58,000
+Still, its speed is considerably higher because of its ease and simplicity, and also various optimizations
+
+249
+00:19:58,000 --> 00:20:01,000
+that is included in the relational database.
+
+250
+00:20:01,000 --> 00:20:07,000
+Further increases its bit so all applications will run with appropriate speeds when used in a relational
+
+251
+00:20:07,000 --> 00:20:08,000
+database.
+
+252
+00:20:08,000 --> 00:20:15,000
+If you want to talk about these advantages of relational databases, I would mention the full once relatively
+
+253
+00:20:15,000 --> 00:20:22,000
+low performance was big amount of data on the one side using all possible features in the relational
+
+254
+00:20:22,000 --> 00:20:24,000
+databases, including indexes.
+
+255
+00:20:24,000 --> 00:20:26,000
+Main bring us to a great performance.
+
+256
+00:20:27,000 --> 00:20:34,000
+But this is for relatively not big amount of data was relatively not so much relations because imagine
+
+257
+00:20:34,000 --> 00:20:39,000
+that you have some model that contains one or even 200 rows.
+
+258
+00:20:39,000 --> 00:20:46,000
+Most of the rules are references to another tables and then those tables zero references to the city
+
+259
+00:20:46,000 --> 00:20:54,000
+was definitely retrieving and manipulating with such data is not a simple, single relational database.
+
+260
+00:20:55,000 --> 00:20:58,000
+That's why no SQL databases work better for big data.
+
+261
+00:20:59,000 --> 00:21:02,000
+We're going to discuss those SQL databases in a few minutes.
+
+262
+00:21:02,000 --> 00:21:03,000
+Complexity.
+
+263
+00:21:04,000 --> 00:21:06,000
+I know exactly what you feel at this moment.
+
+264
+00:21:07,000 --> 00:21:13,000
+You might be wondering, Andre, you just told us that one of advantages of relational databases is
+
+265
+00:21:13,000 --> 00:21:13,000
+simplicity.
+
+266
+00:21:14,000 --> 00:21:17,000
+How this may happen is that one of the disadvantages is complexity.
+
+267
+00:21:18,000 --> 00:21:19,000
+I explaining this now.
+
+268
+00:21:20,000 --> 00:21:26,000
+The main thing here is the volume of data in case you have relatively big amounts of data.
+
+269
+00:21:26,000 --> 00:21:30,000
+And when I say big, I mean, huge amount of data.
+
+270
+00:21:31,000 --> 00:21:39,000
+In this case, you need not forget and understand connection action was hundreds or even thousands models
+
+271
+00:21:39,000 --> 00:21:40,000
+and tables.
+
+272
+00:21:40,000 --> 00:21:41,000
+Can you imagine that?
+
+273
+00:21:42,000 --> 00:21:49,000
+Yes, from one side or relational databases provides us with stools that allow us to easily navigate
+
+274
+00:21:49,000 --> 00:21:51,000
+using existing data.
+
+275
+00:21:51,000 --> 00:21:59,000
+Easily identified dependencies easily add new information to the world, clear structure and perform
+
+276
+00:21:59,000 --> 00:22:00,000
+bulk operations.
+
+277
+00:22:00,000 --> 00:22:03,000
+Stop the data because it has common structure.
+
+278
+00:22:04,000 --> 00:22:07,000
+This is also true, but from another site.
+
+279
+00:22:07,000 --> 00:22:14,000
+Managing all dependencies and relations between different tables may become a nightmare when your application
+
+280
+00:22:14,000 --> 00:22:16,000
+become bigger and bigger.
+
+281
+00:22:17,000 --> 00:22:22,000
+This is also one of the reasons why people might opt for no SQL databases.
+
+282
+00:22:22,000 --> 00:22:30,000
+But remember, it always depends on the amount of data we store operations we perform with the data
+
+283
+00:22:30,000 --> 00:22:36,000
+and personal understanding of complexity and suitable data model for certain domains.
+
+284
+00:22:36,000 --> 00:22:39,000
+We have told me that was relational databases.
+
+285
+00:22:39,000 --> 00:22:46,000
+Sometimes it is hard and sometimes even impossible to describe all different kinds of data.
+
+286
+00:22:46,000 --> 00:22:52,000
+For example, using a relational database to traverse the graph will easily become a nightmare because
+
+287
+00:22:52,000 --> 00:22:55,000
+of the huge amount of unnecessary joints.
+
+288
+00:22:55,000 --> 00:23:01,000
+Using the graph based database like Neo4j will be much more appropriate.
+
+289
+00:23:02,000 --> 00:23:05,000
+The same is valid for deepening nested domain models.
+
+290
+00:23:06,000 --> 00:23:13,000
+Iraqis, as it would require a lot of tables and joints, documentarians and databases like MongoDB
+
+291
+00:23:13,000 --> 00:23:18,000
+acknowledged to be as the best choice for these domains or imagine.
+
+292
+00:23:18,000 --> 00:23:20,000
+You just need to store key value pairs.
+
+293
+00:23:20,000 --> 00:23:26,000
+In this case, something like Radius will have better performance rather than relational database and
+
+294
+00:23:26,000 --> 00:23:28,000
+will be more suitable for such data.
+
+295
+00:23:28,000 --> 00:23:30,000
+Strategy is a clear.
+
+296
+00:23:31,000 --> 00:23:37,000
+Difficult schema, evolution, as you have discussed already, it is just great, we have schemas and
+
+297
+00:23:37,000 --> 00:23:39,000
+different models with structure.
+
+298
+00:23:39,000 --> 00:23:43,000
+We have tables with a specific number of columns of the specific type.
+
+299
+00:23:44,000 --> 00:23:52,000
+This also allows us to perform bulk operations was data blog, irrigation functions and lots more.
+
+300
+00:23:52,000 --> 00:23:55,000
+But think about this from another site.
+
+301
+00:23:55,000 --> 00:24:00,000
+Imagine that you need it to change existing fields, name or existing field type.
+
+302
+00:24:00,000 --> 00:24:04,000
+We need to extend existing DB with other data.
+
+303
+00:24:05,000 --> 00:24:06,000
+Will it be easy for you?
+
+304
+00:24:06,000 --> 00:24:13,000
+Unfortunately, now that's why I'm saying that it always will be difficult to change schema.
+
+305
+00:24:13,000 --> 00:24:17,000
+Once it was created and once the data is in there.
+
+306
+00:24:18,000 --> 00:24:23,000
+That's why you shouldn't worry about time when you just thinking about the database structure for your
+
+307
+00:24:23,000 --> 00:24:23,000
+project.
+
+308
+00:24:24,000 --> 00:24:29,000
+You need to understand the business requirements in order to come up with the best relational database
+
+309
+00:24:29,000 --> 00:24:30,000
+design.
+
+310
+00:24:30,000 --> 00:24:37,000
+So as you can see, in most cases, disadvantages are nothing more than the other side of Advantage
+
+311
+00:24:37,000 --> 00:24:42,000
+model in relational databases and similar to other programming questions.
+
+312
+00:24:42,000 --> 00:24:49,000
+There is always a matter of tradeoffs and understanding of what works better for you and your project
+
+313
+00:24:49,000 --> 00:24:50,000
+at this specific point of time.
+
diff --git a/46 - Databases Overview and Environment Setup/003 Databases Overview - Part 2_en.srt b/46 - Databases Overview and Environment Setup/003 Databases Overview - Part 2_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..4f34a4a62eb44ed18c3b978ba4d3aa3ed335dd5e
--- /dev/null
+++ b/46 - Databases Overview and Environment Setup/003 Databases Overview - Part 2_en.srt
@@ -0,0 +1,1056 @@
+1
+00:00:06,000 --> 00:00:12,000
+The next day, the best times that we are going to review is not the relational databases or like they
+
+2
+00:00:12,000 --> 00:00:19,000
+are often called no SQL database, no SQL is a broad category that includes any database that doesn't
+
+3
+00:00:19,000 --> 00:00:23,000
+use school as its primary data access language.
+
+4
+00:00:23,000 --> 00:00:30,000
+Unlike in the relational databases, data and no SQL database doesn't have to conform to a predefined
+
+5
+00:00:30,000 --> 00:00:31,000
+schema.
+
+6
+00:00:31,000 --> 00:00:39,000
+So these types of databases are great for organizations seeking to store unstructured, semi-structured
+
+7
+00:00:39,000 --> 00:00:39,000
+data.
+
+8
+00:00:40,000 --> 00:00:47,000
+There was a time when no school was a buzzword and everyone tried to learn it and find a project with
+
+9
+00:00:47,000 --> 00:00:48,000
+no SQL database.
+
+10
+00:00:48,000 --> 00:00:55,000
+While the years it sounds behind those sequel is great and cool, it is not so popular as relational
+
+11
+00:00:55,000 --> 00:00:57,000
+database is because of the specific domain.
+
+12
+00:00:58,000 --> 00:01:03,000
+Well, talk about this one will come to advantages and disadvantages of no sequel databases.
+
+13
+00:01:04,000 --> 00:01:09,000
+No sequel is a type of database that is used for storing a wide range of data sets.
+
+14
+00:01:09,000 --> 00:01:13,000
+There are no relations and data might be stored in different ways.
+
+15
+00:01:13,000 --> 00:01:18,000
+For example, your data may be stored in so-called documents.
+
+16
+00:01:18,000 --> 00:01:20,000
+Imagine that we develop Twitter.
+
+17
+00:01:20,000 --> 00:01:24,000
+Well, regular review, for example, was relational databases and Twitter.
+
+18
+00:01:25,000 --> 00:01:29,000
+Now you will see how example with no sequel is different.
+
+19
+00:01:29,000 --> 00:01:31,000
+You have all with different posts.
+
+20
+00:01:32,000 --> 00:01:39,000
+Each costs may be treated as a document and you store all data that is related with this particular
+
+21
+00:01:39,000 --> 00:01:39,000
+post.
+
+22
+00:01:40,000 --> 00:01:46,000
+In the one single document, instead of storing all the related data in different tables, they already
+
+23
+00:01:46,000 --> 00:01:53,000
+understand the advantage of such approach instead of querying multiple tables by doing cross-gen queries.
+
+24
+00:01:53,000 --> 00:01:58,000
+You may just one single query to database and extracts the data you need.
+
+25
+00:01:59,000 --> 00:02:07,000
+It may be post descriptions, so information about post author time of posting number of likes, names
+
+26
+00:02:07,000 --> 00:02:14,000
+of users who liked your post, and you don't necessarily need to store all information about users who
+
+27
+00:02:14,000 --> 00:02:15,000
+likes your posts.
+
+28
+00:02:16,000 --> 00:02:23,000
+For example, you need to store online names to show them in the least on the request and the URL to
+
+29
+00:02:23,000 --> 00:02:29,000
+their pages in order we can redirect user on quicker about also in my store in the same document.
+
+30
+00:02:29,000 --> 00:02:36,000
+All related comments to this post and information about users who commanded the understands.
+
+31
+00:02:36,000 --> 00:02:39,000
+It compares a similar example with the relational database.
+
+32
+00:02:39,000 --> 00:02:44,000
+You don't have dozens of tables that you need to query to get information about the posts.
+
+33
+00:02:45,000 --> 00:02:48,000
+You just make a call to the database to get information about posts.
+
+34
+00:02:48,000 --> 00:02:52,000
+And that's it sounds like a great idea, isn't it?
+
+35
+00:02:53,000 --> 00:02:59,000
+But try to quantify the number of duplicated data in the database, but try to quantify a number of
+
+36
+00:02:59,000 --> 00:03:01,000
+duplicate data in the database.
+
+37
+00:03:01,000 --> 00:03:08,000
+If the same user put comments on the different posts and we don't have reference to the user table because
+
+38
+00:03:08,000 --> 00:03:15,000
+we don't have tables and relations, then all this information is duplicated multiple times just in
+
+39
+00:03:15,000 --> 00:03:17,000
+favor of the first reading.
+
+40
+00:03:17,000 --> 00:03:25,000
+And now imagine another thing you can write information relatively fast and you can extract information
+
+41
+00:03:25,000 --> 00:03:26,000
+relatively fast, too.
+
+42
+00:03:27,000 --> 00:03:30,000
+But what if you would need to update existing information?
+
+43
+00:03:30,000 --> 00:03:34,000
+For example, the same user changed his name or anything else.
+
+44
+00:03:35,000 --> 00:03:41,000
+Can you imagine how much time it would take in comparison to relational database when one of the core
+
+45
+00:03:41,000 --> 00:03:44,000
+concepts is reducing of data duplication in the database?
+
+46
+00:03:44,000 --> 00:03:50,000
+By building connections between tables in a relational database, you would just need to change your
+
+47
+00:03:50,000 --> 00:03:52,000
+user name in one place.
+
+48
+00:03:52,000 --> 00:03:56,000
+But in NoSQL database, this operation will take more time.
+
+49
+00:03:57,000 --> 00:04:07,000
+Some examples of NoSQL databases based on documents are MongoDB, Amazon Document DB Apache Couch 2B.
+
+50
+00:04:07,000 --> 00:04:15,000
+We can first divide no single databases into the following types Key value storage It is the simplest
+
+51
+00:04:15,000 --> 00:04:16,000
+type of database storage.
+
+52
+00:04:16,000 --> 00:04:23,000
+Where is source every single item as a key holding its value together if you value databases are highly
+
+53
+00:04:23,000 --> 00:04:31,000
+scalable and can handle high volumes of traffic, making them ideal for processes such as session management
+
+54
+00:04:31,000 --> 00:04:38,000
+for web applications, user sessions for massive multiplayer online games and online shopping carts.
+
+55
+00:04:38,000 --> 00:04:44,000
+Some examples are Amazon Dynamic to be read graph databases.
+
+56
+00:04:45,000 --> 00:04:52,000
+Xur used for storing the vast amount of data in graph like structure, most commonly social networking
+
+57
+00:04:52,000 --> 00:05:01,000
+websites uses a graph database graph oriented database management system software is designed to identify
+
+58
+00:05:01,000 --> 00:05:03,000
+and work with connections between data points.
+
+59
+00:05:04,000 --> 00:05:11,000
+Therefore, graph databases are often used to analyze the relationships between heterogeneous data points
+
+60
+00:05:11,000 --> 00:05:17,000
+such as and fraud prevention, or from mining data about customers from social media.
+
+61
+00:05:17,000 --> 00:05:25,000
+Some examples are data stacks, enterprise graph, neo 4G vertical databases.
+
+62
+00:05:26,000 --> 00:05:33,000
+This type is also known as White Columns stores, their schema, agnostic data storage and column families,
+
+63
+00:05:33,000 --> 00:05:35,000
+rather than in the rows and columns.
+
+64
+00:05:36,000 --> 00:05:44,000
+Highly scalable white column databases can handle petabytes of data, making them ideal for supporting
+
+65
+00:05:44,000 --> 00:05:46,000
+real time big data applications.
+
+66
+00:05:46,000 --> 00:05:54,000
+Some examples are made Table Apache Cassandra and Silver object oriented databases.
+
+67
+00:05:55,000 --> 00:06:00,000
+The type of database that uses the object based data model approach for storing data in the database
+
+68
+00:06:00,000 --> 00:06:01,000
+system.
+
+69
+00:06:01,000 --> 00:06:03,000
+The data is represented and stored.
+
+70
+00:06:03,000 --> 00:06:09,000
+Objects which are similar to the objects used in object oriented programming language.
+
+71
+00:06:09,000 --> 00:06:15,000
+Some examples are Vulcan objects saw Iraqi code databases.
+
+72
+00:06:15,000 --> 00:06:21,000
+It is a type of database that stores data in the form of parent children, relationship notes.
+
+73
+00:06:22,000 --> 00:06:30,000
+Originally developed by IBM in the early 1960s, Iraqi code databases are commonly used to support high
+
+74
+00:06:30,000 --> 00:06:33,000
+performance and high visibility applications.
+
+75
+00:06:33,000 --> 00:06:39,000
+Some examples are IBM Information Management System Windows Registry.
+
+76
+00:06:40,000 --> 00:06:46,000
+I'm serious that the basis that I'm serious, that the base is a database optimized for timestamp,
+
+77
+00:06:46,000 --> 00:06:48,000
+but time serious data.
+
+78
+00:06:48,000 --> 00:06:55,000
+Examples of this type of data include network data, sensor data and application performance monitoring
+
+79
+00:06:55,000 --> 00:06:55,000
+data.
+
+80
+00:06:56,000 --> 00:06:59,000
+All of those Internet of Things sensors.
+
+81
+00:06:59,000 --> 00:07:06,000
+All of those Internet of Things sensors is that I get attached to everything, puts out a conscious
+
+82
+00:07:06,000 --> 00:07:08,000
+stream of time, serious data.
+
+83
+00:07:08,000 --> 00:07:13,000
+Some examples are just extreme to be in flux to be.
+
+84
+00:07:14,000 --> 00:07:21,000
+Column oriented databases, while a relational database stores data in the rows and reads data row by
+
+85
+00:07:21,000 --> 00:07:25,000
+row column store is organized as a set of columns.
+
+86
+00:07:25,000 --> 00:07:32,000
+This means that when you want to run analytics on a small number of columns, you can read those columns
+
+87
+00:07:32,000 --> 00:07:36,000
+directly without consuming memory with the unwanted data.
+
+88
+00:07:37,000 --> 00:07:44,000
+Columns are often of the same type and benefit from more efficient compression, making the rates even
+
+89
+00:07:44,000 --> 00:07:44,000
+faster.
+
+90
+00:07:45,000 --> 00:07:51,000
+That a databases can quickly aggregates the value of a given column, for example they might be used
+
+91
+00:07:51,000 --> 00:07:54,000
+for an in-app is a total sales for the year.
+
+92
+00:07:54,000 --> 00:08:00,000
+Use cases include analytics, welcome on their database and great for analytics.
+
+93
+00:08:01,000 --> 00:08:08,000
+They're not always the best choice for other domains, but the way in which they write data makes it
+
+94
+00:08:08,000 --> 00:08:11,000
+very difficult for them to be strongly consistent.
+
+95
+00:08:11,000 --> 00:08:16,000
+As writes of all, the columns require multiple write events.
+
+96
+00:08:16,000 --> 00:08:23,000
+Under this, relational databases don't suffer from this problem as road data is written continuously
+
+97
+00:08:23,000 --> 00:08:24,000
+to this.
+
+98
+00:08:24,000 --> 00:08:34,000
+Some examples are Google Query Cassandra Maria, DB Column Store, Azure SQL Data Warehouse Cloud No
+
+99
+00:08:34,000 --> 00:08:38,000
+SQL databases similar to relational database.
+
+100
+00:08:38,000 --> 00:08:45,000
+It is also possible to buy no SQL database as a service and want examples of cloud NoSQL database.
+
+101
+00:08:46,000 --> 00:08:54,000
+I can name Azure Cosmos Debate, Google Cloud Data Store, Oracle, NoSQL, Database, Cloud, MongoDB,
+
+102
+00:08:54,000 --> 00:08:55,000
+Atlas and others.
+
+103
+00:08:56,000 --> 00:09:01,000
+Now, let's talk about the advantages and disadvantages of not the relational databases.
+
+104
+00:09:02,000 --> 00:09:05,000
+Let me start from advantages first flexibility.
+
+105
+00:09:06,000 --> 00:09:13,000
+There is no predefined schema, and the client of no SQL database is flexible to put any data structure
+
+106
+00:09:13,000 --> 00:09:13,000
+needed.
+
+107
+00:09:14,000 --> 00:09:15,000
+This gives flexibility.
+
+108
+00:09:16,000 --> 00:09:21,000
+Also, you don't need the change schema in case you need that additional kind of information.
+
+109
+00:09:22,000 --> 00:09:24,000
+High performance was big data.
+
+110
+00:09:24,000 --> 00:09:31,000
+As we have discussed and reviewed an example with no SQL database, you can achieve high performance
+
+111
+00:09:31,000 --> 00:09:33,000
+with big amount of data.
+
+112
+00:09:33,000 --> 00:09:35,000
+When you read data.
+
+113
+00:09:35,000 --> 00:09:41,000
+And again, usually it is high performance on the read write operations later.
+
+114
+00:09:41,000 --> 00:09:47,000
+In this course, we are going to index concept and you'll find out if you can increase performance by
+
+115
+00:09:47,000 --> 00:09:49,000
+indexing dating database.
+
+116
+00:09:49,000 --> 00:09:56,000
+So in case you have indexes, the document in those equal right operations also may become time consuming
+
+117
+00:09:57,000 --> 00:10:00,000
+because you need to keep your index and up to date state.
+
+118
+00:10:01,000 --> 00:10:07,000
+But definitely, if you use write operations more often than update and write operations, you may take
+
+119
+00:10:07,000 --> 00:10:09,000
+advantage of no sequel performance.
+
+120
+00:10:10,000 --> 00:10:16,000
+You meet people and articles on the internet that will try to assure you that no sequel is faster than
+
+121
+00:10:16,000 --> 00:10:19,000
+the relational databases in all cases.
+
+122
+00:10:20,000 --> 00:10:26,000
+This specific end depends on the relational database configuration and the configuration of SQL database.
+
+123
+00:10:26,000 --> 00:10:33,000
+It depends on the type of operations that we perform, and it depends on the amount of data we are operating
+
+124
+00:10:33,000 --> 00:10:35,000
+on and what is more important, in my opinion.
+
+125
+00:10:36,000 --> 00:10:42,000
+In most cases, it is data consistency, zero different business domains where we can sacrifice with
+
+126
+00:10:42,000 --> 00:10:44,000
+instant data consistency.
+
+127
+00:10:45,000 --> 00:10:47,000
+But in some domains, is this a critical requirement?
+
+128
+00:10:48,000 --> 00:10:52,000
+So don't be fooled and always verify facts.
+
+129
+00:10:52,000 --> 00:10:53,000
+Scalability.
+
+130
+00:10:54,000 --> 00:10:59,000
+It has been promoted, developed to address this ability problem characteristic of sequel.
+
+131
+00:10:59,000 --> 00:11:06,000
+As a result, it is schema free and viewed on distributed systems, which makes it easy to scale and
+
+132
+00:11:06,000 --> 00:11:06,000
+sharp.
+
+133
+00:11:07,000 --> 00:11:13,000
+And one disadvantage is it is worse dimension next Singh's eventual consistency.
+
+134
+00:11:13,000 --> 00:11:18,000
+We have discussed already as its relational databases were created to support transactions.
+
+135
+00:11:18,000 --> 00:11:25,000
+Transactional support means that you have tools to support all data in all tables inconsistent state
+
+136
+00:11:26,000 --> 00:11:27,000
+without anomalies.
+
+137
+00:11:27,000 --> 00:11:31,000
+Because in this one, operation in the common transaction is failed.
+
+138
+00:11:32,000 --> 00:11:37,000
+All transaction is rolled back to the original state, as it was before transaction is started.
+
+139
+00:11:38,000 --> 00:11:45,000
+No sequel uses this principle of eventual consistency and leases this item as disadvantage because for
+
+140
+00:11:45,000 --> 00:11:50,000
+some domains and for some operations, this might be a critical requirement as database.
+
+141
+00:11:51,000 --> 00:11:58,000
+Eventual consistency means that if there are no new updates for a particular data item for a certain
+
+142
+00:11:58,000 --> 00:12:04,000
+period of time, eventually all access to it will return the last updated value.
+
+143
+00:12:04,000 --> 00:12:10,000
+That's why such systems are usually described as providing base guarantees.
+
+144
+00:12:11,000 --> 00:12:20,000
+Base stands for basically available soft state eventual consistency, as opposed to acid that stands
+
+145
+00:12:20,000 --> 00:12:24,000
+for atomistic consistency, isolation, durability.
+
+146
+00:12:24,000 --> 00:12:31,000
+While this approach greatly increases access time and scalability, it may lead to data loss.
+
+147
+00:12:31,000 --> 00:12:37,000
+The severity of the problem depends on database server support and the quality of application court.
+
+148
+00:12:38,000 --> 00:12:41,000
+In some cases, this issue might be very serious.
+
+149
+00:12:42,000 --> 00:12:48,000
+Performance depends on the use case, as we have mentioned before, there are specific cases that should
+
+150
+00:12:48,000 --> 00:12:56,000
+be considered when we decide to use no SQL database because it may help us to bring significant performance
+
+151
+00:12:56,000 --> 00:13:01,000
+and from either side, it can decrease performance while doing other operations.
+
+152
+00:13:01,000 --> 00:13:08,000
+That's why we need to clearly understand the business, domain and data manipulations in our app to
+
+153
+00:13:08,000 --> 00:13:10,000
+make decision about no SQL database.
+
+154
+00:13:11,000 --> 00:13:18,000
+Little uniformity among different SQL databases There are many types of NoSQL systems, as there is
+
+155
+00:13:18,000 --> 00:13:20,000
+little uniformity among them.
+
+156
+00:13:21,000 --> 00:13:29,000
+Such characteristics as flexibility, performance, complexity, scalability and so vary greatly among
+
+157
+00:13:29,000 --> 00:13:36,000
+different systems, which makes choosing from among them difficult, even for experienced specialists.
+
+158
+00:13:37,000 --> 00:13:44,000
+Nevertheless, when properly chosen in concordance with the project's peculiarities, no sequel can
+
+159
+00:13:44,000 --> 00:13:50,000
+provide a much more efficient solution than a school system without significant loss and stability,
+
+160
+00:13:51,000 --> 00:13:53,000
+not mature ecosystem.
+
+161
+00:13:53,000 --> 00:13:58,000
+Probably the biggest downsides of NoSQL is that it is not as mature as sequel.
+
+162
+00:13:58,000 --> 00:14:05,000
+Sure, it has been around since the 70s and started to become popular in 2000.
+
+163
+00:14:05,000 --> 00:14:13,000
+But the truth is that sequel has had massive amounts of investment time and the Fords poured into it.
+
+164
+00:14:14,000 --> 00:14:19,000
+As such, sequel is in the much more advanced state compared to no sequel.
+
+165
+00:14:20,000 --> 00:14:27,000
+But how this may impact us people who invest big money and want to be sure with the success of their
+
+166
+00:14:27,000 --> 00:14:31,000
+progeny more often would opt for a reliable and proven solutions.
+
+167
+00:14:32,000 --> 00:14:38,000
+Also, it will be easier to find necessary information in the internet about school related issues rather
+
+168
+00:14:38,000 --> 00:14:39,000
+than no school.
+
+169
+00:14:40,000 --> 00:14:46,000
+And the same situation is was experts are much more experts in school domain nowadays.
+
+170
+00:14:47,000 --> 00:14:48,000
+Huge databases.
+
+171
+00:14:49,000 --> 00:14:52,000
+No school isn't designed to remove data duplication.
+
+172
+00:14:52,000 --> 00:14:58,000
+Data duplication is a fact in no school and not always considered to be an issue.
+
+173
+00:14:59,000 --> 00:15:06,000
+But in case you count on getting high quality data, you may face wash up as it was no SQL differently.
+
+174
+00:15:06,000 --> 00:15:12,000
+Storage doesn't cost crazy amount of money nowadays, but this is something to bear in mind too.
+
+175
+00:15:13,000 --> 00:15:19,000
+So I believe have information about advantages and disadvantages of school and NoSQL databases.
+
+176
+00:15:20,000 --> 00:15:27,000
+You already understand in which case what database is more applicable and still in case you have not
+
+177
+00:15:27,000 --> 00:15:28,000
+answered questions.
+
+178
+00:15:28,000 --> 00:15:33,000
+After all, this puts them in comments to this video, and I will be happy to answer those.
+
+179
+00:15:34,000 --> 00:15:38,000
+There is one more classification of databases that I'd like to discuss with you.
+
+180
+00:15:39,000 --> 00:15:42,000
+We can also have centralised and distributed database.
+
+181
+00:15:43,000 --> 00:15:46,000
+Let's understand what are they and what is the difference between them?
+
+182
+00:15:47,000 --> 00:15:50,000
+Let's start from understanding what centralised database first.
+
+183
+00:15:50,000 --> 00:15:56,000
+Centralised Database is a type of database that stores data at a centralised database system.
+
+184
+00:15:56,000 --> 00:16:03,000
+It allows to access data sources of special applications that contain the simplification process to
+
+185
+00:16:03,000 --> 00:16:06,000
+let users access data securely.
+
+186
+00:16:06,000 --> 00:16:12,000
+An example of centralised database can be Central Library is it carries a central database of each library
+
+187
+00:16:12,000 --> 00:16:13,000
+in the university.
+
+188
+00:16:14,000 --> 00:16:18,000
+Such databases have their own advantages and disadvantages.
+
+189
+00:16:18,000 --> 00:16:24,000
+Let's review them, and one advantage is we should list next sink's security.
+
+190
+00:16:25,000 --> 00:16:33,000
+Since all the data is in one place, you can take additional steps and actions to secure it better and
+
+191
+00:16:33,000 --> 00:16:36,000
+apply additional security measures around it.
+
+192
+00:16:36,000 --> 00:16:43,000
+Data integrity In case you have all data stored in one single place, it is easy to support its integrity.
+
+193
+00:16:44,000 --> 00:16:51,000
+This means that it is easier to coordinate the data, and that is as accurate and consistent as possible.
+
+194
+00:16:52,000 --> 00:16:55,000
+Minimal data redundancy is a data.
+
+195
+00:16:55,000 --> 00:16:58,000
+Redundancy is minimal in that centralised database.
+
+196
+00:16:58,000 --> 00:17:03,000
+All the data is stored together and not scattered across different locations.
+
+197
+00:17:03,000 --> 00:17:11,000
+Lower costs That centralised database is cheaper than other types of databases, as it requires less
+
+198
+00:17:11,000 --> 00:17:12,000
+power and maintenance.
+
+199
+00:17:13,000 --> 00:17:19,000
+But if you talk about these advantages, it person names are of fallen once more logged on the network.
+
+200
+00:17:19,000 --> 00:17:26,000
+Since all data is at one place, all data requests will be redirected to the one place only.
+
+201
+00:17:27,000 --> 00:17:34,000
+This may cause network overhead and in the case, multiple users try to access the same piece of information.
+
+202
+00:17:34,000 --> 00:17:37,000
+It may reduce efficiency of the system.
+
+203
+00:17:38,000 --> 00:17:42,000
+No recovery matters since all data is stored and want.
+
+204
+00:17:42,000 --> 00:17:50,000
+Is it easy to lost all data at once in case of emergency or in case of physical destruction of storage
+
+205
+00:17:50,000 --> 00:17:55,000
+is to address disadvantages that are inherent for centralized databases?
+
+206
+00:17:55,000 --> 00:18:03,000
+We have distributed databases online that centralized database system in distributed systems data is
+
+207
+00:18:03,000 --> 00:18:07,000
+distributed among different database systems of an organization.
+
+208
+00:18:07,000 --> 00:18:11,000
+These database systems are connected via communication links.
+
+209
+00:18:12,000 --> 00:18:16,000
+Such links how the end users to access data easily.
+
+210
+00:18:16,000 --> 00:18:23,000
+Examples of the distributed database are Apache Cassandra, Age Base, English and others.
+
+211
+00:18:24,000 --> 00:18:33,000
+Distributed database storage is managed into waste replication and fragmentation, internet based replication,
+
+212
+00:18:33,000 --> 00:18:37,000
+the system store corpus of data on different sides.
+
+213
+00:18:37,000 --> 00:18:43,000
+The advantage of that the basic location is that it increases data availability on different sites and
+
+214
+00:18:43,000 --> 00:18:46,000
+allows for parallel query requests to be processed.
+
+215
+00:18:47,000 --> 00:18:54,000
+However, database replication means that data requires constant updates and synchronization with other
+
+216
+00:18:54,000 --> 00:19:02,000
+sites to maintain and exact database copy, and it changes made on one side must be recorded on other
+
+217
+00:19:02,000 --> 00:19:09,000
+sites or else inconsistencies occur when it comes to fragmentation of distributed database storage.
+
+218
+00:19:09,000 --> 00:19:14,000
+The relations are fragmented, which means they're split into smaller parts.
+
+219
+00:19:14,000 --> 00:19:19,000
+Each of the fragments is stored on a different site where it is required.
+
+220
+00:19:20,000 --> 00:19:26,000
+One of the key things we have to worry about before fragmentation is to make sure that the fragments
+
+221
+00:19:26,000 --> 00:19:30,000
+can later be reconstructed into the original relation without losing data.
+
+222
+00:19:31,000 --> 00:19:37,000
+The advantage of fragmentation is that there are no data copies, which prevents data, and consistency
+
+223
+00:19:38,000 --> 00:19:43,000
+is a fragmentation and churn, maybe of two types horizontal fragmentation.
+
+224
+00:19:43,000 --> 00:19:51,000
+This is one relation schema is fragmented into groups of rows, and each group is assigned to one fragment
+
+225
+00:19:52,000 --> 00:19:53,000
+and the vertical fragmentation.
+
+226
+00:19:54,000 --> 00:20:00,000
+This is one relation schema is fragmented into smaller schemas, and each fragment contains a common
+
+227
+00:20:00,000 --> 00:20:03,000
+candidates key to guarantee a lossless drawing.
+
+228
+00:20:04,000 --> 00:20:11,000
+We can classify distributed databases further into homogeneous databases, and the heads are genius
+
+229
+00:20:11,000 --> 00:20:18,000
+databases, homogeneous database systems, works on the same operating system and used the same application
+
+230
+00:20:18,000 --> 00:20:21,000
+process and carries the same hardware devices.
+
+231
+00:20:22,000 --> 00:20:28,000
+On the other hand, it's a genius that the best systems work on different operating systems under different
+
+232
+00:20:28,000 --> 00:20:32,000
+application procedures and carries different hardware devices.
+
+233
+00:20:33,000 --> 00:20:40,000
+Basically, the logical advantages of distributed databases hurt the lost all data at once and easy
+
+234
+00:20:40,000 --> 00:20:43,000
+recovery since data is distributed.
+
+235
+00:20:43,000 --> 00:20:50,000
+It would be hard to destroy all data at once, since it is stored in different locations and any way.
+
+236
+00:20:50,000 --> 00:20:55,000
+It will be easy to recover the lost data since it is also stored in other places.
+
+237
+00:20:56,000 --> 00:21:03,000
+Flexibility Since data is distributed already, it is easier to scale it across different locations.
+
+238
+00:21:03,000 --> 00:21:10,000
+Better performance In case you have users across the world, they can send requests to strategies that
+
+239
+00:21:10,000 --> 00:21:16,000
+are physically closer to them, and thus Zlatan's and network is distributed between different locations.
+
+240
+00:21:17,000 --> 00:21:24,000
+Durability Even if some of the data nodes go offline, the rest of the database can continue its normal
+
+241
+00:21:24,000 --> 00:21:25,000
+functions.
+
+242
+00:21:26,000 --> 00:21:31,000
+And even despite all advantages, distributed database also have some disadvantages.
+
+243
+00:21:31,000 --> 00:21:34,000
+Some of them are extra complexity.
+
+244
+00:21:34,000 --> 00:21:36,000
+I believe that this is obras.
+
+245
+00:21:36,000 --> 00:21:41,000
+Its support of consistent data shared between different places takes additional force.
+
+246
+00:21:41,000 --> 00:21:45,000
+So ensuring of data integrity become a more complex task.
+
+247
+00:21:46,000 --> 00:21:47,000
+Extra costs.
+
+248
+00:21:47,000 --> 00:21:53,000
+Another obvious thing is that more costs will be spent for support and maintenance of such systems.
+
+249
+00:21:53,000 --> 00:21:59,000
+In case you have any questions regarding centralised and distributed databases, let me know in comments
+
+250
+00:21:59,000 --> 00:22:00,000
+to this video.
+
+251
+00:22:01,000 --> 00:22:04,000
+Basically, that's all what I wanted to share with you today.
+
+252
+00:22:04,000 --> 00:22:07,000
+Let's review what we have learned in this lesson.
+
+253
+00:22:07,000 --> 00:22:14,000
+Today, we learned what database is and why we need it now, you know, advantages of using databases
+
+254
+00:22:14,000 --> 00:22:15,000
+in your apps.
+
+255
+00:22:15,000 --> 00:22:17,000
+This is an important thing to understand.
+
+256
+00:22:18,000 --> 00:22:22,000
+Also, after this lesson, you can understand the difference between database and database management
+
+257
+00:22:22,000 --> 00:22:23,000
+system.
+
+258
+00:22:24,000 --> 00:22:31,000
+Learn different types of databases, namely, learn what's relational database is and will learn what
+
+259
+00:22:31,000 --> 00:22:37,000
+not relational on those SQL databases are really of different types of know SQL databases.
+
+260
+00:22:37,000 --> 00:22:40,000
+We compared centralized and distributed databases.
+
+261
+00:22:41,000 --> 00:22:45,000
+Also, we removed advantages and disadvantages of each type of database.
+
+262
+00:22:46,000 --> 00:22:50,000
+So as you can see, there are really a lot of things that we have learned to date.
+
+263
+00:22:51,000 --> 00:22:53,000
+Thanks a lot for your attention.
+
+264
+00:22:53,000 --> 00:22:56,000
+Have a great day and see you in the next lesson.
+
diff --git a/46 - Databases Overview and Environment Setup/004 How-to-Install-MySQL-on-MacOS.url b/46 - Databases Overview and Environment Setup/004 How-to-Install-MySQL-on-MacOS.url
new file mode 100644
index 0000000000000000000000000000000000000000..1bf35ba8ae44c60d4d86db9672970b236a4c422f
--- /dev/null
+++ b/46 - Databases Overview and Environment Setup/004 How-to-Install-MySQL-on-MacOS.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://dev.mysql.com/doc/refman/8.0/en/macos-installation-pkg.html
\ No newline at end of file
diff --git a/46 - Databases Overview and Environment Setup/004 Microsoft-MySQL-Installer.url b/46 - Databases Overview and Environment Setup/004 Microsoft-MySQL-Installer.url
new file mode 100644
index 0000000000000000000000000000000000000000..f45c33c1db9f424b736c483446d19cf9020aefe2
--- /dev/null
+++ b/46 - Databases Overview and Environment Setup/004 Microsoft-MySQL-Installer.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://dev.mysql.com/downloads/installer/
\ No newline at end of file
diff --git a/46 - Databases Overview and Environment Setup/004 MySQL Overview & Installation (including Workbench Installation)_en.srt b/46 - Databases Overview and Environment Setup/004 MySQL Overview & Installation (including Workbench Installation)_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..5cf29c90cb7ce53579ca7217fc6d624e390916d8
--- /dev/null
+++ b/46 - Databases Overview and Environment Setup/004 MySQL Overview & Installation (including Workbench Installation)_en.srt
@@ -0,0 +1,1120 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello, Jim.
+
+2
+00:00:06,000 --> 00:00:11,000
+In this lesson, we are going to configure and prepare environment for our further education.
+
+3
+00:00:12,000 --> 00:00:19,000
+Basically, you can select any database, any database management system you like the most because for
+
+4
+00:00:19,000 --> 00:00:25,000
+learning purposes, especially when we're on the basics, everything is the same when gradually we will
+
+5
+00:00:25,000 --> 00:00:27,000
+jump to more advanced concepts.
+
+6
+00:00:27,000 --> 00:00:30,000
+You would understand the dialect of ESC.
+
+7
+00:00:30,000 --> 00:00:35,000
+You might be, in some rare cases, a little bit different in the build.
+
+8
+00:00:35,000 --> 00:00:37,000
+Functions might be named differently.
+
+9
+00:00:37,000 --> 00:00:43,000
+Zoe, how DBE works inside might be different, but anyway, I will give these, Colman says.
+
+10
+00:00:43,000 --> 00:00:47,000
+We go and consider, and these differences are not dramatic.
+
+11
+00:00:47,000 --> 00:00:50,000
+It will be easier to hold comparative analysis.
+
+12
+00:00:50,000 --> 00:00:56,000
+During the last day, they were going to hold an overview of my cycle, including my skill workbench
+
+13
+00:00:56,000 --> 00:00:58,000
+and install it on your computer.
+
+14
+00:00:58,000 --> 00:01:03,000
+We are going to start from question Why am I sequel and will hold overview of my sequel?
+
+15
+00:01:04,000 --> 00:01:06,000
+We'll talk about my sequel features in order.
+
+16
+00:01:06,000 --> 00:01:13,000
+You can understand it better after a small piece of Syria will jump to practical part will install with
+
+17
+00:01:13,000 --> 00:01:17,000
+you, my SQL server, my sequel workbench and my sequel Shell on your computer.
+
+18
+00:01:17,000 --> 00:01:23,000
+We'll create our route user and configure our database once all configuration will be done.
+
+19
+00:01:24,000 --> 00:01:29,000
+We'll establish a new connection from my school workbench store on my SQL server to be sure that we
+
+20
+00:01:29,000 --> 00:01:31,000
+are ready for the next lessons.
+
+21
+00:01:31,000 --> 00:01:36,000
+And at the end of the lesson, I will elaborate more about Windows service for my sequel.
+
+22
+00:01:37,000 --> 00:01:38,000
+Let's start our lesson.
+
+23
+00:01:39,000 --> 00:01:46,000
+Let's start from my sequel overview why we may want to choose my sequel in few words, according to
+
+24
+00:01:46,000 --> 00:01:49,000
+some statistics and different sources of information.
+
+25
+00:01:49,000 --> 00:01:54,000
+My sequel may be considered as the most popular relational database nowadays.
+
+26
+00:01:55,000 --> 00:02:01,000
+Nephron Zero will be different opinions on that because it is hard to calculate the number of users
+
+27
+00:02:01,000 --> 00:02:02,000
+objectively.
+
+28
+00:02:02,000 --> 00:02:08,000
+But still, it is hard to reject the fact that this is definitely one of the most popular relational
+
+29
+00:02:08,000 --> 00:02:10,000
+databases in the world.
+
+30
+00:02:10,000 --> 00:02:13,000
+I will try to explain you briefly what my sequel is.
+
+31
+00:02:14,000 --> 00:02:18,000
+First of all, my sequel is a relational database management system.
+
+32
+00:02:18,000 --> 00:02:25,000
+A relational database stores data in separate tables rather than put an old data in one big storeroom.
+
+33
+00:02:26,000 --> 00:02:33,000
+The database structures are organized into physical files optimized for split the logical model with
+
+34
+00:02:33,000 --> 00:02:36,000
+objects such as database tables.
+
+35
+00:02:36,000 --> 00:02:41,000
+We use rows and columns offers a flexible programming environment.
+
+36
+00:02:41,000 --> 00:02:44,000
+Another important thing is that my SQL is free.
+
+37
+00:02:45,000 --> 00:02:47,000
+You should pay nuttin for using it.
+
+38
+00:02:47,000 --> 00:02:51,000
+You can use it even in commercial projects for free.
+
+39
+00:02:51,000 --> 00:02:59,000
+The reason my sequel Community Edition that you can use for in GPL license GPL stands for General Public
+
+40
+00:02:59,000 --> 00:03:02,000
+License is a serious or widely used free software license.
+
+41
+00:03:02,000 --> 00:03:09,000
+This is a guarantee and users the freedom to run, study, share and modify the software.
+
+42
+00:03:10,000 --> 00:03:12,000
+The different versions of it.
+
+43
+00:03:12,000 --> 00:03:16,000
+So you can follow up with the specifics of the license for my school.
+
+44
+00:03:17,000 --> 00:03:22,000
+But in general and in main goal, all versions of GPL license are similar.
+
+45
+00:03:23,000 --> 00:03:25,000
+My school is open source.
+
+46
+00:03:25,000 --> 00:03:27,000
+This is important point of my school.
+
+47
+00:03:27,000 --> 00:03:32,000
+It is supported by a huge and active community of open source developers.
+
+48
+00:03:32,000 --> 00:03:37,000
+That means that there are a lot of information available in the internet about it.
+
+49
+00:03:37,000 --> 00:03:41,000
+A lot of problems are resolved and a lot of workarounds found.
+
+50
+00:03:41,000 --> 00:03:47,000
+Definitely, selecting a tool was a big community to support, usually considered as a right step.
+
+51
+00:03:48,000 --> 00:03:53,000
+My school is ideal for both small and large obligations.
+
+52
+00:03:53,000 --> 00:03:58,000
+It is easy to make this statement when you are familiar with the advantages of my school and how it
+
+53
+00:03:58,000 --> 00:04:04,000
+is built inside my school works just perfect with small and medium amount of data.
+
+54
+00:04:05,000 --> 00:04:08,000
+Definitely, we are talking about terabytes of data.
+
+55
+00:04:08,000 --> 00:04:10,000
+We might consider no SQL database.
+
+56
+00:04:11,000 --> 00:04:14,000
+But for most cases, my sequel is just perfect.
+
+57
+00:04:15,000 --> 00:04:19,000
+My sequel is very fast, reliable, scalable and easy to use.
+
+58
+00:04:20,000 --> 00:04:24,000
+If that is what you are looking for, you should give it a try.
+
+59
+00:04:24,000 --> 00:04:32,000
+My SQL server can run comfortably on a desktop or laptop alongside your other applications, web service
+
+60
+00:04:32,000 --> 00:04:33,000
+and so on.
+
+61
+00:04:33,000 --> 00:04:36,000
+Required little or no attention.
+
+62
+00:04:36,000 --> 00:04:42,000
+If you dedicate an entire machine to my sequel, you can adjust the settings to take advantage of all
+
+63
+00:04:42,000 --> 00:04:46,000
+memory, CPU power and i o capacity available.
+
+64
+00:04:47,000 --> 00:04:52,000
+My sequel can also scale up to clusters of machines networked together.
+
+65
+00:04:53,000 --> 00:05:00,000
+My sequel server was originally developed to handle large databases much faster than existing solutions
+
+66
+00:05:00,000 --> 00:05:05,000
+and has been successfully used in highly demanding production environments for several years.
+
+67
+00:05:06,000 --> 00:05:11,000
+My sequel also comes with my sequel Rogue Batch is that we can use to administrate our database.
+
+68
+00:05:12,000 --> 00:05:19,000
+This is nice desktop application that allows us to perform different operations with our database and
+
+69
+00:05:19,000 --> 00:05:21,000
+data inside it in very simple manner.
+
+70
+00:05:22,000 --> 00:05:24,000
+My sequel is cross-platform.
+
+71
+00:05:25,000 --> 00:05:31,000
+The different installation packs four different operating systems, so you can be sure that my sequel
+
+72
+00:05:31,000 --> 00:05:39,000
+will be supported on your operating system to my sequel is compliant with the A.I. sequel standards
+
+73
+00:05:39,000 --> 00:05:44,000
+like I mentioned already originally that different dialects of sequel.
+
+74
+00:05:44,000 --> 00:05:51,000
+And currently there is a process of standardization of structured query language between different databases.
+
+75
+00:05:51,000 --> 00:05:56,000
+Obviously, this is not the easiest thing because owner of each database.
+
+76
+00:05:57,000 --> 00:06:00,000
+First of all, worries about his user.
+
+77
+00:06:00,000 --> 00:06:07,000
+But my sequel is already compliant with the first sequel standard that was created by American National
+
+78
+00:06:07,000 --> 00:06:08,000
+Standards Institute.
+
+79
+00:06:09,000 --> 00:06:16,000
+My SQL server works in client, server or embedded systems there, my SQL database software is client
+
+80
+00:06:16,000 --> 00:06:23,000
+still a system that consists of not just shredded SQL server that supports different backgrounds, several
+
+81
+00:06:23,000 --> 00:06:29,000
+different client programs and libraries, administrative tools and a wide range of application programming
+
+82
+00:06:29,000 --> 00:06:31,000
+interfaces API.
+
+83
+00:06:32,000 --> 00:06:35,000
+My school was first released in 1995.
+
+84
+00:06:36,000 --> 00:06:41,000
+My SQL is developed, distributed and supported by Oracle Corporation.
+
+85
+00:06:42,000 --> 00:06:45,000
+Years, of course, have demonstrated features of my sequel.
+
+86
+00:06:46,000 --> 00:06:48,000
+I will just briefly mention them here on the slide.
+
+87
+00:06:49,000 --> 00:06:53,000
+So many features of my sequel are my sequel.
+
+88
+00:06:53,000 --> 00:06:56,000
+A silver design is multilayered, was independent Moyo's.
+
+89
+00:06:57,000 --> 00:07:00,000
+It is fully moved, just shredded by using kernel shreds.
+
+90
+00:07:01,000 --> 00:07:04,000
+It can handle multiple CPUs if they are available.
+
+91
+00:07:05,000 --> 00:07:09,000
+My sequel provides transactional and non transactional storage engines.
+
+92
+00:07:10,000 --> 00:07:13,000
+It has a high speed, spread based memory allocation system.
+
+93
+00:07:14,000 --> 00:07:19,000
+Also, it supports in memory chip table handles large databases.
+
+94
+00:07:19,000 --> 00:07:25,000
+Several books in client, server or embedded systems works on many different platforms.
+
+95
+00:07:26,000 --> 00:07:33,000
+In general, there are a lot of cool features in different areas, namely in such areas as internals
+
+96
+00:07:33,000 --> 00:07:34,000
+and portability.
+
+97
+00:07:34,000 --> 00:07:36,000
+Statements and functions.
+
+98
+00:07:36,000 --> 00:07:38,000
+Security, scalability and limits.
+
+99
+00:07:39,000 --> 00:07:41,000
+Connectivity, localization, et cetera.
+
+100
+00:07:42,000 --> 00:07:47,000
+As of now, I believe you have at least high level understanding about my sequel.
+
+101
+00:07:48,000 --> 00:07:50,000
+Let's proceed now with my sequel installation.
+
+102
+00:07:50,000 --> 00:07:56,000
+I prepared Special Guide for you, highlighting the main sinks during the installation process.
+
+103
+00:07:56,000 --> 00:07:59,000
+As we said before, my sequel is cross-platform.
+
+104
+00:07:59,000 --> 00:08:03,000
+That means you can install it on different operating systems.
+
+105
+00:08:03,000 --> 00:08:04,000
+I use windows.
+
+106
+00:08:05,000 --> 00:08:09,000
+That's why we are prepared tutorial for Windows installation.
+
+107
+00:08:09,000 --> 00:08:15,000
+In case you have Mac by Apple, don't worry in attachments, the last thing you can find detailed the
+
+108
+00:08:15,000 --> 00:08:18,000
+guide on how to install my sequel on Mac.
+
+109
+00:08:19,000 --> 00:08:21,000
+And the meantime, let me press it.
+
+110
+00:08:22,000 --> 00:08:27,000
+The first thing that they recommended to do is to download my SQL installer.
+
+111
+00:08:27,000 --> 00:08:32,000
+I'm going to leave links in attachments to this lesson for Windows Installer.
+
+112
+00:08:32,000 --> 00:08:37,000
+You can download it from official my SQL website downloads.
+
+113
+00:08:37,000 --> 00:08:44,000
+A bigger file like it is shown on the slide was the next page will be offered easier to log in or to
+
+114
+00:08:44,000 --> 00:08:48,000
+sign up, and a lot of students of mine session registration at this moment.
+
+115
+00:08:49,000 --> 00:08:54,000
+Just wanted to draw attention that this is not necessary to create an account.
+
+116
+00:08:54,000 --> 00:08:56,000
+If you want, you can create one.
+
+117
+00:08:57,000 --> 00:09:00,000
+But this is not a blocker for us to proceed with the lot.
+
+118
+00:09:00,000 --> 00:09:03,000
+Please pay attention to clickable text below.
+
+119
+00:09:03,000 --> 00:09:04,000
+No sex.
+
+120
+00:09:04,000 --> 00:09:05,000
+Just start my download.
+
+121
+00:09:06,000 --> 00:09:09,000
+Just click here and the lot will be started straight away.
+
+122
+00:09:09,000 --> 00:09:12,000
+After you click this button, your download will be started.
+
+123
+00:09:13,000 --> 00:09:16,000
+Make a cup of tea because this may take some time.
+
+124
+00:09:17,000 --> 00:09:23,000
+Once the law is finished, Iran's installer right after the start up, you will be offered to choose
+
+125
+00:09:23,000 --> 00:09:24,000
+someone's a different set up types.
+
+126
+00:09:25,000 --> 00:09:29,000
+This is my siko installer that allows it to install the different products.
+
+127
+00:09:30,000 --> 00:09:36,000
+You can spend a minute or two really and screws a set up type description somewhere you will be offered
+
+128
+00:09:36,000 --> 00:09:43,000
+to install my SQL Server router workbench, my skill for visual studio connectors, the communication
+
+129
+00:09:44,000 --> 00:09:47,000
+symbols and different combination of these options.
+
+130
+00:09:47,000 --> 00:09:51,000
+I always prefer to select things that they need by myself.
+
+131
+00:09:51,000 --> 00:09:54,000
+That's why I select custom radio button.
+
+132
+00:09:55,000 --> 00:09:59,000
+Remember, it is only up to you what you would like to install on your computer.
+
+133
+00:09:59,000 --> 00:10:03,000
+But I would select for myself the next things my SQL server.
+
+134
+00:10:04,000 --> 00:10:08,000
+This is our actual database, my SQL workbench.
+
+135
+00:10:08,000 --> 00:10:14,000
+This is desktop applications that allows us to interact with my SQL database with nice user experience
+
+136
+00:10:15,000 --> 00:10:16,000
+and great UI.
+
+137
+00:10:17,000 --> 00:10:23,000
+My Circle Shell My Circle Shell is an advanced client and code editor for my SQL.
+
+138
+00:10:23,000 --> 00:10:30,000
+I install it, you know, just in case, because in case workbench will be accidentally broken, I would
+
+139
+00:10:30,000 --> 00:10:31,000
+use my SQL shell.
+
+140
+00:10:32,000 --> 00:10:36,000
+I believe you would be able to handle this UI in install that.
+
+141
+00:10:36,000 --> 00:10:41,000
+Basically, you need to expand each option and select the option you need.
+
+142
+00:10:42,000 --> 00:10:49,000
+And after that, the arrow to move your selection in other area that is called products to be installed.
+
+143
+00:10:50,000 --> 00:10:54,000
+After this, I press Max button on the next step.
+
+144
+00:10:54,000 --> 00:10:57,000
+You basically need the NASM, just verify your selections.
+
+145
+00:10:58,000 --> 00:11:02,000
+All products should have status ready to install and press execute.
+
+146
+00:11:03,000 --> 00:11:05,000
+After that, install process will be started.
+
+147
+00:11:05,000 --> 00:11:10,000
+You just need to wait until status will be changed to complete for all products.
+
+148
+00:11:10,000 --> 00:11:12,000
+Wait for a few minutes here.
+
+149
+00:11:12,000 --> 00:11:17,000
+You can press ghosts in the lesson and wait until installation will be over.
+
+150
+00:11:18,000 --> 00:11:22,000
+When all products successfully installed, you will be notified with complete status.
+
+151
+00:11:23,000 --> 00:11:25,000
+After this, just press next button.
+
+152
+00:11:26,000 --> 00:11:31,000
+Now, when all products are installed, you will be offered the wrong configuration wizard for products
+
+153
+00:11:31,000 --> 00:11:33,000
+that require configuration.
+
+154
+00:11:33,000 --> 00:11:38,000
+In our case, only one product requires configuration that is my SQL server.
+
+155
+00:11:38,000 --> 00:11:42,000
+Not so much other options at this stage besides clicking next.
+
+156
+00:11:43,000 --> 00:11:48,000
+The first scene that we need to configure is config type and network configurations.
+
+157
+00:11:48,000 --> 00:11:50,000
+You have a few predefined config types.
+
+158
+00:11:51,000 --> 00:11:58,000
+The main differences between them is how much memory and resources dedicate to my SQL server process.
+
+159
+00:11:58,000 --> 00:12:05,000
+Obviously, if this is development computer, we can't afford the same computing power as on the separate
+
+160
+00:12:05,000 --> 00:12:08,000
+so that we use, especially for databases.
+
+161
+00:12:08,000 --> 00:12:12,000
+That's why I opt for development computer option here.
+
+162
+00:12:13,000 --> 00:12:16,000
+Next things that we need to do is to configure port number.
+
+163
+00:12:16,000 --> 00:12:23,000
+My SQL server will be running on your computer and we need to specify a port of this application.
+
+164
+00:12:23,000 --> 00:12:29,000
+We're going to learn web development and web technologies in a separate course, and I will explain
+
+165
+00:12:29,000 --> 00:12:34,000
+in detail what TCP IP protocol and how it works.
+
+166
+00:12:34,000 --> 00:12:39,000
+But still, I want you to understand what this configuration is about.
+
+167
+00:12:39,000 --> 00:12:46,000
+All computers are connected into a global network, and you can use IP address to find the device.
+
+168
+00:12:46,000 --> 00:12:47,000
+Is this connected to the network?
+
+169
+00:12:48,000 --> 00:12:55,000
+IP address is similar to the address of the building in the city, and when we found a building in the
+
+170
+00:12:55,000 --> 00:12:59,000
+city, we need also to know apartment number to visit our friends.
+
+171
+00:12:59,000 --> 00:13:01,000
+They understand the analogy.
+
+172
+00:13:01,000 --> 00:13:05,000
+So the port number is number of apartment in the building.
+
+173
+00:13:06,000 --> 00:13:11,000
+In order other apps, no address of my SQL server hubs.
+
+174
+00:13:11,000 --> 00:13:12,000
+This is clear now.
+
+175
+00:13:12,000 --> 00:13:17,000
+By default, my SQL server uses Port Citizenry 06.
+
+176
+00:13:18,000 --> 00:13:21,000
+If for some reasons and this is almost next to very unlikely.
+
+177
+00:13:22,000 --> 00:13:28,000
+In case your port search history 06 is not available because other app using it just changed the sport
+
+178
+00:13:28,000 --> 00:13:30,000
+number anyway.
+
+179
+00:13:30,000 --> 00:13:35,000
+This is not super critical because we'll use this port during the configuration of any connection,
+
+180
+00:13:35,000 --> 00:13:43,000
+and we will be able to change it manually when we need the Port of X protocol supported by clients such
+
+181
+00:13:43,000 --> 00:13:50,000
+as my school show, my SQL connectors and my SQL router is calculated by multiplying port used for classic
+
+182
+00:13:51,000 --> 00:13:52,000
+cycle protocol by 10.
+
+183
+00:13:53,000 --> 00:13:58,000
+For example, it was a classic my SQL protocol port is a default value of such history.
+
+184
+00:13:58,000 --> 00:14:02,000
+06 is an X Protocol port is such as three oh six.
+
+185
+00:14:02,000 --> 00:14:06,000
+Oh, that's all configurations that we are going to apply on this page.
+
+186
+00:14:06,000 --> 00:14:08,000
+Let's press next button.
+
+187
+00:14:09,000 --> 00:14:13,000
+On this step, we need to select our syndication method.
+
+188
+00:14:13,000 --> 00:14:21,000
+It is recommended to use strong passwords, encryption my school use improved stronger as a 256 based
+
+189
+00:14:21,000 --> 00:14:22,000
+password message.
+
+190
+00:14:23,000 --> 00:14:24,000
+Let's move on to the next step.
+
+191
+00:14:25,000 --> 00:14:32,000
+In database, we always have user with all the rights and privileges, God admin user who can do everything
+
+192
+00:14:32,000 --> 00:14:34,000
+with the configurations of the app.
+
+193
+00:14:35,000 --> 00:14:37,000
+Usually such user is called route user.
+
+194
+00:14:38,000 --> 00:14:41,000
+And now we have opportunity to set the password for this user.
+
+195
+00:14:42,000 --> 00:14:44,000
+Please make sure that you will never forget this password.
+
+196
+00:14:45,000 --> 00:14:46,000
+This is important password.
+
+197
+00:14:47,000 --> 00:14:52,000
+You may forget passwords to other users, but never for this one on this step.
+
+198
+00:14:53,000 --> 00:14:58,000
+You can also add other users, but I don't think that this is necessary at this moment.
+
+199
+00:14:58,000 --> 00:15:03,000
+We are going to learn how to add users and grant them privileges later in the course.
+
+200
+00:15:03,000 --> 00:15:06,000
+Let's press next button here.
+
+201
+00:15:06,000 --> 00:15:08,000
+You have opportunity to configure a Windows service.
+
+202
+00:15:09,000 --> 00:15:16,000
+Windows Services, a core component of the Microsoft Windows operating system and enables the creation
+
+203
+00:15:16,000 --> 00:15:18,000
+and management of long running processes.
+
+204
+00:15:18,000 --> 00:15:24,000
+Basically, my SQL server will be up and running with the name you specify here.
+
+205
+00:15:24,000 --> 00:15:29,000
+Also, you can start my SQL server every time at System Start up.
+
+206
+00:15:29,000 --> 00:15:33,000
+You will be able to change this configuration later to and below.
+
+207
+00:15:33,000 --> 00:15:37,000
+You can select accounts that will start my SQL server.
+
+208
+00:15:37,000 --> 00:15:42,000
+I recommend you do not change this option and limit select it on standard system account.
+
+209
+00:15:43,000 --> 00:15:47,000
+And the last thing that we need to do is to agree to apply a configuration.
+
+210
+00:15:47,000 --> 00:15:53,000
+You can check all your configurations and navigate back if you want to change something, but in case
+
+211
+00:15:53,000 --> 00:15:55,000
+you are happy with all configurations that was set.
+
+212
+00:15:56,000 --> 00:15:57,000
+Click Execute button.
+
+213
+00:15:58,000 --> 00:16:04,000
+When all configurations are applied, you are going to see assumption like you see on the slide finish
+
+214
+00:16:04,000 --> 00:16:06,000
+button will become available to you.
+
+215
+00:16:07,000 --> 00:16:07,000
+Let's click it.
+
+216
+00:16:09,000 --> 00:16:15,000
+Now, after all, configuration is completed, click next and finish to close my circle and stellar.
+
+217
+00:16:15,000 --> 00:16:20,000
+You can keep checked check boxes to start my school workbench and my cycle show.
+
+218
+00:16:20,000 --> 00:16:25,000
+Anyway, they're already installed and you will be able to find those in the menu.
+
+219
+00:16:26,000 --> 00:16:31,000
+Finally, we managed to open the workbench in the Mystical Connection section.
+
+220
+00:16:31,000 --> 00:16:35,000
+You can see that by default, you already have one connection.
+
+221
+00:16:36,000 --> 00:16:42,000
+This is connection to your local classical server that is running on your local hosts and available.
+
+222
+00:16:42,000 --> 00:16:49,000
+We are port two, three or six in computer network and local host is a hostnames that refers to the
+
+223
+00:16:49,000 --> 00:16:51,000
+current computer used to access it.
+
+224
+00:16:51,000 --> 00:16:57,000
+It is used to access the network services that are running on the current machine, even in case this
+
+225
+00:16:57,000 --> 00:16:59,000
+connection is absent.
+
+226
+00:16:59,000 --> 00:17:04,000
+All you need to create a new one, just click the plus sign to add new connection.
+
+227
+00:17:05,000 --> 00:17:09,000
+The Act's new connection and connection name first.
+
+228
+00:17:09,000 --> 00:17:13,000
+This is just a name that you will use to refer to this specific connection.
+
+229
+00:17:14,000 --> 00:17:19,000
+We will keep Thunder Connection massive, but remember this is also configurable.
+
+230
+00:17:19,000 --> 00:17:26,000
+You can also use to speed connection over as a sage or local circuit by any way.
+
+231
+00:17:26,000 --> 00:17:30,000
+This information doesn't bring a lot of sense at this moment.
+
+232
+00:17:30,000 --> 00:17:37,000
+As I said before, I have separate course about the web and web programming, and that course we focus
+
+233
+00:17:37,000 --> 00:17:39,000
+all our attention on network questions.
+
+234
+00:17:40,000 --> 00:17:44,000
+You can check that course later because it is not critical at the moment.
+
+235
+00:17:44,000 --> 00:17:50,000
+If you're my SQL server is running on your local machine, you can leave hostname like this.
+
+236
+00:17:50,000 --> 00:17:53,000
+But this address also refers to the local hosts.
+
+237
+00:17:53,000 --> 00:17:59,000
+In other words, does this computer if you have another IP address, you can put it here.
+
+238
+00:18:00,000 --> 00:18:04,000
+You also should verify port if you use default my SQL Server port.
+
+239
+00:18:05,000 --> 00:18:07,000
+You can leave here three oh six.
+
+240
+00:18:08,000 --> 00:18:15,000
+If no Xen change change usernames that you want to use to connect the database and passwords for this
+
+241
+00:18:15,000 --> 00:18:20,000
+specific username, though at password, click on Store Invalid button.
+
+242
+00:18:22,000 --> 00:18:26,000
+In this case, I'm going to use my road user with his password.
+
+243
+00:18:26,000 --> 00:18:29,000
+If you remember, so far we have only one user.
+
+244
+00:18:30,000 --> 00:18:36,000
+If you didn't add any other users during the database configuration step that we did together, then
+
+245
+00:18:36,000 --> 00:18:41,000
+you also need to use route user and password for this user to connect to the database.
+
+246
+00:18:42,000 --> 00:18:45,000
+Press OK button once you enter a password.
+
+247
+00:18:45,000 --> 00:18:50,000
+Now we can test our connection in case we successfully connect connected to the database.
+
+248
+00:18:50,000 --> 00:18:54,000
+You will see a similar message to the one you can see on the slide.
+
+249
+00:18:54,000 --> 00:19:00,000
+If there are some errors, for example, like wrong password, you are going to see that notification
+
+250
+00:19:00,000 --> 00:19:01,000
+in this window.
+
+251
+00:19:02,000 --> 00:19:08,000
+Once connection is tested, press OK button in the popup window, an OK button one more time to create
+
+252
+00:19:08,000 --> 00:19:10,000
+new connection to the database.
+
+253
+00:19:10,000 --> 00:19:11,000
+Great.
+
+254
+00:19:11,000 --> 00:19:12,000
+Well done, team.
+
+255
+00:19:12,000 --> 00:19:15,000
+We prepared environment for our future lessons.
+
+256
+00:19:16,000 --> 00:19:17,000
+Congratulations with this!
+
+257
+00:19:17,000 --> 00:19:23,000
+Now we are ready to start learning how to work with a workbench and database in case you still have
+
+258
+00:19:23,000 --> 00:19:24,000
+some questions.
+
+259
+00:19:24,000 --> 00:19:28,000
+Please let me know in the comments below this video.
+
+260
+00:19:29,000 --> 00:19:34,000
+And the last thing for the day that I'd like to share with you is configuration of my school windows
+
+261
+00:19:34,000 --> 00:19:34,000
+service.
+
+262
+00:19:35,000 --> 00:19:36,000
+Yes, open services.
+
+263
+00:19:37,000 --> 00:19:43,000
+You can find them in your Windows menu using Search, which services keyword Sheehan's Elise.
+
+264
+00:19:43,000 --> 00:19:45,000
+You will be able to find my school service.
+
+265
+00:19:46,000 --> 00:19:49,000
+This is a place where you can stop it.
+
+266
+00:19:49,000 --> 00:19:51,000
+Put it on pause and start again.
+
+267
+00:19:52,000 --> 00:19:54,000
+Also, you can change start up type.
+
+268
+00:19:55,000 --> 00:20:01,000
+In case you don't want this service, slow at your processor, click properties and change start up
+
+269
+00:20:01,000 --> 00:20:02,000
+type.
+
+270
+00:20:02,000 --> 00:20:04,000
+Everything is simple here.
+
+271
+00:20:04,000 --> 00:20:05,000
+Well done, Tim.
+
+272
+00:20:06,000 --> 00:20:09,000
+That's all what I wanted to share with you in this lesson.
+
+273
+00:20:09,000 --> 00:20:12,000
+Let's recap what we have learned in this lesson.
+
+274
+00:20:13,000 --> 00:20:18,000
+In this lesson, we hold my school overview, you used it main features.
+
+275
+00:20:18,000 --> 00:20:22,000
+After that, we installed my SQL server workbench and shell.
+
+276
+00:20:23,000 --> 00:20:26,000
+We connect it to our my SQL server using our workbench.
+
+277
+00:20:27,000 --> 00:20:32,000
+And at the end of the lesson, I explain, you're more about windows service for my cycle.
+
+278
+00:20:32,000 --> 00:20:33,000
+That's it.
+
+279
+00:20:33,000 --> 00:20:35,000
+Thanks a lot for your attention.
+
+280
+00:20:35,000 --> 00:20:38,000
+Have a great day and see you in the next lesson.
+