GithubHelp home page GithubHelp logo

samuraipolix / oop_ex2 Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 651 KB

a Social Network in Python, focusing on design patterns as an assignment for OOP @ Ariel University

Python 100.00%
ariel ariel-oop-course ariel-university arieluniversity oop oop-assignment oop-examples oop-principles oops-in-python python

oop_ex2's Introduction

Social Network Project

Assignment #2 in Object-Oriented Programming @ Ariel University

Overview

This project is an implementation of a social network in Python, focusing on object-oriented programming principles and design patterns. The social network allows users to register, connect with each other, upload posts, comment, like posts, and more. The implementation adheres to the specified requirements, utilizing three design patterns: Singleton, Observer, and Factory.

Project Structure

Main Components

  1. Network: Manages user registration, connection, disconnection, and activity tracking. Enforces constraints such as unique usernames and password length. Implements the Singleton pattern to ensure only one network instance exists.

  2. Users: Represents individual users in the social network. Users can follow each other, upload posts, like/comment on posts, and receive notifications. The Observer pattern is implemented to notify users of relevant activities.

  3. Posts: Represents different types of posts: TextPost, ImagePost, and SalePost. Each post type has specific functionalities. The Factory pattern is utilized to create instances of different post types.

Design Patterns

  1. Singleton: The Singleton pattern is applied in the SocialNetwork class and the PostFactory class, ensuring that only one network and one post-factory instance are created throughout the program's execution.

  2. Observer: The Observer pattern is used in the User class, to notify users of relevant activities, such as receiving notifications when someone they follow uploads a post or when someone likes/comments on their post.

  3. Factory: The Factory pattern is used in the Post class, to create instances of different post types (TextPost, ImagePost, SalePost) based on the specific requirements of each post type.

UML Diagram

classes packages

Running the Project

Use the provided main.py file to simulate social network activities.

oop_ex2's People

Contributors

samuraipolix avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.