Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #37161
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Cecil Westerhof <Cecil@decebal.nl> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Is this a correct implementation of an abstract class and implementation class |
| Date | Sun, 13 Aug 2017 07:33:04 +0200 |
| Organization | Decebal Computing |
| Lines | 50 |
| Message-ID | <87378wxca7.fsf@munus.decebal.nl> (permalink) |
| References | <87r2wgxz2p.fsf@munus.decebal.nl> <wrapper-20170812225442@ram.dialup.fu-berlin.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Info | mx02.eternal-september.org; posting-host="1615173a1409002a85fbdd25ac4b9ead"; logging-data="19613"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ZuvpXypdGjZ6ruGogrZKIgBENDUNYAac=" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
| Cancel-Lock | sha1:90fuqA+1MDxfpQTH4Gm3Z/G6wOI= sha1:p3GDmUGlCIcTYzeS14AHElhk9ak= |
| X-Homepage | http://www.decebal.nl/ |
| Xref | csiph.com comp.lang.java.programmer:37161 |
Show key headers only | View raw
ram@zedat.fu-berlin.de (Stefan Ram) writes:
> Cecil Westerhof <Cecil@decebal.nl> writes:
>>public SQLite3 (String database) throws SQLException {
>> super(database);
>>}
>>Is this the correct way to do this, or is there a better way?
>
> There is no »correct« in this case. There are different
> possibilities. But the choice between them depends on the
> use expected, and you know best how you expect the classes
> to be used.
In a way I do not. ;-) I am writing it as an exercise and to make live
a little easier for myself. But I am thinking about sharing it, so it
can be used in a lot of ways.
For example: I will ‘always’ use the database connection for the whole
run of my program, but I made the class AutoCloseable, so it can also
be used in a try with resources, even if I do not use it that way.
> You are using the Template Method pattern to provide
> arguments to an abstract superclass, but you just fill in
> string values, not operations with behavior, so you could
> have a single class that takes the database, the package and
> the driver path as arguments as well. Or, if you want to
> factor out the package and driver:
At the moment I only implemented SQLite3. But this has the methods:
getSQLiteVersion
isDBLocked
And the fields:
GET_SQLITE_VERS
SQLITE_BUSY
UNEXPECTED_ERROR
Also I do not want have to give the driver path.
So for the moment I stick with what I have got.
I probably should rename getSQLiteVersion to getDBVersion, because
probably other drivers will have the same functionality.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread
Is this a correct implementation of an abstract class and implementation class Cecil Westerhof <Cecil@decebal.nl> - 2017-08-12 23:20 +0200
Re: Is this a correct implementation of an abstract class and implementation class Arne Vajhøj <arne@vajhoej.dk> - 2017-08-12 22:00 -0400
Re: Is this a correct implementation of an abstract class and implementation class Cecil Westerhof <Cecil@decebal.nl> - 2017-08-13 07:14 +0200
Re: Is this a correct implementation of an abstract class and implementation class Andreas Leitgeb <avl@logic.at> - 2017-08-13 09:37 +0000
Re: Is this a correct implementation of an abstract class and implementation class Andreas Leitgeb <avl@logic.at> - 2017-08-13 10:13 +0000
Re: Is this a correct implementation of an abstract class and implementation class Arne Vajhøj <arne@vajhoej.dk> - 2017-08-13 16:27 -0400
Re: Is this a correct implementation of an abstract class and implementation class lewbloch@gmail.com - 2017-08-13 09:49 -0700
Re: Is this a correct implementation of an abstract class and implementation class Arne Vajhøj <arne@vajhoej.dk> - 2017-08-13 16:25 -0400
Re: Is this a correct implementation of an abstract class and implementation class Cecil Westerhof <Cecil@decebal.nl> - 2017-08-13 07:33 +0200
csiph-web