nic-dgl104-winter-2024 / pattern-library

A multi-language library containing implementations of common software design and architecture patterns
4 stars 37 forks source link

Propose a new filename scheme for all pattern files #45

Open ash-teach opened 7 months ago

ash-teach commented 7 months ago

Assess existing filenames and determine if an alternative approach is preferred. Discuss here before implementation.

kattsky commented 7 months ago

Hi @ash-teach I'd like to help with this too

nazrinzuwair commented 7 months ago

Hello @ ash-teach, Can I be assigned to this?

mrsaif888 commented 7 months ago

hello @ash-teach can you assign me this?

ash-teach commented 7 months ago

@kattsky, @nazrinzuwair and @mrsaif888 I think you can all work on this together? Feel free to put some proposals together in comments here and that will allow others to weigh in on your ideas.

KaiKitKobold commented 7 months ago

I think this issue Is less of a sole Document issue (Although a Document or rules could be defined in the read.me, at a later date/version. Either way, before everyone rushes to get assigned to this issue, we will discuss the implementation of the result.

Looking at more extensive pattern libraries such as Design Patterns Library and Java Design Patterns, I've noticed a pattern of rather short descriptive Titles such as Builder.js, AppTest.java, etc.

Since the Folders and the Table of Contents links (Will update if requested) do most of the heavy lifting in the project. Short Simple File names such as singletonJavaScript.js can work; however, to add to the ease of accessibility, I recommend we use underScores (With no actual rules on definitive camel case of the languages) Such as Singleton_JavaScript.js instead; of course, we should also do singleton_JavaScript.js, I wish to hear everyone preference on that scheme.

kattsky commented 7 months ago

I've done some research and this is what I've gathered.

To provide information at a quick glance,

Documentation: For example: prefixlanguage used design pattern _ author.file extension The author info can be shortened to only show first name initial followed by first 3 letters of their last name

File name: impl_js_observer_kcor.md OR README lua singleton _kcor.md

Code: Prefixes: usecase_ or snippet_ File name: usecase_kotlin_observer_kcor.kt OR snippet_js_observer_kcor.js

And...

Also once we have an agreement on the file naming convention, I can help add it to our README file so that others can follow the standard.

References: Barsky, B. H. P. L. E. (n.d.). File naming. Research Data Management. https://ubc-library-rc.github.io/rdm/content/01_file_naming.html

File naming conventions. (n.d.). Data Management. https://datamanagement.hms.harvard.edu/plan-design/file-naming-conventions

OSF. (n.d.). https://osf.io/dpu45

kattsky commented 7 months ago

Just a thought, while not a file name convention, what do you think about adding a file header comment to include the following:

Having the file header will shorten the file name as it won't have the author name in it.

nazrinzuwair commented 7 months ago

Hi,

I completely agree with @kattsky suggestions, and I'd like to add some additional points to address the issues we've identified with the current naming conventions:

  1. The current naming conventions in the directory are extremely confusing and result in duplicate names. For instance, in the "Abstract Factory" directory:
├── abstract-factory
  │   ├── abstract-factory
  │   ├── README.md

This directory contains duplicate names for subdirectories ("abstract-factory"). It's advisable to opt for more descriptive names for subdirectories, such as "abstract-factory-implementation".

  1. The directory structure under "Behavioral Patterns" appears to be well-organized with subdirectories for each programming language. However, the "Observal" directory should be renamed to "Observer" for consistency.
├── behavioral-patterns
  │   ├── Observal
  │   │   ├── Dart
  │   │   │   ├── observer
  │   │   │   ├── README
  1. Moreover, there's inconsistency in the naming conventions of directories throughout the project. Some directories use underscores (_) to separate words, while others use hyphens (-). For instance:
├── basic_dart_singleton
│   │   │   ├── lazy_dart_singleton
├── abstract-factory

While both naming styles are valid, hyphen-separated naming (kebab-case) is more commonly used in file and directory names due to its compatibility with most file systems and web conventions. Therefore, I recommend utilizing hyphen-separated naming (kebab-case) for file names to ensure compatibility, readability, and consistency.

Implementing the suggestions provided by @kattsky will greatly improve the clarity and understandability of our file names.

Thank you.

ting-dev-coder commented 7 months ago

I am up for @KaiKitKobold's suggestion. A file name should be descriptive and as short as necessary. The author and date last modified could be included in the document, but the date of the initial version of the file is probably not necessary.

john24alex commented 7 months ago

I like the @nazrinzuwair suggestion about naming and directories because is intuitive to navigate. Is just to have clear the rules in the contributing file before submitting a PR. so the first step is to read and understand the contributing before starting work on an issue

mrsaif888 commented 7 months ago

@kattsky @nazrinzuwair i agree with you both i can add one thing to contribute in this like using prefixes like "usecase" for files focusing on specific use cases and "snippet" for code snippets for example we have a use case focusing on implementing the Observer design pattern in Java. The file name could be (usecase_java_observer_kcor.java)