title: Managing complex relationships with Entity Framework

text: I'm using Entity Framework with POCO's and change tracking enabled. I started off using CASCADE DELETE relationships, but in some situations, due to cyclic or multiple-possible-cascade-paths, SQL Server prevented me from adding CASCADE DELETE... so I need to manage those deletions myself. Take for example the following situation:   * A site has many chassis   * A chassis has many cards   * A card has many ports   * A link has two ports (`PortAId` and `PortZId`) (and a port may participate in multiple links). The first 3 relationships have CASCADE DELETE, however the final (`Link`) relationship has "multiple cascade path" on the `Link.PortAId` and `Link.PortZId` attributes. Because of this, I _couldn't_ add the CASCADE DELETE relationship. * * * My **problem** is that when a port gets deleted, a foreign key constraint gets thrown because there are still `Link`'s referencing the deleted port. * * * I tried looking through the `ChangeTracker` on `SaveChanges()` for `Port`s which were deleted, and deleting their respective links; _but_ a port deleted implicitly (through CASCADE DELETE) doesn't show up in the ChangeTracker; so I have to look for cards as well, and chassis, and sites... it becomes untenable. I then tried adding `TRIGGER`s to the database, such as:               CREATE TRIGGER delete_port_links ON Ports FOR DELETE AS        DELETE FROM Links WHERE PortAId IN (SELECT Id FROM deleted) OR PortZId IN (SELECT Id FROM deleted)      ... however `FOR` triggers fire _after_ the foreign key constraint has been checked (and failed). I can't use `INSTEAD OF`, because the table has a foreign key. * * * So I'm really stuck in terms of what direction to go down to solve this. What techniques, patterns or features of EF would allow me to detect when a Port (directly or implicitly) been deleted, such that I can delete the Links as well?


title: libavcodec/libavformat question

text: I've seen this code referenced in two different places, yet I haven't seen anybody bring this up, but it seems that on line 00339 there is an empty if block and I just copied the code to compile try it out but it won't even compile cause of that.               if (frame_count >= STREAM_NB_FRAMES) {      /* no more frame to compress. The codec has a latency of a few         frames if using B frames, so we get the last frames by         passing the same picture again */     } else {      Any idea or explanation why it is like that. Is it a mistake on the author's part when copying it? What is supposed to be going on in that if block anyways?


title: Autosave in web development tools

text: I'm working on a new web based development tool (version management based on git). Usability tests showed that developers are used to manual save. I asked 15 developers that are used to work with Eclipse or Visual Studio to develop in my web based code editor. After a short mission I asked them if they feel their code is saved. They all said no, and looked for a save button, and didn't notice a "saved" label turning on and off at the top right corner. I'm wondering if auto save will be a better experience, and something developers will get used to, like in google docs?


title: Should I use friend classes in C++ to allow access to hidden members?

text: Here is my situation (a simple example). Say I have a class called `HiddenData`   Then I have another class called `StoreHiddenData`   And finaly a class called `OperateHiddenData` Here's the thing, my class called `HiddenData` has private members that I don't want to be visible to the rest of the world, but I still need classes to be able to operate on private members of this `HiddenData` class (`StoreHiddenData` and `OperateHiddenData` for example). I would like to be able to pass this object around to different classes that do different things on it. Another thing I was thinking of is to create a form of handle to these `HiddenData` objects, but I can't think of a way to use handles without using friend classes again (as to give the other classes access to a table that contains what the handles point to, without exposing it to the rest of the world as well). I was reading this question on this site just a while ago as I was researching the use of friend classes, and it has me thinking if using friends is the best way to go. If anyone has any suggestions for how to accomplish this task without the use of friend classes in C++, or if the use of friend classes is an OK OOP practice, please provide me with any suggestions. Thanks. EDIT: I figure I should add a little bit more information about my problem. For one thing, I am trying to create an API that consists of several classes that hide their functionality from the outside and only allow public functions to be accessed. On the inside I have data structures (or classes, doesn't really matter), that need to be passed around to these different classes with public functions. I don't want the outside to have access to anything inside these data structures other than being able to pass them around to functions of the API. I kind of think of it like the Windows API, where you pass around Handles to API functions, but you can't actually dissect the handles in your own code. Well I would like to do something very similar, but while remaining object oriented, and NOT passing these private data structures around by value because they will be BIG. Thanks again.


title: Segmentation fault with a c++ file handling program

text: I am learning file handling c++. This program read words from a file and inserts them in a vector alphabetically as they are entered. When I am executing this program, I am getting segmentation fault. Can someone spot the error in the program?               #include <iostream>     #include <string>     #include <vector>     #include <algorithm>          using namespace std;          int main(int argc,char *argv[])     {         if(argc!=2)         {         cerr << "Incorrect number of arguements in Usage" << endl;         return 1;         }            ifstream fin(argv[1]);              if(!fin)         {         cerr << "File " << argv[1] << " not found\n";         return 1;         }            vector <string> v;       string word;       int i;              fin >> word;         v.push_back(word);              while(fin >> word )         {                 i=0;                 while( word.compare(v[i])<0 && i<v.size() )                 i++;                      v.insert(v.begin()+i,word);         }              for(i=0;i!=v.size();i++)         cout << v[i] << "  " ;         cout << endl;              return 0;     }


title: Is 'lazy' the correct term for timestamp-based skipping?

text: (1)   * The old`make`utility looks at timestamps, and if the output is newer than the input, it skips (pointless, time-consuming) re-compilation of e.g. C files.   * The same is true for many languages and compilers. “Lazy” thumbnail generation in web aplications skips those thumbs that are newer than the source image.   * “Smart” file syncing tools do the same, looking at time stamps, to reduce transfer volume. I used to refer to this as **“lazy”**. However, looking at web citations, the term “lazy” in Computer Science seems to actually mean something different: „do something as late as possible“.   * only load that extra part when it's necessary   * initialize lazily, aka as late as needed   * only evaluate that part of the equaption, when you get to it... So is my term wrong? And what would be more correct, for all that „is-newer- based“ skip optimizations?


title: Preventing Liskov Substitution violation

text: I am reimplementing some component and noticed that the original version has a Liskov Substitution violation. It's not all that critical, though I'd like to get rid of it in the new implementation . It is however not clear to me how to do this. I have a component defining very simple value classes used by the system. This component has a DataValue interface and a dozen implementations such as NumberValue and GeoCoordinateValue. The component I'm reworking is a storage layer meant for indexing data so it can easily be queried against. This component contains a set of classes that provide storage information for a particular DataValue implementing class. This information are things such as which fields a table needs to have to contain the DataValue in question, which field should be used for sorting, and what indexes should be placed. These classes all implement some DataValueHandler interface. The LSP violation occurs for two particular methods in this DataValueHandler interface:               getWhereConditions( DataValue $dataValue )          getInsertValues( DataValue $dataValue )      The interface defines these methods take a DataValue. The implementations however expect the DataValue for which they provide information. For instance, the NumberValueHandler expects a NumberValue, and will throw an exception if it gets a GeoCoordinateValue. So how can I get rid of this? (Before anyone suggests it: putting info of some specific storage backend in DataValue is not going to happen, as this would be worse design wise then the current LSP violation.)


title: Scheduling a few CPU-intensive tasks

