Questions tagged [attributes]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
2 answers
261 views

Why access the attributes of a Python class by reference?

Attribute references and instantiation In this link, that is part of the official Python documentation, I have found the following information: Class objects support two kinds of operations: ...
User051209's user avatar
3 votes
3 answers
225 views

Referencing transient class attributes

I've just started dipping my feet into OOP. Is it considered bad practice to have classes that reference attributes that depend on another function being called and thus may not exist (version 1)? I'...
Tim Kirkwood's user avatar
3 votes
2 answers
297 views

Accessing properties from embedded objects as attributes of container class

In Python, I have a class C which embeds objects from classes A and B. Is it considered good practice to creates shortcuts from the properties of embedded objects of classes A and B as attributes of ...
Daniel Arteaga's user avatar
0 votes
1 answer
2k views

Mastering the usage of [PublicAPI] attributes?

Take the following class, without [PublicAPI] attribute, ReSharper says that all public members can be made private. using System; using JetBrains.Annotations; namespace ObjMtl { // [PublicAPI] ...
aybe's user avatar
  • 727
-1 votes
2 answers
123 views

How to change a data model

In my model a user entity has three attributes : ID, name, hasBoyfriend. I want now to change hasBoyfriend to boyFriendsNames which is an array of names . The user entity is used by many services. The ...
Cap Barracudas's user avatar
-2 votes
4 answers
353 views

Is judicious & plausible selection of class fields a valid refactoring step?

I'm a great fan of refactoring but I've been wondering about the issues raised by refactoring. Fowler advises refactoring to make code readable to all users to make the code structure more sensible, ...
Trunk's user avatar
  • 135
-1 votes
2 answers
80 views

How to set object parameters

I am rewriting a lexer class that has several "parameters" like whitespaceSplit. So it goes this way: lexer = new Lexer(); lexer.whitespaceSplit = true; lexer.otherParameter = ...; lexer.parse(file);...
porton's user avatar
  • 752
0 votes
0 answers
49 views

Which components of an HTML Element, can I assume will be static over the course of its lifetime?

This is a question for people who are familiar with how HTML typically is built and behaves on webpages. Backstory and requirements I am building an HTML tracker with a C++/Qt backend. I am trying ...
Anon's user avatar
  • 3,593
1 vote
2 answers
317 views

API - editing subset of attributes

Given a resource for which only its subsets of attributes can be edited, {E.g. invoice (resource) with a status (attribute) and paidAmount (attribute)}, in terms of API design, which amongst the ...
Opal's user avatar
  • 275
4 votes
3 answers
24k views

Dynamically add/change attributes of values in C#

I want to tag the values of variables with a "quality" attribute that can be changed dynamically during my programs execution. My first thought was to abuse the standard attribute functionality by ...
Peter M's user avatar
  • 2,029
2 votes
2 answers
100 views

Creating an Instance of a Complicated Class

How do I create instances of classes which require a huge amount of components and attributes? Take for example a car. A car has hundreds of sub components each with their own specific properties. ...
supertommy's user avatar
0 votes
1 answer
86 views

Auto-generated Api help pages test dialog using parameter options from a data service

I am a student worker currently close to the finish line of a project I have been working on. Right now I'm implementing the .net Auto generated Api help pages. The nuget package WebApiTestClient does ...
Tenderdude's user avatar
5 votes
2 answers
15k views

How multi-valued and derived attributes are denoted in crow foot's notation of ERD?

In Chen notation multi-valued attributes are denoted by double eclipse(oval) and derived attributes are denoted by dotted eclipse(oval), but how they are denoted in crow foot notation? Also how ...
user avatar
4 votes
3 answers
7k views

What to do with database foreign keys in an entity class?

I know that an attribute defines the state of an object. So, is it correct to keep attributes that don't define the state of an object of a class? For example, I have an Employee class, which has ...
Rajeev's user avatar
  • 535
5 votes
1 answer
9k views

How can attributes/annotations be illustrated on a UML class diagram?

Many programming languages offer a way to annotate types. For instance, in .NET this can be achieved by deriving a custom attribute class from System.Attribute and then annotating another type with ...
Lea Hayes's user avatar
  • 1,033
0 votes
1 answer
67 views

Accessing struct attribute: casting vs field name

I was just going over some kernel code, I noticed that rb->__rb_parent_color = (unsigned long)p | color; is kinda wired. The first field of a struct is accessed by casting the pointer and not by ...
Ramzi Kahil's user avatar
  • 1,089
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-* ...
Ky -'s user avatar
  • 525
11 votes
1 answer
47k views

The advantage of using __attribute__((aligned( )))

I found in more than one SIMD program the instruction __attribute__((aligned(16))) . When I looked for an explanation I found The keyword attribute allows you to specify special attributes of ...
S.E.K.'s user avatar
  • 145
1 vote
1 answer
95 views

Custom Domain or Attribute Reference Table or Both?

I'm designing my first real database and I'm weighing the pros and cons of how to enforce uniformity in my data. My first option is to create a custom domain and program my UI to only allow certain ...
Jonathon Anderson's user avatar
0 votes
3 answers
152 views

If an object should be flagged, should it be built with the flag attribute?

Let us assume I have a basic object with a handful of self-relevant points of data. class A(object): def __init__(self, x, y, width, length): self.x = x self.y = x self....
user avatar
3 votes
2 answers
137 views

Should I put the datatype of a class attribute in its name?

Most of my system's class attributes are just text, but in this case it makes more sense to place this particular class's attributes into one single hash (from a "keep the source code pretty" aspect). ...
yurisich's user avatar
  • 1,391
19 votes
6 answers
3k views

A programming language that allows you to define new limits for simple types

Many languages like C++, C#, and Java allow you to create objects that represent simple types like integer or float. Using a class interface you can override operators and perform logic like checking ...
Reactgular's user avatar
  • 13.1k
3 votes
3 answers
2k views

C# Coding Standard - Position of Attribute in relation to Target

I had thought that this was one of the few solved problems in C# coding standards / style; Attributes always appear on the line above the thing to which they are applied a la [SomeClassAttribute] ...
satnhak's user avatar
  • 149
3 votes
1 answer
429 views

Should I use multivalued attributes in conceptual modelling?

My team and I have designed a simple, affordable conceptual modelling language as part or a larger research project. This language is aimed to end users with little or no training in information ...
CesarGon's user avatar
  • 2,981