Skip to content

paasio: implement exercise #1813

Open
Open

Description

@jmrunkle

The exercise paasio has not been implemented yet for the Java track.
The description of the exercise can be found in the problem specification repository.

How to implement a new exercise for the Java track is described in detail in CONTRIBUTING.md. Please have a look there first before starting working on the exercise.
Also please make sure it is clear that you are currently working on this issue, either by asking to be assigned to it, or by opening an empty PR.

When opening an PR, please reference this issue using any of the closing keywords.

If you have had a look at the exercise description and you concluded that the exercise might not be possible to implement in the Java language, please leave a comment and describe the problem.

In case you have any further questions, feel free to ask here.

Activity

  1. CliffRoberson commented on Aug 1, 2020

    @CliffRoberson

    This is my first attempt at implementing an exercise and it seems like a good one to try. May I have this assigned to me and do you know of another language which has this exercise that I can copy from?

  2. mirkoperillo commented on Aug 3, 2020

    @mirkoperillo
    Contributor

    Thank you @CliffRoberson for the help.
    I found a go implementation of this problem if it can help you.

    Feel free to ask for every doubt

  3. github-actions commented on Sep 23, 2021

    @github-actions
    Contributor

    This issue has been automatically marked as action/stale because it has not had recent activity. Please update if there are new updates to provide.

  4. andrerfcsantos commented on Jun 5, 2022

    @andrerfcsantos
    Member

    @CliffRoberson Still interested in working on this?

  5. github-actions commented on Sep 4, 2022

    @github-actions
    Contributor

    This issue has been automatically marked as action/stale because it has not had recent activity. Please update if there are new updates to provide.

  6. 18 remaining items

  7. shreyasgosavi commented on Jun 5, 2025

    @shreyasgosavi
    Contributor

    Not really no need to introduce, found other way round of implementing it (passing dummy input-output Streams for Socket).

  8. kahgoh commented on Jun 9, 2025

    @kahgoh
    Member

    I'd still prefer to avoid it if possible especially as none of the other exercises use Mockito and introducing it for this exercise means students will have to become familiar enough with Mockito to read the tests.

    Would you be able to push your what you've got so far? I'd like to try get an idea of where you're coming from and see if we can come up with a way forward.

  9. shreyasgosavi commented on Jun 10, 2025

    @shreyasgosavi
    Contributor

    Ohh don't worry havent used mockito

  10. shreyasgosavi commented on Jun 10, 2025

    @shreyasgosavi
    Contributor

    I have pushed it in my cloned repository, Need to discuss one point, in the exercise I have added a generic class that overrides I/O methods. Both File-operation & Socket can use the generic implementation, but for File-Operations I have decided to take type-of operation (read & write) while creating FileOperation instance (which is not needed in Socket as both operations can take place at single instance).

    Due to that additional check of file-operation is added.

    Can you confirm me if this is correct?

  11. kahgoh commented on Jun 10, 2025

    @kahgoh
    Member

    I'd be happy to take a look 😉 . Could you please a link to your repository and branch or open a draft pull request?

  12. shreyasgosavi commented on Jun 14, 2025

    @shreyasgosavi
    Contributor

    Any suggestions?

  13. kahgoh commented on Jun 14, 2025

    @kahgoh
    Member

    Sorry, I got caught up with things the last few days. I noticed Passion.java had a number of classes for the different IO types (e.g. SocketOperations, GenericInputStream, FileOperations). Do we really need to have separate implementations based on whether it is socket vs file? I'd suggest we may be able to simplify things by wrapping around Java's standard InputStream/OutputStream or Reader/Writer instead, similar to how Go's implementation wraps around their standard io.reader/io.writer.

  14. shreyasgosavi commented on Jun 14, 2025

    @shreyasgosavi
    Contributor

    Ok that clears the doubt !!! I was thinking about issues with concurrent read/write file operations, so for that defined another utility to restrict simultaneous access.

    But for simplicity and for learners your idea works.. will update the code and ask you to verify.

  15. shreyasgosavi commented on Jun 20, 2025

    @shreyasgosavi
    Contributor

    I have pushed the changes, can you verify it

  16. kahgoh commented on Jun 21, 2025

    @kahgoh
    Member

    I just had a quick glance - I think it looks better and is going in the right direction 😁. For the test, I was thinking the DummySocket and tmpFile are not doing much. I'd suggest simplifying the test by using the ByteArrayInputStream and ByteArrayOutputStream directly. This would probably reduce the number of tests as well, but that's ok 😉.

    When ready, feel free to raise a PR so that I can properly review and merge it.

  17. shreyasgosavi commented on Jun 23, 2025

    @shreyasgosavi
    Contributor

    Have made changes, Actually need to add hints and other related document as well, so will raise a PR after that, till that time can you verify the code

  18. kahgoh commented on Jun 24, 2025

    @kahgoh
    Member

    The reference solution generally looks good. There are still some things I'd mention in a PR, like:

    • The tests should throw the exception instead of try-catch-print.
    • There are likely some tests (or assertions) missing. For example, what about asserting the contents from readNBytes & writeNByte when N is less than than the available content length? And then another for when it is greater than the available content length?
    • In a couple of places, the assertions are the wrong way. The first argument to assertThat should be the call to the method you're testing. For example, assertThat(4).isEqualTo(fileOperations.getWriteOperationCount()) should be assertThat(fileOperations.getWriteOperationCount()).isEqualTo(4).

    Btw, hints aren't required for this exercise. They are only needed in the concept exercises where specific concepts are taught. Paasio is a practice exercise where can be different approaches.

  19. shreyasgosavi commented on Jul 5, 2025

    @shreyasgosavi
    Contributor

    Hiii, I have raised PR, can suggest changes there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions