Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.

learn more… | top users | synonyms (3)

2
votes
2answers
6 views

Copy, Paste and Format 2.0

This is a follow up with revised code, see the original question and subsequent answer in the following link (Copy, Paste And Format) This is a full version of all three "Macros" or subs within the ...
1
vote
1answer
12 views

Overloaded applyRestrictionsToCriteria(…) methods

We want to refactor two methods that are exactly the same, except for one difference: one takes an org.hibernate.Criteria and the other ...
-1
votes
0answers
16 views

PHP get a view object for a polymorphic model

I need to render polymorphic models in different situations. Model's base class: ...
7
votes
1answer
42 views

Class: 2D Variant Array

Note: Yes. It's big. I'm not expecting commensurately long/detailed answers (though if anyone wants to write one, you'll definitely be receiving a substantial bounty). This class is going to be ...
1
vote
3answers
53 views

Python static / instance method or function?

background: I have a model called FileInfo, which represents a sftp file / windows dfs file. ...
0
votes
2answers
35 views

Getting and posting data use PHP OOP and mysqli

I am not very experienced in php oop. Moreover, when mysqli comes with php oop, it make me more confused about using it in best efficient way. Anyway, first look at my connection class: ...
3
votes
3answers
85 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 ...
3
votes
1answer
31 views

Python 3 class constructor

I have implemented a metaclass in Python 3 that, apart from the usual instance constructor (i.e. __init__), enables you to define a class constructor (as a class ...
-2
votes
0answers
18 views

CRUD Operation Using OOP PHP and PDO [on hold]

I am new to PHP and trying to learn OOP PHP. I am creating a registration form (a simple one) to learn OOP PHP, when I submit data the success message shows up but data is not inserted in data base. ...
2
votes
1answer
39 views

Raindrops in Java

Problem Statement: Write a program that converts a number to a string, the contents of which depends on the number's prime factors. If the number contains 3 as a prime factor, output ...
2
votes
0answers
64 views

Dictionary as context manager

I've created a class that implements customized addition, subtraction, etc. But for this class I'd like to have some additional parameters for these methods (...
0
votes
0answers
16 views

PHP dice game with classes [on hold]

I'm trying to develop the 'roll the dice' with classes in PHP and with two dice and several players, do you know how the structure could be better? I've started with this simple code: ...
6
votes
2answers
220 views

Rock-Paper-Scissors game with OOP concepts

This is code for a Rock-Paper-Scissors game I made using some of the OOP concepts I learned in C#. I don't know if I am making the right choices but I am fairly confident. It would be great if I could ...
0
votes
0answers
17 views

Modeling of customers and suppliers as business relations [on hold]

I'm getting started with Object Oriented modeling, so I thought this was a good question for Code Review. Let us consider that we are building a system which will be used by a company that has both ...
-4
votes
0answers
35 views

Understanding about clean code [on hold]

I am struggling to write a clean code. I read lot of articles about clean code. I have written a small project to demonstrate my understanding. Can Someone review my code. advice to improve the ...
3
votes
3answers
46 views

Binary string to decimal conversion

Problem Statement: Write a program that will convert a binary number, represented as a string (e.g. '101010'), to its decimal equivalent using first principles Implement binary to decimal ...
1
vote
0answers
20 views

An [InternalCopyArray] by any other name

So I'm building a 2D Array class. I want to have CopyArray and RemoveIndexes functions. However, in both cases, the method ...
7
votes
2answers
116 views

Pokemon game in JavaScript

I'm practicing my JavaScript skills by trying to create a Pokemon game. So far, I've made the dataset and the functions required to work the game. Can someone help me optimize the code and tell me why ...
5
votes
1answer
68 views

Let's revisit Roman numbers

Problem Statement: Write a function to convert from normal numbers to Roman Numerals: e.g. 1 => I 10 => X 7 => VII Code: ...
2
votes
2answers
76 views

Let's play Scrabble

Problem: Write a program that, given a word, computes the scrabble score for that word. Code: ...
1
vote
1answer
39 views

Python file reader/writer, with processing pipeline and context manager

The following code does three things: The filename is determined by the RawData class The reader and writer send data through a processing pipeline (Hopefully) makes changes and extensions easy ...
-2
votes
0answers
19 views

Private functions in Object-Oriented JavaScript [closed]

When I'm trying to do object-oriented pure JS with private methods, I frequently do the following ...
1
vote
1answer
33 views

Private method to validate Excel header

I am new to unit testing and I am unsure how to design classes that use third party libraries, so that I can easily test them. The example I'll use is with EPPlus-...
10
votes
0answers
42 views

Dynamic Colour Binning: Grouping Similar Colours in Images

This is a piece of code that implements an image-processing algorithm I came up with. I call it Dynamic Colour Binning. It's a fairly academic exercise that was more about providing a learning ...
3
votes
1answer
32 views

PDO update method

I am in my first object-oriented project and wrote this method for updating the database. The PDO include is just for convenience, so I could work on a single file temporarily. I'm not entirely clear ...
-4
votes
0answers
34 views

hackerrank challenge:sherlock-and-the-beast [closed]

Code is working and giving correct solution but not passing all test cases. Thanks! https://www.hackerrank.com/challenges/sherlock-and-the-beast Explanation For N=0, there is no decent number having ...
-6
votes
0answers
34 views

minion game from HackerRank [closed]

https://www.hackerrank.com/challenges/the-minion-game code is giving answers as per the following link. however test cases on hackerrank are failing... Thanks!! a link on this site related to the ...
2
votes
0answers
25 views

jQuery form change listener, modularized using ES6

I have the following javascript code that I'm trying to modularize using ES6: ...
-1
votes
2answers
306 views

How to use PHP Visibility method?

At my new job, with new young developers, we are seriously discussing improving code structure and performance. (They keep more than 80 lines of code in a method). However I've read more tutorials, ...
5
votes
1answer
71 views

Write a program that, given an age in seconds, calculates how old someone is in terms of a given planet's solar years

Problem: Write a program that, given an age in seconds, calculates how old someone is in terms of a given planet's solar years. Earth: orbital period 365.25 Earth days, or 31557600 ...
1
vote
0answers
49 views

A Search Engine Class

I've built a Search Engine class for a website that permits to search companies in base of their locations and their categories (companies pay a plan to be found in the places that they will). In the ...
2
votes
1answer
31 views

Form validation in core php with oops concept

Here, i build one form validation script in php using understanding SOLID concept. My question is the way i coded my code is true way for ...
4
votes
1answer
53 views

Tic Tac Toe using WinForms

I have made a simple tic tac toe game and need help tweaking it to fit the bill of object oriented design. Any suggestions most welcome. I basically want it safer, and more "best practice-like" It is ...
5
votes
2answers
1k views

Wrapper for commonly used database classes

The main idea behind this class is to create a wrapper for commonly used Database classes. I'm new to SOLID principles and I'm trying to implement them in this library. Does this code adhere to SOLID ...
0
votes
0answers
12 views

Validating string lengths of link attributes

Here is a working typescript code: A modelValidator class that validates form user input. In this basic example it must check for length of form data submitted by user, and if one of the form field ...
3
votes
1answer
63 views

Write a small archiving program that stores students' names along with the grade that they are in

Problem: Write a small archiving program that stores students' names along with the grade that they are in. In the end, you should be able to: Add a student's name to the roster for ...
4
votes
2answers
83 views

Let me fix thou number

Problem Statement: Write a program that cleans up user-entered phone numbers so that they can be sent SMS messages. The rules are as follows: If the phone number is less than 10 ...
9
votes
1answer
106 views

Game Tutorial in Java

I’ve been working on a Rampart inspired multiplayer game for a few weeks now, and it is finally in a playable state. The big thing left to do before going alpha was to add a tutorial to the game. I ...
4
votes
1answer
43 views

Transparent wrapper class for data structure in Python

I needed a deque who's maxlen can be set again after it has been initialized. So, since new-style classes in Python are treated ...
1
vote
1answer
40 views

Concat strings from Object or Array

How would you merge these two functions into a single more generic function? ...
5
votes
1answer
52 views

Let's have a meetup

Problem statement: Calculate the date of meetups. Typically meetups happen on the same day of the week. Examples are the first Monday the third Tuesday the Wednesteenth the ...
1
vote
0answers
86 views

Class Level Properties in Objective-C and Swift Classes

I was recently tasked with architecting a user/profile object in Objective-C and wanted the ability to access a static instance from the class level, similar in style to the way Parse manages their ...
4
votes
3answers
107 views

Composing and executing a customer search

I was wondering if someone could help me refactor this code. Although I know this looks bad, it works. Now I would like to refactor it so I would respect the open/closed principle in SOLID. Let's say ...
4
votes
1answer
65 views

JavaScript calendar widget

I'd like to know how I can refactor my JS code for usability. Currently my JavaScript uses some HTML to build out a simple calendar with the following functionality: a. opens into the current month ...
3
votes
1answer
39 views

Composite implementation of a prototype singleton registry

I am studying design patterns and I've implemented a composite prototype pattern which is also a singleton (one instance per JVM). The main and most important part of the code is the ...
15
votes
5answers
1k views

Generating Robot Name

Problem: Write a program that manages robot factory settings. When robots come off the factory floor, they have no name. The first time you boot them up, a random name is generated, such ...
1
vote
0answers
28 views

Algorithm and PHP Class to Compare companies' information and define similarity

The task is: I get companies' information from a large CSV file and then I need to compare this information with each company in the database to know if the company is a new one or if it is already in ...
2
votes
1answer
15 views

JavaScript idle managing structure

I am just getting into the world of javascript, coming from the world of classical inheritance. The following is a library I wrote to track when a webapp is idling and I wrote it like I write ...
1
vote
0answers
24 views

Save Custom Product Kit using Web Application

How far do I break down individual tasks within a typical scenario of "Web application reacts to user input"? For example, in the case below, say a scenario is "User submits a form, causing user data ...
4
votes
2answers
118 views

Simple builder pattern implementation for building immutable objects

This is a builder pattern implementation to build immutable Person objects: Person class ...