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

2
votes
1answer
28 views

versatile insertion method for PDO class

this is my insertion method in PDO, it is working 100%. this 'insert' method accepts table, column and value but i want to make it versatile. (i want to insert values with or without the column names) ...
0
votes
1answer
25 views

Placing and removing a dynamic tooltip

I'm making a calendar and this is one part of the larger project. This adds a tooltip with more information when a calendar event is clicked. It then disappears after 10 seconds, or earlier if a click ...
2
votes
1answer
36 views

Structure pages mvc + oop

I am developing a website and I want to use PDO and MVC. Before, I was coding in procedural MySQL, but I'm starting to understand the object-oriented programming. My problem is the following: If I ...
-1
votes
0answers
22 views

If an object is needed by a two classes (outer and inner), what's the best way to share the object? [on hold]

Lets say: Class A has a B which has a C which has a D which has an E. Class A and class Z both have a Z. In an instantiated case, A and E need to share the same Z. What's the best way to get the Z ...
0
votes
1answer
21 views

please help to simplify my method (taxonomy) (propel ORM)

I'm working on a simple blogsystem (for learning purposes, not to reinvent the wheel). In this system the user can add existing or new tags to a blogpost. I wrote a method to achieve this, but it's ...
1
vote
1answer
38 views

Attempted to make Blackjack in JavaScript

I realise I’m not the first person to do this, but I’ve attempted to make Blackjack in JavaScript to improve my JavaScript skills. The code is on GitHub at ...
1
vote
3answers
161 views

Constructor Injection, new dependency and its impact on code

This is my interface, all of my transport concrete classes will be implementing this interface. interface ITransport { void Travel() } These are my existing implementation class: class Horse : ...
5
votes
3answers
283 views

OOP how to show query

I just started with OOP and I am trying out some things but I got a simple questions which I need help for. The code below is it possible to OOP'efy it more? class koffiepost { public function ...
3
votes
2answers
65 views

Photogallery First project in OOP review

Please take it easy on my as this is my first OOP web application I plan on converting it to some deeper degree but not sure yet. The basic functionality is there I think, but I'm looking for some ...
3
votes
2answers
104 views

Review some of my code

I'm working on a simple CMS. It's working quite ok, but I think my code can be improved a bit~ so i'm reaching out to you experts. I work with a section.php, which is included from the index.php with ...
2
votes
2answers
198 views

Improving my Java object-oriented? Review!

Did I improve since then? I have been writing this program today, and tried my best to improve my object-oriented understanding. Mains.java: import games.GameHandler; import java.util.Scanner; ...
1
vote
1answer
14 views

javascript canvas -javascript design

I am doing some tests with html5 Canvas object. At the same time I am trying to make my javascript code more modular. In the following code, where/how should I declare canvas and context, so that it ...
0
votes
0answers
70 views

Login script, please review for exploits holes and security

My old script: Does my Login Script contain any exploitable holes? Did I improve? I've wrote this script today, by listening to many many suggestions from my last login script thread (link above). ...
1
vote
2answers
110 views

creating a concreate implemetation inside a method

