Unit Testing and Immutable Sets in Object-Oriented Programming

week 8 n.w
1 / 20
Embed
Share

Explore the importance of unit testing, variable access, and immutable sets in object-oriented programming. Learn about writing unit tests and implementing immutable sets for efficient code testing and management.

  • Unit Testing
  • Immutable Sets
  • Object-Oriented Programming
  • Programming Best Practices
  • Test Automation

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. WEEK 8 TUTORCLASSTC = NEW TUTORCLASS( WEEK8 );

  2. TODAYS PLAN Unit Testing Demo Object Orientated Programming Explanation Access to Variables Demo Immutable Set Timetable

  3. UNIT TESTING Tests the Inputs and Outputs of a Function Checks if the output is what is expected Of course this only works on deterministic functions

  4. UNIT TESTING Junit Library is used

  5. UNIT TESTING TEST BASED PROGRAMMING It forces you to consider what each functions input and output is long before Also makes you consider the interaction of edge cases Automates Testing Don t have to enter everything manually

  6. UNIT TEST Demo

  7. OBJECT ORIENTATED PROGRAMMING Blueprint vs Instance

  8. VARIABLE ACCESS

  9. VARIABLE ACCESS Demo

  10. IMMUTABLE SET Think of it as a set of Strings [aa, AA, bb] Rule of Sets: All elements are unique

  11. IMMUTABLE SET IMPLEMENT Constructor Creates a empty set Boolean isElement(String s) Is s included in set Boolean superset(ImmutableSet subset) are all elements of subset found within the current set Boolean isEqual(ImmutableSet other) Are all elements of other found in the current set Void add(String s) Append s to the set if s is not currently found in the set String toString() Represent the set as a String in the following format [a, b, c]

  12. IMMUTABLE SET TESTS I have written for you a unit test that will test your code Found on my website in this weeks folder

  13. IMMUTABLE SET IMPLEMENT Constructor Creates a empty set Boolean isElement(String s) Is s included in set Boolean superset(ImmutableSet subset) are all elements of subset found within the current set Boolean isEqual(ImmutableSet other) Are all elements of other found in the current set Void add(String s) Append s to the set if s is not currently found in the set String toString() Represent the set as a String in the following format [a, b, c]

  14. TIME TABLE This is a two part task First Implement the class Date Then Implement the class Timetable With a subclass DateList

  15. TIME TABLE LIST REFRESHER What is a list?

  16. TIME TABLE LIST REFRESHER What is a list?

  17. THE CLASS DATE

  18. TIME TABLE CLASS

  19. DATE LIST CLASS

  20. TIME TABLE CLASS

Related


More Related Content