<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: daniel</title>
    <description>The latest articles on DEV Community by daniel (@danielf09).</description>
    <link>https://dev.to/danielf09</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4193539%2F33cf7017-5412-4cf3-bd77-c27287c7ed9a.png</url>
      <title>DEV Community: daniel</title>
      <link>https://dev.to/danielf09</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/danielf09"/>
    <language>en</language>
    <item>
      <title>Can You Use Case Study Research in an MBA Dissertation?</title>
      <dc:creator>daniel</dc:creator>
      <pubDate>Mon, 26 Oct 2026 10:58:43 +0000</pubDate>
      <link>https://dev.to/danielf09/can-you-use-case-study-research-in-an-mba-dissertation-161k</link>
      <guid>https://dev.to/danielf09/can-you-use-case-study-research-in-an-mba-dissertation-161k</guid>
      <description>&lt;p&gt;If you are working on your MBA dissertation, one of the first big decisions is how you will collect and analyse your evidence. Many students assume a dissertation needs a large survey with hundreds of responses, so a study built around one company feels risky. The good news is that case study research is accepted on most MBA programmes, and when it is done properly it can score very well. If you are looking for &lt;a href="https://primeassignmenthelp.co.uk/mba-dissertation-help/" rel="noopener noreferrer"&gt;MBA dissertation help&lt;/a&gt; to decide on your approach, this guide explains when a case study works, when it does not, and how to build one your supervisor will respect.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Short Answer
&lt;/h2&gt;

&lt;p&gt;Yes, you can. A case study is a recognised research strategy in business and management. Your university may have preferences, so check your programme handbook and talk to your supervisor early. But the method itself is well established, and many MBA students choose it because it lets them study a real organisation in real depth.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Case Study Research Actually Means
&lt;/h2&gt;

&lt;p&gt;A case study is an in-depth investigation of one organisation, a small group of organisations, a project, a decision or a process, inside its real setting. You are not trying to count how many people agree with a statement. You are trying to understand how and why something happened.&lt;/p&gt;

&lt;p&gt;Examples that suit an MBA level:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How a retail company changed its supply chain after a major disruption&lt;/li&gt;
&lt;li&gt;Why a digital transformation project in a hospital trust stalled&lt;/li&gt;
&lt;li&gt;How a family business handled leadership succession&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Notice that each one asks "how" or "why". That is the signal that a case study may fit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Business Schools Accept It
&lt;/h2&gt;

&lt;p&gt;Business problems rarely happen in a lab. They happen inside companies, with real people, budgets, politics and deadlines. A case study lets you look at all of that together. It also matches how MBA programmes teach, since most of your coursework already uses cases.&lt;/p&gt;

&lt;p&gt;The method also has a strong academic base. Robert Yin's work on case study design is the most cited starting point, and Kathleen Eisenhardt's paper on building theory from case studies is widely used in management research. Citing sources like these in your methodology chapter shows you did not just pick the method because it looked easy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Single Case or Multiple Cases
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Single case.&lt;/strong&gt; You go deep into one organisation. This works well when the case is unusual, very typical, or gives you access to something few people can see.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Multiple cases.&lt;/strong&gt; You compare two to four organisations. This gives you stronger evidence for patterns, but it takes more time and more access, so be realistic about your timeline.&lt;/p&gt;

&lt;p&gt;For most MBA dissertations, one well-chosen case or a small comparison of two or three is enough. Going wider usually means going thinner.&lt;/p&gt;

&lt;h2&gt;
  
  
  Case Study vs Survey: A Quick Comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Point&lt;/th&gt;
&lt;th&gt;Case Study&lt;/th&gt;
&lt;th&gt;Survey&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Main question type&lt;/td&gt;
&lt;td&gt;How and why&lt;/td&gt;
&lt;td&gt;How many and how much&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sample&lt;/td&gt;
&lt;td&gt;One to a few organisations&lt;/td&gt;
&lt;td&gt;Large group of respondents&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data&lt;/td&gt;
&lt;td&gt;Interviews, documents, observation&lt;/td&gt;
&lt;td&gt;Questionnaire responses&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Strength&lt;/td&gt;
&lt;td&gt;Depth and context&lt;/td&gt;
&lt;td&gt;Breadth and statistical testing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Main weakness&lt;/td&gt;
&lt;td&gt;Hard to generalise&lt;/td&gt;
&lt;td&gt;Limited depth&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;Understanding a process or decision&lt;/td&gt;
&lt;td&gt;Testing relationships between variables&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Neither is better in every situation. The right choice depends on your research question.&lt;/p&gt;