text: I need to schedule a small number of CPU-intensive tasks to run every so often, reading from shared data and writing to dedicated buffers. I don't necessarily want to roll my own scheduling, but am unsure if libraries like Quartz are appropriate for this small of scale. I'm using Java 8 in a server environment, but with isolated nodes and it doesn't matter if a few iterations are lost every now and then. **Problem detail:** I have 5 buffers of data of binary data to process. Before processing each buffer, I allocate an empty destination and the function writes to that destination. Each buffer needs to be processed on a different schedule with a different function, although all the functions can handle missing an iteration and calculating double on the next go. The first buffer is ~30mb and takes ~200ms to process, and needs to be processed every 500ms. The remainder are around ~6mb each and take ~50ms to process, and need to be processed every 1000ms. The processing functions must only write to the destination buffer and are stateless, but may read any of the existing buffers. The whole process will at least have its own thread, and may have multiple threads. None of this is critical, it won't be clustered, and will be maintained almost exclusively in- memory. **Example:** A fairly dumb implementation might be:               for (layer in parent.layers) {         new thread(() => {             while (true) {                 buffer = new int[layer.data.length]                 process(layer.data, buffer, parent)    // remember, this can access other layers                 layer.data = buffer                 sleep(layer.increment)             }         }     }          Running each layer on its own thread makes the processing fairly simple, so long as nothing in the middle is locked. Grabbing each layer the processing function cares about when it begins an iteration and releasing them at the end should work, since they are read-only and I'm not worried about another thread replacing the reference. **Question:**   1. Are there any issues with Timers for this kind of work? Do they provide a way to discard or wait on the previous iteration?   2. Is Quartz a viable choice, or simply absurd?   3. Can something as simple as `System.nanoTime` suffice at this precision?


title: Cleanest way to report errors in Haskell

text: I'm working on learning Haskell, and I've come across three different ways of dealing with errors in functions I write:   1. I can simply write `error "Some error message."`, which throws an exception.   2. I can have my function return `Maybe SomeType`, where I may or may not be able to return what I'd like to return.   3. I can have my function return `Either String SomeType`, where I can return either an error message or what I was asked to return in the first place. My question is: **Which method of dealing with errors should I use, and why?** Maybe I should different methods, depending on the context? My current understanding is:   * It's "difficult" to deal with exceptions in purely functional code, and in Haskell one wants to keep things as purely functional as possible.   * Returning `Maybe SomeType` is the proper thing to do if the function will either fail or succeed (i.e., there aren't different _ways it can fail_ ).   * Returning `Either String SomeType` is the proper thing to do if a function can fail in any one of various ways.


title: GPL and non GPL software common installer

text: From my vague understanding of this subject I assumed that if I make an installer for my program and it contains a GPL library my code would have to fall under GPL. However, I noticed yesterday when installing Ubuntu that its installation had checkboxes (selected by default) to install non free software. This question specifies about programming behavior and says that my program wouldn't fall under GPL as long as the library can be seem as separated programs but it does not say anything about making a common installer for the package. I saw this answer saying about common installers in StackOverflow in Portuguese and it does say about a common installer making the code fall under GPL. **If I create an installer for the library and put my non-free program that uses that library there as an option my program wouldn't fall under GPL ?**


title: Adding new functionality to all of shelve.Shelf's subclasses in Python

text: In order to avoid the overhead associated with the shelve module's `writeback` option I'm interested in putting together a shelf class that only accepts hashable values, with hashability being a proxy for immutability. So I'd like to subclass `shelve.Shelf` and override the `__set__` method. The catch is that `shelve.open` can return one of a number of different classes (e.g., `Dbfilenameshelf`), and I'd like my code to allow `shelve` this flexibility. Ideally a solution would have the following properties:   1. No need to wrap every function that `Shelf` provides, as in: `def keys(self): return self._shelf.keys()`   2. Will not break if Python adds new methods to `Shelf` or new subclasses of `Shelf`   3. Avoiding fragility, by which I mean doing something complicated that could easily trip up someone (conceivably me) who is modifying or using the code months or years down the road. An example in this context would be reassigning `Shelf.__set__`, as in `Shelf.__set__ = my_func`. To me defining a new `__getattr__` as @Winston hesitantly offers seems moderately fragile--I take it that's why he suggests it only with hesitation Less important but still desirable would be:   1. Consistent with object-oriented design principles. It seems to me that the new class here _is a_ shelf, not that it _has a_ shelf. And probably not both (it's not a shelf which contains another shelf)


title: strategies for dealing with machine epsilon

text: Say you have a situation where you divide and then multiply a float, and you need to guarantee that it survives macheps (ie multiplication output equals division input). What are known strategies for guaranteeing this? Rounding would work, but anything else?


title: Is it acceptable for projects to go over budget?

text: This question is something that's been bugging me for the past 3 months since I switched from being a freelancer to working at a Web Design firm. Our sales people often ask us something similar to the following series of questions:   * How much does it cost to program a widget   * How many hours will it take to convert this website to this software.   (Without knowing what the website currently runs)   * etc * * *   1. How can we give a quote without any information? ( **No, I can't ask for more info!** ) I have another question if a project goes over budget it's bad. Recently, I missed an entire menu when calculating the cost of transferring a website over to a new platform so the project went over budget. My boss was not happy at all, and it's my opinion that some things like this can't be avoided. 2\. What is the general practice for dealing with going over budget   and do projects like web development often go over budget? If you work at a web development/design/similar company: 3\. How does your billable hour system work? For me, we have a time tracking application that we record how many hours we spend on which project and if they are billable or internal (AKA non- billable). If don't meet xx billable hours a week we can get in trouble/fired eventually. Work you do for the company or for clients that isn't billable isn't part of this system, and we often _have_ to do internal work, so I'm wondering if any alternative systems exist. **EDIT:** Ok I am a developer at this firm not a designer :) Second, I am paid salary, but here is how management looks at it. You have 35 hours a week that you must work. You could be doing work that they bill to clients in that 35 hours and you should. If they figure out a project will take 50 hours and I take 55 hours, that 5 hours could have been spent on another project that wasn't over budget so we just "lost" money. Another example is that if I only have 1 project, that is due in two weeks and I spend a day doing internal work, some how we lost money because I wasn't working. If I worked that day, I would finish a day early and still have no work. Either way, the work is contract so we will get paid the same amount regardless of which days I work!


title: Kiln - Mercurial and Git limitation

text: According to this blog post: Kiln now supports repositories accessible from both Git and Mercurial > We decided that the awesome way would be to make Kiln fully bilingual. It > stores every repo in both formats. It automatically converts everything back > and forth, always. The translation is 1:1, reversible, and round-trippable. > Whatever you do to a Kiln repository using Git will be immediately visible > to Mercurial users and vice versa. I can't imagine that everything runs smoothly. What limitations does this have?


title: Why aren't we building and using parallel processors *meant* for general computation?

text: We all know GPUs are much faster than CPUs for a wide range of applications. When someone asks why we are not just programming for GPUs at all, one of the most common answers is that GPUs are not good for everything - i.e., they fail to do some things that CPUs do easily. Well, no wonder: after all, they are not **meant to be used for general computations**. GPUs are strongly tied to games and graphical applications, not only having specialized functions for those, but often being advertised for them. My question is: why, then, aren't we building and using processors that are **actually designed for parallel programs**?


title: What is the legality of making a mobile app version of an existing card or board game?

text: I see that the market is full of mobile apps based on card/board games. For example, do a search for "Taboo" and there are many results which are not published by Hasbro Inc. Is this legal? The top "Taboo" result says in the description that they are not associated with Hasbro--does this absolve them of infringement issues? I can think of a few games that I could make mobile versions of that could be successful, but I'm wary of publishing (and monetizing) a game based on another, especially if it has the same name. Note: I noticed this useful thread, which hints that it is legal to create such games, but that the original owner may fight to have similar games removed and might win. If I develop such a game and have to pull it down, would I be able to resubmit it after making some changes?


title: how does semantic versioning apply to programs without API

text: In http://semver.org/ —which in my perception seems to be the most widely used convention in versioning— it is recommended to increase the major version number when a change that breaks/modify the API is introduced. There are two related scenarios I don't see how to apply this guideline though:   1. What if my code doesn't offer any API? How should I version my code?   2. What if my code starts offering an API in a late stage of its development?


title: Learning by doing (and programming by trial and error)

text: How do you learn a new platform/toolkit while producing working code and keeping your codebase clean? When I know what I can do with the underlying platform and toolkit, I usually do this:   1. I create a new branch (with GIT, in my case)   2. I write a few unit tests (with JUnit, for example)   3. I write my code until it passes my tests So far, so good. The problem is that very often I do not know what I can do with the toolkit because it is brand new to me. I work as a consulant so I cannot have my preferred language/platform/toolkit. I have to cope with whatever the customer uses for the task at hand. Most often, I have to deal (often in a hurry) with a large toolkit that I know very little so I'm forced to "learn by doing" (actually, programming by "trial and error") and this makes me anxious. Please note that, at some point in the learning process, usually I already have:   1. read one or more five-stars books   2. followed one or more web tutorials (writing working code a line at a time)   3. created a couple of small experimental projects with my IDE (IntelliJ IDEA, at the moment. I use Eclipse, Netbeans and others, as well.) Despite all my efforts, at this point usually I can just have a coarse understanding of the platform/toolkit I have to use. I cannot yet grasp each and every detail. This means that each and every new feature that involves some data preparation and some non-trivial algorithm is a pain to implement and requires a lot of trial-and-error. Unfortunately, working by trial-and-error is neither safe nor easy. Actually, this is the phase that makes me most anxious: experimenting with a new toolkit while producing working code and keeping my codebase clean. Usually, at this stage I cannot use the Eclipse Scrapbook because the code I have to write is already too large and complex for this small tool. In the same way, I cannot use any more an indipendent small project for my experiments because I need to try the new code in place. I can just write my code in place and rely on GIT for a safe bail-out. This makes me anxious because this kind of intertwined, half-ripe code can rapidly become incredibly hard to manage. How do you face this phase of the development process? How do you learn-by-doing without making a mess of your codebase? Any tips&tricks, best practice or something like that?


title: How do you send a new command using NSTask to a unix executable file?

text: I'm trying to learn how to use NSTask, NSPipe, and NSFileHandler to make use of unix executable files in Xcode. I've already written a program that both renders chess and plays it against a user, so I now I want to make a chess GUI with Stockfish, which I have included in my Xcode project as a unix executable file. To this end, I've written the following program, but I've gotten stuck in sending new commands to Stockfish; that is, I can send it a command when I launch the NSTask, but I can't send it commands once the task is running. When I send these commands via Terminal, Stockfish responds perfectly, but for some reason, it ignores any commands I send it after launch (i.e. with [self sendCommandToStockfish]). If I send it a command, it simply ignores it and continues executing the original command while the input-pipe continues executing perfectly. How can I continue to send commands with NSTask after launch? Here's the code I've got so far:               //     //  AppDelegate.m     //  CommandLineToolRunner     //     //  Created by Thomas Redding on 8/28/14.     //  Copyright (c) 2014 Thomas Redding. All rights reserved.     //     #import "AppDelegate.h"     @implementation AppDelegate     - (void)applicationDidFinishLaunching:(NSNotification *)aNotification     {         // Insert code here to initialize your application              self.myTimer = [NSTimer scheduledTimerWithTimeInterval:0.1f                                                     target:self                                                   selector:@selector(timerFired:)                                                   userInfo:nil                                                    repeats:YES];              // set up task         self.task = [[NSTask alloc] init];         [self.task setLaunchPath:[[[NSBundle mainBundle] pathForResource:@"stockfish" ofType:@""] copy]];         [self.task setArguments:@[@"go infinite"]];              // set up output-pipe         [self.task setStandardOutput:[NSPipe new]];         NSNotificationCenter* notificaitonCenter = [NSNotificationCenter defaultCenter];         [notificaitonCenter addObserver:self selector:@selector(getReadData:) name:NSFileHandleReadCompletionNotification object:[[self.task standardOutput] fileHandleForReading]];         [[[self.task standardOutput] fileHandleForReading] readInBackgroundAndNotify];              // set up input-pipe         [self.task setStandardInput:[NSPipe new]];         [self.task launch];              self.frame = 0;     }          - (void) timerFired:(NSTimer *)timer {         // do stuff         self.frame++;              if(self.frame == 20) {             // write             NSLog(@"[[Sending Commands]]");             [self sendCommandToStockfish:@"stop"];             [self sendCommandToStockfish:@"position fen rnbqkbnr/8/8/8/8/8/8/RNBQKBNR w KQkq - 0 1"];             [self sendCommandToStockfish:@"go infinite"];         }     }          - (void) getReadData:(NSNotification *)notification     {         NSData *data = [[notification userInfo] objectForKey:@"NSFileHandleNotificationDataItem"];         NSString *response = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];              [[notification object] readInBackgroundAndNotify];              NSLog(@"%@", response);     }          - (void)sendCommandToStockfish:(NSString *)string     {         NSLog(@"[[%@]]", string);         NSString *strWithNewLine = [NSString stringWithFormat:@"%@\n", string];         NSData *myData = [strWithNewLine dataUsingEncoding:NSUTF8StringEncoding];              @try {             NSLog(@"((START TRY))");             [[self.task.standardInput fileHandleForWriting] writeData:myData];             NSLog(@"((END TRY))");         }         @catch (NSException * e) {             NSLog(@"((ERROR))");             if ([self.task isRunning]) {                 NSLog(@"^^^");                 [self.task terminate];             }             else {                 NSLog(@"***");             }         }     }     @end      When I run this, I get the following output logged (I terminate the program on my own):               2014-09-02 15:02:18.474 CommandLineToolRunner[49999:303] Stockfish 140714 64 SSE4.2 by Tord Romstad, Marco Costalba and Joona Kiiski     2014-09-02 15:02:18.713 CommandLineToolRunner[49999:303] info depth 1 seldepth 1 score cp 85 nodes 27 nps 27000 time 1 multipv 1 pv e2e4     2014-09-02 15:02:18.714 CommandLineToolRunner[49999:303] info depth 2 seldepth 2 score cp 6 nodes 155 nps 77500 time 2 multipv 1 pv d2d4 d7d5     2014-09-02 15:02:18.715 CommandLineToolRunner[49999:303] info depth 3 seldepth 3 score cp 64 nodes 386 nps 128666 time 3 multipv 1 pv d2d4 d7d5 g1f3     2014-09-02 15:02:18.717 CommandLineToolRunner[49999:303] info depth 4 seldepth 4 score cp 25 nodes 1082 nps 216400 time 5 multipv 1 pv e2e4 e7e5 d2d4 b8c6     2014-09-02 15:02:18.724 CommandLineToolRunner[49999:303] info depth 5 seldepth 5 score cp 53 nodes 3129 nps 284454 time 11 multipv 1 pv b1c3 g8f6 d2d4 d7d5 g1f3     2014-09-02 15:02:18.729 CommandLineToolRunner[49999:303] info depth 6 seldepth 6 score cp 26 nodes 4702 nps 313466 time 15 multipv 1 pv e2e4 e7e5 d2d4 g8f6 b1c3 b8c6     2014-09-02 15:02:18.732 CommandLineToolRunner[49999:303] info depth 7 seldepth 7 score cp 58 nodes 6866 nps 343300 time 20 multipv 1 pv e2e4 d7d5 e4e5 b8c6 d2d4 e7e6 f1b5     2014-09-02 15:02:18.754 CommandLineToolRunner[49999:303] info depth 8 seldepth 8 score cp 12 nodes 14656 nps 396108 time 37 multipv 1 pv e2e4 d7d5 e4d5 g8f6 d2d4 d8d5 b1c3 d5a5     2014-09-02 15:02:18.791 CommandLineToolRunner[49999:303] info depth 9 seldepth 11 score cp 33 nodes 24157 nps 402616 time 60 multipv 1 pv e2e4 d7d5 e4e5 c7c5 d2d4 c5d4 d1d4 b8c6 f1b5 d8a5 b1c3 a5b5 c3b5 c6d4 b5d4     2014-09-02 15:02:18.807 CommandLineToolRunner[49999:303] info depth 10 seldepth 14 score cp 28 nodes 44269 nps 465989 time 95 multipv 1 pv e2e4 e7e5 b1c3 b8c6 g1f3 f8c5 c3a4 d7d6 a4c5 d6c5     2014-09-02 15:02:18.839 CommandLineToolRunner[49999:303] info depth 11 seldepth 15 score cp 41 nodes 75424 nps 593889 time 127 multipv 1 pv e2e4 e7e5 b1c3 b8c6 g1f3 f8c5 f3e5 c5f2 e1f2 c6e5 d2d4     2014-09-02 15:02:19.002 CommandLineToolRunner[49999:303] info depth 12 seldepth 16 score cp 28 nodes 254305 nps 879948 time 289 multipv 1 pv g1f3 d7d5 e2e3 b8c6 d2d4 c8g4 f1b5 g8f6 e1g1 a7a6 b5c6 b7c6     2014-09-02 15:02:19.042 CommandLineToolRunner[49999:303] info depth 13 seldepth 16 score cp 34 nodes 309418 nps 937630 time 330 multipv 1 pv g1f3 d7d5 e2e3 e7e6 d2d4 g8f6 f1d3 f8e7 e1g1 b8c6 c1d2 e8g8 b1c3     2014-09-02 15:02:19.224 CommandLineToolRunner[49999:303] info depth 14 seldepth 18 score cp 22 nodes 524342 nps 1024105 time 512 multipv 1 pv e2e4 e7e5 b1c3 b8c6 g1f3 g8f6 f1b5 f8b4 e1g1 e8g8 b5c6 d7c6 f3e5 d8e7 d2d4 b4c3 b2c3 f6e4     2014-09-02 15:02:19.603 CommandLineToolRunner[49999:303] info depth 15 seldepth 19 score cp 24 nodes 1002076 nps 1125928 time 890 multipv 1 pv g1f3 d7d5 d2d4 g8f6 c1f4 b8c6 e2e3 c8f5 f1d3 f5d3 d1d3 e7e6 d3b5 d8c8 b1c3 a7a6 b5a4     2014-09-02 15:02:19.769 CommandLineToolRunner[49999:303] info depth 16 seldepth 19 score cp 24 nodes 1213245 nps 1148906 time 1056 multipv 1 pv g1f3 d7d5 d2d4 g8f6 c1f4 b8c6 e2e3 c8f5 f1d3 f5d3 d1d3 e7e6 d3b5 d8c8 b1c3 a7a6 b5a4     2014-09-02 15:02:20.311 CommandLineToolRunner[49999:303] info depth 17 seldepth 20 score cp 22 nodes 1878116 nps 1174556 time 1599 multipv 1 pv g1f3 d7d5 d2d4 e7e6 c1f4 f8d6 f4d6 c7d6 b1c3 g8f6 e2e3 b8c6 f1d3 e8g8 e1g1 c8d7 a2a3 a7a6     2014-09-02 15:02:20.471 CommandLineToolRunner[49999:303] [[Sending Commands]]     2014-09-02 15:02:20.471 CommandLineToolRunner[49999:303] [[stop]]     2014-09-02 15:02:20.472 CommandLineToolRunner[49999:303] ((START TRY))     2014-09-02 15:02:20.472 CommandLineToolRunner[49999:303] ((END TRY))     2014-09-02 15:02:20.472 CommandLineToolRunner[49999:303] [[position fen rnbqkbnr/8/8/8/8/8/8/RNBQKBNR w KQkq - 0 1]]     2014-09-02 15:02:20.472 CommandLineToolRunner[49999:303] ((START TRY))     2014-09-02 15:02:20.473 CommandLineToolRunner[49999:303] ((END TRY))     2014-09-02 15:02:20.473 CommandLineToolRunner[49999:303] [[go infinite]]     2014-09-02 15:02:20.473 CommandLineToolRunner[49999:303] ((START TRY))     2014-09-02 15:02:20.473 CommandLineToolRunner[49999:303] ((END TRY))     2014-09-02 15:02:20.823 CommandLineToolRunner[49999:303] info depth 18 seldepth 20 score cp 23 nodes 2495624 nps 1182760 time 2110 multipv 1 pv g1f3 d7d5 d2d4 e7e6 c1f4 f8d6 e2e3 g8f6 f1e2 e8g8 e1g1 b8c6 f3e5 c8d7 b1c3 a7a6 a2a3 c6e5 d4e5     2014-09-02 15:02:21.756 CommandLineToolRunner[49999:303] info depth 19 currmove d2d4 currmovenumber 5     2014-09-02 15:02:21.951 CommandLineToolRunner[49999:303] info depth 19 currmove d2d3 currmovenumber 6     2014-09-02 15:02:21.960 CommandLineToolRunner[49999:303] info depth 19 currmove c2c3 currmovenumber 7     2014-09-02 15:02:21.966 CommandLineToolRunner[49999:303] info depth 19 currmove f2f3 currmovenumber 8     2014-09-02 15:02:22.010 CommandLineToolRunner[49999:303] info depth 19 currmove b2b4 currmovenumber 9     2014-09-02 15:02:22.015 CommandLineToolRunner[49999:303] info depth 19 currmove g1h3 currmovenumber 10     2014-09-02 15:02:22.022 CommandLineToolRunner[49999:303] info depth 19 currmove a2a3 currmovenumber 11     2014-09-02 15:02:22.029 CommandLineToolRunner[49999:303] info depth 19 currmove f2f4 currmovenumber 12     2014-09-02 15:02:22.036 CommandLineToolRunner[49999:303] info depth 19 currmove g2g4 currmovenumber 13     2014-09-02 15:02:22.037 CommandLineToolRunner[49999:303] info depth 19 currmove b2b3 currmovenumber 14     2014-09-02 15:02:22.044 CommandLineToolRunner[49999:303] info depth 19 currmove c2c4 currmovenumber 15     2014-09-02 15:02:22.086 CommandLineToolRunner[49999:303] info depth 19 currmove h2h3 currmovenumber 16     2014-09-02 15:02:22.091 CommandLineToolRunner[49999:303] info depth 19 currmove g2g3 currmovenumber 17     2014-09-02 15:02:22.095 CommandLineToolRunner[49999:303] info depth 19 currmove a2a4 currmovenumber 18     2014-09-02 15:02:22.098 CommandLineToolRunner[49999:303] info depth 19 currmove b1a3 currmovenumber 19     2014-09-02 15:02:22.101 CommandLineToolRunner[49999:303] info depth 19 currmove h2h4 currmovenumber 20     2014-09-02 15:02:22.107 CommandLineToolRunner[49999:303] info depth 19 seldepth 23 score cp 17 upperbound nodes 4113455 nps 1211621 time 3395 multipv 1 pv g1f3 d7d5 d2d4 g8f6 c1f4 c8f5 e2e3 e7e6 f1d3 f5d3 d1d3 b8c6 e1g1 f8d6 f4d6 c7d6 b1c3     info depth 19 currmove g1f3 currmovenumber 1     2014-09-02 15:02:22.410 CommandLineToolRunner[49999:303] info depth 19 currmove e2e4 currmovenumber 2     2014-09-02 15:02:23.133 CommandLineToolRunner[49999:303] info depth 19 currmove b1c3 currmovenumber 3     info depth 19 currmove d2d4 currmovenumber 4     info depth 19 currmove e2e3 currmovenumber 5     info depth 19 currmove d2d3 currmovenumber 6     info depth 19 currmove c2c3 currmovenumber 7     info depth 19 currmove a2a3 currmovenumber 8     info depth 19 currmove c2c4 currmovenumber 9     2014-09-02 15:02:23.158 CommandLineToolRunner[49999:303] info depth 19 currmove b2b4 currmovenumber 10     info depth 19 currmove f2f3 currmovenumber 11     info depth 19 currmove g2g4 currmovenumber 12     2014-09-02 15:02:23.159 CommandLineToolRunner[49999:303] info depth 19 currmove h2h3 currmovenumber 13     info depth 19 currmove a2a4 currmovenumber 14     info depth 19 currmove g1h3 currmovenumber 15     info depth 19 currmove b1a3 currmovenumber 16     info depth 19 currmove b2b3 currmovenumber 17     info depth 19 currmove f2f4 currmovenumber 18     info depth 19 currmove g2g3 currmovenumber 19     info depth 19 currmove h2h4 currmovenumber 20     2014-09-02 15:02:23.160 CommandLineToolRunner[49999:303] info depth 19 seldepth 23 score cp 27 nodes 5442993 nps 1223969 time 4447 multipv 1 pv e2e4 e7e5 b1c3 b8c6 g1f3 g8f6 f1c4 f8c5 d2d3 a7a6 e1g1 e8g8 a2a3 d7d6 b2b4 c5a7 c1e3 a7e3 f2e3     info depth 20 currmove e2e4 currmovenumber 1


title: Why does the Perl community have such a bad reputation?

text: I'm still fairly new to programming. I spend most of my time in Ruby, and I'm discovering a certain fondness for playing with regular expressions. That being said, I'm considering taking a look at Perl, just as a hobby. However, I've heard a lot about the Perl community, and none of it good. I've heard the community described as extremely elitist and resistant to inexperienced programmers. Is this true? If it is, why is that the case?


title: Is it easier to write robust code in compiled, strictly-typed languages?

text: I'd like to read the opinion of experts on whether compiled, strictly-typed languages help programmers write robust code easier, having their backs, checking for type mismatches, and in general, catching flaws in compile time that otherwise would be discovered in runtime ? Has unit testing in loosely typed, interpreted languages need to be more thorough because test cases need to assess things that in a compiled languages wouldn't simply compile ? Need the programer in compiled, strictly-typed need to write less code since he/she doesn't have to constantly check for correct types ( instance of operator ) since the compiler catches those things ( the same applying to misspelled variable names or uninitiated variables ) ? **NOTE: by strictly typed language I mean languages that force you to declare variables and assign a type to them in order to be able to use them, and once a variable is declared, you cannot change its type or assign incompatible type values.**               int myInt = 0;     String myString = "";     myInt = myString; // this will not fly in a strictly typed language     myInte = 10;   // neither will this ( myInte variable doesn't exist )


title: Starting new project with TDD

text: I'm studying TDD and I read that it also helps you to define the design of the app, correct? So I decided to start creating a new project to help me understand it better. I want to create a simple user registration system that will ask for its name, email address, country (will pick one from a list) and phone number. So the question is... I created a new solution in VS 2010, added a new Test project and I just don't know what tests to write! Since it will help me define the design, what tests could I write here? Thanks for any help!


title: Is it a good idea to design an architecture thinking that the User Interface classes can be replaced by a command line interface?

text: In Code Complete page 25, it's said that it's a good idea to be able to easily replace the regular user interface classes by a command line one. Knowing its advantages for testing, what about the problems it may bring? Will this extra work really pay off for web and mobile projects? What about small and medium projects; do the same rules apply? What if it makes your design more complex?


title: Using a GPLv3 library in a freemium business model

text: I read several related questions about the use of GPLv3 in a commercial app but they don't say anything about a freemium app. I would like to use a GPLv3 library in two apps, a free one (with limited features) and a paid one. Basically, the free app will allow to use the library without limitations, and the paid one will include it as well as other unrelated features. I will release the free app under GPLv3 but do I need to release the paid one under the same license? I don't want to release the whole source code of my paid app (for obvious reasons), as the other features don't use the library in any way. It would just be more convenient for users who bought the full version to have all features in a single app instead of putting the library in a separate one.


title: How Do I Become a More Autonomous and Self-Sufficient Programmer?

text: The single largest factor in what is holding me back from being a stellar developer is my reliance on others. I feel like I ask too many questions because I fear the consequences of breaking everything and holding everyone back. So I'm overly cautious by asking so many questions that I basically get the answers after enough questioning. I've recognized that's bad but I want to stop it. Part of it comes that there are times where I simply don't know the code (either it's a branch I've never worked with or it's a brand new product), but I want to rely on others less. To preface, these kinds of questions are not the ones about generic patterns or languages: usually my questions revolve around how we do code at our company, and how we get things to work in our ecosystem. I want to be able to take specs and roll with them without having to feel like I need to get help every step of the way. Is this normal? Have you been through this, and if so, how did you get over it?


title: Is it frowned upon to release works in progress to github/sourceforge/bitbucket/etc?

text: Long story short, I've spent the last two years in an entirely new career, transitioning from academia to a data analyst role (working towards a data scientist). Before starting at my current company, I knew next to nothing about coding, save for teaching myself SQL for a few hours per week over a couple of months. Besides SQL, I have since become conversant in Perl, have used PHP a bit here and there, and have made some headway into learning other languages (primarily Java and C). So, I still have a lot of catch-up work to do. In order to teach myself things, I've built a few side projects--a lot more sophisticated than `"Hello World, my name is $name."`, but not as complicated as, say, Minecraft or a device driver. I'd like to release the code for them in order to learn from constructive feedback and to build a portfolio to sit alongside my resume. However, a lot of these things are works in progress and, to be honest, I feel some trepidation at putting code out there for all to see that's not completely, 100% "done" and polished. Am I worrying over nothing? If not, is there some minimal polish threshold a project should have before releasing it as open source?


title: Good practice about Javascript referencing

text: I am fighting about a web application script optimization. I have an ASP.NET web app that reference jQuery in the master page, and in every child page can reference other library or JavaScript extension. I would like to optimize the application with YUI for .NET. The question is, I should put all the libraries reference in the master page or to compress all the JavaScript code in a single file, or I should create a file for every page that contains only the code useful to the page? Is there any guidance to follow?


title: Should I use a formal grammar for my interpreted scripting language

text: I have a scripting engine I just published as an open source project. It's been sitting on my harddrive waiting for about a year. My engine of course isn't complete in any way, but it does work for simple scripts. It has a javascript-ish feel to it, but I don't wish to abide by the ECMA spec or anything. Now, the big thing I'm working on is improving code quality while leaving the language working as it is(which I have a few regression tests to "prove"). It doesn't have a formal grammar at all and works like so:   1. Preprocess/Tokenize. At this point it removes whitespace and cuts everything into "tokens", which is basically just a structure containing a string and a rough "hint" as to what the token is (Number, Identifier, Operation, etc) and some debugging info such as line number   2. A ScriptingEngine class which takes the list of tokens and actually parses them and executes them   3. An "ExpressionEvaluator" class which will take a subset of the tokens list and build a specific tree of operations, values, and then execute operations and such and collapse the tree down into a single value My engine has the goals of being portable(works everywhere .Net does) and self-contained. So far, this "works", but the code is terrible and I'm pretty sure that I'm going about it the wrong way. I'm wondering if a formal grammar and everything that goes with it might help Some benefits I've heard of being more formal with grammar   * Unambiguous specification of the language   * Easier to maintain/change   * More traditional/Bigger community support?  And some of the disadvantages   * Some languages can be very difficult to reduce to a formal grammar, ie Perl.   * A learning curve for someone not in the know(ie, me)    * Generally rely on tools such as yacc and ANTLR, which introduce another step in your workflow and/or add dependencies(which I'd like to avoid) Although this project is in .Net, it could equally apply to any other implementing language. Should I use a formal grammar? Can someone expand on the pros/cons of both sides?


title: What's the best way to show some of my code during an interview?

text: I realize that there are already a couple of questions about this, but they mostly are about _if_ you should bring code to the interview, which is not the case here. I have a job interview (at a startup) coming up next week and they _requested_ to bring some code to the interview. I have two smaller open-source projects and a closed-source Android app, which I mentioned (and linked) in my skill sheet I sent along, so I wanted to show them some code of those projects. It's my first job after graduating, so I don't have any sources from previous employments and there won't be any issues regarding "spying", licensing issues, confidential code etc. All the code is completely mine and written by me. I guess I have pretty much three options: print some interesting parts of the code on paper or have everything on my tablet or laptop to show. The latter two have the advantage that I can bring all my projects and basically show them everything they want to see. However you can't directly make notes/underline stuff etc. as if I had printed it out and it's less convenient than just handing out paper. What's the best way to handle this professionally and do this as hassle-free as possible? I currently tend to print out some of the parts that I think are both interesting and well written, but have everything on my tablet in case they want to see more.


title: How do these technologies go together?

text: * Ruby on Rails    * Twitter Bootstrap    * Html5Boilerplate    * Backbone.JS or Knockout.JS I sort of understand what each one is individually, but my understanding isn't strong enough to understand whether some of them sort of overlap in functionality and whether any subset of that list contains items you wouldn't use together because they play similar roles. I'm fairly clear on RoR-- it's mainly the latter three that I'm not sure how they play together.


title: How to plan/manage multi-platform (mobile) products?

text: Say I've to develop an app that runs on iOS, Android and Windows 8 Mobile. Now all three platforms are technically in different program languages. The only 'reuse' that I can see is that of the boxes-and-lines drawings (UML :) charts and nothing else. So how do companies/programmers manage the variation of the same product across different platforms especially since the implementation languages differ? It's 'easier' in the desktop world IMO given the plethora of languages and cross-platform libraries to make your life easier. Not so in the mobile world. More so, product line management principles don't seem to be all that applicable - what is same and variant doesn't really matter - the application is the same (conceptually) and the implementation is variant. Some difficulties that come to mind:   * **Bug Fixing** : Applications maybe designed in a similar manner but the bug identification and fixing would be radically different. A bug on iOS may/may-not be existent for that on Android. Or a bug fix approach on one platform may not be the same on another (unless it's a semantic bug like `a!=b` instead of `a==b` which would require the same 'approach' to fixing in essence   * **Enhancements** : Making a change on one platform would be radically different than on another   * **Code-Design Divergence** : They way the code is written/organized, the class structures etc., could be very different given the different implementation environments - leading to further reuse of the (above) UML models. There are of course many others - just keeping the development in sync and making sure all applications are up to the same version with the same set of features etc. Seems the effort is 3x that of a single application. So how exactly does one manage this nightmarish situation? Some thoughts:   * Split application to client/server to minimize the effect to client side only (not always doable)   * Use frameworks like Unity-3D that could take care of the cross-platform problem (mostly applicable to games and probably not to other applications etc.) Any other ways of managing a platform line? What are some proven approaches to managing/taming the effects?


title: Carpool logical architecture

text: I'm designing a carpool system (drivers can publish their routes and passengers can subscribe to them) with WebServices(axis2) and Android clients (ksoap2). I have been having problems with the logical architecture of the system and I wondered if this architecture is fine. ![enter image description here](http://i.stack.imgur.com/mmyUf.png) And another question: for that architecture (if it is ok), how would be the packages structure? I suppose something like that: (In android)   `package org.carpool.presentation`   *All the activities here (and maybe mvc pattern) (In the server)   `package org.carpool.services`   *Public interfaces (for example: register(User user), publishRoute(Route route) ) `package org.carpool.domain`   *Pojos (for example: User.java, Route.java, etc) `package org.carpool.persistence`   *Dao Interface and implementation (jdbc or hibernate)


title: There's a most performant way to check that a collection has exactly 1 element?

text: I came up with this solution :               if (Take(2).Count() == 1)      is there any more performance solution (or better syntactical sugar) to do this check ? I want a performance way because this will be an extension used on Linq To Entites and Linq to Objects. I'm not using `SingleOrDefault` because that will throw and exception if it has more than 1 element. Based on @Telastyn answer I came up with the following:               public static bool HasOne<T>(this IEnumerable<T> enumerable) {         var enumerator = enumerable.GetEnumerator();         return enumerator.MoveNext() && !enumerator.MoveNext();     }      another implementation (slighly slower but 100% sure will work effectivly on Linq to Entities) would be :               public static bool HasOne<T>(this IEnumerable<T> enumerable) {         return !enumerable.FirstOrDefault().Equals(default(T)) && !enumerable.Skip(1).Any();     }      I'm not sure if the `MoveNext` one works with IQueryable on Linq to Entites. (any takers? I don't know how to test that) After some test, `Take(2).Count() == 1`; is the fastest. :S


title: How to develop complex applications

text: I want to know the approach in developing big complex application regardless of which programming language to use. I want to know how developers make such big applications such as internet banking, API's and big database management application. How should one approach to make such applications. I have only 1 year programming experience so far and I work as a freelancer so when I saw such applications lots of questions came in my mind. How to understand the basic need of information technology. What actually it is? How it can be useful for common people of small towns. I want everyone to make use of technology no matter they are educated or not, rich or not. Please post some suggestions.


title: Is it good practice to return an array of objects?

text: If I have an ItemContainer class that contains, for example, items in an order, where each item is an Item object; is it best to have a method like:               ItemContainer->getItems()       that returns an array containing Item objects, or is it better practice to do something like:               ItemContainer->getItem($itemNo)       which returns a single item object for that item number, and forgoes the array. I realise this may be a trivial question or simply one of preference, but I'd like my app to adopt best practices from the start and I'm unsure which way to proceed. I'm writing in PHP, but I figured this pretty much applies to any OOP language.


title: What to bring to a programming interview?

text: I have just completed my Master's degree in Computer Science and have gotten my first job interview as a developer. I do not have much experience in large scale development projects, but I am hoping my university education counts for something. I am wondering, what materials should I bring that would impress my interviewers? What do most interviewers expect, especially from a new graduate? **Edit: The job interview went OK, except I forgot my pants. Thanks for all the great advice!


title: What are the relative merits for implementing an Erlang-style "Continuation" pattern in C#

text: What are the relative merits ( _or demerits_ ) for implementing an Erlang- style "Continuation" pattern in C#. I'm working on a project that has a large number of `Lowest` priority threads and I'm wondering if my approach may be all wrong. It would seem there is a reasonable upper limit to the number of long-running threads that any one Process 'should' spawn. With that said, I'm not sure what would signal the tipping-point for too many thread or when alternate patterns such as "Continuation" would be more suitable. In this case, many of the threads do a small amount of work and then sleep until woken to go again ( _Ex. Heartbeat, purge caches, etc..._ ). This continues for the life of the Process.


title: What are some best practices for cookie based web authentication?

text: I'm working on a small side project using CGI and Python (scalability is not an issue and it needs to be a VERY simple system.) I was thinking of implementing authentication using cookies, and was wondering if there were any established best practices. When the user successfully authenticates, I want to use cookies to figure out who is logged on. What, according to the best practices, should be stored in such a cookie?


title: When do we need to apply a software development methodology?

text: There are many software development methodologies - SCRUM, agile, XP, etc. - and they all have there advantages and disadvantages I suppose. But when do we really need to apply them? Surely they are not necessary for small 1-man projects, but for large 50+ teams you can most certainly not go about ad-hoc:ing the whole thing. So what's the line for when to use and when to not use such a methodology, if there indeed is one?


title: Staying OO and Testable while working with a database

text: What are some OOP strategies for working with a database but keeping things unit testable? Say I have a User class and my production environment works against MySQL. I see a couple possible approaches, shown here using PHP:   1. Pass in a $data_source with interfaces for `load()` and `save()`, to abstract the backend source of data. When testing, pass a different data store.              $user = new User( $mysql_data_source );     $user->load( 'bob' );     $user->setNickname( 'Robby' );     $user->save();        2. Use a factory that accesses the database and passes the result row to User's constructor. When testing, manually generate the $row parameter, or mock the object in UserFactory::$data_source. (How might I save changes to the record?)              class UserFactory {         static $data_source;              public static function fetch( $username ) {             $row = self::$data_source->get( [params] );                  $user = new User( $row );             return $user;         }     }      I have _Design Patterns_ and _Clean Code_ here next to me, but I'm struggling to find applicable concepts.


title: Write Unit test for heavily-database application?

text: I'm currently developing a Spring-based web-application, in which almost every operation create/update/delete something in the database. The logic mostly about checking condition so as to we should create/update records in the database or not. The reason I want to try unit test is that we often meets regression errors when request changes or refactor. Most the bugs comes from Database changes, when I doesn't fully reflect those changes in the code. I have some experience in web-development now, but it seems that's not enough to stop them appear. My controller/service is actually not too complex. I just take the binding object submited from the HttpRequest, **check the condition** & record in DB. Sometimes the system must read the Database, take out some records & manipulate them, then update some other records.Much of the coding effort lies on the interface(HTML/CSS/Javascript) too. I'm investigating unit test, and I heard that when it comes to database operation, it's no longer unit test, since the test will be slow. Is that true? So that if my project is heavily database-operation, I shouldn't use unit test? I also heard about DBUnit & some in-memory database which can quicken the test. Should I use them? And how I can write good unit test for database operation?


title: What pattern to use for this 'constructor'? Decorator vs Factory?

text: I'm developing a programme to generate LARP characters in java and I've hit a snag. Initially I had planned to use a decorator to iterate through the potential 'roles' (effectively classes), and then from that work out the costs for each skill depending on the combination of roles and store that in the character. I.e you might be a Java Coder/Nerdfighter, if those are your two roles, or you might just have the SysAdmin role etc. I then prototyped out a way to buy a skill that required looking up skills in a data base that contained their name and cost. Here is the snag: If I've preworked out the costs then I don't ever need to look up the database, so no changes in the db are pushed through (if the skill costs on a SysAdmin go down I'd like to know). As well as this, I may only buy a fraction of the available skills so I'll be storing unnecessary data on skill costs, and besides the character should only know about their skills, not all skills. More over, the decorator would only decorate the skill costs, nothing more. Instead I feel I need a factory that has two options for constructing the character, something like:               public static CharacterFactory multiRolePlayerCharacter(Role firstRole, Role secondRole) {         /*Some code goes here*/     }     public static CharacterFactory singleRolePlayerCharacter(Role role) {         /*Some more code goes here*/         }      But this seems far less extensible compared to the decorator. If the game ever changes so that you can multirole morethan twice (and Java Coder/Nerdfighter/SysAdmin is an allowed role) then I need to rework from the top to add a new factory in. Also I don't quite know how each factory differs besides perhaps a flag to say if it's multirole or not, and another variable to hold the secondRole. Which doesn't seem much. So it seems either way I lose: Decorator adds extensibility for the long run whilst bogging my classes/objects down, and Factory will work to start with but will resist change. So how do I know which one to pick? Is there some way to combine the two?   **Edit** : I'm really interested in learning about the _whys_ and _hows_ of this, so I know next time which option to go for.


title: iphone application give up rights

text: Is it possible to give up an iphone application rights to another person or company? I mean, you make an application, you sell it for a while, and then you don't need it anymore and you give or sell it to another person or company to continue develope it. And in this case, how persons who already bought a copy of it can continue to receive next updates? I hope I'm clear.


title: Should I put extension methods of an interface in the interface.cs file?

text: Imagine this set up:               public interface IMass{         double Mass {get;}     }          public static class IMassExtension {         public static double ToKg(this IMass massObject) {             return massObject.Mass / 1000.0;         }              public static double CalculateInteractiveGravity(this IMass massObject, IMass otherMassObject)                   {              return blah;         }     }      Is it ok to put the extension class in the same file as the interface (i.e. IMass.cs) or should it be in a separate file (IMassExtension.cs)? * * * A base class is not possible here. Imagine               public class Person : Animal, IMass {}      and               public class House : Building, IMass {}


title: not checking in from the project root

text: Whenever I do a check-in, I always check in from the **root** of the project... i.e. check in **all** the files in my working copy, so after the check-in the source control repo contains exactly the same set of files that I just finished testing in my local copy. I also make sure my source control is set to flag local files that are **not** under source control. In general, there are **none** of these files... if there are, I either add them to source control or mark them as "ignored". I also check in all my changes together in one check-in. A lot of colleagues check in much differently. They carefully select each file to check in, as if they are a master jeweler selecting only the very best gemstones to set into the royal crown, and they check in each one as a separate check-in. They rely only on their memory to figure out which files need to be checked in, or especially **added** to source control. The results are quite predictable... frequent broken builds because they forget to add their new files to source control or forget to check in a changed file (especially changed project files). I have mentioned this to them and they never seem to change. When I mentioned it to the team lead he said, "this is just a different way of working". To which I may respond: What if I want to drive my car with my eyes closed? Is that just "a different way of driving"? Am I right in being bothered by this practice?


title: What can be the cause of new bugs appearing somewhere else when a known bug is solved?

text: During a discussion, one of my colleagues told that he has some difficulties with his current project while trying to solve bugs. "When I solve one bug, something else stops working elsewhere", he said. I started to think about how this could happen, but can't figure it out.   * I have sometimes similar problems **when I am too tired/sleepy to do the work correctly** and to have an overall view of the part of the code I was working on. Here, the problem seems to be for a few days or weeks, and is not related to the focus of my colleague.   * I can also imagine this problem arising on a **very large project, very badly managed** , where teammates don't have any idea of who does what, and what effect on other's work can have a change they are doing. This is not the case here neither: it's a rather small project with only one developer.   * It can also be an issue with **old, badly maintained and never documented codebase** , where the only developers who can really imagine the consequences of a change had left the company years ago. Here, the project just started, and the developer doesn't use anyone's codebase. So what can be the cause of such issue **on a fresh, small-size codebase written by a single developer who stays focused on his work**? What may help?   * Unit tests (there are none)?   * Proper architecture (I'm pretty sure that the codebase has no architecture at all and was written with no preliminary thinking), requiring the whole refactoring?   * Pair programming?   * Something else?


title: How to ease the maintenance of event driven code?

text: When using an event based component I often feel some pain at maintenance phase. Since the executed code is all split around it can be quite hard to figure what will be all the code part that will be involved at runtime. This can lead to subtle and hard to debug problems when someone adds some new event handlers. Edit from comments: Even with some good practices on-board, like having an application wide event bus and handlers delegating business to other part of the app, there is a moment when the code starts to become hard to read because there is a lot of registered handlers from many different places (especially true when there is a bus). Then sequence diagram starts to look over complex, time spend to figure out what is happening is increasing and debugging session becomes messy (breakpoint on the handlers manager while iterating on handlers, especially joyful with async handler and some filtering on top of it). //////////////   Example I have a service that is retrieving some data on the server. On the client we have a basic component that is calling this service using a callback. To provide extension point to the users of the component and to avoid coupling between different components, we are firing some events: one before the query is sent, one when the answer is coming back and another one in case of a failure. We have a basic set of handlers that are pre-registered which provide the default behavior of the component. Now users of the component (and we are user of the component too) can add some handlers to perform some change on the behavior (modify the query, logs, data analysis, data filtering, data massaging, UI fancy animation, chain multiple sequential queries, whatever). So some handlers must be executed before/after some others and they are registered from a lots of different entry point in the application. After a while, it can happens that a dozen or more handlers are registered, and working with that can be tedious and hazardous. This design emerged because using inheritance was starting to be a complete mess. The event system is used at a kind of composition where you don't know yet what will be your composites. End of example   ////////////// So I'm wondering how other people are tackling this kind of code. Both when writing and reading it. Do you have any methods or tools that let you write and maintain such code without to much pain ?


title: Naming: StartDate or StartDateTime when working with DateTimes

text: I am using a lot of DateTimes in my application. Now I usually name it like StartDateTime, EndDateTime, etc, to imply there is also a time involved. I am getting a bit tired of this (it is tiresome to read), and _most of the time_ it is quite logical there is a time compartment to it anyway. Now I'm thinking about ditching `StartDateTime` in favor of the shorter `StartDate`, despite that there is also a time part included. **Question** What is better: easier to read _vs_ being more explicit about that there is a time included? (ps: I guess this has a lot to do with C# not having separate objects for `Date` and `DateTime`, so that's where the need for Hungarian comes from)


title: Can I do a git merge entirely remotely?

text: My team shares a "work" branch and a "stable" branch. Whenever a particular work branch is approved for further testing/release/etc, we merge it into stable. No code is ever checked directly into the stable branch. Because of this, merge conflicts simply won't happen, and it seems silly to pull down the work branch and the stable branch, merge them, and then push the changes back. Is there a git command to ask a remote git server to commit a merge of two branches that it already knows about?


title: How should I structure a solution for a long term project?

text: I'm about to create a do-everything dashboard for my team and am still having second thoughts about my project/solution structure. Since this could be a long ongoing project, I want to get the structure right from the beginning. This is what I had in mind:   1. Create a solution named "doEverythingDashboard"   2. Delete the project named "doEverythingDashboard" under the solution "doEverythingDashboard"   3. Create winform project named "interface"   4. Create console applications projects for each functionality of "doEverythingDashboard"   5. Reference each console application in "interface" Does this make any sense? Would it make more sense to just have one project and create a class per functionality instead of an entire project?


title: How can I indicate if an object operates with another one in an UML class diagram?

text: Suppose I want to draw a class diagram of a DAO and an Entity. The DAO is used to load instances of the Entity from the database. How can I represent this relationship on my class diagram? Is this considered one? I think it should be displayed on the diagram somehow: ![enter image description here](http://i.stack.imgur.com/HUL9D.jpg) **TL;DR** : should I draw something between them or not?


title: Does a webapp need a connection monitoring feature?

text: I developing a client using Flex and ActionScript that is run in the browser and communicates with our server backend. There has been concern that the application "needs" to have a graphic indicator to show whether the client has a connection to the server or not. Part of the problem of this requirement is that is coming from a high-level perspective that because the interface looks "broken" (i.e. doesn't update properly). I have an idea where the problem is, but that doesn't mean that the error is in the interface. I believe that a connection monitor feature is unnecessary because:   1. Users won't be able to do squat. Our user base is largely non-technical.   2. Flex generates HTTP error events but does not specify what happened. I can't tell what _real_ problem is which could be:      * The user actually has no network connection.     * The application server code is broken in some way.     * The server itself is messed up (i.e. "Oops, I broke the Apache config").     * Server load is too high and becomes unresponsive.     * There is a some other problem (e.g. network or hardware) beyond my or users' control. How do I convince that this feature is not valuable to develop? If it is something worth keeping, what are alternatives to showing a "network status" or server connection problem in the client? I would rather spend the time to dig at the root of the problem and _prevent_ it from happening rather than creating an additional "feature" that doesn't solve anything.


title: Creating crossplatform TCP proxy/gateway that would handle maximum possible clients simultaneously on 1GB ethernet pipe?

text: So what I wonder about is preaty simple - having in mind next architecture:                        -> computing unit "A"             /      gateway --> computing unit "B" same as A             \              -> computing unit "C" same as A      We do not care to which unit to forward request so we should forward them one by one to A than to B than to C and than to A, etc. I wonder in what language, using what framework it is possible to create such crossplatform TCP proxy/gateway (not ethernet card dependent) that would redirect incoming requests into internal nodes via simple rool, and would be capable to get as much as possible from ethernet cable load in/out capabilety - receive and send as much as possible? I started to wonder after I read this nice 2003 article...


title: Who are 'users' in testing?

text: Having e.g. a system for booking flights, during UAT it is not being tested by real users (customers who will buy tickets) rather than people from the client side who will just simulate this. Are there any more specific terms to distinquish between real users (like end user) and users doing the UAT?


title: Writing a simple code validator

text: I know that programming languages can be defined in EBNF which can be converted into regular expressions. Right now I am working on a very simple BASIC interpreter for a project. The code has to be entered in a gui which should validate the syntax to later transfer the code to an embedded system where it is executed. I was googling to find an article or tutorial on writing a validator for this job but I could not really find such a thing. Is it just defining the regular expressions and try to match them? Note: the GUI part is written in Java while the embedded code is written in C++.


title: Main activity design too busy

text: I have a main activity that contains many buttons. I don't want to have a list of buttons like this. I know this looks bad, only cause I threw this together to show you what I have. As you can see, I really don't even have enough room. I don't want a `scrollView` in my main Activity. Does anyone have suggestions on building my activity to look sleek and simple? ![enter image description here](http://i.stack.imgur.com/JrZbM.png)


title: Is there any real benefit to Microsoft's application certification programs?

text: I'm developing a server application and am looking at Windows 2008 R2 **application** certification located here. Does application certification really make a difference to your application? Has anything tangible ever come from it in your experience? Are there any other certifications I should consider?


title: What do I need to make a messaging app?

text: I was wondering how to make a messaging app like whats app? What are the resources I need? What will I need yo know? I want to make it for iPhone's. I know some obj-c but that's really it...


title: Why is local copy writable by default in SVN, but readonly in Perforce/TFS?

text: I have some experience with Perforce, SVN, and TFS. For SVN, The source files were by default writable after synchronization. However, they were readonly for Perforce, as well as TFS if memory served me.   Meanwhile, 'checkout' means source sync for SVN but its meaning is quite different for other popular tools. I'm wondering which is more 'correct' behavior and why these tools behave differently.   Thanks.


title: Trimming script size by using array notation for frequently accessed properties

text: I noticed some redundancy in a script I ran through Google Closure Compiler.               (function(){function g(a){var k;if(a){if(a.call)a.prototype=j,a.prototype[e]={}}else a=     {};var c=a,b,c=(a=c.call?c:null)?new a(a):c;b=c[e]||{};var f=b.extend;b=b.a;var      d=c.hasOwnProperty("constructor")?c.constructor:b?b:f?g.b(f):new Function;if     (f)b=d.prototype,k=new h(h.prototype=f.prototype),f=k,h.prototype={},d.prototype=f,i     (d.prototype,b);i(d,a);i(d.prototype,c);return d.prototype.constructor=d}function i(a,c)     {for(var b in c)c.hasOwnProperty(b)&&"prototype"!=b&&b!=e&&(a[b]=c[b])}var h=new Function,     e="decl-data",j={extend:function(a){return(this[e].extend=a).prototype},a:function(a)     {return(this[e].a=a).prototype}};g.c=function(a){e=a};return g})().b=function(g){return      function(){g.apply(this,arguments)}};      It looks like a big sea of `prototype` and `constructor`, doesn't it? I was was able to get it to about 6/7 of the size of the original by storing "constructor" and "prototype" strings and using array notation everywhere to access prototypes and constructors. The size savings should grow as the size of the script grows. Here's what it looks like after the change:               (function(b,h){function i(a){a?a.call&&(a[b]=l,a[b][f]={}):a={};var d=a,c,d=(a=d.call?     d:null)?new a(a):d;c=d[f]||{};var g=c.extend;c=c.a;var e=d.hasOwnProperty(h)?d[h]:c?c:g?i.b     (g):new Function;if(g){c=e[b];var m=b,g=new j(j[b]=g[b]);j[b]={};e[m]=g;k(e[b],c)}k(e,a);k(e     [b],d);return e[b][h]=e}function k(a,d){for(var c in d)d.hasOwnProperty(c)&&c!=b&&c!=f&&(a     [c]=d[c])}var j=new Function,f="decl-data",l={extend:function(a){return(this[f].extend=a)     [b]},a:function(a){return(this[f].a=a)[b]}};i.c=function(a){f=a};return i})     ("prototype","constructor").b=function(b){return function(){b.apply(this,arguments)}};      Is it worth it to **damage readability to save a few bytes?** It's hard to know when to stop... `hasOwnProperty` only appears twice, I might use it once more. So, should I replace `.hasOwnProperty` with `[_has]`? Should I just stop here? Or should I put it back the way it was, and not worry about the few extra bytes? On the other hand, **maybe this doesn't damage readability** at all, and could just be looked at as convenient shortcuts. Another alternative would be abstracting the behavior **using macros** ; write `.prototype` and have it converted to `[_p]` at build time, of course declaring `_p` somewhere. But that seems overly complicated for a relatively minor size optimization. Speaking of which, I wonder why closure-compiler doesn't do something like this already? I'm curious what the community thinks about this. * * * For reference, the un-minified source before the size optimization:               var decl = (function(){          var Clone = new Function(), // dummy function for prototypal cloning         /** dataKey                  The name of the property where declaration objects'              metadata will be stored. If you want to pass objects to decl              instead of functions, put the metadata (parent, partial, etc.)              in this property.         */         dataKey = 'decl-data',              /** proto                  This object is used as a prototype for declaration objects,             so all properties are available as properties of `this`             inside the body of each declaration function.              */         proto = {                /** extend                    Perform prototypal inheritance by calling `this.extend(ParentCtor)`               within your decalration function.                    @param {Function} ctor to extend.                    @return {Object} prototype of parent ctor.           */           extend: function (ctor) {              return (this[dataKey].extend=ctor).prototype;            },                /** augment                    Finish a partial declaration.               TODO: test for bugs, possibly retroactively fix child classes when augmenting parent.                    @param {Function} ctor to augment.                    @return {Object} prototype of partial ctor.           */           augment: function (ctor) {              return (this[dataKey].augment=ctor).prototype;            }              };               /** decl              Create a prototype object and return its constructor.              @param {Function|Object} declaration     */     function decl (declaration) {       if (!declaration) {         declaration = {};       }       else if (declaration.call) {         declaration.prototype=proto;         declaration.prototype[dataKey]={};       }       return getCtor(declaration);     }          /** setDataKey              Sets the name of the property where declaration objects'          metadata will be stored. If you want to pass objects to decl          instead of functions, put the metadata (parent, partial, etc.)          in this property.              @param {String} String value to use for dataKey     */     decl.setDataKey = function (value) { dataKey=value; };          /** clone              Create a copy of a simple object.              @param {Object} obj              @return {Object} clone of obj.          */     function clone (object) {       var r=new Clone(Clone.prototype=object);       Clone.prototype={};       return r;     };          /** merge              Merge src object's properties into target object.              @param {Object} target object to merge properties into.              @param {Object} src object to merge properties from.              @return {Object} target for chaining.          */     function merge (target, src) {        for (var k in src) {         if (src.hasOwnProperty(k) && k!='prototype' && k!=dataKey) {             target[k] = src[k];         }       }       return target;     };          /** getCtor              Prepare a constructor to be returned by decl.              @param {Function|Object} declaration              @return {Function} constructor.          */     function getCtor (declaration) {           var oldProto,           declFn = declaration.call ? declaration : null,           declObj = declFn ? new declFn(declFn) : declaration,            data = declObj[dataKey] || {},           parent = data.extend, partial = data.augment,            ctor =  // user-defined ctor                    declObj.hasOwnProperty('constructor') ? declObj.constructor :                    // ctor already defined (partial)                     partial ? partial :                    // generated wrapper for parent ctor                   parent ? decl.wrap(parent) :                    // generated empty function                   new Function();             // If there's a parent constructor, use a clone of its prototype       // and copy the properties from the current prototype.       if (parent) {         oldProto = ctor.prototype;         ctor.prototype = clone(parent.prototype);         merge(ctor.prototype, oldProto);       }            // Merge the declaration function's properties into the constructor.       // This allows adding properties to `this.constructor` in the declaration function       // without defining a constructor, or before defining one.       merge(ctor, declFn);            // Merge the declaration objects's properties into the prototype.       merge(ctor.prototype, declObj);            // Have the constructor reference itself in its prototype, and return it.       return (ctor.prototype.constructor=ctor);     };          return decl;          }());          // This is outside of the main closure so wrapper functions     // will have as short a lookup chain as possible.          /** wrap              Generate wrapper for parent constructor.              @param {Function} parent constructor to wrap.              @return {Function} child constructor.          */     decl.wrap = function (parent) {       return function(){ parent.apply(this, arguments); };     };      And after:               var decl = (function(_p, _c){          var Clone = new Function(), // dummy function for prototypal cloning              /** dataKey                  The name of the property where declaration objects'              metadata will be stored. If you want to pass objects to decl              instead of functions, put the metadata (parent, partial, etc.)              in this property.         */         dataKey = 'decl-data',              /** proto                  This object is used as a prototype for declaration objects,             so all properties are available as properties of `this`             inside the body of each declaration function.              */         proto = {                /** extend                    Perform prototypal inheritance by calling `this.extend(ParentCtor)`               within your decalration function.                    @param {Function} ctor to extend.                    @return {Object} prototype of parent ctor.           */           extend: function (ctor) {              return (this[dataKey].extend=ctor)[_p];            },                /** augment                    Finish a partial declaration.               TODO: test for bugs, possibly retroactively fix child classes when augmenting parent.                    @param {Function} ctor to augment.                    @return {Object} prototype of partial ctor.           */           augment: function (ctor) {              return (this[dataKey].augment=ctor)[_p];            }              };               /** decl              Create a prototype object and return its constructor.              @param {Function|Object} declaration     */     function decl (declaration) {       if (!declaration) {         declaration = {};       }       else if (declaration.call) {         declaration[_p]=proto;         declaration[_p][dataKey]={};       }       return getCtor(declaration);     }          /** setDataKey              Sets the name of the property where declaration objects'          metadata will be stored. If you want to pass objects to decl          instead of functions, put the metadata (parent, partial, etc.)          in this property.              @param {String} String value to use for dataKey     */     decl.setDataKey = function (value) { dataKey=value; };          /** clone              Create a copy of a simple object.              @param {Object} obj              @return {Object} clone of obj.          */     function clone (object) {       var r=new Clone(Clone[_p]=object);       Clone[_p]={};       return r;     };          /** merge              Merge src object's properties into target object.              @param {Object} target object to merge properties into.              @param {Object} src object to merge properties from.              @return {Object} target for chaining.          */     function merge (target, src) {        for (var k in src) {         if (src.hasOwnProperty(k) && k!=_p && k!=dataKey) {             target[k] = src[k];         }       }       return target;     };          /** getCtor              Prepare a constructor to be returned by decl.              @param {Function|Object} declaration              @return {Function} constructor.          */     function getCtor (declaration) {           var oldProto,           declFn = declaration.call ? declaration : null,           declObj = declFn ? new declFn(declFn) : declaration,            data = declObj[dataKey] || {},           parent = data.extend, partial = data.augment,            ctor =  // user-defined ctor                    declObj.hasOwnProperty(_c) ? declObj[_c] :                    // ctor already defined (partial)                     partial ? partial :                    // generated wrapper for parent ctor                   parent ? decl.wrap(parent) :                    // generated empty function                   new Function();             // If there's a parent constructor, use a clone of its prototype       // and copy the properties from the current prototype.       if (parent) {         oldProto = ctor[_p];         ctor[_p] = clone(parent[_p]);         merge(ctor[_p], oldProto);       }            // Merge the declaration function's properties into the constructor.       // This allows adding properties to `this.constructor` in the declaration function       // without defining a constructor, or before defining one.       merge(ctor, declFn);            // Merge the declaration objects's properties into the prototype.       merge(ctor[_p], declObj);            // Have the constructor reference itself in its prototype, and return it.       return (ctor[_p][_c]=ctor);     };          return decl;          }('prototype', 'constructor'));          // This is outside of the main closure so wrapper functions     // will have as short a lookup chain as possible.          /** wrap              Generate wrapper for parent constructor.              @param {Function} parent constructor to wrap.              @return {Function} child constructor.          */     decl.wrap = function (parent) {       return function(){ parent.apply(this, arguments); };     };


title: Agile for the Solo Developer

text: How would someone implement Agile process concepts as a solo developer? Agile seems useful for getting applications developed at a faster pace, but it also seems very team oriented...


title: Using Agile development in a one person team

text: > **Possible Duplicate:**   >  Agile for the Solo Developer I am going to be starting a project soon and plan to use as much of agile methods as I can (CI, TDD etc.). What have been people's experiences doing agile development when working solo? I want to get good practices in place now while its a one person team so when I scale up to having several people the basics are in place.


title: Agile methodology for a single developer working on a prototype

text: > **Possible Duplicate:**   >  Agile for the Solo Developer For my thesis I will be working on a user interface prototype during a 6 month period. I am required to pick a strategy and create a precise planning. While reading through different descriptions of agile methodologies I felt like I'm in buzz-word heaven. Instead of just picking one because it's famous, I was hoping someone could give some insight into which one/or which parts of it might be useful. Are there any agile methodologies specifically suitable (or scalable) for single developers?


title: How can a single developer make use of Agile Methods?

text: I am a freelancer and work as a single developer. In all cases, I am the person wearing different hats. I am the Scrum Master and I am the only person in the development. What I am not is the Product Owner? Are there any Agile Methods and free tools that a freelancer can make use of?


title: How can a single person use agile method? for software application

text: I am looking to do a personal project on a web application. on my methods section I'm finding it difficult to choose just one Agile Method so here is the list I am trying to combine those or just a few of those to one method that works best for me.   * Scrum (I noticed for this one it requires a team of minimum of seven)   * XP (Extreme Programming)   * Crystal   * FDD (Feature dive n development)   * DSDM (Dynamic System Development Method)   * Adaptive Software Development   * RUP (Rational Unified Process) for example I was thinking something like split from scrum simple design (KISS) from eXtreme Programming only 19 weeks for this project so DSDM and TIMEBOXING USE cases etc.?


title: Whats the best way to build a HTML/AJAX site that requires login?

text: Let's say that hypothetically you wanted to build a website that delivered content to the visitors entirely using HTML and Javascript (AJAX to fetch server side data). The site would require login for certain functions. Let's also say, for the sake of discussion, you have the ability to create necessary web service methods that would be called from AJAX (for authenticating a user, getting data from a database, etc). What would be the best way to implement this site? Would there be any advantages / drawbacks compared to building a site using a server side language like ASP.NET or PHP? **EDIT 1** First, thanks to everyone that has replied so far. I didn't properly phrase my question so I'm getting responses that aren't addressing my question. I've built many sites using traditional methods - a database backend and a frontend that was a mix of server side languages (.NET or PHP) and client side scripting JavaScript / jQuery. Let's say I'm going to build an environment that has a database server, a web services server, and a web server. My web services server has all the methods I need to interact with the database (authentication, CRUD operations, reporting, etc). The web server does not support any server side languages (like PHP or ASP.NET). I know it would be possible to build the site entirely in HTML, CSS, and JavaScript (jQuery). A user could be authenticated via AJAX, the authentication token could be stored in a cookie, and then token could be used on all subsequent AJAX requests. My questions are:   1. What would be the advantages / drawbacks of such an approach?   2. What challenges would be faced with authentication and security?   3. Would this solve any of the problems typically faced when building a website?   4. If your boss was asking you to use this environment, would you argue against it? Why or why not?


title: Tips and Tricks on Web Page Design on ASP.NET MVC (Razor Syntax)

text: I am a newbie in web development and have started studying ASP.NET MVC. I noticed that cshtml replaces aspx when using Razor syntax and design view is not supported. Now designing ASP.NET MVC webpages is difficult without design view. How do you handle your web page fesigns in your projects without it?


title: Reading CSV files located on a Linux server and updating the tables in a SQL Server database

text: I was wondering how we could ingest CSV files located on a Red Hat Linux server into SQL Server database tables. I know we can write a stored procedure/bulk insert to read the files that are located on the same Windows server as SQL Server and update the database, but not sure how to do it when the files are present on a Linux server. Any help would be greatly appreciated.


title: Good naming convention for named branches in {DVCS} of your choice

text: We're integrating Mercurial slowly in our office and doing web-development we started using named branches. We haven't quite found a good convention as far as naming our branches though. We tried:   * FeatureName (Can see this causing problem down the line)   * DEVInitial_FeatureName (Could get confusing when developer come and go down the line)   * {uniqueID (int)}_Feature So far the uniqueID_featureName is winning, we are thinking of maintaining it in a small DB just for reference. It would have: branchID(int), featureName(varchar), featureDescription(varchar), date, who etc... This would give us branches like: 1_NewWhizBangFeature, 2_NowWithMoreFoo, ... and we would have an easy reference as to what that branch does without having to check the log. Any better solution out there?


title: Prefer class members or passing arguments between internal methods?

text: Suppose within the private portion of a class there is a value which is utilized by multiple private methods. Do people prefer having this defined as a member variable for the class or passing it as an argument to each of the methods - and why? On one hand I could see an argument to be made that reducing state (ie member variables) in a class is generally a good thing, although if the same value is being repeatedly used throughout a class' methods it seems like that would be an ideal candidate for representation as state for the class to make the code visibly cleaner if nothing else. Edit: To clarify some of the comments/questions that were raised, I'm not talking about constants and this isn't relating to any particular case rather just a hypothetical that I was talking to some other people about. Ignoring the OOP angle for a moment, the particular use case that I had in mind was the following (assume pass by reference just to make the pseudocode cleaner)               int x     doSomething(x)     doAnotherThing(x)     doYetAnotherThing(x)     doSomethingElse(x)      So what I mean is that there's some variable that is common between multiple functions - in the case I had in mind it was due to chaining of smaller functions. In an OOP system, if these were all methods of a class (say due to refactoring via extracting methods from a large method), that variable could be passed around them all or it could be a class member.


title: What is the definition of pointer?

text: Conceptually a "pointer" is just something that "points" to something else;Is this definition is sufficient to tell exactly what a pointer is in programing languages? Does it need to have any other features? Programmers who come from specific language may have pre-conceived ideas of what constitutes a 'pointer' based on how it is used in the language So let say if he is from **c/c++** language, he say's pointers supports pointer arithmetic.Is pointer arithmetic an essential feature of a pointer? **Go** has pointers and does not support pointer arithmetic. Is the ability to "dereference" the pointer essential to the concept of a pointer? So what is the precise definition of a pointer that I can give as an answer, irrespective of any specific programming language?


title: When does switching to a framework mid-project make sense?

text: Some of my friends and I started a PHP project some weeks ago. In the beginning, I suggested we use a PHP framework such as CodeIgniter or Zend. But my friends wanted to start clean and without the overhead or extra complexity. But as time has passed, the project has become more and more complex. At first, we wrote all the code in the view files, in code blocks before the HTML output. Eventually, we changed direction and started to use controllers that did most of the work. But as you can see there is a coding difference here. At this point, we're trying to determine how to proceed before the project becomes more complex. When does it make sense to start over and use a framework? Or is it possible to formulate a simple way to introduce an MVC pattern to our existing code without having to start from scratch?


title: What should I do when my project manager does not care about implementation details?

text: My project manager, when providing requirements for specific tasks, does not care about the implementation details. Although he has a programming background and has some knowledge of the MVC framework, he does not consider the perspective of the developer. For example, I was given a task to create a simple form in ASP.NET MVC. This form should be pluggable - that is, the customer should choose which fields do or do not exist and which fields are required. If this were a simple form with validation, I would easily be able to implement it using ASP.NET validations. However, the problem is not simple and requires design and architecture first. The time that I have to implement the solution, which is not well understood, is very restricted. Not having sufficient time will not let me come upwith a solution that meets the requirements, but also benefits myself and any future developers. What should I do in this situation? Do you feel that given requirements in the example can be expected from a single developer?


title: Should newbies use IDE autocomplete (Intellisense)?

text: I often encounter this when I am helping out someone who is new to programming and learning it for the first time. I'm talking about really new newbies, still learning about OOness, constructing objects, method calls and stuff like that. Usually, they have the keyboard and I am just offering guidance. On the one hand, the autocomplete feature of the IDEs helps to give them feedback that they are doing it right and they quickly get to like and rely on it. On the other hand, I fear that early dependence on the IDE autocomplete would make them not really understand the concepts or be able to function if they one day find themselves only with a simple editor. Can anyone with more experience in this regard please share their opinion? Which is better for a newbie, autocomplete or manual typing? **Update** Thanks for the input everyone! Many answers seem to focus on the main use of autocomplete, like completing methods, providing methods lookup and documentation etc. But IDEs nowadays do a lot more like.   * When creating an object of List type, an IDE autocompletes to new ArrayList on right hand side. It may not be immediately clear to a newbie why it cannot be new List, but hey it works, so they move on.   * Filling method parameters based on local variables in context.   * Performing object casts   * Automatically adding 'import' or 'using' statements and much more. These are the kinds of things I mean. Remember I'm talking about people who are doing Programming 101, really just starting. I have watched the IDE do these things which they have no idea about, but they just carry on. One could argue that it helps them focus on program flow and getting the hang of things first before going in-depth and understanding the nuances of the language, but I'm not sure.