Design-patterns Questions
Ad
Qt "passthrough" or "container" widget
In qt / pyside2, is there such a thing as a qt widget that simply passes through to a wrapped widget, without adding any extra layers of layout
Any suggestions for a crash course on design patterns?
I am going to be giving developers at my company a crash course on design patterns (after coming across some scary code recently). one of
How To Implement Shared Behavior Between Classes (Without Multiple Inheritance Of Course) in C#
Update: so pretty much everyone here has told me that i just need to start all over again on how i designed my classes (thank you folks for your
Can any one provide me a sample of Singleton in c++?
I write a singleton c++ in the follow way: class a { private: static a* m_pa; a(); virtual ~a();
What is a good online resource for css 'design patterns'?
Can anyone out there recommend a good online resource for css 'design patterns'? i know design patterns in a software context usually
Thoughts on Design - Core Control Logic and Rendering Layers
I just wanted to see if i could have your thoughts on the design of some work i am currently doing. here's the current situation -
What are the advantages and disadvantages of the Session Façade Core J2EE Pattern?
What are the advantages and disadvantages of the session façade core j2ee pattern? what are the assumptions behind it? are
How to write an event emitter in node.js that let's you create a function "myFunction" but then call either success or failure when it runs?
For example, i have seen functions like this, which are handy to use: myfunction(data). success(function() { // success! }).
Looking for example of Command pattern for UI
I'm working on a winform .net application with the basic ui that includes toolbar buttons, menu items and keystrokes that all initiate the same
Custom WPF command pattern example
I've done some wpf programing and one thing i never got was the command pattern. every example seems to be for built in ones, edit, cut, paste.
Ad
One listener for all packets vs separate listeners to handle specific types
Smack's xmppconnection implements an event-driven manner of receiving xmpp responses from a jabber server. the method
Add index to filename for existing file (file.txt => file_1.txt)
I want to add an index to a filename if the file already exists, so that i don't overwrite it. like if i have a file
Where do you record validation rules for form data in a web application?
Say you have a web form with some fields that you want to validate to be only some subset of alphanumeric, a minimum or maximum length etc.
Refactor the python design patterns
I have a class called resources and i have defined one method called get_connect. i want to use the data of which get_connect returns to the other
How to deal with monstrous Struts Actions?
I inherited this gigantic legacy java web app using struts 1.2.4. i have a specific question regarding actions. most of the pages have exactly one
Understanding MVVM Architecture in iOS
I have few questions in order to understand the mvvm architecture for ios as below - how is model different from the view-model?
Splash screen using MVP design pattern in Android
I am doing some research about mvp design pattern in android and got a question about splash screen. the app that i am developing with mvp design
Algorithm to create a binary-like pattern
I have two numbers: n and sp. i want to create a pattern of list elements with sp elements that rotate like
Where's the best place to call methods that interact with my database?
I'm creating an app that interacts with a firestore database. as of now i have a singleton class, databasemanager that has all the
Undo redo for a huge object
I have a requirement where the product needs to implement undo-redo functionality. currently i hold a huge object which comes from a
Android Camera2 API with "State" Design Pattern
I've been working for 2 months with different camera2 api projects. as you may know, camera2 api is little difficult to understand and maintain,
Ad
Display pattern error without submitting the form
I have a form that i have put on couple pages, i have a 'next' button wich is displaying the next page, and, when on last page turns to a submit
How to draw shape like below image
Please help me to draw a shape like the image below. i have tried many things, but none of the code worked.
Matching pattern and adding values to a list in TCL
I wondered if i could get some advice, i'm trying to create a list by reading a file with input shown below example from input file
Python Singleton objects with the same attribute should reference to the same object
I want python to return the same object when the instances are created with the similar attributes. also when i am changing some attribute of one
Form validation in Clean Architecture
Input validation is a business logic so we should hide this process in the domain layer. as discussed
Interface to interface association in the book Head First Design Patterns
The book head first design patterns presents the following uml as an example of the observer pattern:
How to implement a reusable multistep state-machine into MVP?
In my android app i have a multi step login procedure: enter a id, and send to backend: firstcall(id) if id
how to use Builder Pattern?
I'm creating a view entend framelayout now that has about 10 parameters. i was thinking about using the builder pattern, similar to how
Laravel functions in pivot models?
We've got two tables that are in a relation to each other. user and booking. the pivot model
Combining Context and Token Use Cases into Generic ABC
I have a basic abc here: from abc import abcmeta, abstractmethod class streamingservice(object, metaclass=abcmeta):
How to change the using of the pattern repository loaded using interfaces for initializing the model? Laravel, Laracom
Good day. a store was created based on
Ad
Is the View or the ViewModel responsible for transforming data from a Model to be presented in the UI?
I am new to mvvm pattern, and this is a general question for me but i will use a specific example. i have: a data class
Design pattern for inheriting across modules
I have a baseclass object with two childclass objects inheriting from it. each of these is a significant bit of code
Most Pythonic/Django way to dynamically load client libraries at runtime
I'm writing a django application in which we will have multiple client libraries that make calls to third party apis. we want to be able to
Enabling / Disabling Features in a Laravel App
I'm building a laravel app, which has a number of various features. i want to be able to enable or disable them depending on a particular domain's
Handling Firebase "Tasks" and implement Manager Classes (for Firebase) in Unity
I'm writing the code for a game whose server-side is totally based on firebase. i expect to use auth, database, instanceid, messaging and cloud
How to Separate Router from Controller in Express App?
I want to separate routes from controller. i tried this approach: routes/index.js var express
Best practice to create "flag" for multiprocess project with db as bridge between processes?
I have two processes: 1) scraper - take info from another website, do the needfull calculations and put results in db 2) web app
Callback casting and set from another object [resolved]
I just wanted to ask if my approach is wrong or one is the right way and it can be done. in the project, i have one hal and several types
Sequentially execute webhooks received in node application
I have a node application using koa. it receiving webhooks from external application on specific resources. to illustrate let say the
Which is worse - duplicated code or double try/except?
I have a situation where i want to do multiple things while handling an exception. since i want to make this about the general case, i'll
About designing a course system. When should I inspect assignments due or not? Where should I put this logic?
I am working on designing a system for students, teachers, etc. to use, and i'm using laravel framework to develop. teachers can
Ad
How to create a class that returns different objects
I am trying to do the following: #a wrapper object that based on it's parameters returns other
Authorizing in controller constructor vs form request
When should i authorize in controller constructor using authorizeresource
Should i pass functions to my component manually or using ref attribute?
I have built my own formbuilder component (which is almost 5k line now), so it can cover all my needs, one issue i'm
What is the best way to fix "IFs hell"?
I have a deal class, that has several states : new, bought, finished, trend and crossing properties. deal instance can change trend and crossing
How to add top lines in navbar - Flutter
I am relatively new to flutter and i was wondering how to make this design possible. i assume i have to use dividers etc but i haven't been able
Matcher doesn't return the matched regex, instead returns whole string in group(0) (Java)
The problem i'm facing is that upon following the question at this link,
bottom navigation view
I am trying to use bottom navigation view in my app but i'm having issues getting it to work as it seems to behave differently according to the
Node.js config file vs .env architecture practice and building pattern
I'm developing server side app on node.js and i thinking about config file usage. but when i google it.. well as for now i have more
Which pattern/architecture follow to build Flutter app?
I started build an e-commerce app that allows people buy one item by turn. however, i don't have deep knowledge about flutter app architecture to
is Context in Android an implementation of a complex Strategy design pattern?
I was reading several guides and one book about the strategy pattern. i noticed that in all the guides there is a referall to a
Ad
Why do many Win32 Strucs contain their size as a member
This is not strictly a programming question but more of a design question. working with some strucs from the winapi i noticed that many of
Concurrent async requests - keep track of necessary timeout
With nominatim requests i need to keep a timeout of 1500ms between every requests. how do i handle that if multiple concurrent running processes
React design question about creating remove functionality
This is a little long winded. i would like advice on how to go about making the functionality of a remove button. i'm relatively new to
React hooks: activable states patterns
I'm trying to create a component that can activate/disable some functionality depending on the props. all of those functions will need a state
Python decorator-like design pattern for Dart/Flutter?
I'd like to have common try/catch/finally logic in a decorator-like feature that can "wrap" a function or class method. consider the
Pub-Sub Design Pattern
I've got two projects: one of them is a multi-processor project and the second is a single processor. both of them are written in node js.
Flutter: Mapping Type to Widget
I have multiple widgets corresponding to each type of object, to modify attributes of these objects. these widgets are based on different state of
Restrictions for input type=text
Could someone help me with restrictions for input text? <input type = text size = 18 name = part_numb value = '' pattern =
What could be the pattern behind Provider in Flutter
I was wondering to which formal pattern the provider in flutter corresponds. i've seen in the wiki that the one from microsoft is a rename of
Should we save/update models in repository pattern?
I'm learning about repository pattern and i have seen a lot of examples where repository pattern is used for creation and update. here is one
Laravel design patterns
I have a little hard time with all of those design patterns and things that could help me write maintainable code, clean and reusable.what are the
Ad
how to implement Repository Pattern In Laravel
Although there are some tutorials on medium and some other sites about the repository pattern for laravel i read in some sites that repository
Abstract Factory Design pattern implementation
I am rewriting my already working python code in a oop manner as i want to implement it in a modular way. i have a dataset that has been obtained
What is the best design pattern to consume REST API
I want to consume a rest api in laravel (an mvc framework) but i resort to use __call and was wonder if there is a better design
How to avoid duplication in Laravel validation rules
For validating form validation rules i currently stored them in user model and use it in register controller, user controller in admin panel, user
Repository Pattern on Laravel
I would like to use the repository pattern but i am stuck on the syntax. i want to get my function index(). first step, i
Laravel: difference between using a Trait or extending a model
We're working on a laravel application with a scheduling module. the module has three types of classes that can be put in an agenda: task, event
How to display a snackbar conditionally based on redux state using thunks?
I'm writing a website in react which displays information on mobile apps and i'm using redux to store the information about the current app. i
what is best pattern or approach to handle ACL in Eloquent Models?
I'm creating a rest api using laravel in which there is multiple parameter for an endpoint based on user's role. currently checking this
How to combine Material-UI's snackbar and input components in react?
I'm using material-ui components to build my website. i have a header component
Using adapter pattern when consuming 3rd party APIs and creating a domain in Laravel
In my laravel rest api project i mainly consume 3rd party apis. for that, i have a 'services' folder grouped by apis
Ad
Using one dictionary vs. many to store program configurations
I am writing a python program with many (approx ~30-40) parameters, all of which have default values, and all should be adjustable at run time by
ES6 modules - best approach for creating an immutable service
I'm using the following approach for creating a singleton-like service in my application: myservice.js:
Will this cause a deadlock or a bad pattern?
Will the following way of using a thread pool cause a deadlock? or is such a pattern not preferred? if so, what is the alternative. passing
Find a Decorator of a particular type when using the Decorator Pattern?
I'm building an app that needs to use multiple types of similar sensors. since the sensors could also have different behaviours, or combinations
Handling sorted and filtered collections coming from APIs in a redux store
Redux guidelines suggest to think at an app's
how can i learn javascript coding patterns
First what i mean by patterns.. basically in js there are multiple ways to do something but some ways of doing things offer greater benefits in
Inherent python abstract base class in django
I would like to make an generic module in python which uses data from a django model, and use typing to document the interface. the module should
Is it a good pattern to use !! notation to listen for ReactJS changes?
I've been adopting reactjs + redux in my projects for a couple of years. i often end up in asynchronous situations where i need my component to
Where I should put the model creation code?
Let's assume i have user model that related to models image, card, etc. that means when i create a new user, i should create image and card
How to implement listener pattern in swift
I am new in swift moved from java. and some implementaion of dessign patterns confuse me. for example i have presudo pattern observer
How to avoid parameter type in function's name?
I have a function foo that takes a parameter stuff stuff can be something in a database and i'd like to create a
Ad
Pass field name/type as a parameter to a method in Java
I have a list of localizedattributes public class localizedattribute<t> { t value; locale locale; }
How can saving React Child Components inside state value be efficient?
I'm working on some project where i need to add react child components dynamically. while this task may seem to be easy to complete, i'm concerned
Sed REMOVE / REPLACE double parentheses
I have a python file, which has lots of double parentheses like this, which i would like to replace with single parenthesis. sometimes the print
Design problems of ActiveRecord for large application
In most of the frameworks you have model classes that represents row in the database. for example php code: class user
Javascript - Change lots of if statements by using class (ES6)
I am using lots of if statements in my code now, so i want to change by using class (es6) however, i am not much good at javascript... so
Algorithms to achieve reasonable result with most economic efforts
Suppose that there are six kinds of problems to be handled when reading a book, i illustrate the details as follow: while
Return same Parameter On Some Objects By type
I want that remove my if what can i do? i retrieve my data from database and in all of type they have some field named isverified is
a good way to implent l.php like facebook?
What is the l.php im guessing l.php is link.php on facebook. its a pre-redirecting script. every link on facebook is
How to check if object which is of a sub
I have an object which is modeled as such: public class template { private form form; public form getform() { return form;
Why is interface used as a type in the Laravel Repository Pattern?
I did a investigation on the laravel repository pattern in order to isolate somehow custom queries and i've also tried it on my internal
Design pattern for managing groups of tasks
I have a system that processes task objects, and now i would like to perform some benchmarking experiments. specifically, i will
Ad
Meaning of abstraction in bridge design pattern
I am confused on how should i explain the bridge design pattern in java. based on gof's definition: the bridge pattern is
Ad
Blog Categories
Ad