&lt;h2&gt;
  
  
  When a Case Study Is a Good Fit
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Your question starts with "how" or "why"&lt;/li&gt;
&lt;li&gt;You can get access to an organisation or enough public information about one&lt;/li&gt;
&lt;li&gt;The topic is hard to measure with numbers alone&lt;/li&gt;
&lt;li&gt;You want to understand a process, not just an outcome&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When You Should Think Twice
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You want to prove a cause and effect relationship with statistics&lt;/li&gt;
&lt;li&gt;You cannot get any access to people or internal documents&lt;/li&gt;
&lt;li&gt;Your question is really about a whole industry or country&lt;/li&gt;
&lt;li&gt;You only plan to describe a company without any analysis&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your plan is just "I will write about Company X," that is a company profile, not a case study. A case study needs a clear question, a method and an argument.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Build a Strong Case Study Step by Step
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Write a focused research question.&lt;/strong&gt; Keep it narrow. "How did Company X manage change during its ERP rollout?" is workable. "How do companies manage change?" is too wide.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Choose your case and explain why.&lt;/strong&gt; Do not pick a company only because it is famous or easy. State your selection logic. For example, it may be a typical example, an extreme example, or the only one you can access.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Plan your data sources.&lt;/strong&gt; Strong case studies use more than one source. Common options are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Semi-structured interviews with managers or staff&lt;/li&gt;
&lt;li&gt;Annual reports, internal policies and meeting records&lt;/li&gt;
&lt;li&gt;Public sources such as press releases and regulator filings&lt;/li&gt;
&lt;li&gt;Direct observation, if you are allowed on site&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Triangulate.&lt;/strong&gt; This means checking one source against another. If a manager says a project went smoothly but the documents show repeated delays, that difference is worth discussing. Triangulation is one of the best ways to show your findings are credible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Choose your analysis method before you collect data.&lt;/strong&gt; Thematic analysis is common for interview data. Pattern matching, where you compare your findings with a theory you set out in advance, is also widely used. For multiple cases, you can add a cross-case comparison.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Link back to theory.&lt;/strong&gt; Your case should talk to the literature. Show where your findings agree with existing models, where they differ and what that might mean.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ethics and Access
&lt;/h2&gt;

&lt;p&gt;This is where many case study plans fall apart. Before you contact anyone, check your university's ethics process. You will usually need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Permission from a gatekeeper at the organisation&lt;/li&gt;
&lt;li&gt;A participant information sheet and consent form&lt;/li&gt;
&lt;li&gt;A plan for anonymity and secure data storage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some companies will agree to talk only if their name is hidden. That is fine. Many dissertations use a pseudonym and describe the sector and size instead. Just make sure the organisation cannot be easily identified if you promised anonymity.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Write the Methodology Chapter
&lt;/h2&gt;

&lt;p&gt;Your supervisor will look for justification, not just description. Cover these points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your research philosophy and approach, for example the layers in Saunders' research onion&lt;/li&gt;
&lt;li&gt;Why a case study fits your question better than other strategies&lt;/li&gt;
&lt;li&gt;Your case selection logic&lt;/li&gt;
&lt;li&gt;Data collection methods and sample details&lt;/li&gt;
&lt;li&gt;Your analysis steps&lt;/li&gt;
&lt;li&gt;Validity, reliability and limitations&lt;/li&gt;
&lt;li&gt;Ethical approval&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Write it in the past tense if your university expects it, and keep your language plain. A methodology chapter that is clear and honest usually scores better than one filled with heavy terms.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dealing With the Generalisability Problem
&lt;/h2&gt;

