Skip to main content

Questions tagged [initialization]

Filter by
Sorted by
Tagged with
2 votes
3 answers
284 views

I have an application, which contains a logger. The logger already exists and is ready to be used, so it can be passed directly to the constructor. class App { private readonly logger: Logger; ...
404 Name Not Found's user avatar
6 votes
4 answers
1k views

According to https://softwareengineering.stackexchange.com/a/334994/432039, I know init is a code smell and should be avoided, and one of the solutions is to use a builder to hold the state first ...
wcminipgasker2023's user avatar
12 votes
4 answers
3k views

I encountered the following situation: I have two modules, TokenService and Wifi which are initialized from main(). The modules themselves don't know of the existence of each other and function ...
glades's user avatar
  • 493
0 votes
1 answer
279 views

I have a program that accepts computer names and then will perform CIM session tasks. The computer names are passed in from the user input and separated by "," (ex: program.exe -computers ...
James's user avatar
  • 11
3 votes
3 answers
2k views

This question is mostly related to the way language implementer do implements static class initalization (pretty specialized question). It is for curiosity and also to potentially improve my code to ...
Eric Ouellet's user avatar
0 votes
0 answers
482 views

I am using a 3rd party library that must be initialized with Lib::init() before any of its other functions may be called and that must be uninitialized with Lib::destroy() before the application ends. ...
pschill's user avatar
  • 2,040
2 votes
1 answer
151 views

Assume we want to model a table where players can sit down to get together to play a game (card games, dice games, ...). Assume a few properties associated with each seat class Seat { public int ...
Benj's user avatar
  • 169
-5 votes
2 answers
279 views

// Default initialization int i; // i has an unspecified value return i; // Probably 0, but Unreliable i = 5; // i has a specified value i = int();// This will give it a specified value, 0 i = ...
Anon's user avatar
  • 3,649
0 votes
1 answer
907 views

Considering a class method that takes a "vector" (Tuple or List of either int or float) of defined values such as the following: import sys from numpy import isnan, array, float64 class Shape: """ ...
lucasgcb's user avatar
  • 385
4 votes
2 answers
1k views

I was reading on this SO page about when to check parameters when constructing an object. The accepted answer suggests throwing the exception from the constructor so that an invalid object cannot be ...
user avatar
1 vote
2 answers
5k views

I'm implementing a simple rendering system for a game engine. In my engine I have renderable entities that have a Model component (I'm using inheritance as opposed to a ECS for my engine for now, but ...
Luca's user avatar
  • 181
1 vote
1 answer
236 views

I have a function that creates a new object by passing to it's constructor integer ids primarily with values of 0. This function is called when saving a newly created record (not an edit). public ...
samus's user avatar
  • 475
1 vote
1 answer
606 views

See the comment inside ChildEntity ::__construct(): class ChildEntity extends ParentEntity { /** @var int */ protected $classParameter; function __construct(int $classParameter) { ...
Dennis's user avatar
  • 8,277
2 votes
2 answers
236 views

Components common to all ExoPlayer implementations are: A MediaSource that defines the media to be played, loads the media, and from which the loaded media can be read. A MediaSource is injected via ...
Mehdi Haghgoo's user avatar
3 votes
4 answers
328 views

When debugging object oriented (Java) code, sometimes some field of some object is null while it should not be. I often spend what I feel is way too much time trying to figure out where it should have ...
Mark's user avatar
  • 682

15 30 50 per page