Questions tagged [utilities]

15 questions
17
votes
2 answers

Unit testing utility classes

All of us have some utility classes, which contain only static methods, for usage from different sources. Now, there can be two approaches which can be taken towards testing this piece of code. Approach 1: Have separate unit tests for utility…
alpha_ulrich
  • 281
  • 1
  • 2
  • 6
11
votes
4 answers

Few big libraries or many small libraries?

Over the course of some months I've created a little framework for game development that I currently include in all of my projects. The framework depends on SFML, LUA, JSONcpp, and other libraries. It deals with audio, graphics, networking,…
6
votes
2 answers

Static console object or dependency injection?

For a current project I have created a Console class which wraps up C++'s usual cout, writes output to a file or uses Console::WriteLine depending on the environment. Currently I've setup my code base to inject a console object into each class that…
sydan
  • 373
  • 1
  • 4
  • 11
4
votes
3 answers

What about Utility-Classes, but without hard dependencies?

The average utility class: A stateless class that provides some functionality by exposing static methods. Its default constructor is private to avoid instantiation. When ever the average utility class is used, a hard dependency is created. So,…
Diggi55
  • 51
  • 1
  • 4
4
votes
2 answers

Need some advice on CLI design, I need to provide simple but powerful command line options

I am writing a utility that runs on RHEL5 command line. I need my command line options to be simple but powerful. I looked at the various UNIX utilities to get an idea of how simple command line utilities have to be. Do you guys suggest any…
3
votes
0 answers

Forgetting about the utils

Let's say my language's standard library does not include TrickyFunction(). Since implementation seems quite trivial for me, I decide to create utils in the project and add such function, for others to use. Next month another programmer requires…
JoshThunar
  • 217
  • 1
  • 6
3
votes
1 answer

Where do utility libraries fit in a layered architecture?

Consider this mock-up of a software stack designed with layered architecture in mind : Every application layer is decoupled through API calls, but a memory handling library is used throughout. All layers need to copy, allocate or somehow affect…
Mobius
  • 51
  • 4
2
votes
4 answers

Is it ok to test an external function?

I have a utility function called connectToMongoDB() which connects to MongoDB. Basically, it creates a client for MongoDB and returns that. I'm making a library and I'm thinking of unit testing the utility functions. The way my unit test would work…
DaCool1
  • 37
  • 3
1
vote
1 answer

An application to get statistical data about HTTP Request/Response

I'm looking for an application which takes the address of a website, browses that website, and provides reports based on some user-defined criteria about the HTTP requests/responses. For example, this application should report how many images…
Saeed Neamati
  • 18,142
  • 23
  • 87
  • 125
1
vote
2 answers

Should we switch to standard functions for utilities?

Many projects need a set of various utilities. There is some discussion about where to place them. But what happens if the utility becomes part of the standard? For example, C++ kept adding to the standard many useful functions. For example,…
Paul92
  • 2,571
  • 15
  • 17
1
vote
3 answers

Refactoring - Utility classes behavior under a common interface

I was suggested to put my question here, so I'm doing so ;) I need a common interface which represents some specific behavior: public interface Contract(){ public void methodA(); public void methodB(); // and so on... } The problem is,…
radekEm
  • 367
  • 1
  • 3
  • 10
1
vote
3 answers

Converting mysql and SQLServer tables quickly in an update utility

The requirements are to take an existing list of identical tables (AAA0001 - AAA9999) which generally don't meed our current requirements and need to be swapped out with three tables (XXX0001-XXX999, YYY0001-YYY999 and ZZZ0001-ZZZ999). Currently,…
Peter Turner
  • 6,897
  • 1
  • 33
  • 57
0
votes
1 answer

The usefulness of java util classes to call a service (to create a model) as opposed to using that services's impl

Example I will explain the paradigm below but I am specifically talking about Liferay's Service Builder code for anyone who knows that platform. Basically in Liferay you can definite a model and it's properties in an xml file. Let's say that we…
0
votes
3 answers

Utility class or helper function in class?

I'm Working with php and we using enum's by create an Abstract class that mocking enum behavior - but my question is cross-languages. Where all the helper functions like toString, getEnumTypes, checkValidValue, etc... should be, in a dedicated…
Michael
  • 187
  • 1
  • 8
0
votes
1 answer

What is ServletUtilities?

The answer in this question suggests creating a ServletUtilities class to handle text conversion between Java strings and XML text. Generally when you create a JEE web application you put together a class that handles general conversions like…
dwjohnston
  • 2,543
  • 6
  • 29
  • 49