Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [static]

The static keyword, in object-oriented programming languages, is used to define a function/method or field/property as bound to the context of a type/class, but not to any specific instance. Unlike constants, static properties can usually be changed at runtime. static also refers to the storage class in languages like C. static variables are initialized once, at run-time, and persist in between function calls (i.e. they aren't re-initialized).

Filter by
Sorted by
Tagged with
10 votes
2 answers
958 views

Basic Imitation of C# Enumerable in VBA - or any other static class

Since implementing static classes in VBA actually seems possible I came up with an idea to try to imitate C#' Enumerable class (well, to some extent...). This is ...
user avatar
0 votes
1 answer
620 views

Class for finding the median of a two-dimensional space

I have a simple static class that it's purpose is given an RDD of Point to find the median of each dimension and return that as a new ...
Aki K's user avatar
  • 1,329
13 votes
1 answer
13k views

Business with dbcontext and static class

Many speak of using dependency injection. I do not use repository. The entity framework is uow/repository. What is wrong with using static class like the one below? My context is a new instance per ...
Marcos's user avatar
  • 139
11 votes
5 answers
2k views

Static factory function and lifetime

I'm trying to teach myself C++ at the moment, after years of C# and other managed languages. The class in question is a Level in a game, and the idea is to ...
Michael Stum's user avatar
6 votes
2 answers
886 views

Singleton design pattern

I am a beginner in PHP-OOP and design patterns. I have got this basic piece of code in Singleton Pattern and I changed it in order to understand its behavior. I can see that it works as expected. ...
DanielTheRocketMan's user avatar
5 votes
1 answer
2k views

How to make static methods testable? [closed]

I am creating an application which will be testable(unit + integration). In this application I have a FileHelper static class, ...
Imran Qadir Baksh - Baloch's user avatar
3 votes
2 answers
8k views

What's wrong with static utility classes, versus beans?

My inclination is to make these methods static: ...
Thufir's user avatar
  • 379
3 votes
2 answers
857 views

Web browser in Swing with MVC

Follow up question to: Utilizing OOP when creating a web browser After I received help on the question above, I've created 3 classes for my Browser. ...
armara's user avatar
  • 279
1 vote
2 answers
229 views

Creating Immutable Student Object

For a project I'm working on I have the following requirements: We have two student types: Domestic and International ...
user avatar
1 vote
1 answer
3k views

Dependency injection and inversion of control

I have recently been looking into the concepts/patterns behind dependency injection, inversion of control, and registries/service locators. I have searched about the internet on the subjects and have ...
Crackertastic's user avatar
1 vote
2 answers
3k views

Secure image upload class

Last night I made this image uploading class. It was the first time I made a file uploader to be used on a real site, so I thought I would share it here and on Github to get some reviews, hoping if I ...
samayo's user avatar
  • 325
0 votes
1 answer
122 views

Improving poor man's translations mechanism in c++98 program

In order to add basic translation capabilities in an old c++98 program I've come up to a basic and shameless code summarized by this snippet: ...
MatG's user avatar
  • 149