ArkProjectNFTs / ark-project

ArkProject is a liquidity layer for digital assets, uniting markets, empowering creators, and bridging the gap to mass adoption. Built on top of Starknet, ArkProject is designed to provide a fully decentralized and trustless orderbook on-chain.
https://arkproject.dev
Apache License 2.0
26 stars 17 forks source link

Refactor Duplicated Code from Pontos and Sana #463

Open ybensacq opened 3 days ago

ybensacq commented 3 days ago

In this repository, we duplicated parts of the Pontos project to build Sana. As a result, there are many instances of duplicated code that could potentially be refactored to improve maintainability, readability, and reduce redundancy.

It would be great if we could refactor these duplicated areas to streamline the codebase. If anyone is interested in helping with this refactoring, contributions are welcome!

Feel free to share your thoughts and suggestions on how to best approach this.

ShantelPeters commented 3 days ago

Hi @ybensacq please i will like to work on this issue?

jimenezz22 commented 2 days ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am an active member of the Dojo Coding community in Costa Rica, with experience in Cairo, having built onchain games like ByteBeasts and contributed to open-source projects such as CairoLint, where I implemented tests for Cairo lints. Additionally, I taught Cairo during the Starknet Bootcamp for Dojo Coding. I also have experience with TypeScript, contributing to Starknet Quest by developing components like ComboBoxes, among others.

How I plan on tackling this issue

Approach for the Issue:

  1. Identify Duplicated Code:
    • Review the codebases for both Pontos and Sana to locate instances of duplicated code (e.g., functions, modules, or classes).
  2. Analyze Common Functionality:
    • Analyze the duplicated code to understand the common logic and functionality that can be extracted into reusable components or modules.
  3. Create Reusable Modules:
    • Refactor the shared logic into separate reusable modules or functions that both Pontos and Sana can utilize. Ensure the refactored code maintains flexibility to handle specific cases in both projects.
  4. Replace Duplicates with Refactored Code:
    • Replace the duplicated sections in both projects with the new reusable components, ensuring the refactored code integrates smoothly with the existing structure.
  5. Test Refactored Code:
    • Run tests to ensure the refactoring does not break any existing functionality and that the shared logic works correctly across both projects.

Estimated Time to Completion: 3-5 days depending on the complexity of the duplicated code.

aji70 commented 2 days ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

i'm a solidity and cairo smart contract developer with over 2 years experience and believe i have the skill set for the task

bloomingpeach commented 2 days ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have experience in Rust, especially in refactoring task.

How I plan on tackling this issue

I will refactor and also try to improve code coverage for these refactored paths to ensure the code still work well after refactoring. I will also keep communicating with the maintainer to ensure the refactoring is heading the right direction.

GideonBature commented 2 days ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a Software Engineer with experience in writing Rust, Typescript and Cairo. I participated in the last ODHack (ODHack 7.0) and I was assign a task to refactor the deployment script written in typescript of a project written in cairo, which I completed and was merged.

How I plan on tackling this issue

I will first of go through the code based to understand the structure, next I will start looking at each of the files one after the other, taking note of each of the functions and their use-case.

Will afterwards start by removing redundant code, if there are any, then move forward to unify and merge the functions with the same functionality, finally will do a thorough testing to be sure that my changes is not breaking anything.

abdegenius commented 2 days ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a skilled fullstack developer with a wealth of experience in both frontend and backend JavaScript as well as my knowledge of Rustlang, With a solid foundation in testing,I have mastered frameworks like Mocha, Chai, and Jest to ensure robust, reliable code in every project. In addition to traditional web development, I have a strong background in blockchain technology, with hands-on experience in Solidity for Ethereum-based smart contracts. Moreover, I have delved into the emerging world of StarkNet, working with Cairo, a cutting-edge language tailored for STARKs, making them a versatile developer capable of bridging both traditional and decentralized web applications.

How I plan on tackling this issue

  1. Identify Duplicated Code Automated Code Analysis: Utilize static code analysis tools like SonarQube, CodeClimate, or ESLint to scan the repository for duplicate code and other code smells. Manual Review: Conduct a manual audit of the codebase, focusing on high-traffic modules that were likely copied from Pontos to Sana. Pay attention to commonly used utilities, helper functions, and components.

  2. Classify Duplicates Group Similar Duplicates: Once identified, categorize the duplicated code into buckets based on functionality. For instance: Utility functions (e.g., logging, data transformations) API handling and middleware UI components (if applicable) Check for Project-Specific Differences: Some duplications may have small variations to meet specific project needs. Carefully evaluate these differences to ensure that refactoring doesn’t break functionality.

  3. Create Shared Modules or Libraries Abstract Common Logic: Refactor the duplicated code into reusable modules, functions, or classes that can be shared between projects (Pontos and Sana). This can be done by: Creating a shared internal library or package. Moving common code into a utils or common directory within the repository. Extracting reusable UI components or hooks for frontend projects (if relevant). Use Dependency Management: If Pontos and Sana will continue to evolve separately but share similar functionality, consider abstracting the duplicated code into a separate repository, versioning it, and including it as a dependency in both projects.

  4. Incremental Refactoring Prioritize Critical Sections: Start refactoring critical or frequently changed areas of the codebase to minimize the risk of introducing new bugs. Test-Driven Refactoring: Ensure robust test coverage with unit, integration, and end-to-end tests before making changes. Refactor one part at a time, running tests at every step to maintain stability. Gradual Refactoring: Aim for incremental improvements. You don’t need to refactor everything at once. Start with small, manageable changes that won’t disrupt ongoing development.

  5. Collaborate on Contributions Create a Refactoring Plan: Document the refactoring plan, detailing what needs to be refactored, who will be responsible, and timelines for completion. Open Contributions to the Team: Encourage team members to take ownership of specific parts of the code that they’re familiar with. Use GitHub issues or a project board to track refactoring tasks and assign them accordingly. Code Reviews and Pair Programming: Conduct code reviews and encourage pair programming to ensure consistency in refactoring approaches and best practices across the codebase.

  6. Documentation Update Documentation: As refactoring progresses, update the documentation to reflect the new structure of the codebase, ensuring that future developers understand where the shared components are and how they should be used. Maintain Changelogs: If new shared libraries or modules are created, maintain changelogs to track updates and potential breaking changes.

  7. Feedback and Continuous Improvement Team Feedback: Regularly solicit feedback from the team on the refactoring process. Encourage developers to suggest improvements and report issues related to maintainability or readability. Continuous Refactoring: Make refactoring a part of the team's ongoing process to ensure that the codebase remains clean and efficient over time. By following this approach, the repository will become more maintainable and easier to work with, while also reducing technical debt over time. The goal is to create a streamlined, well-organized codebase that both current and future developers can easily navigate and contribute to.

Luluameh commented 18 hours ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have experience in Rust and refactoring code for improved maintainability. I’ve worked on similar projects, reducing code duplication and improving readability without compromising functionality.

How I plan on tackling this issue

I’d start by identifying and comparing the duplicated code between Pontos and Sana. I’d refactor shared logic into reusable components or modules, ensuring the refactor improves maintainability and reduces redundancy while maintaining code clarity.