Questions tagged [attributes]

23 questions
19
votes
6 answers

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 if a value exceeds a business rule of 100. I'm…
Reactgular
  • 13,040
  • 4
  • 48
  • 81
11
votes
1 answer

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 variables or structure fields. Apparently variables…
S.E.K.
  • 145
  • 1
  • 1
  • 8
5
votes
2 answers

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 associative entities are denoted in crow foot?
Saif Ullah
5
votes
1 answer

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 this: [AttributeUsage(AttributeTargets.Class,…
Lea Hayes
  • 1,033
  • 1
  • 10
  • 17
4
votes
3 answers

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 tagging the value with my custom quality attribute. …
Peter M
  • 2,029
  • 2
  • 17
  • 22
4
votes
3 answers

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 these…
Rajeev
  • 525
  • 1
  • 5
  • 9
3
votes
3 answers

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] class SomeClass { [SomeFieldAttribute] bool…
satnhak
  • 149
  • 6
3
votes
3 answers

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'm self-taught so trying to gauge what is…
3
votes
2 answers

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 container class C? The goal is to create a simpler…
3
votes
1 answer

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 technologies. It allows them to create class models…
CesarGon
  • 2,981
  • 1
  • 22
  • 26
3
votes
2 answers

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). Basically, a list of attributes is returned, and…
yurisich
  • 1,391
  • 1
  • 11
  • 16
2
votes
2 answers

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. There would be thousands of parameters to pass or…
supertommy
  • 129
  • 2
1
vote
2 answers

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 following is the better approach: PUT…
Opal
  • 275
  • 1
  • 2
  • 9
1
vote
3 answers

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-* attribute? This would be more for me than anything…
Ky -
  • 525
  • 5
  • 17
1
vote
1 answer

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 options. My second option is to create an…
1
2