Questions tagged [library-design]

Use this tag for topic related to library development

Relates to designing and developing libraries, which can be used for private or public software development.

66 questions
0
votes
1 answer

Writing database library in Scala - initialization code

I wanted to write small library for Neo4j database in Scala language. This library will talk with Neo4j database and mostly map classes to nodes. I want to make it work like spray-json library: https://github.com/spray/spray-json Anyway I was…
Andna
  • 6,539
  • 13
  • 71
  • 120
0
votes
4 answers

What would you do here? Return a null or throw an exception (framework design guides)

I'm developing a C# .NET Framework 4.0 library. I have this code: public static byte GetBatchStatus(string connString) { if (string.IsNullOrEmpty(connString)) throw new ArgumentNullException("connString"); byte status; using…
VansFannel
  • 45,055
  • 107
  • 359
  • 626
0
votes
1 answer

Dependency-free JavaScript onLoad

I'm working on a JavaScript library which needs to give the user the ability to run some code on load. Of course, I'm familiar with window.onload, and things like $(function() {}); with jQuery. But I don't want to be dependent on another library,…
Joel Martinez
  • 46,929
  • 26
  • 130
  • 185
0
votes
2 answers

How do I handle a growing Controller Class?

$object_cin = new CIO( ); $object_cin->invoke( $_POST[ 'model' ] ); class CIO { private function invoke( $model ) { switch( $model ) { case 'user_try': $model = new MUserTry(); …
user656925
-2
votes
1 answer

Confusion about the interface design of C++11 random distributions

Let's take uniform_int_distribution for example. In my opinion, despite the fact that it stores a default set of distribution parameters, it is practically stateless. As such, wouldn't it be better and more convenient to design it as a function…
Lingxi
  • 14,579
  • 2
  • 37
  • 93
-4
votes
3 answers

Use outer class instance as self in inner class?

I'm writing a wrapper for the GMAIL API. In this wrapper, I am trying to include subattributes in the "main class" so it more closely follows the below: Previously, I was use methods such as: class Foo: def __init__(self, ...): # add…
IllustriousMagenta
  • 514
  • 1
  • 4
  • 19
1 2 3 4
5