Skip to content

This repository contains a simple password validation with Object-Oriented Programming (OOP) Explanation

Notifications You must be signed in to change notification settings

SuluJulianto/password-validator-with-oop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Password Validator

This repository contains a simple password validation script implemented in various programming languages. The script checks the strength of a password based on length, special characters, and numbers.

Python

Prerequisites

  • Python 3.x

Usage

  1. Run the script.
  2. Input your password when prompted.
  3. Review the summary to see the strength of your password.

Object-Oriented Programming (OOP) Explanation

  • The Python script embraces Object-Oriented Programming (OOP) principles.
  • The PasswordValidator class encapsulates attributes (password and strength) and methods (validate_length, validate_special_chars, validate_numbers, validate_spaces, display_password, and summary) related to password validation.
  • The constructor (__init__ method) initializes the object with an initial state.
  • Methods utilize parameters for flexibility in validation based on special characters and numbers.
  • The code follows the principles of encapsulation, grouping data and related functionality within the class.

JavaScript

Prerequisites

  • Node.js

Usage

  1. Run the script.
  2. Input your password when prompted.
  3. Review the summary to see the strength of your password.

Object-Oriented Programming (OOP) Explanation

  • The JavaScript script implements OOP through object creation using prototypes.
  • Functions act as methods of the PasswordValidator object, encapsulating the logic.
  • The password and strength are properties of the object.
  • The script follows the principles of encapsulation, where related data and functions are organized within an object.

Ruby

Prerequisites

  • Ruby

Usage

  1. Run the script.
  2. Input your password when prompted.
  3. Review the summary to see the strength of your password.

Object-Oriented Programming (OOP) Explanation

  • The Ruby script embraces OOP principles.
  • The PasswordValidator class encapsulates attributes (password and strength) and methods (validate_length, validate_special_chars, validate_numbers, validate_spaces, display_password, and summary) related to password validation.
  • The constructor initializes the object with an initial state.
  • Methods use parameters for flexibility in validation based on special characters and numbers.
  • The code demonstrates encapsulation, grouping data and related functionality within the class.

PHP

Prerequisites

  • PHP

Usage

  1. Run the script.
  2. Input your password when prompted.
  3. Review the summary to see the strength of your password.

Object-Oriented Programming (OOP) Explanation

  • The PHP script incorporates OOP concepts.
  • The PasswordValidator class features attributes (password and strength) and methods (validate_length, validate_special_chars, validate_numbers, validate_spaces, display_password, and summary) for password validation.
  • The constructor initializes the object with an initial state.
  • Methods use parameters for flexibility in validation based on special characters and numbers.
  • The code exemplifies encapsulation, organizing data and related functionality within the class.

C

Prerequisites

  • GCC Compiler

Usage

  1. Compile the program: gcc password_validator.c -o password_validator
  2. Run the executable.
  3. Input your password when prompted.
  4. Review the summary to see the strength of your password.

Object-Oriented Programming (OOP) Explanation

  • While C is not inherently an object-oriented language, the script emulates some OOP principles.
  • It organizes functionality related to password validation in functions.
  • The data (password and strength) is managed through function parameters.
  • The script lacks true encapsulation and inheritance due to C's procedural nature.

C++

Prerequisites

  • C++ Compiler

Usage

  1. Compile the program: g++ password_validator.cpp -o password_validator
  2. Run the executable.
  3. Input your password when prompted.
  4. Review the summary to see the strength of your password.

Object-Oriented Programming (OOP) Explanation

  • The C++ script adheres to object-oriented principles.
  • The PasswordValidator class encapsulates attributes (password and strength) and methods (validate_length, validate_special_chars, validate_numbers, validate_spaces, display_password, and summary) related to password validation.
  • The constructor initializes the object with an initial state.
  • Methods use parameters for flexibility in validation based on special characters and numbers.
  • The code exemplifies encapsulation, where data and related functionality are grouped within the class.

Java

Prerequisites

  • Java Development Kit (JDK)

Usage

  1. Compile the program: javac PasswordValidator.java
  2. Run the compiled program: java PasswordValidator
  3. Input your password when prompted.
  4. Review the summary to see the strength of your password.

Object-Oriented Programming (OOP) Explanation

  • The Java script embraces OOP principles.
  • The PasswordValidator class encapsulates attributes (password and strength) and methods (validate_length, validate_special_chars, validate_numbers, validate_spaces, display_password, and summary) for password validation.
  • The constructor initializes the object with an initial state.
  • Methods use parameters for flexibility in validation based on special characters and numbers.
  • The code exemplifies encapsulation, where data and related functionality are grouped within the class.

Golang

Prerequisites

  • Go Programming Language

Usage

  1. Run the script.
  2. Input your password when prompted.
  3. Review the summary to see the strength of your password.

Object-Oriented Programming (OOP) Explanation

  • Golang supports OOP concepts, but it takes a unique approach.
  • While it doesn't have classes in the traditional sense, it uses struct types and methods associated with those types.
  • The script uses a struct PasswordValidator with associated methods (validateLength, validateSpecialChars, validateNumbers, validateSpaces, displayPassword, and summary) to achieve OOP-like encapsulation.

Feel free to customize and expand the information based on the specifics of your implementation or any additional details you'd like to include.

About

This repository contains a simple password validation with Object-Oriented Programming (OOP) Explanation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published