Questions tagged [delegates]
Delegates can refer to several concepts. An object can rely on another (a delegate) to perform a function. Delegation can also refer to programming language feature making use of the method lookup rules for dispatching self-calls. In C#, a delegate defines which method to call when an event is triggered.
                66 questions
            
            
            
                7
            
            votes
        
        
            
                1
            
            answer
        
        
            
                559
            
            views
        
        
            
            
        TFunction: std::function replacement for event system
                    I've been trying to implement delegate for my event system. I thought that maybe std::function can do the trick for me, but it turned out to be not comparable, so what i have end up doing is this - ...
                
            
       
        
            
                3
            
            votes
        
        
            
                2
            
            answers
        
        
            
                221
            
            views
        
        
            
        Pool of Thread Pools
                    I had a problem at my work that we have some tasks that need to be executed as fast as possible. To do this we implemented them so they are multi-threaded in an ExecutorService. Originally we had for ...
                
            
       
        
            
                8
            
            votes
        
        
            
                1
            
            answer
        
        
            
                266
            
            views
        
        
            
            
            
        Way to delegate command to methods in different files
                    What I want to do is for an example command have it defined in its own file - e.g. command.js - and the same for the other methods. I want to make a separate file for every module - for example "...
                
            
       
        
            
                3
            
            votes
        
        
            
                2
            
            answers
        
        
            
                3k
            
            views
        
        
            
            
        Validating CSV headers against an expected list
                    My application (legacy code) reads a CSV input file with an expected format with regards to Column names as follows:
1st column - Should say "Marker"
2nd column - Should say "Category"
3rd column ... ...
                
            
       
        
            
                2
            
            votes
        
        
            
                0
            
            answers
        
        
            
                90
            
            views
        
        
            
            
        Inherited class calls initialization code in base class [closed]
                    I am interested in hearing your opinion on the approach I have taken to have inherited classes initialize their base class.
Here's a Machines collection class from that maintains a list of Machine ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                178
            
            views
        
        
            
            
            
        Repeatedly open and close a PDF document to perform various operations [closed]
                    I am trying to implement the Execute Around pattern described in Kent Beck's Smalltalk Best Practice Patterns. An example in Java could be found here. 
Basically, I am repeatedly opening and closing ...
                
            
       
        
            
                3
            
            votes
        
        
            
                1
            
            answer
        
        
            
                655
            
            views
        
        
            
            
        Java - propagating a threadlocal by wrapping a runnable
                    My aim is to use a thread pool together with a thread local. I cannot use InheritableThreadLocal because the thread data is different per user and there a couple of ...
                
            
       
        
            
                5
            
            votes
        
        
            
                3
            
            answers
        
        
            
                10k
            
            views
        
        
            
            
            
        Measuring method execution time
                    I want to easily measure method's execution time. Of course instead of doing something like this:
...
                
            
       
        
            
                6
            
            votes
        
        
            
                3
            
            answers
        
        
            
                10k
            
            views
        
        
            
            
        Several approaches to a logging class
                    I'm making a personal logger and so far I have come up with 3 solutions.
I have them simplified in this example to highlight my dilemma. I want to know the pros and cons of my approaches and ways to ...
                
            
       
        
            
                2
            
            votes
        
        
            
                2
            
            answers
        
        
            
                112
            
            views
        
        
            
            
        Counting quiz for children
                    I made a game for children. This game tests the ability to count (i.e. compare numbers based on magnitude). First you must select the age of the child in the upper menu, then you need to select blocks ...
                
            
       
        
            
                1
            
            vote
        
        
            
                2
            
            answers
        
        
            
                149
            
            views
        
        
            
            
        Selecting multiple filters based on the true/false conditions
                    I wrote a method to select the filters (two or more) based on the true/false conditions. Here is the method I used for selecting the multiple filters:
...
                
            
       
        
            
                2
            
            votes
        
        
            
                1
            
            answer
        
        
            
                239
            
            views
        
        
            
            
            
        Amplitude and Frequencies of sound Analyser
                    As I'm beginner with mobile/OO programming, I reached a situation that confused me and made me wonder if I was coding correctly...
The main class:
...
                
            
       
        
            
                1
            
            vote
        
        
            
                2
            
            answers
        
        
            
                152
            
            views
        
        
            
            
            
        View controllers and delegation for a weightlifting app in Swift
                    I've got several UIViewControllers that are trying to do too much so I'm trying to learn how to clean them up so that they only have code that does UI things (...
                
            
       
        
            
                4
            
            votes
        
        
            
                1
            
            answer
        
        
            
                1k
            
            views
        
        
            
            
        Event delegation without jQuery
                    I created event delegation like concept which is present in jQuery. AFAIK, event delegation is used to register an event for an element which is supposed to be added dynamically. So, in jQuery we do ...
                
            
       
        
            
                6
            
            votes
        
        
            
                1
            
            answer
        
        
            
                743
            
            views
        
        
            
            
            
        iOS delegation design pattern
                    I am working on a project that has a Model-View-Presenter structure and use the delegation design pattern that has the following structure/implementation. I would love feedback.
The ViewController ...
                
            
       
         
         
         
         
         
        