Skip to content

Strelitzia-Khazan/What-for-dinner-lab2-variant-3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What for dinner - lab 2 - variant 3

This is an example project which demonstrates project structure and necessary CI checks. It is not the best structure for real-world projects, but good enough for educational purposes.

Project structure

  • BinaryTree.py -- implementation of BinaryTreeNode class.

  • BinaryTree_test.py -- unit and PBT tests for BinaryTreeNode

Features

  • PBT: test_add_commutative

Contribution

Changelog

  • 26.05.2024 - 7
    • Update README.
    • Fix bugs in code.
  • 24.05.2024 - 6
    • Fix bugs in code.
  • 17.05.2024 - 5
    • Fix bugs in code.
  • 10.05.2024 - 4
    • Implement PBT test.
  • 05.05.2024 - 3
    • Implement unit test.
  • 29.03.2022 - 2
    • Add test coverage.
  • 29.03.2022 - 1
    • Update README.
  • 29.05.2024 - 0
    • Initial.

Design notes

  • Compare mutable and immutable implementation:
    • Variable programming allows the value of variables to change while the code is running,making programming more intuitive and achieving higher performance.
    • However, in a multi-threaded or concurrent environment, variable states can easily lead to race conditions and data inconsistency issues.
    • In immutable programming, once a variable is assigned a value, it cannot be changed. Each modification requires a new data structure, which is more suitable for multi-threaded or concurrent environments, and there is no need to worry about data race conditions.
    • However, every time the data is modified, a new copy will be created, which may cause more memory consumption and garbage collection pressure.
    • At the same time, it is necessary to change the programming idea when programming, which is more cumbersome.
  • Note implementation restriction:
    • In immutable programming, all objects cannot be changed after they are created, and each change requires the generation of a new data structure.
    • Therefore, the copy() function is used repeatedly in the code to build a new data structure based on the original data structure to ensure that the original structure will not change.
  • Find possible implementation errors, which can pass property-based tests:
    • When implementing a Binary Tree based set, special conditions are sometimes overlooked. For example, if the implemented function fails to handle empty inputs. Due to the nature of property-based testing (PBT), automatically generated inputs may not include empty inputs. Consequently, the test may pass, giving the impression that the function is problem-free. However, when we manually introduce marginal conditions such as empty lists or empty trees, the test will fail.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages