Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [properties]

A property, in some object-oriented programming languages, is a special sort of class member, intermediate between a field (or data member) and a method. Properties are read and written like fields, but property reads and writes are (usually) translated to get and set method calls.

0
votes
1answer
30 views

Factory to instantiate and configure Selenium WebDriver

I, also, need to know whether this is a valid implementation of the factory pattern. The amount of effort which goes into configuring DriverFactory to simply get a ...
3
votes
1answer
55 views

Read a single int from an optional .properties file

I am no newcomer to Java. One thing that confounds me is why it is so messy to load values from .properties files. I have an application where, if the .properties file is found, then the value if ...
-2
votes
1answer
97 views

Method to populate a dictionary from properties

I have a class with some properties. In the class I have a method that is "collecting" all the properties in a specific instance of the class to a dictionary, with the properties name being the ...
3
votes
2answers
93 views

Javascript extend object

I'm looking for a review of the Javascript code which has this specifications: Given two objects, the function "extend" adds properties from the 2nd object to the 1st object. Notes: Add any keys ...
2
votes
0answers
200 views

Setting many properties in a PHP class

I'm trying to define parameters for my API. It's a super basic one and the first I've made. I'm trying to instantiate my class and set parameters but to me it seems super messy. Is this really the ...
1
vote
2answers
96 views

Class for course information

Here's what the question asks: Build a class called Course.java. This class should have 4 properties: CourseId, CourseName, Description, and credit hours. Also add the appropriate set and get ...
3
votes
1answer
169 views

Attempting to make my properties an enum based singleton

I was attempting to implement my first singleton using an enum, was a bit of a struggle for me and I'm not sure if its right and more importantly thread safe? Property provider enum: ...
1
vote
1answer
54 views

Class Property Definition to Prevent Unnecessary Database Calls

The challenge I'm facing is creating a class for a Loan object which contains a number of properties, some of which are classes in and of themselves with similar ...
-1
votes
1answer
179 views

Dependent properties in C#

BountyHunter has a secure line named JobLine that provides them with Prey to hunt. The Prey can be changed at any time, either from the JobLine or changing circumstances that make the bounty hunter ...
4
votes
2answers
1k views

If non-array property exists convert it to one and push new value

Is there a simpler/shorter/better way to do this? ...
3
votes
2answers
1k views

Using attributes with properties in asp.net MVC

I have an auto generated partial class in my Model folder with lots of properties and I need to modify some of the setters in these properties(annotate property), to ensure that I don't repeat myself ...
2
votes
2answers
3k views

Enum with associated value as stored property in Swift extension

I have a service which connects to server using socket and stays connected, I used this enum to manage connection state: ...
4
votes
2answers
164 views

Lazily forward properties

I want to have a object where I can reference another object's properties dynamically while they are still considered properties. If I try to do a simple setattr I'll only get the current state when I ...
4
votes
1answer
66 views

Excel VBA object with validated bounds for an interval

I'm working through a problem I have with Excel VBA. I have two object classes. Class clsLoadStep stores three copies of class clsLoad objects. Class clsLoad simply stores a value and a string stating ...
1
vote
1answer
49 views

One method for changing one of the properties

I have a few resources set in my class – coins, diamonds, hearts, enum of these resources names, and method for increasing specified resource. I want to make single "Increase" method for all resources ...
4
votes
1answer
602 views

Jinja2 template loader

I am playing around with building my own back end with python 2.7 and jinja2/cgi. Originally I was defining some of my environment and loader variables at the top but figured this was not the best ...
3
votes
1answer
1k views

Testing multiple logins using Selenium listed in a property file

Excuse please review my code. I am working in automation testing. I did a automation testing for my login page. I am using selenium with page object pattern. I wrote here my code. I am using java ...
3
votes
1answer
90 views

Loading configuration properties from XML

I would like a review of the transformation of the first method to the updated one below: ...
5
votes
1answer
4k views

Python proper abstract class and subclassing with attributes and methods

The goal of the code below is to have an abstract base class that defines simple methods and attributes for the subclasses. This is part of an application that provides the code base for others to ...
1
vote
1answer
60 views

Class to help dealing with files, with lazy properties

I have the following class to help me deal with files: File class: ...
2
votes
2answers
778 views

Property value from an asynchronous operation

I have an app which has a session mechanism. When a user creates an account in the app initially, the API returns an access token, the expiry date of that access token and a refresh token which can be ...
0
votes
2answers
159 views

Assigning properties

I am leaving my first job because I always worked alone on projects from my day one, which was both useful but also taught me some bad practices some of which I managed to realize but many others are ...
4
votes
3answers
2k views

Reading properties from file during standalone application startup

I've a standalone Java application, which basically starts and manages two socket servers. I'd like to configure server ports in a .properties file using the ...
4
votes
3answers
181 views

Reading and working with a large number of XML attributes

I'm currently facing the problem of unmarshalling a huge number (47) of attributes to a Java object. Changing the format of the XML file to be more structured is sadly not an option. The following ...
4
votes
1answer
285 views

IQueryable Extensions working on expression for collection property

