liskov_example

Example of Liskov Substitution Principle violation in Python

https://github.com/alex-ip/liskov_example

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (2.1%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Example of Liskov Substitution Principle violation in Python

Basic Info
  • Host: GitHub
  • Owner: alex-ip
  • Language: Jupyter Notebook
  • Default Branch: main
  • Size: 17.6 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Created over 5 years ago · Last pushed about 2 years ago
Metadata Files
Readme Citation

README.md

Liskov_example

Example of Liskov Substitution Principle (LSP) violation in Python.

Demonstration of LSP violation

The violation example has a subclass "Square" of a superclass "Rectangle". The Square class overrides the setter methods for height and width as a bodgy work-around which causes problems in the "multiply" base class function.

python -m liskov_badness

Demonstration of LSP correctness

The conformance example has a subclasses "Square" and "Rectangle" of a superclass "Polygon". The Square and Rectangle classes both implement their own getters and setters for height and width.

python -m liskov_conformance

Owner

  • Name: Alex Ip
  • Login: alex-ip
  • Kind: user
  • Location: Canberra
  • Company: @aarnet

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: Ip
    given-names: Alex
    orcid: https://orcid.org/0000-0001-8937-8904
title: "Demonstration of Liskov Substitution Principle"
version: 0.1.0
date-released: 2020-10-12

GitHub Events

Total
Last Year

Dependencies

environment.yml pypi