&lt;p&gt;The most common criticism of case studies is that you cannot generalise from one organisation. Do not hide from this. Address it directly in your limitations section.&lt;/p&gt;

&lt;p&gt;A good answer is that case studies aim for analytic generalisation, not statistical generalisation. You are not claiming that every company will behave the same way. You are using the case to test, refine or extend a theory, and you explain what other organisations in similar conditions might learn from it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Mistakes to Avoid
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Choosing a case with no clear link to the research question&lt;/li&gt;
&lt;li&gt;Relying on a single interview and calling it a case study&lt;/li&gt;
&lt;li&gt;Using only company websites as evidence&lt;/li&gt;
&lt;li&gt;Describing events without analysing them&lt;/li&gt;
&lt;li&gt;Skipping the ethics process until the last minute&lt;/li&gt;
&lt;li&gt;Writing a findings chapter that is just a long quote dump&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Quick Checklist Before You Commit
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Is my question a "how" or "why" question?&lt;/li&gt;
&lt;li&gt;Do I have realistic access to the case?&lt;/li&gt;
&lt;li&gt;Have I planned at least two data sources?&lt;/li&gt;
&lt;li&gt;Do I know how I will analyse the data?&lt;/li&gt;
&lt;li&gt;Has my supervisor seen and agreed with the plan?&lt;/li&gt;
&lt;li&gt;Have I started the ethics form?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you can answer yes to most of these, a case study is likely a safe and strong choice for your MBA dissertation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Case study research is a valid and respected option for an MBA dissertation. It rewards students who ask clear questions, collect evidence carefully and explain their choices honestly. It does not reward shortcuts. If you plan it well, it can also give you something useful beyond the grade, which is a detailed understanding of how a real business works. For students who want guided support with planning, structure and referencing, &lt;a href="https://primeassignmenthelp.co.uk/" rel="noopener noreferrer"&gt;Prime Assignment Help&lt;/a&gt; offers academic guidance for UK university work, and you stay the author of your own dissertation.&lt;/p&gt;

</description>
      <category>writing</category>
      <category>career</category>
      <category>mbadissertation</category>
      <category>education</category>
    </item>
    <item>
      <title>Java OOP Concepts Explained with Simple Examples</title>
      <dc:creator>daniel</dc:creator>
      <pubDate>Mon, 19 Oct 2026 07:54:35 +0000</pubDate>
      <link>https://dev.to/danielf09/java-oop-concepts-explained-with-simple-examples-527e</link>
      <guid>https://dev.to/danielf09/java-oop-concepts-explained-with-simple-examples-527e</guid>
      <description>&lt;p&gt;Most students meet object-oriented programming in week three or four of a Java module, right after they've finally got comfortable with loops and arrays. Then the lecturer uses the words class, object, inheritance and polymorphism in a single breath, the slides fill up with diagrams of dogs and cars, and a good part of the room quietly decides that OOP is something they'll understand later. The catch is that later usually arrives as a coursework brief. A big share of first and second year Java tasks are OOP tasks in disguise: design a small system, split it into classes, make those classes work together, and explain why you built it that way. When people go looking for &lt;a href="https://primeassignmenthelp.co.uk/Java-Assignment-Help/" rel="noopener noreferrer"&gt;Java assignment help&lt;/a&gt; at that point, the gap they find is rarely syntax. It's that nobody showed them how to think in objects first and write code second. So instead of four unrelated animal examples, this post uses one small library system that grows a little in each section, which is closer to how a real assignment feels.&lt;/p&gt;

&lt;h2&gt;
  
  
  Classes and objects
&lt;/h2&gt;

&lt;p&gt;A class is a template. An object is one thing built from that template. A book is a good place to start because everyone knows what one looks like.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Book&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Main&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Book&lt;/span&gt; &lt;span class="n"&gt;first&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
        &lt;span class="n"&gt;first&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Clean Code"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;first&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;author&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Robert C. Martin"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

        &lt;span class="nc"&gt;Book&lt;/span&gt; &lt;span class="n"&gt;second&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
        &lt;span class="n"&gt;second&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Effective Java"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;second&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;author&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Joshua Bloch"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;first&lt;/code&gt; and &lt;code&gt;second&lt;/code&gt; come from the same class but hold their own data. Change one title and the other doesn't move. That's all "object" really means in practice.&lt;/p&gt;

&lt;p&gt;One thing worth getting right early: writing &lt;code&gt;Book third;&lt;/code&gt; does not create a book. It creates a reference that points at nothing. Call a method on it and you get a &lt;a href="https://writeupcafe.com/how-to-fix-a-nullpointerexception-in-java-without-just-guessing" rel="noopener noreferrer"&gt;NullPointerException in Java&lt;/a&gt;, one of the most common crashes in early coursework. The &lt;code&gt;new&lt;/code&gt; keyword is what actually builds the object.&lt;/p&gt;

&lt;h2&gt;
  
  
  Encapsulation
&lt;/h2&gt;

&lt;p&gt;The Book above has a problem. Anyone can write &lt;code&gt;first.title = ""&lt;/code&gt; and nothing stops them. Encapsulation fixes that by making the fields private and allowing changes only through methods you control.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Book&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;boolean&lt;/span&gt; &lt;span class="n"&gt;onLoan&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;author&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;getTitle&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;boolean&lt;/span&gt; &lt;span class="nf"&gt;isOnLoan&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;onLoan&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;checkOut&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;onLoan&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;IllegalStateException&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;" is already on loan"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;onLoan&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;giveBack&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;onLoan&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is no &lt;code&gt;setOnLoan(boolean)&lt;/code&gt; here, and that's deliberate. A book can only become unavailable through &lt;code&gt;checkOut()&lt;/code&gt;, which refuses to run twice. If you let the IDE generate a setter for every field, anyone can flip the flag directly and the check is pointless. A getter and setter on every field is just a public field with extra typing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Inheritance
&lt;/h2&gt;

&lt;p&gt;Libraries don't only lend books. There are DVDs, magazines, audiobooks. Copying the title and loan logic into each class is how the same bug ends up in four places, so the shared part moves into a parent class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LibraryItem&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;boolean&lt;/span&gt; &lt;span class="n"&gt;onLoan&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;LibraryItem&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;getTitle&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;boolean&lt;/span&gt; &lt;span class="nf"&gt;isOnLoan&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;onLoan&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;checkOut&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;onLoan&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;IllegalStateException&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;" is already on loan"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;onLoan&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;giveBack&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;onLoan&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="nf"&gt;lateFee&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;daysLate&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;daysLate&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.10&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Book class now shrinks to what is specific to books:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Book&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;LibraryItem&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;super&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;author&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;getAuthor&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;extends&lt;/code&gt; is what links the two, and &lt;code&gt;super(title)&lt;/code&gt; hands the title up to the parent constructor. It has to be the first line of the child constructor, which catches a lot of people out. A Book never had to write &lt;code&gt;checkOut()&lt;/code&gt; itself, it just has it.&lt;/p&gt;

&lt;p&gt;A quick test before using &lt;code&gt;extends&lt;/code&gt;: say "a Book is a LibraryItem" out loud. If the sentence sounds wrong, inheritance is probably the wrong tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  Polymorphism
&lt;/h2&gt;

&lt;p&gt;DVDs usually have heavier late fees, so the Dvd class changes that one method and leaves everything else alone.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Dvd&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;LibraryItem&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;minutes&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;Dvd&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;minutes&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;super&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;minutes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;minutes&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;getMinutes&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;minutes&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="nd"&gt;@Override&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="nf"&gt;lateFee&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;daysLate&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;daysLate&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.50&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the interesting part:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;LibraryItem&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;returned&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Clean Code"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Robert C. Martin"&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Dvd&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"The Social Network"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;LibraryItem&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;returned&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getTitle&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;" late fee: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;lateFee&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Clean Code late fee: 0.4
The Social Network late fee: 2.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The variable type is &lt;code&gt;LibraryItem&lt;/code&gt;, but Java decides which &lt;code&gt;lateFee&lt;/code&gt; to run by looking at the actual object at runtime. The loop has no idea which kind of item it's holding and doesn't need to. Add a Magazine class next month and this loop doesn't change at all. (Using &lt;code&gt;double&lt;/code&gt; for money is fine for a demo. In anything real, use &lt;code&gt;BigDecimal&lt;/code&gt;.)&lt;/p&gt;

