S
Stefan Ram
I assume that one wants to design an API with the option to
open a FileOutputStream for /append mode/. There are several
possibilities, and one can compare their readability,
extendability (fitness for later API extensions), usability
and other software quality factors. (feel free to comment):
==
new FileOutputStream( "path", "a" );
==
new FileOutputStream( "path", "append" );
==
new FileOutputStream( "path", true );
==
new FileOutputStream( "path", FileOutputStream.APPEND_MODE );
==
new FileOutputStream( "path", FileAccessMode.APPEND_MODE );
==
new FileOutputStream( path, new AppendMode() );
/* here, »AppendMode« might be a subtype of another type »FileAccessMode« */
==
new FileOutputStream( path, new FileAccessMode( "append" ));
==
new AppendFileOutputStream( path );
/* here, »AppendFileOutputStream« might be a subtype of »FileOutputStream« */
==
Possibly, I have missed others possibilities to design this.
open a FileOutputStream for /append mode/. There are several
possibilities, and one can compare their readability,
extendability (fitness for later API extensions), usability
and other software quality factors. (feel free to comment):
==
new FileOutputStream( "path", "a" );
==
new FileOutputStream( "path", "append" );
==
new FileOutputStream( "path", true );
==
new FileOutputStream( "path", FileOutputStream.APPEND_MODE );
==
new FileOutputStream( "path", FileAccessMode.APPEND_MODE );
==
new FileOutputStream( path, new AppendMode() );
/* here, »AppendMode« might be a subtype of another type »FileAccessMode« */
==
new FileOutputStream( path, new FileAccessMode( "append" ));
==
new AppendFileOutputStream( path );
/* here, »AppendFileOutputStream« might be a subtype of »FileOutputStream« */
==
Possibly, I have missed others possibilities to design this.