You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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?
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.
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.
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.
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.
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.
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
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.
Activity
CliffRoberson commentedon Aug 1, 2020
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?
mirkoperillo commentedon Aug 3, 2020
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
github-actions commentedon Sep 23, 2021
This issue has been automatically marked as
action/stalebecause it has not had recent activity. Please update if there are new updates to provide.andrerfcsantos commentedon Jun 5, 2022
@CliffRoberson Still interested in working on this?
github-actions commentedon Sep 4, 2022
This issue has been automatically marked as
action/stalebecause it has not had recent activity. Please update if there are new updates to provide.18 remaining items
shreyasgosavi commentedon Jun 5, 2025
Not really no need to introduce, found other way round of implementing it (passing dummy input-output Streams for Socket).
kahgoh commentedon Jun 9, 2025
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.
shreyasgosavi commentedon Jun 10, 2025
Ohh don't worry havent used mockito
shreyasgosavi commentedon Jun 10, 2025
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?
kahgoh commentedon Jun 10, 2025
I'd be happy to take a look 😉 . Could you please a link to your repository and branch or open a draft pull request?
shreyasgosavi commentedon Jun 11, 2025
Sorry for delay : https://github.com/shreyasgosavi/exercism-java/tree/paasio-exercise/exercises/practice/paasio
shreyasgosavi commentedon Jun 14, 2025
Any suggestions?
kahgoh commentedon Jun 14, 2025
Sorry, I got caught up with things the last few days. I noticed
Passion.javahad 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 standardInputStream/OutputStreamorReader/Writerinstead, similar to how Go's implementation wraps around their standardio.reader/io.writer.shreyasgosavi commentedon Jun 14, 2025
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.
shreyasgosavi commentedon Jun 20, 2025
I have pushed the changes, can you verify it
kahgoh commentedon Jun 21, 2025
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
DummySocketandtmpFileare not doing much. I'd suggest simplifying the test by using theByteArrayInputStreamandByteArrayOutputStreamdirectly. 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.
shreyasgosavi commentedon Jun 23, 2025
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
kahgoh commentedon Jun 24, 2025
The reference solution generally looks good. There are still some things I'd mention in a PR, like:
readNBytes&writeNBytewhenNis less than than the available content length? And then another for when it is greater than the available content length?assertThatshould be the call to the method you're testing. For example,assertThat(4).isEqualTo(fileOperations.getWriteOperationCount())should beassertThat(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.
shreyasgosavi commentedon Jul 5, 2025
Hiii, I have raised PR, can suggest changes there