&lt;h2&gt;
  
  
  Abstraction
&lt;/h2&gt;

&lt;p&gt;Nobody walks into a library and borrows a generic "item". &lt;code&gt;LibraryItem&lt;/code&gt; only exists so the real things can share it, so it shouldn't be possible to create one directly. That's what &lt;code&gt;abstract&lt;/code&gt; is for.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LibraryItem&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// fields, constructor, checkOut and giveBack stay as they were&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="nf"&gt;lateFee&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;daysLate&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now &lt;code&gt;new LibraryItem("x")&lt;/code&gt; won't compile, and every subclass has to supply its own fee rule:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Book&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;LibraryItem&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// author field and constructor as before&lt;/span&gt;

    &lt;span class="nd"&gt;@Override&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="nf"&gt;lateFee&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;daysLate&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;daysLate&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.10&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Interfaces are the other half of abstraction. Use an abstract class when the subclasses share state and code. Use an interface when you only want to promise a behaviour.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;Reservable&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;reserve&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;memberName&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A Dvd could implement &lt;code&gt;Reservable&lt;/code&gt; while a reference-only Book doesn't. A class can only extend one parent, but it can implement as many interfaces as it needs, which is usually the deciding factor.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick reference
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Concept&lt;/th&gt;
&lt;th&gt;Problem it solves&lt;/th&gt;
&lt;th&gt;Where you see it&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Encapsulation&lt;/td&gt;
&lt;td&gt;Outside code breaking an object's rules&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;private&lt;/code&gt;, constructors, getters&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Inheritance&lt;/td&gt;
&lt;td&gt;Same code copied into several classes&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;extends&lt;/code&gt;, &lt;code&gt;super&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Polymorphism&lt;/td&gt;
&lt;td&gt;Code that has to check what type it's holding&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;@Override&lt;/code&gt;, parent type variables&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Abstraction&lt;/td&gt;
&lt;td&gt;Modelling things that shouldn't exist on their own&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;abstract&lt;/code&gt;, &lt;code&gt;interface&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Mistakes that cost marks
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Public fields because it was quicker. It stays quicker until validation has to be added in twelve places.&lt;/li&gt;
&lt;li&gt;Generating setters for everything, which quietly undoes encapsulation.&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;extends&lt;/code&gt; just to borrow methods. A &lt;code&gt;Member&lt;/code&gt; that holds a list of items should have an &lt;code&gt;ArrayList&lt;/code&gt; as a field, not extend one. A member isn't a list.&lt;/li&gt;
&lt;li&gt;Long &lt;code&gt;if&lt;/code&gt; and &lt;code&gt;instanceof&lt;/code&gt; chains where an overridden method would do the job.&lt;/li&gt;
&lt;li&gt;Leaving out &lt;code&gt;@Override&lt;/code&gt;. Misspell &lt;code&gt;lateFee&lt;/code&gt; as &lt;code&gt;latefee&lt;/code&gt; and Java happily treats it as a brand new method, so the parent version keeps running and you spend an hour wondering why. With the annotation the compiler tells you immediately.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The library here is small on purpose. Try extending it with a &lt;code&gt;Member&lt;/code&gt; class that can hold at most three items and a &lt;code&gt;Magazine&lt;/code&gt; that can't be reserved, then check how many of your earlier classes you had to touch. If the answer is none, the design is doing its job. Real coursework briefs are messier, with file input, a menu loop and marking criteria that reward design choices you can justify in writing, and sketching the classes before writing any code is the same approach the Java walkthroughs on &lt;a href="https://primeassignmenthelp.co.uk/" rel="noopener noreferrer"&gt;Prime Assignment Help&lt;/a&gt; follow.&lt;/p&gt;

</description>
      <category>java</category>
      <category>beginners</category>
      <category>programming</category>
      <category>oop</category>
    </item>
  </channel>
</rss>
