Questions tagged [reusability]

Reusability is the likelihood and potential for a piece of source code to be reused in other projects

In computer science and software engineering, reusability is the likelihood a segment of source code that can be used again to add new functionalities with slight or no modification. Reusable modules and classes reduce implementation time, increase the likelihood that prior testing and use has eliminated bugs and localizes code modifications when a change in implementation is required.

See: http://en.wikipedia.org/wiki/Reusability

974 questions
93
votes
7 answers

Is there any way to reuse a Stream?

I'm learning the new Java 8 features, and while experimenting with streams (java.util.stream.Stream) and collectors, I realized that a stream can't be used twice. Is there any way to reuse it?
Francisco
  • 951
  • 1
  • 6
  • 5
76
votes
5 answers

Why can a string be assigned to a char* pointer, but not to a char[] array?

Can someone explain why this works with the pointer: char * str1; str1 = "Hello1"; str1 = "new string"; // but not this char str2 [] = "hello"; str2 = "four"; // or this char str3 []; str3 = "hello"; str3 = "hello";
nick
  • 1,147
  • 1
  • 11
  • 12
53
votes
3 answers

Can we include common css class in another css class?

I am a CSS newbie. I am just wondering, is that possible to include one common class into another class? for example, .center {align: center}; .content { include .center here}; I came across css framework - Blueprint. We need to put the position…
janetsmith
  • 8,562
  • 11
  • 58
  • 76
45
votes
7 answers

Can Razor Class Library pack static files (js, css etc) too?

Maybe duplicate of this already, but since that post does not have any answer, I am posting this question. The new Razor Class Library is awesome, but it cannot pack libraries files (like jQuery, shared CSS). Can I somehow reuse the CSS across…
Luke Vo
  • 17,859
  • 21
  • 105
  • 181
41
votes
4 answers

WCF Service Reference generates its own contract interface, won't reuse mine

My first question so hope it is suitable: Shared interface assembly - I have a 'shared' assembly which has an interface, let's call it IDocRepository. It's marked with [ServiceContract] and there are several [OperationContract]-marked methods. WCF…
Kieren Johnstone
  • 41,277
  • 16
  • 94
  • 144
40
votes
4 answers

Reuse of a LINQ query

This is not about the reuse of a result but more the statement itself. Nor is it about an error when using var as mentioned in: LINQ to SQL: Reuse lambda expression Out of sheer curiosity I was wondering if it is possible to reuse a single LINQ…
Blaatz0r
  • 1,205
  • 1
  • 12
  • 24
35
votes
2 answers

How to use ui:include with parameters?

Have JSF 1.2 two pages(one.xhtml and other.xhtml), that are included to the current page by following rule: ...
sergionni
  • 13,290
  • 42
  • 132
  • 189
31
votes
6 answers

Reusing thread in loop c++

I need to parallelize some tasks in a C++ program and am completely new to parallel programming. I've made some progress through internet searches so far, but am a bit stuck now. I'd like to reuse some threads in a loop, but clearly don't know how…
notaCSmajor
  • 311
  • 1
  • 3
  • 3
26
votes
2 answers

Android using layouts as a template for creating multiple layout instances

OK, So I understand how to use the include tag but I've run into a problem. Basically I want to have a layout defined in xml which has a couple of TextViews and an ImageView in it. I then want to iterate across an array and populate fields within…
gunboatmedia
  • 435
  • 1
  • 6
  • 15
25
votes
5 answers

javabean vs servlet

I was searching for difference between javabean and servlet. I found Servlet corresponds a Controller JavaBean corresponds a Model and java bean is a reusable component,where as the servlet is the java program which extends the server…
Ravi
  • 30,829
  • 42
  • 119
  • 173
24
votes
2 answers

How to utilize a thread pool with pthreads?

I have a queue of jobs and I want to make a pool of four threads where I can throw my jobs at. What I am stuck at is in how to make the threads and keep them suspended while there is no work. JOB QUEUE | job1 | job2 | job3 | job4 |…
Pithikos
  • 18,827
  • 15
  • 113
  • 136
23
votes
3 answers

One xib File with Multiple "File's Owner"s

I've got three different UITableViews, each in it's own view, accessed via tabs. All three tables would ideally share the same custom UITableViewCell class and .xib file. I started with one table, setting the class of the .xib to my custom class…
Matthew Frederick
  • 22,245
  • 10
  • 71
  • 97
22
votes
1 answer

How to reuse/recycle custom element like uitableviewcell does?

When using UITableView, we can reuse its cells using [[ UITableViewCell alloc] initWithStyle: reuseIdentifier:] and [uiTableViewInstance dequeueReusableCellWithIdentifier:] methods. This helps keep memory in check for huge tables as only a few cells…
Sailesh
  • 25,517
  • 4
  • 34
  • 47
19
votes
6 answers

Multiple WCF services referencing the same data contracts

I am building a set of WCF services that share common data contracts (or entities if you prefer). These are simple data transfer objects that are decorated with DataContract and DataMember attributes. I am explicitly specifying the name and…
Paul Speranza
  • 2,302
  • 8
  • 26
  • 43
19
votes
3 answers

UICollectionView do not reuse cells

I am having trouble with reuse cells and UICollectionView on iOS 7. My code works fine on iOS 6 but in iOS 7 it does not reuse the cell after calling dequeueReusableCellWithReuseIdentifier (do not call prepareForReuse). Even this code…
1
2 3
64 65