I have this code: public bool IsWorkAddedWIthConcreteImplementation() { SomeAgentClass agentClass = new SomeAgentClass(); bool param1 = true; string param2 = "Hello"; DataTable dt1 = ...
2
votes
2answers
84 views

OOP PHP How can I improve my own framework?

Hi,EveryOne! I want to develop my own MVC framework.This is a very small framework. I have tested this framework and it's working fine. I can do CRUD without any troubles. I am using Smarty to handle ...
0
votes
1answer
40 views

A decent use-case for static property

I'm currently writing a REST-tool that connects to a third-party server (duh). They offer a fairly large (if not too large) API in a single wsdl file, as well as separate wsdl's for each specific part ...
2
votes
3answers
166 views

Is there any way to improve my java ? Anything wrong with it?

I see many many programs that are written out of the main method. But most of my programs are written in main, and access some methods from other classes. Am I programming in the correct way? ...
-2
votes
0answers
38 views

OOP connection compatibily [closed]

I have not sure with the tutorial connection script that I got online, If still compatible with PHP 5.5.0 ver., I know there's an issue with regards compatibility, I just want to get your opinion or ...
-2
votes
0answers
34 views

Is it fine to extend a database class? [closed]

I have a database class, that has dynamic query functions, and creates the connection with consturct. Is it fine to extend every class with Database Class? Problem: What if I need to extend another ...
0
votes
0answers
92 views

Javascript Nested Classes

Are there any potential issues with the following Javascript code: var BobsGarage = BobsGarage || {}; // namespace /** * BobsGarage.Car * @constructor * @returns {BobsGarage.Car} */ ...
-2
votes
0answers
44 views

encode and decode [closed]

I need several methods to encode and decode my string. I am having trouble getting it set up correctly... I only want it to shift by one letter... import java.io.*; import java.util.*; public ...
1
vote
0answers
16 views

Javascript organise site's module

today I was wondering about on how to organise the code on my site , to make it clearer as possibile and clearly readable. I'm organising it with namespace, separating every single section of the ...
0
votes
1answer
36 views

Single Player Pong - Java

I recently created the following code: Pong class: import javax.swing.JFrame; public class Pong extends JFrame { private static final int HEIGHT = 500, WIDTH = 900; public Pong() { ...
1
vote
1answer
115 views

Is this correct implementation of MVC pattern for PHP website?

I'm currently developing a music website using OOP PHP and I'm trying to correctly implement the Model View Controller pattern. I am creating this website from scratch so I would like to avoid ...
3
votes
2answers
196 views

PHP Classes and variables

Hy all, First of all, i'm trying to learn OOP PHP, so any advise will be great ( and sorry for the bad English ). The later idea is to create some kind of MVC Framework CMS kind of thing, just to ...
2
votes
2answers
77 views

Does my Login Script contain any exploitable holes?

This is my most recent login system I have been developing. It is working with Sessions. I want to know if I am doing well, if my code contains any serious exploits, and if my logic is correct. This ...
0
votes
1answer
29 views

Best way to manage a device information class

This is probably a really simple question. An embedded device I'm working with will store the device information in an xml file. In my code, I want to read this xml file and freely reference to it ...
1
vote
2answers
63 views

What Data Annotations need to be shared/different between my Model & ViewModel to keep seperation of concerns?

I read this question and answers, about if Display Annotations on model properties violates the separation of concerns between view and model. And my interpretation of their answer was "No, not if ...
2
votes
3answers
89 views

Flaws in this Design?

I need to find the flaws in this design. So far the only ones i can think of are: No use of generics the class Concept uses a parametrized constructor, which means every sub class would need to pass ...
1
vote
2answers
58 views

Java Theory: Classes Design for Currency, Futures and Metals Analysis 1

This is a continuation from here: http://stackoverflow.com/questions/16761207/java-theory-classes-design-for-currency-futures-and-metals-analysis I have created 2 classes for now. 1) Historical Data ...
3
votes
2answers
104 views

Looking for a better solution to my OO code

I would like if this could be kept to a post providing concrete examples of how I could solve my problem better, and not about which one would be "best" as such :) I would simply love some insight to ...
3
votes
1answer
256 views

Generic method for database calls

Background Breaking from MVC, I've implemented the following architecture: POST/GET ➤ PHP ➤ Database Calls ➤ XML ➤ XSLT ➤ HTML All database interactions are relegated to the call method in the ...
3
votes
1answer
141 views

Improvement of my php code

I wrote a class with this function. Can I improve my code performance in the bottom of the function? I don't like the while loops! public function loadFields(array $fields, $as_object = ...
2
votes
1answer
53 views

Can I do something better in that code? And improvements?

Hi guys, simple question! Can I do something better with the code I wrote. It's running problem less. It's just a snippet of a library I wrote. Thank you for all answers! <?php /* * ...
0
votes
1answer
48 views

Box(x,y,X,Y), box(x,X,y,Y), box(x,w,y,h), box(x,y,w,h) or box(fromPos,toPos)?

Say you are representing a box, or creating a function that slices a 2d array, or whatever. How do you represent it?
5
votes
3answers
515 views

Is it wrong to write an entire program under one class/method in Java?

I'm new to programming an created a simple rock, paper, scissors game. The entire program is under a single class and the main method, i hear that's probably not the best way to code. How should i ...
0
votes
1answer
72 views

I've finally found a satisfactory way to create classes on JavaScript. Are there any cons to it?

Depending on external OO libraries is really bad, using prototypes/new has some limitations, using only hashes has others. Dealing with classes was always a pain in JavaScript and it didn't help that ...
2
votes
1answer
122 views

Collision detection implementation

I'm working on a clone of Hunter Story. You shoot monsters with your bow. Recently I implemented collision detection, this is all working correctly, and I don't think the code needs any dramatic ...
4
votes
4answers
171 views

General advice on a practice linked_list for C++ classes/templates

Introduction I'm learning C++ (Coming from Haskell, C, and Assembly - and other languages sparsely) and this was my practice with classes and templates. It's a linked list that you can call in this ...
4
votes
2answers
120 views

Best OOP method for a layout library

I had a code for a layout library which looked like : $this->layout->setLayout($layout)->setTitle($title)->render() etc. Today I started writing a new code, simpler and smaller : ...
0
votes
1answer
80 views

Q&A system model design [closed]

Now I am trying to build a Q&A website by myself.The models below is my model design.I have some questions about this. 1、class Category: public class Category { private String name; } ...
2
votes
0answers
48 views

Lua OOP and classically-styled prototypal inheritance

I want to do some object-oriented programming in Lua, and I decided on something like this: local B = {} -- in real life there is other stuff in B B.Object = { constructor = function() end, ...
1
vote
2answers
83 views

Image Resize/Crop Class

I've combined some of my own functions with a function I found and I'm curious to know what others think of it. It will be used to upload and resize/crop images that are jpeg, jpg, png. <?php ...
0
votes
1answer
51 views

Should a User class only contain attributes and no methods apart from getters/setters?

I'm trying to improve my OOP code and I think my User class is becoming way too fat. In my program a user has rights over "lists". Read, Write, Update, Delete. So I made a User class class User { ...
1
vote
4answers
200 views

Making this code 'more' OOP

I have just started to try and learn 'OOP' but it appears I'm doing this wrong, according to the people on StackOverflow the code below is far from Object Orientated, but I'm finding it hard as I'm ...
2
votes
1answer
85 views

Abstraction for multiple connection methods

Coding to the interface, rather than the implementation. Here is what I'm doing in simple terms. Note: Although written using PHP, this is more of a general design / abstraction question that ...
2
votes
1answer
75 views

Design with Context, Table and Functions

Each class of my project has several inputs and outputs. Each input, the same as output, depends on it's own set of value-datatype. I need to provide a mechanism to forward data streams from one ...
3
votes
1answer
101 views

The eternal dilemma: bar.foo() or foo(bar)?

I was using foo(bar) as it's adopted for functional programming. console.log( join( map(function(row){ return row.join(" "); }, tablify( ...
3
votes
1answer
67 views

Static variable in method vs private class property

I have a class with a method that will be called multiple times over an object's lifetime to perform some processing steps. This method operates on a mixture of immutable (does not change over the ...
1
vote
1answer
44 views

autoloader class fine tune to be usable in every project

I'm open to any advice to help improve this code for general use. /** * * This code was created by Joshua Getner. * @license http://opensource.org/licenses/bsd-license.php BSD * * */ namespace ...

1 2 3 4 5 6