Followup to Repository searching code duplication My goal currently is to make my current implementation of my repository's IQueryable filtering less duplicative. First, I looked into passing ...
4
votes
1answer
250 views

Getting enum values of Pseudo-Enum classes

By "Pseudo-Enum" classes I mean cases where someone's used a class with public static properties to emulate enum behaviour; e.g. as described here. Per the example below, this is useful for classes ...
4
votes
1answer
186 views

ViewModel base class supporting property notification, error notification and property value history

I've created a general purpose ViewModel base class in what I believe it's purest behaviour. It features property notification, error notification and property value history. Please take a look at it ...
1
vote
3answers
91 views

Instantiating a property when the required attributes have been set

I have a simple class which holds my product. Someone can add a serial to this product and also a purchase id. On change of the properties, I want to check whether both properties are set, and get the ...
3
votes
1answer
1k views

Setting various types of properties on a JCR node

This code checks value's type and cast it into appropriate type, then puts it into a javax.jcr.Node. The checking looks long and boring. Is there a way to refactor ...
4
votes
4answers
2k views

Property caching

Trying to figure out how to efficiently cache property calculations with dependency tracking to invalidate the cache. Here is the syntax I have at the moment (one ...
10
votes
5answers
914 views

Setting user permissions, where certain permissions imply other permissions

The purpose of the class is to set permissions for a user. These include delete, download, upload, view, etc. These properties often depend on other properties, and setting them has side effects. For ...
1
vote
2answers
81 views

Two classes to validate and store an e-mail address

I'm trying to improve my limited knowledge in PHP (7) and I wrote these two simple classes as a proof of concept. They both have just one (private) property ->email and they run validation before ...
0
votes
4answers
93 views

iOS SDK object to represent a place

I am building an iOS SDK to be consumed by apps. I am building an object that represents a physical place. The interface looks like so: ...
1
vote
2answers
137 views

Class to read the property files

I wrote the following code to read the config/property files. I will be exposing my api as jar to multiple application teams. Functionality: Reads the property files and returns the resource bundle ...
5
votes
1answer
164 views

Simulate a person who is working in a quarry with classes

I build my first "bigger" program with classes. Does this look good? Or do you see something, which I could do better? Do you think I could use a delegate for changing the stones to money here? And ...
0
votes
1answer
602 views

Copying properties between two classes

I have an ASP.NET MVC 5 app and I map properties between model and viewmodel and vice versa. I could use automapper to do this but since I don't need mapping rules to convince me to use it as I ...
3
votes
4answers
4k views

Checking the validation of a field through the Property mutator method `set`

I'm newish to C#, being mainly Java oriented. I have a field _config which needs to be a value from 1 to 8, and I have this code which checks to make sure I can ...
6
votes
2answers
172 views

A possibly-terrible alternative to conditionals full of null checks

I am always super annoyed when I have to write a bunch of if statements whenever I have to traverse an object graph of possibly null objects. As there is not yet a <...
4
votes
2answers
199 views

Property file loader

I have the following code: ...
4
votes
1answer
559 views

Properties File MRU Cache

I made an attempt to implement a Properties File MRU Cache with a limited cache size which are of the most recently used properties can only be held in. A read miss from this cache leads to a read ...
5
votes
1answer
145 views

Writing a class to hold Arduino Properties for an Arduino I2C Debugger

I have this class which mostly holds a bunch of properties and their setters. I also have wrappers for some functions of another module. Here is the class: ...
6
votes
3answers
527 views

C#-like properties

I'm studying metaprogramming I figured out a way to implement C#-like properties in C++. This is proxy object that performs a specified function when you try to receiving or assigning values. ...
1
vote
2answers
139 views

Lazy properties for the angle and length of a line segment

The code below shows the pattern I use to manage properties in my classes when I have the following requirements: Some properties are slow to calculate and are rarely used, so I want them to be lazy ...
2
votes
0answers
626 views

Making a default value a property

I recently asked a question on StackOverflow, looking for a way to more easily turn a class attribute into a @property, but only if no other value has been provided ...
4
votes
1answer
893 views

Enums for measurement units, with possible circular dependency

I have some enums that define measurement information, such as volume, mass, distance etc... They are defined as such: ...
1
vote
2answers
359 views

EF Code First Identity/Info Storage

I've built this EF for storing data for web scraping. Any ideas? What am I missing? ...
5
votes
2answers
299 views

Applying TrimSideSpaces() method to multiple string properties

I am looking for generic ideas and guidelines of how to improve the style of my coding and make it more readable and robust. ...
0
votes
1answer
288 views

Binding controls to properties in ASP.Net WebForms

In my application, we have a number of pages which provide an advanced search capability, with a large number of potential search options (some pages have as few as 3, some as many as 150). The HTML ...
3
votes
1answer
145 views

Correct practice for Python properties that depend on other attributes

When a property is essentially a boolean value for whether or not an attribute exists or is set a certain way, is it more appropriate to create an object that does not list the option attribute in its ...
4
votes
1answer
163 views

Downloading and Loading Remote Game Assets

On advice from an answer to my previous question, I have written some code that will allow my game balance properties to be loaded from a remote server. Right now I am just hosting the raw property ...