It is the practice of reusing existing code to avoid redundancy in code.
2
votes
2answers
129 views
Performance help with C++ algorithm
This is an algorithm I'm trying to optimize. I was trying to use openMP without any success.
I know the code is long but most of it is params init
Please try to explain why I need to change any ...
4
votes
1answer
62 views
PHP magic function for accessors and mutators
I have implemented the following PHP magic method behavior to save my time of creating accessor and mutators for properties of any class that extends this base class.
I am looking for suggesiongs on ...
11
votes
3answers
907 views
4×4 Tic-Tac-Toe in C
While trying to teach myself C, I decided to take a stab at writing this Tic-Tac-Toe program on a 4x4 board. It will be great if somebody could review it and let me know of some ways of refining this.
...
4
votes
1answer
80 views
UIView subclass – done right?
Generally, UI code is painful and full of kludges. (At least, mine was like that.) Recently I have decided to put an end to it and try to learn how to write good and reusable UI code.
So here is the ...
2
votes
1answer
74 views
Code reuse while keeping meaning clear and avoiding unforseen consequences
I like to reuse code as much as possible and keeps things DRY. But I'm afraid that sometimes it creates too many layers of indirection. It then becomes a chore to find where code exists that is ...
3
votes
2answers
100 views
Array manipulation exercise
While trying to learn more about arrays in C, I tried to write some code that did the following:
Read a stream of numbers from the stdin and store them in an array
Print the array in the order the ...
6
votes
1answer
138 views
Home-grown web service
I needed to build a one-way web service for a mobile app I developed. Its only goal is to receive incoming JSON data and insert it into the correct tables. It works, but it looks very "kludgy" and ...
1
vote
2answers
115 views
Improving this implementation of delegates
I borrowed the code from this question. I'm trying to implement the delegate in that code. Below is my outcome so far.
What else can be done to improve this code? Any suggestions? I would appreciate ...
1
vote
1answer
38 views
FixedSizePriorityQueue - Review Request
I implemented the FixedSizePriorityQueue class. The intended purpose is that, you can add as many elements as you want, but it will store only the greatest maxSize elements.
I would like any ...
2
votes
1answer
80 views
Simple I/O class - Review Request
I wrote a FastReader utility class that is supposed to read input fast. Mostly aimed at parsing input files in competitive programming.
How could I made this better? I am mainly looking for good code ...
1
vote
2answers
172 views
Is there a more efficient way for code reuse in Python - Largest prime factor?
I was doing timing with variations of function largest_prime_factor. I was able to write a better one largest_prime_factor2. There were some repetitions in the new function so I wrote another function ...