Questions tagged [concept]
Concept programming is a programming paradigm focusing on how concepts that live in the programmer's head translate into representations that are found in the code space. This approach was introduced in 2001 by Christophe de Dinechin with the XL Programming Language.
301
questions
1139
votes
12
answers
441k
views
Node.js + Nginx - What now?
I've set up Node.js and Nginx on my server. Now I want to use it, but, before I start there are 2 questions:
How should they work together? How should I handle the requests?
There are 2 concepts for ...
116
votes
3
answers
231k
views
how to implement Interfaces in C++? [duplicate]
Possible Duplicate:
Preferred way to simulate interfaces in C++
I was curious to find out if there are interfaces in C++ because in Java, there is the implementation of the design patterns mostly ...
66
votes
2
answers
42k
views
What is a distributed cache?
I am confused about the concept of Distributed Cache. I kinda know what it is from google search. A distributed cache may span multiple servers so that it can grow in size and in transactional ...
58
votes
3
answers
5k
views
Why does same_as concept check type equality twice?
Looking at the possible implementation of the same_as concept at https://en.cppreference.com/w/cpp/concepts/same_as i noticed something strange is happening.
namespace detail {
template< class ...
30
votes
5
answers
108k
views
Interact with other programs using Python
I'm having the idea of writing a program using Python which shall find a lyric of a song whose name I provided. I think the whole process should boil down to couple of things below. These are what I ...
22
votes
2
answers
4k
views
Python supports a limited form of multiple inheritance. In what way limited?
In the python tutorial it's said that "Python supports a limited form of multiple inheritance".
What are the limitations?
19
votes
12
answers
42k
views
Is it necessary to write else part in every if condition?
My question might get closed, but I'm curious about whether it's always required to add an "else" part to every "if" statement in coding. A senior programmer told me, "You ...
19
votes
2
answers
1k
views
How to do simple C++ concept has_eq - that works with std::pair (is std::pair operator== broken for C++20)
Compiler Explorer link
template <typename T>
concept HasEq = requires(T t) {
{ t == t } -> std::convertible_to<bool>;
};
struct X {};
static_assert(not HasEq<X>);
//bool a = ...
13
votes
6
answers
1k
views
Recursion Vs Loops
I am trying to do work with examples on Trees as given here: http://cslibrary.stanford.edu/110/BinaryTrees.html
These examples all solve problems via recursion, I wonder if we can provide a iterative ...
12
votes
4
answers
14k
views
Why .NET is a Framework and Java is a Language [closed]
Ok. It's not a battle. I'm curious about the concept of framework, I worked with some frameworks like django, zend, rails and cakephp in various levels.
Today a friend of mine sent me a presentation ...
12
votes
3
answers
3k
views
Can a pure function call external function?
Can a pure function call an external method?
for example:
class Dog {
function jump(name) {
return "a dog named " + name + " jumped!"
}
function jumpTwice(names) {
var result = [];
...
12
votes
2
answers
425
views
Passing a concept to a function
Since concepts are defined as compile-time predicates, is it also possible to actually reuse these predicates for compile-time algorithms? For example would it be possible to check whether all types ...
11
votes
3
answers
2k
views
Getting started with Core Data
I am having trouble understanding how Core Data works conceptually and in terms of code.
I get that there is a coordinator and a context. I also get that there is state management. How do they work ...
11
votes
1
answer
9k
views
Give a generic enum type as template argument
In short:
Is there a way I can feed a General templated class with something that only represent an enum type? Something like:
template <typename T> struct General {};
struct EnumSpecific : ...
11
votes
6
answers
9k
views
Remove unwanted jQuery functions
Helo,
A library like jQuery is fully loaded and comes with many functions that we may not use in our scripts. Am wondering if there is a way to say read my script find out all the jQuery functions ...
10
votes
1
answer
2k
views
Why does `ranges::view::for_each` require the functor must return a model of the `InputRange` concept?
#include <vector>
#include <algorithm>
#include <range/v3/all.hpp>
using namespace ranges;
int main()
{
auto coll = std::vector{ 1, 2, 3 };
std::for_each(coll.begin(), coll....
10
votes
2
answers
18k
views
Which one is fast, Abstract class or Interface? [duplicate]
Possible Duplicate:
Why are interface method invocations slower than concrete invocations?
I recently had a chance to appear in an interview in which interviewer asked which one is faster among ...
10
votes
4
answers
6k
views
The difference between a `global variable` and a `field`?
Fields are variables within a class or struct, local variables sit within a method and global variables are accessible in every scope (class and method included).
This makes me think that fields ...
9
votes
7
answers
904
views
Is Hashing a suitable solution? Am I over-complicating it?
I write a 2D platformer game where I need rooms with (maximum 4) doors. I write it in Java, but the language is irrelevant.
Each room can have 4 doors, on the top, bottom and sides. I call them NORTH,...
9
votes
2
answers
40k
views
Understanding C's fork() through a simple example
#include <stdio.h>
int num = 0;
int main(int argc, char*argv[]){
int pid;
pid = fork();
printf("%d", num);
if(pid == 0){ /*child*/
num = 1;
}else if(pid > ...
9
votes
1
answer
2k
views
Unterstanding how Vaadin uses GWT
After playing around with Vaadin for about a week I'm curious about how Vaadin uses GWT. GWT compiles Javacode to Javascript. This has to be done everytime when you are redeploying.
Since Vaadin has ...
8
votes
4
answers
7k
views
"Client" concept in OOP Design Patterns?
I read many topics about OOP Design Patterns of GoF, but i am not sure about "Client" concept. So what is it? How can we realize it in our application. Thank!
8
votes
2
answers
4k
views
What's the difference between software and firmware?
I know this is a bit of a basic question, but I am a little confused and couldn't find the complete answer on Google.
I know that the difference has to deal with how permanent and malleable a section ...
7
votes
4
answers
3k
views
Demandware MVC concept
I am new guy to Demandware and I am switching from Magento to Demandware.
Demandware is not opensource I am not getting proper tutorials, stuff to understand the concepts of it.
I am from Magento so ...
6
votes
3
answers
18k
views
Handle multiple EntityManager in Java EE application
I have Java EE application with about 10 EntityManagers (number of EMs will probably increase). My application also contains many stateless, statefull and message driven beans.
Rather than inject in ...
6
votes
4
answers
4k
views
Timer Efficiency
I am planning to develop a system with tens of thousands of objects in it, which will each have up to 42(but more likely down around 4 or 5) separate actions they will potentially be performing at ...
6
votes
2
answers
3k
views
Extjs: How to approach the concept: Add, remove, add instance
Concept:
Consider having two panels A and B, and a window C like in the following example. The buttons on the window switches between the two panels.
var A = new Ext.Panel({
title: 'A'
});
var B ...
5
votes
6
answers
3k
views
Why should I use asynchronous operation over synchronous operation?
I have always pondered about this.
Let's say we have a simple asynchronous web request using the HttpWebRequest class
class webtest1
{
HttpWebRequest webRequest = (HttpWebRequest)WebRequest....
5
votes
1
answer
8k
views
Login system concept & logic?
I want to know the process which usually web apps follow to maintain login between multiple requests and also how they manage things using COOKIES.
In my login form I am providing "Remember Me" ...
5
votes
1
answer
3k
views
What is cluster and node in RabbitMQ?
About RabbitMQ two concept is unknow to me, cluster and node ? what is different between them?
5
votes
2
answers
658
views
Happstack-state concept and docs?
I'm starting making Haskell web server. I've decided to start with Happstack and Happstack-state. And I'm feeling hard to understand concept and attribute of Happstack-state. Is it a new kind of ...
5
votes
3
answers
1k
views
Is NULL a pointer?
So, I had an argument with my professor earlier defending that NULL is not a pointer, but he kept on insisting that it is because there is such a thing as NULL pointer. So, here I am now a little bit ...
5
votes
2
answers
200
views
How is constraint overloading resolved by the partial ordering of concept?
Per cppreference, the partial ordering of constraints over subsumption is used to determine "the best match for a template template argument". And in the example section, the option that is &...
5
votes
1
answer
1k
views
Why two individually created immutable objects have same id and mutable objects have different while both refer to same values? [duplicate]
Two individually created mutable list have different ids.
Python SHELL: (mutable)
>>> mylist = ['spam', 'eggs']
>>> yourlist = ['spam', 'eggs']
>>> id(mylist), id(yourlist)...
5
votes
4
answers
3k
views
application logic vs business logic
While I am trying to discerned the difference between the application logic and business logic I have found set of articles but unfortunately there is a contradiction between them.
Here they say ...
5
votes
1
answer
289
views
What happens when the name of a C++20 concept is the same as the name of a class type
Does C++ define the behavior of the following code:
template <class T>
concept C = true;
struct C {};
template <C T>
struct A {};
template <struct C T>
struct B {};
int main() {
...
5
votes
2
answers
132
views
What is Injectable and Embeddable?
I have heard about both terms Injectable and Embeddable many times, but I am not getting actual meaning of it.
Please help me to understand both clearly.
5
votes
1
answer
230
views
Java concept idea
** SOLVED **
I'm fairly new to Java and so far I love it!
So I'm just asking if someone has a idea that could help me out. So here's what I would like to do.
What I'm working on right now is a ...
5
votes
1
answer
347
views
What are values of function(a, b)?
I am testing module example from JavaScrit: The Good Parts. I don't know who passes in a and b in function(a, b). Somehow it works.
Function.prototype.method = function(name, f) {
this.prototype[...
4
votes
3
answers
1k
views
what is the concept behind java iterator?
I am doing a research on java iterator interface and cannot understand why it is designed like that.
Why java iterator use hasNext and next instead merge them into one method?
this a typical usage ...
4
votes
3
answers
9k
views
How exactly does minimax recursion work?
So I was looking up Mini-max for a Tic-Tac-Toe Game, but couldn't understand how the recursion worked? Okay, so basically here are my questions:
How does minimax know whose turn is it? Whats the best ...
4
votes
3
answers
1k
views
what's the concept of mandatory in orientdb?
I'm trying OrientDB.
Most of concepts are easy and clear to understand. But there was one unfamiliar concept. The mandatory. What's this?
4
votes
3
answers
223
views
What does an interface in Java interface with?
I've been trying to learn some basic object oriented programming in Java. I was curious to know what the origin of the word interface is , if there is any documented description. Also I was trying to ...
4
votes
7
answers
13k
views
encapsulation and abstraction OOPs concept
Does Encapsulation is information Hiding or it leads to information hiding??
As we say that Encapsulation binds data and functions in a single entity thus it provides us control over data flow and we ...
4
votes
5
answers
643
views
Is there a concept name for a regular type for which comparisons doesn't compare the full object state?
I have a set of types which looks like this:
struct MyFlag
{
SomeId source_id; // INVALID_ID by default
SomeData data; // regular type
friend bool operator==( const MyFlag& a, ...
4
votes
2
answers
114
views
C++ template friend class does not satisfy conceptual constraints because it is an incomplete type
#include <mutex>
#include <shared_mutex>
template<typename T>
concept is_buffer = requires (T t) {
{ t.pointer() } -> std::same_as<char*>;
{ t.capacity() } -> ...
4
votes
2
answers
3k
views
UML - How to model either/or/both (union) concept?
In my business we have a "Data Store" where data is stored (e.g. database, flat file, etc) and a "Data Provider" who delivers the data (e.g. human, sensor, etc).
To model this in UML is no problem ...
4
votes
1
answer
405
views
Bug in C++20 concepts with template member functions and std::invocable
I was experimenting with C++20 concepts and the Eigen library, and I incurred an unexpected behavior. Specifically, consider the following concept requiring a type to be callable with either an Eigen::...
4
votes
1
answer
80
views
C++20 Concept test not working in MSVS 16.5
I'm new to C++20 concept, but from examples I've seen, this code should work...
#include <iostream>
#include <string>
#include <concepts>
#include <memory>
using namespace std;...
4
votes
1
answer
2k
views
MvvmCross: ViewModel inside of another ViewModel scenario
I've got the following question: what's the expected scenario for the logic when I would want to bind some elements inside of ViewModel separatly. What I mean...
http://slodge.blogspot.co.uk/2013/04/...