Coder Social home page Coder Social logo

BufferedImageConverter cleanup about doodle HOT 3 OPEN

noelwelsh avatar noelwelsh commented on July 4, 2024
BufferedImageConverter cleanup

from doodle.

Comments (3)

jCabala avatar jCabala commented on July 4, 2024

I'm happy to work on this. I could be useful to turn it into a project to submit 1 PR at the time. Can I do it or does it need to be someone with write access to the repo?

from doodle.

jCabala avatar jCabala commented on July 4, 2024

Java2dWriter extends both FileWriter (previously Writer) and Base64Writer (previously Base64). On the other hand Java2dWriter is a separate object that only uses one function from the Java2dWriter companion object. I was thinking that it would make sense to:

  1. Move the companion object to a separate class (say Java2dWriterUtils)
  2. separate the logic of Java2dWriter into 2 traits: Java2dFileWriter and Java2dBase64Writer
  3. Create a separate file called Writers that stores all of the actual writer objects (e.g Java2dPdfWriter, Java2dGifWriter, Java2dBufferedImageWriter)

Is that reasonable or is it better to just leave it as Java2dWriter (because technically it is missleading to call it a Java2dFileWriter since it is also a Base64Writer) and have another file Java2dBufferedImageWriter?

from doodle.

noelwelsh avatar noelwelsh commented on July 4, 2024

I've created a project: https://github.com/orgs/creativescala/projects/8/

Regarding the refactorings you describe above:

  1. Moving the companion object to a class means that code is not usable (and hence not testable) without creating an instance of the class. I'd rather not add this complication if it's not necessary. Some of the code could move into Java2d, which handles other parts of rendering using the Java 2D API.

  2. I'm not sure there is value in separating the implementation of Java2dWriter. Conceptually they are distinct, and they are represented by distinct algebras / type classes. However, the implementations are related (i.e. they share a lot of the implementation.) I don't think it's a problem to have the implementations together. The concepts are already distinct, just at a different level of the code.

  3. This is reasonable.

from doodle.

Related Issues (20)

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.