Questions tagged [semantics]
The semantics tag has no usage guidance.
76
questions
7
votes
1
answer
181
views
What is the term used to describe the number of times a pointer can be dereferenced?
For example, which term completes the sentence "p has 5 ____" in order to describe a situation like int *****p?
102
votes
9
answers
20k
views
Is putting general-use functions in a "helpers" file an anti-pattern or code smell?
Is it an anti-pattern or code smell to put "general use" functions (examples below) into a catch-all file named "helpers" or "utils"?
It's a pattern I've seen quite a lot ...
0
votes
1
answer
182
views
How can I tell if a library's execution model is the same as or different from the execution model of its base language?
https://en.wikipedia.org/wiki/Execution_model says
A programming language consists of a grammar/syntax plus an execution
model. The execution model specifies the behavior of elements of the
language. ...
-3
votes
4
answers
130
views
What's should I call a Location (Longitude and Latitude) associated with a DateTimeOffset? [closed]
In the Xamarin.Essentials library there is a Location class that comes with a DateTimeOffset TimeStamp.
I know I'm being pedantic and I should just move on - I know it's to indicate a location of the ...
1
vote
1
answer
137
views
Where's the interpolation in "string interpolation"?
In most contexts, the concept of "interpolation" seems to be related to estimating unknown states from known ones, like video frames or data points.
From the Wikipedia entry on interpolation:...
3
votes
1
answer
106
views
A size-type vs index-type conundrum
Suppose I'm writing C or C++ code which deals with... ok, let's make it citizens in a state. In this state, citizens have numeric id's (not strings - numbers); and for reasons of performance, or ...
3
votes
4
answers
607
views
What log level use for deprecated features?
There is a feature that is now deprecated and going to be removed. Adding a logging statement, observed by some alerting mechanism, can help finding out whether the feature is still being actively ...
1
vote
1
answer
77
views
Lexicon for syntax patterns? [closed]
I am having trouble finding a lexicon which provides terminology for the explicit patterns that are employed when parsing syntax. I am trying to write about the niggling differences between the 10+ ...
4
votes
1
answer
3k
views
Semantics of simulating a 64bit integer with two 32bit integers (hi, lo)
I am working in a system which only supports 32bit integers, in order to have a 64bit (unsigned) integer I decided to simply use two 32bit integers with one being the upper 32 bits (hi), and the other ...
4
votes
2
answers
1k
views
How to categorize configuration changes in semantic commit messages
I am trying to switch to semantic commit messages for project. While the idea is good, sometimes I find it is difficult to properly categorize changes like a configuration value change.
If I commit a ...
3
votes
2
answers
153
views
Why create CSS classes named to match one specific style? (non-semantic class names)
There are a number of CSS frameworks that have a one-to-one correspondence between many of the classes and a single style. For example, in basscss ".inline-block" is defined as "display: inline-block;...
2
votes
3
answers
577
views
Is a literal out of range a syntax error or a semantic error?
I am reading more about the differences between syntax and semantics, but I am still wondering about this one.
Let's assume that we have a language that only allows integers to be in the range of 0-...
2
votes
1
answer
216
views
What is the difference between a migration pattern and a refactoring?
I have recently come across the terms migration pattern and refactoring on the topic of migrating monoliths to microservices. Is there any real difference between the two terms, or can they be used ...
2
votes
3
answers
329
views
filesystem::path vs. optional<filesystem::path> as argument to function
Sometime ago in a code-review (C++) I suggested to change the input argument from Path type to Optional<Path>, where the function has specific logic for unset path. It looks for me intuitively ...
8
votes
5
answers
3k
views
Where do I store user-defined business rules?
Let's say I have an application that works around departments and employees. Each department has a set of rules that defines which employee is assigned to each department. For instance the system will ...
7
votes
2
answers
954
views
Domain Model Representation - Formal ontology vs code
Disclaimer: I have limited experience building domain models, this is purely asked out of interest to those who do
I have recently stumbled upon the concept of representing data models with ...
1
vote
2
answers
345
views
Declaring a function without named parameters that accepts at least 1 argument
Say I have a function whose first parameter is used differently depending on how many arguments are passed. In this case, it is easier to just process the arguments object as a whole within the ...
2
votes
1
answer
2k
views
Should objects be singular since arrays are plural?
Might be a silly question, but what is more logical:
object.actions.bark() or object.action.bark()?
Simply about plurality. I know arrays are usually pluralized. But if I were to be consistent; ...
-1
votes
1
answer
124
views
Semantic action in parser combinators
I have a parser that can be defined as
int = a:/[0-9]+/ {parseInt(a)}.
It is supposed to match an int and convert it into a number. There can also be a parser like
sum = a:int b:int {a+b}
As ...
4
votes
2
answers
107
views
Is there any good/fundamental reason that Python classvars, and JavaScript prototype inheritance, don't mutate the parent on assignment?
In Python, if you have a classvar, it's accessible from an instance, but if you set the variable on the instance it doesn't actually change the classvar, rather it assigns a new name which shadows the ...
2
votes
2
answers
1k
views
Are there good reasons for avoiding the use of semantic HTML markup?
Background
I have recently taken up a new job as a developer at a company where I have inherited an in-house CMS built approximately 5 years ago. The CMS constructs pages in XML which are then output ...
2
votes
1
answer
58
views
Help settle an argument: article element usage question
A team member and I are having a disagreement on the usage of the <article> tag. By the definition in MDN, to me, it sounds like it should be used when presenting the user with content of some ...
0
votes
1
answer
52
views
How Do DB Version Control Systems Lack in Script Semantics When Modeled on Source/Target Difference Comparisons
There are several database version control solutions out there to assist with controlling not only the versioning of a database, but also deploying and synchronizing databases. These systems are ...
1
vote
3
answers
185
views
In an ESB type system, what field name should be used as a "correlation ID"?
We're using ASP.NET Web API and Azure Service Bus and adding logging to our disparate services and systems. We need to track a correlation ID to the headers of each set of bus messages as well as logs ...
9
votes
5
answers
2k
views
Is it correct to say that a variable is an instance of a data type?
(that can change its value over the course of the program)
Or is 'instance of something' strictly related to classes and objects? If so, how would you define the concept of 'variable' when it comes ...
4
votes
2
answers
1k
views
Why doesn't C have first class arrays? [duplicate]
I've got a question about the semantics of C and was wondering why the powers that be decided to make arrays different from every other type in the language.
I understand that arrays and pointers are ...
5
votes
1
answer
537
views
When designing a directory structure should filenames include folder names?
Suppose I have two directories: house-1 and house-2. Each house directory needs to have files describing its windows and doors.
I am trying to understand how to name the files and directories. My ...
6
votes
2
answers
12k
views
REST API - omitted properties in POST request: How should they be handled?
Given the following scenario:
Teacher entity
{
"id": "1234",
"name": "Mr. Didactic",
"Subject": "History",
"Classroom": "1A"
}
REST API endpoint:
/teacher/id/1234
Let's say I submit a ...
5
votes
2
answers
744
views
Why are semantics and type systems are so important?
I heard that semantics and type systems are very important for all programmers! But I why are they so important? I don't understand. Maybe they are imortant only for theoreticians and compiler ...
7
votes
2
answers
2k
views
Why does Scala name monadic composition as "for comprehension"?
Not sure if it's an appropriate question, but here it goes.
I know Haskell's do notation pretty well. And I realized that Scala's "for comprehension" really is just mostly the same as do notation in ...
1
vote
4
answers
293
views
When is an object passed to a function?
Trying to clearly state the semantics of a function call.
In calling a function, are the arguments passed to the function the ones the calling code initially gives or the ones the function receives?...
3
votes
1
answer
592
views
Semantic web and web UI impedance matching
While developing a web-application (= application with web UI) using semantic web resources / technology like RDF, OWL, SPARQL, there is constantly a feeling that at the same time semantic offers much ...
0
votes
2
answers
539
views
Is it appropriate to use the unordered list (ul) element for composite content
I recently had a thought of utilizing the unordered list element to represent a list of composite content (such as a product list with details or an image list with captions).
For example:
<ul&...
3
votes
2
answers
2k
views
Semantics of heading levels in multiple sections in HTML5
I'm never quite sure what is the best, most semantic way to handle heading levels in HTML5 markup, when you have multiple sections. On one hand it makes sense to have an H1 heading as a title of a ...
1
vote
3
answers
115
views
Should I mark what blocks mean in data-* attributes?
I was writing a webpage today with a comment after the start of every major section. Instead of using a comment, which comes with the bulgy <!-- --> syntax, could I instead put this in a data-* ...
7
votes
2
answers
728
views
How can I make sense of the word "Functor" from a semantic standpoint? [closed]
When facing new programming jargon words, I first try to reason about them from an semantic and etymological standpoint when possible (that is, when they aren't obscure acronyms). For instance, you ...
54
votes
9
answers
5k
views
Is immutability very worthwhile when there is no concurrency?
It seems that thread-safety is always/often mentioned as the main benefit of using immutable types and especially collections.
I have a situation where I would like to make sure that a method will ...
72
votes
6
answers
74k
views
What is a helper? Is it a design pattern? Is it an algorithm?
Maybe a little tongue-in-cheek, but as I can't find this answer anywhere through Google, so to ensure Software Engineering has the answer:
What is a helper?
I have seen the name being used ...
0
votes
2
answers
222
views
How could an expert system get some meaning from a sentence? [closed]
How could an expert system tell following scenarios apart? How could we include some meaning of a sentence, if at all?
A machine needs 1 day to produce x units, and,
we know that two machines like ...
1
vote
3
answers
144
views
Do we tell the object to do something or do we do something (on/with/to/etc.) the object?
Take the (unprecedented and groundbreaking) example of the calculator:
public class Calculator
{
public double Add(double augend, double addend)
{
return augend + addend;
}
}
...
1
vote
2
answers
3k
views
How is 'bolt-on' the same or different from add-on, extension, or module? [closed]
I hear the term 'bolt-on' used in many contexts, specifically in my organization where PeopleSoft is used extensively. I don't know exactly how it differs from an 'extension' of an existing product, ...
1
vote
3
answers
4k
views
Why do expressions print variable value using System.out.print?
Why does java print the value of the variable that is assigned it in the code below? I want understand what is happening here.
My thought is that the expression inside println() method is evaluated ...
0
votes
2
answers
97
views
Placing arguments on their own lines [closed]
This question applies to both parameters and arguments, since I've seen this style used in both.
I usually write parameters like this
someFunction(arg0, arg1, arg2)
but I've recently noticed that ...
4
votes
1
answer
308
views
What HTTP verb is appropriate for an api route that restarts an application the server?
I got asked to do a code review of a very simple one-route web service that when hit would simply restart an application on the system. The developer had coded this up as a POST which strikes me as ...
2
votes
1
answer
621
views
Does changing the name of a namespace count as a MAJOR change in semantic versioning?
I'm writing a C++ library, and
according to this site here: http://semver.org/,
I should increment the MAJOR version when I make incompatible API changes.
Is changing the name of a namespace ...
18
votes
4
answers
7k
views
Is there a difference between iterable and enumerable?
Many languages seem to have structures that are very similar called iterable or enumerable. These are structures that can be iterated or enumerated over, which seem to me extremely similar things. ...
3
votes
3
answers
669
views
Cogent arguments for 'semantic css' over 'object oriented css'
[Context - I'm a Java developer, having a discussion with a designer who works in the html/css space]
I was having a discussion with a co-worker today about the merits of 'semantic css'.
His ...
0
votes
1
answer
2k
views
How to format this line according to PEP 8? [closed]
I'm trying to adhere to PEP 8, with a 78 character limit on the length of my lines.
I have the following statement:
startTime = time.strptime(request.GET.get('st', (dt.datetime.now() - dt.timedelta(...
23
votes
3
answers
4k
views
Which are the alternatives to using a stack to represent function call semantics?
We all know and love that function calls are usually implemented using the stack; there are frames, return addresses, parameters, the whole lot.
However, the stack is an implementation detail: ...
5
votes
2
answers
680
views
Difference between sending a message and emitting it
Halfway through the RabbitMQ tutorial, I noticed that the tutorial stops referring to producers "sending" messages and starts using the verb "emit" instead — and pretty consistently, too; after the ...