Using Mock for event listeners in unit-testing

I keep getting to test this kind of code (language irrelevant) :               public class Foo() {             public Foo(IDependency1 dep1) {           this.dep1 = dep1;        }             public void setUpListeners() {           this.dep1.addSomeEventListener(.... some listener code ...);        }     }      Typically, you want to test what when the dependency fires the event, the class under tests reacts appropriately (in some situation, the _only_ purpose of such classes is to wire lots of other components, that can be independently tested. So far, to test this, I always end up doing something like :   * creating a 'stub' that implements both a `addXXXXListener`, that simply stores the callback, and a `fireXXXX`, that simply calls any registered listener. This is a bit tedious since you have to create the mock with the right interface, but that can do   * use an introspective framework that can 'spy' on a method, and inject the real dependency in tests Is there a cleaner way to do this kind of things ? EDIT : to clarify what I mean, my trouble is that if I could write something like this :               public class FooTest() {            public void testListensToDependencies() {             IDependency mockDependency = createMock(IDependency.class)             Foo tested = new Foo(mockDependency);        tested.setUpListeners();             expect(mockDependency.addSomeEventListener).toHaveBeenCalled();            }     }      However, obviously this test would pass _no matter what the listener does_. This is troubling me, since I want to test that I am wiring my objects to do the proper thing. The next best thing would be : public class Foo() {                 public Foo(IDependency1 deps) { .... }            public void setUpListeners() {               // In a language with first class function :           this.dep1.addSomeEventListener(this.handleSomeEvent);                      // In a language without it :           this.dep1.addSomeEventListener(new Foo.SomeEventHandler());       }      And then I would write tests to :   * check that the 'addSomeEventListener' was called either with the right handler function, or with an instance of the right event handler class   * check that the handler function, or the event handler class, actually implement the expected behavior.  Now I am not sure if that would be clearer, or if it is the sign I'm wiring my objects at the wrong place....


What does the latest "C++ Renaissance" mean?

There's recently some voice about C++ renaissance, among which the most noteworthy one is from Herb Sutter, Chairman of the C++ Standard Committee. You can search for "C++ renaissance" on Google and you'd find a bunch of links including Herb's talk on "C++ and Beyond" and other talks on Channel9 from Microsoft. The key argument here is that with the Cloud trend becoming clearer and more popular than ever, a lot of the dev work on the cloud side calls for high- performance native languages, which on some level, basically means C/C++. I don't mean to start again some flame war about C vs C++. But I do want to know to what extent does this trend affect the growing and expanding of C++ community and popularity. How exactly are C++ used on the cloud side? high-perf backend? more? How large, exactly, is the Cloud dev market anyway? P.S. I've been lucky to be able to use C++0x in my project recently, and it _is_ *awesome* (VC++10). The most useful feature for everyday programming is of course lambda. And the second I would say is rvalue reference (I finally had the courage to return vector!!) Below are Herb's words C++ and Beyond: > I’ve been asked to give the opening “Welcome, Everyone!” talk at C&B 2011, > and it’s time to cover an increasingly open secret: After a decade-long > affair with managed languages where it became unfashionable to be interested > in C++, C++’s power and efficiency are now getting very fashionable again. > At the same time, C++ has been getting easier to use; key productivity > features from the C++0x standard (aka C++11), like auto and lambdas, are > increasingly widely available in commercial compilers and making using C++ > easier than ever before without sacrificing its cornerstone — efficiency. > > This opening 40-minute talk covers the reasons why C++ is now enjoying a > major renaissance, and why that will continue to grow over the next few > years because of industry trends from processor design to mobile computing > to cloud and datacenter environments. > > We already know that C++ is “the” language of choice for demanding > applications. Here, we’ll cover why “demanding applications” increasingly > means “most applications” and will be the bread and butter of our industry > for the foreseeable future. We’ll see why and where other languages are > still appropriate, but why C++’s applicability and demand is now again on an > upswing more so than it has been for over a decade.


Is SOA an Utopia?

I have attended to many SOA related sales pitches and presentations through the years. SOA projects have died because of lack of interest or because of grandiose scopes. The very buzzword has lost momentum. Has someone seen SOA implemented ? Or is it a kind of utopian vision one must strive for ? Do one have to believe in SOA without touching it or having seen it ?


Front-End Java Web App Framework

I have not done web development in Java for the past three years and now I need to use one for a project I am working on. I am thinking of using Seam, Flex + BlazeDS, Struts2 or Spring MVC. The most attractive of the four is Flex, however I am trying to stay away from it since the app will end up being entirely in Flash. Struts2 and Seam are mature but might require more time to learn. I had basic experience with Spring framework in the past so I am also considering its MVC. Should I use one of these or go for some other framework?


Using Completed User Stories to Estimate Future User Stories

In Scrum/Agile, the complexity of a user story can be estimated in story points. After completing some user stories, a programmer or team of programmers can use those experiences to better estimate how much time it might take to complete a future user story. **Is there a methodology for breaking down the complexity of user stories into quantifiable or quantifiable attributes?** For example, User Story X requires a rich, new view in the GUI, but User Story X can perform most of its functionality using existing business logic on the server. On a scale of 1 to 10, User Story X has a complexity of 7 on the client and a complexity of 2 on the server. After User Story X is completed, someone asks how long would it take to complete User Story Y, which has a complexity of 3 on the client and 6 on the server. Looking at how long it took to complete User Story X, we can make an educated estimate on how long it might take to complete User Story Y. I can imagine some other details:   * The complexity of one attribute (such as complexity of client) could have sub-attributes, such as number of steps in a sequence, function points, etc.   * Several other attributes that could be considered as well, such as the programmer's familiarity with the system or the number of components/interfaces involved   * These attributes could be accumulated into some sort of user story checklist. To reiterate: **is there an existing methodology for decomposing the complexity of a user story into complexity of attributes/sub-attributes,** or is using completed user stories as indicators in estimating future user stories more of an informal process?


Using a random string to authenticate HMAC?

I am designing a simple webservice and want to use HMAC for authentication to the service. For the purpose of this question we have:   * a web service at example.com   * a secret key shared between a user and the server [K]   * a consumer ID which is known to the user and the server (but is not necessarily secret) [D]   * a message which we wish to send to the server [M] The standard HMAC implementation would involve using the secret key [K] and the message [M] to create the hash [H], but I am running into issues with this. The message [M] can be quite long and tends to be read from a file. I have found its very difficult to produce a correct hash consistently across multiple operating systems and programming languages because of hidden characters which make it into various file formats. This is of course bad implementation on the client side (100%), but I would like this webservice to be easily accessible and not have trouble with different file formats. I was thinking of an alternative, which would allow the use a short (5-10 char) random string [R] rather than the message for autentication, e.g.               H = HMAC(K,R)      The user then passes the random string to the server and the server checks the HMAC server side (using random string + shared secret). As far as I can see, this produces the following issues:   * There is no message integrity - this is ok message integrity is **not** important for this service   * A user could re-use the hash with a different message - I can see 2 ways around this      1. Combine the random string with a timestamp so the hash is only valid for a set period of time     2. Only allow each random string to be used once   * Since the client is in control of the random string, it is easier to look for collisions I should point out that the principle reason for authentication is to implement rate limiting on the API service. There is zero need for message integrity, and its not a big deal if someone can forge a single request (but it is if they can forge a very large number very quickly). I know that the **correct** answer is to make sure the message [M] is the same on all platforms/languages before hashing it. But, taking that out of the equation, is the above proposal an acceptable 2nd best?


Is this technique a design pattern? If so, what's it called?

I'll use C# as an example, but it should apply globally. Say I have a string value that should be one of a few constants, but I also want the client to set which string value to use so:               private int foo;     private string bar;          public int Foo {         get { return foo; }         set         {             foo = value;             bar = getStringValueFromDatabase(value);         }     }          public string Bar { get { return bar; } }      I use this technique quite a lot and want to know if it's considered as any formal concept.


ruby for desktop app or web app development

i am a beginner to ruby . i just did some minor research about why RUBY ? why choose RUBY ? whats new in it. Whenever i do type in a word RUBY in google search there comes a suggestion like RUBY on RAILS . so my mind changed to learn stuffs about ruby on rails. I went through some forums but got the same answer from everyone. RUBY ON RAILS is a web development FRAMEWORK . once again i learnt stuffs about what a framework is. There are lot of questions which is u know like itching my mind.Varieties of answer from everyone. i dont know which is the right one. first if anyone wish to give me a reply .. tell me solution for this. just like java we run ruby programs in command prompt by moving to the directory in cmd where ruby is installed.it is similar to java. so can we create a desktop application by using it.i mean like a file searching program which is default in windows . We can create the same file searching program using java swing and playing with some string functions isn't it? can we do the same with ruby .? thats my first one. i will raise doubts on ruby on rails after i get cleared about the above question.


Becoming a part-time freelancer

I have a full time job as a senior software developer. It pays well but the work is unsatisfying for many reasons. I often daydream about going freelance but don't want to throw away a stable paycheck without dipping my toe in the freelancing water first. I have recently developed a commercial-grade application in my spare time so have a healthy respect for the kind of lifestyle having two jobs can lead to but the experience has also given me the confidence that I can pull it off, at least for a while. I joined eLance but was quickly disheartened by the number of bids at very low prices by well established studios and teams of programmers with good ratings. How can I compete with other freelancers if I am only willing to work evenings and weekends? I can prepare a solid portfolio which will certainly give me an advantage over 'sweatshops' in third world countries but I still struggle to see why anyone would employ me when they could get their project completed in less time by employing a full-time developer or a dedicated studio. Should I 'fail to mention' that I already have a full time job? This doesn't seem honest though, and I don't want freelance contractors phoning me while I'm at work. I'm willing to work for cheap at first. Contracting and travelling are out of the question. Where can I find part-time programming work from home?


Do employers and headhunters maintain a database somewhere about programmers?

Is there a website that is being maintained somewhere in which trash talk and nasty allegations about workers are entered by employers and headhunters sort of like a reverse glassdoor.com? I ask this as a worker, NOT as an employer.


Application Architecture

first of all I am new here and I hope that this is the right place for my question. I have a question about the recommended architecture of a project. IDEA: Automate some calculations concerning to aerodynamics. I have some input data and I need to process this data in several sub-calculations. You can see such a calculation somehow like a black box: INPUT => CALCULATION => RESULTS Some of these calculations are already available as open source programs and some of them I need to program on my own. This shouldn't be a problem at all. But I want to connect these calculations in a flexible way. For example: INPUT => CALCULATION 1 => CALCULATION 2 => CALCULATION 3 => RESULTS Number and order of calculations should be changeable. Should I see each calculation as standalone program and connect them in a kind of framework where I can specify order and arguments of program calls? Or are there other techniques to solve problems like this? Thanks a lot for each advice and every recommendation. Sebastian


Communication between View and Model

I have a basic issue with the MVC architecture. I am aware that the View usually listens to the Model. But how are user requests propagated to the Model? Currently I do it like this, when the user clicks e.g. the update Button in the GUI. So the `ActionListener` calls a method of the View. The View calls a method of the Controller. And the Controller calls a method of the Model. But I have three concedrns about this.   * The View must be aware of the Controller.   * The long call chain seem to be not the right way   * With the number of user actions, the number of those call chains increase. What are the best practises here?


What is a Service Locator?

I've heard the term pop all around. I've read various articles regarding the subject and heard two main definitions to the term "Service Location":   1. A glorified Registry - Bad practice, global variables, general evil.   2. A type of Dependency Injection Container - Can help with managing dependencies, making modular and extensible applications, generally helpful. But I can't differentiate between the two. What does a Service Location really means? Can you give a simple example of a Service Locator? Is it good or evil?


JavaScript codes complexity and maintainability

I am trying to make my way back to JavaScript (been there last time some 7 years ago) with the help of lovely "Eloquent JavaScript" book. While I admire author's capabilities and approach, I have also began being concerned. I am from C/C++ background and there I learnt it rather hard way that funky constructs often undermine project survival. Experience with the Perl proved different. Being capable of cool tricks seemed a valuable perk. **So, what is the common view upon JavaScript code complexity. Does using it at "full speed" (OOP done own way, higher order functions everywhere etc) help having maintainable projects?** Thanks for your answers


Is speed a parameter for responding emails of technical tests?

I am sending my CV to different companies and some of them have replied asking me to complete a test to have an idea of my skills. I wonder if the time to respond to this email is key factor for being selected? I have a job now and I need to take my spare time to answer that questions. So, I don't know if I should take time to respond the questions carefully or try to respond them in the same day, even is that implies not to sleep too much that night.


Which CSS attributes should be in HTML and which in BODY?

I have the following:               html {     overflow-y: scroll;     }          body {     font-family: Georgia, "Times New Roman", serif;     font-size: 1.125em;     line-height: 1.5em;     margin: 0 auto;     max-width: 41em;     }      Which attributes should be with the HTML section, and which within the BODY section?


What tools can I use for professional document-creation and -printing in PHP?

I'm in the process of building a new pledge management system for one of my clients, a charity foundation. I have already built one for them (it was done using Delphi), but its feature-set is a little limited. Now, I have decided to move to PHP and use the Laravel framework to manage the database for the new system - its Eloquent ORM allows me to easily implement new features that are needed at present. This is good and well – I know everything that I need to do there. However, I am not sure which direction to take for when it comes to creating, saving, and printing documents that will be hand-delivered to donors. At the moment, it used Word to process documents - i.e. creating invoices, letters of appreciation, and any other templates that may be selected during a pledge submission. The thing is, I am not extremely happy with the implementation, and don’t believe this is the best route to take. There have been times where the documents did not print correctly, or multiple documents where printed (where only one was needed). Nonetheless, I could stick to Word, provided that PHP can handle it properly and show me progress as it goes along (i.e. **Opening Word** -> **Opening Invoice Template (companies)** -> **Replacing Variables** -> **Saving** -> **Printing** -> **Closing** -> **Opening Food Project Mission Statement** -> **Replacing Variables** \- > **Saving** -> **Printing** -> **Closing** … etc.). I guess that progress notifications are not necessary, but I would like to have them there - just in case it freezes, the user would be able to see whatever it may be struggling with. I would assume that I could do this using a jQuery script (with AJAX) that interfaces with a PHP script, but I honestly have no idea how to do it. (Note: I’d have to use AJAX as Laravel uses buffered output.) I also know that I could pass the information about a pledge to an EXE which would handle the printing on its own, but I don’t think I want to use this implementation as I have plans to make the system cross-platform. **Question 1:** Is there a package for PHP that allows me to create documents, save them, and then print them? If not, is there a suitable package that handles Word without difficulty, and with a large array of features? If it is the latter, I would need to be able to access the full COM API so that I can prevent dialogs from popping up in the background and pausing the procedure. **Question 2:** Is there a package (jQuery, AJAX) available that would allow me to track the progress of the document-creation procedure? **EDIT** Having reconsidered everything, and weighed the pro's and con's, I would like to put emphasis on **printing** here. When the user submits a pledge to the database, I need the document to print immediately. I do not necessarily want to focus on a document creation tool only. The reason I asked my question as I did is because I would, ideally, like to find something that can do both the creation and printing of each document. In addition, I do not want to make it too difficult for myself. This is why I originally chose Word - and, it was a lot easier to manage from a Delphi application. Because of this, I will be leaving the question open (just in case something very interesting is proposed), but will be asking a new question that is a little more specific to the problem that this question originated from. (To those who have answered so far, thank you for your help and showing me the various options.)


How do you handle time series .Net?

I have been looking for Time Series models over in SO, but I figured this place was the best site to actually ask the question. I am wondering what is the "best" way to handle Time Series in .Net. First, I would define a Time Series as a mapping of different `DateTime` with a single value of type `T`. The value can possibly be `null`. Several methods should be available so that the series can be manipulated easily. For example, you want to be able to `Filter` the data (based on criteria on dates and/or on values). You would also like to have an `Apply` method, which applies a given function to all the values. Ideally, you would be willing to run some of these functions in parallel to increase performance. Several data structures already implement such features, such as a `Dictionary<DateTime,T>`, possibly even a `SortedDictionary<DateTime,T>`. However, these are mutable structures, which can be an issue if there are some closure effects. Which model would/did you use? Do you know an existing library already widely used for this matter?


Encapsulating a single property

If you have a single property that is relevant across a full project, but you should logically have only a single representation of, how would you represent this? In my case, I am developing a simple drawing app where the user can select a colour. This colour should then be available to all the pen/shape classes in the project. Would I simple just have a static class with a static property of Color CurrentColor (C#), that each client class could then call, or is there a more effective way?


Spring Controllers and Services

we are at the middle of a project. It's a REST Service. Now we have controllers to handle the Requestmappings and the forwarding to the Services. A concrete example we have a UserController, GroupController, UserService and a GroupService. The user controller has as injection the UserService and the GroupController has as injection the GroupService. (one to one dependency) When I create/update/delete a user then the scenario is simple: userControllers tells the userService and it do this. Now the system has a lot of other controller/services that are going to be added. But what I don't know is: what is the best way when I have to to mix user/group action? For example: I have to add a user in a group. But I must check that the user exists, that the group exists and after save the information in the user (Entity/DTO) that the user is now port of this group. 1) schould I manage all from the userController: -userService.checkUser() -groupService.checkGroup() -userService.updateUser() 2) or schould I manage al from the userService: -userService.addUser() (in the userService then: -checkUser() -checkGroup() -updateUser() ) In the solution 1 what I don't like is the injection of some other Services that not belongs to users In the solution 2 I have the idea that I'm going to replicate concepts that exists on the groupServices... The exapmle above is only a litle part of the great picture. But that what i would understand is how can I design this part to don't have a lot dependency and a lot of code replication?


Need help understanding reference operator(C++) in specific functions

In the current semester at the university we are working on OOP with C++.   I would like to understand the difference between a pointer and a reference operator. The differences that I understand are:   1\. Cannot change the object that the reference variable is binded to   2\. we can use the reference variables to refer to the binded object without having to type the & operator (in contrast with the pointers where we would write *pi = 5;) Also,does a reference variable contain the address of the object that is binded to?   In example:               int i;     int &ri = i;       Here ri contains the address of i? And the reason why when overloading ++ operator in this example of enumeration we are using the dereference or reference(*) operators before the name of the function.


Exception handling in WIn Forms application

When handling exceptions for example in a method in my presentation logic, is it ok to catch all possible exceptions in a one catch block as follows if the only purpose here is alerting the user.               private void Do()     {         try         {             //  Do some stuff here which might throw an exception         }         catch (Exception e)         {             MessageBox.Show(e.Message);         }     }      Or else should we always catch every possible exceptions (like `OutOfMemoryException`, `NullReferenceException` etc. followed by more generalized exceptions) in separate catch blocks ? Since the information in e.message is not relevant for average users, we could do like               MessageBox.Show("Exception occurred and contact system administrator");      Is that the standard way ? NOTE : My sole purpose is to alert user and try to keep the system up (with out crashing)


How can "hash functions" be used to implement hash maps at all?

My understandment is that hash maps allow us to link, say, a string, to certain memory location. But if every string were to be linked to a unique place in memory it would need a huge block of empty memory. I don't get it.


Best way to let users/visitors alter the website design

What I am trying to do is give the users/visitors the option to alter the whole website based on their taste. So they can move for example the sticky bar from top to bottom, alter background colors, news box from left to right etc. For users I will probably store all the information in the DB but I am not sure how I should handle this afterward. Should I store all the settings into a cookie instead of grabbing that info from the DB all the time and "rebuilding" the website based on their taste or do you have any other idea?


Red flags of unpaid IT internship

I read the following question: Tips for a first year CS student looking for a summer internship to gain experience? But rather than how to get and/or look for internships, my questions concerns of how to filter companies looking for free labor to do their website VS companies that might not offer a paid check, but it will offer you mentorship and skills. I have a cousin that is a college freshman and she is looking for Sofware development internships, but at this point, she is desperately looking for any internship that is IT related. Besides the big software names and elite small software shops, How do you recognize a good internships in non-it- companies(large or small) doing IT maintenance vs the bad ones? If you don't have work experience, what questions a college student should ask to prevent ripoff? Are there any red flags that you can spot before accepting an offer?


Django REST + Backbone/Ember/Angular Implementation Method

http://stackoverflow.com/questions/10941249/separate-rest-json-api-server-and- client In light of this post, I wanted to ask questions regarding Django and specifically the implementation methods of getting one of these client side technologies to work with Django. Currently, I have a backend that is setup that uses Django Rest Framework to serialize the data. My problem though, is I'm not sure how to get the client side to access the backend. Django is a MVC framework. Originally I thought that I could just take out the View, and just implement the model and controller. Then, I would write complete separate View code so to speak using Backbone/Ember/Angularjs. Then the client would access the REST resources. How would I combine these two later if I wanted to deploy this to Heroku? Heroku only takes a whole Django application. How can I get the client code on there as well then? The other option, which I've seen before, is to NOT take out the View completely, but to use Django templates WITH Backbone/Ember/Angularjs. Then, I can just simply put these js files in the "static" folder so to speak. But then that seems weird, because then I'd have a View on the server side (correct me if I'm wrong), that accesses my own REST resources. I tried this, but for some reason even though my page retrieves the javascript files, it does not seem to be working as expected.


Flags with deferred use

Let's say I have a system. In this system I have a number of operations I can do, but all of these operations have to happen as a batch at a certain time, while calls to activate _and_ deactivate these operations can come in at any time. No matter how many times the `doOperation1()` method/function is called the operation is done only once in the batch. To implement this, I could use flags like `doOperation1` and `doOperation2` but this seems like it would become difficult to maintain. Is there a design pattern, or something similar, that addresses this situation?


Best way to define 'snap points' between two arbitrary objects in 3D?

I'm working on a simple in-browser 3D model constructor using THREE.js. The user picks a plane body, and adds wings, cockpit, tail etc of their choice, choosing from multiple options. I need to be able to define relationships between many bodies and many add-ons, and of course I don't want to manually have to define the position/rotation of each combination of parts. Therefore, I want to be able to define a set of 'snap points' on the body, places where certain components may be inserted, and to define a matching set of points on the add-on parts, basically matching the two in software to position the add- ons correctly. I though of defining a triangle of 3 points, as that would lock in all 3 degrees of freedom. If I make the order important, it will even prevent the object from "flipping" across the plane defined by the three points. Here's an illustration: ![before](http://i.stack.imgur.com/LCeyZ.png) ![after](http://i.stack.imgur.com/ierSd.png) I'm thinking of making a "dummy" for the 3D designers to use to get the coordinates of the points, but once case I can see this failing is when the two triangles don't exactly correspond to each other. Should I simply set in stone that the points must form an equilateral triangle of side length 10 units for example, or is there another way I could do the maths from triangles which do not completely match? Perhaps there's another, more standard way to do what I want? Thanks


Using packages (gems, eggs, etc.) to create decoupled architectures

**The main issue** Seeing the good support most modern programming platforms have for package management (think `gem`, `npm`, `pip`, etc), does it make sense to design an application or system be composed of internally developed packages, so as to promote and create a loosely coupled architecture? **Example** An example of this would be to create packages for database access, as well as for authentication and other components of the system. These, of course, use external packages as well. Then, your system imports and uses these packages - instead of including their code within its own code base. **Considerations** To me, it seems that this would promote code decoupling and help maintainability, almost in a Web-based-vs.-desktop-application kind of way (updates are applied almost automatically, single code base for single functionality, etc.). Does this seem like a rational and sane design concept? Is this actually used as a standard way of structuring applications today?


How small is the footprint of a small C compiler?

This week I could optimize using a reduced C library that allowed a drastic shrinkage in code size - from about 60 K to about 6 K and then we could load the code in the 8 K on-chip memory of an FPGA (Altera DE2) which I suppose is SRAM so there is SRAM both on-chip and off-chip(?) The program was rather small itself and we noticed that most of the size was from libraries and doing embedded system we reduce the libraries to only what is needed so that the footprint is minimized. It makes me wonder about something I heard in the media which was a story, maybe fictious, that Microsoft had to deliver a C compiler in only 20 K or so in the 70s or early 80s when there was not much memory available for software, is it true? What is a feasible size of the footprint for a small C compiler?


Websockets VS SSE

Suppose I have a service which requires to _seek_ the database for different data once and in a while. For this I have 2 or 3 SSE, each one with a different _retry_ basetime (20000 miliseconds, 1000 miliseconds...). **What I'd like to know is if websockets can handle different "data type" accordingly to the request** , for example, could I create **one** websocket to handle a notification system, a chat system, a group system instead of separated **_SSEs_** and treat data differently with javascript? And if so, would it be of higher interest (performance) than actually performing different queries to the server through different _SSEs_? If this is possible then would it be bad design to create multiple sockets for each service here?


What is (are) the most useful technique/visualization for overall project status?

For reasons "above my pay grade", we're developing an issue/project tracking system where I work (similar to Trac, FogBugz, etc). The managers want a useful tool to be able to track the overall health of the project (e.g. How much time left, how are we performing vs estimates) and one of the features that has been requested is some type of critical path support and visualization. The logic explained to me is that they want to be sure that at least the most important pieces of the project are currently being worked on. The initial idea was that we would create task-based dependencies. My understanding of project management tells me that this kind of granular approach is unnecessary - having milestones with specific deadlines/dependencies is much more useful. I would like to know what are the most useful techniques and "pretty pictures" you've seen/used for project development. Having objective data would be best, but somewhat subjective data is helpful too.


Validating data to nest if or not within try and catch

I am validating data, in this case I want one of three ints. I am asking this question, as it is the fundamental principle I'm interested in. This is a basic example, but I am developing best practices now, so when things become more complicated later, I am better equipped to manage them. Is it preferable to have the try and catch followed by the condition:               public static int getProcType()     {         try         {             procType = getIntInput("Enter procedure type -\n"                 + " 1 for Exploratory,\n"                  + " 2 for Reconstructive, \n"                 + "3 for Follow up: \n");         }         catch (NumberFormatException ex)         {             System.out.println("Error! Enter a valid option!");             getProcType();         }         if (procType == 1 || procType == 2 || procType == 3)         {             hrlyRate = hrlyRate(procType);             procedure = procedure(procType);         }         else         {             System.out.println("Error! Enter a valid option!");             getProcType();         }              return procType;     }      Or is it better to put the if within the try and catch?               public static int getProcType()     {         try         {             procType = getIntInput("Enter procedure type -\n"                 + " 1 for Exploratory,\n"                  + " 2 for Reconstructive, \n"                 + "3 for Follow up: \n");                  if (procType == 1 || procType == 2 || procType == 3)             {                 hrlyRate = hrlyRate(procType);                 procedure = procedure(procType);             }             else             {                 System.out.println("Error! Enter a valid option!");                 getProcType();             }         }         catch (NumberFormatException ex)         {             System.out.println("Error! Enter a valid option!");             getProcType();         }              return procType;     }      I am thinking the if within the try, may be quicker, but also may be clumsy. Which would be better, as my programming becomes more advanced?


What happens with project backlog if sprint due date is missed?

Suppose that I have project backlog item with effort of 40 hours. My sprint is 40 hours (1 week) and I have one developer in team. So developer creates child task to pending backlog and estimates work to 40 hours. At the end of the sprint developer didn't succeed in resolving his task. Suppose that developer works only and only 40 hours per week. On the next week there would be new backlog items and new sprint. What should I do with backlog item and velocity graph? Obviously backlog item is not resolved on that sprint. Should I estimate the remaining work and subtract it from effort , so that now I see that our velocity is, say, 38hr per 40hr sprint?


Is it absolutely necessary for a web programmer to be a web designer?

Though it is always a plus point to have knowledge of multiple technologies, but due to time-constraint it is not possible for me right now. I have extensive experience in .NET Windows development and 1 year experience in PHP. I want to apply for a job of web programmer. Is it absolutely necessary for me to learn web-designing also that includes CSS and PhotoShop?


What are the main things a programmer expects from the senior programmer?

Recently I read the following 5 Types Of Bosses and How To Deal With Them , which describes the attires of the worst boss. I've just started leading a small team of software developers. I would like to know what are the main things a programmer expects from the senior programmer or what are the things we should avoid while managing a team. Also, I would like to know how to keep the programmers satisfied and create a productive & completeness environment for my team.


Payments and open source core developers

I'm not sure if there's an established protocol for this (even if it's not an official one), but thought those most experienced with open source might want to share with us. I'm aware that random patches submitted to open source projects are never paid. They may be indirectly funded by a client but they're never paid for by the open source project itself. But how about core developers? I heard for example that drupal has some 800 core developers behind it. Core developers means that they work on drupal core itself and together they push the main releases, so they're very important to the project. Of course drupal is just an example, but in general, is there any established protocol in the open source world that defines whether the company behind the project is expected to pay them and do these core developers expect such payment? Any facts or first hand experiences?


When one should read 'Code Complete'?

I'm pretty sure about `Who` but when ? The one with proficient knowledge of programming and software development or the one who's just a beginner in cyber ( programming, to be precise ) world ? I'm persuing bachelors right now, when its preferable for me( and folks like me) to read this **_Must read for programmers_** book ?


Is splitting up programming tasks a good idea?

We have a small but growing team at work, and are thinking of doing things differently. We develop websites from scratch and do HTML/CSS/Javascript/PHP/MySQL coding. Currently, we all work on things as they come, and everybody could do either of those things. So everybody in the team has currently several projects assigned, and they could be doing different things, so for one project somebody takes care of the front-end things - mostly Javascript/CSS, and for another site it's the back-end part with mostly PHP/MySQL. The issue is that most in the team have a decent basic understanding of things but are still learning the details. And it seems to take its toll in terms of productivity. I think we could improve this by assigning everybody to just specific tasks (only CSS / Javascript / PHP / MySQL... just one thing at a time). This way:   * Tasks are clearer for everybody   * Everybody can better learn one particular thing and not get overwhelmed   * When mastering one skillset, one can upgrade to the next level   * Productivity should go up What do you think?


Preferring Python over C for Algorithmic Programming

I've been studying a bit of algorithms and have been looking at sites like SPOJ.pl TopCoder etc. I've seen that programmers prefer C or C++ usually for most algorithmic programming contests. Now I've been having some trouble lately. I know both a bit of C and Python and when trying to write a code I seem to prefer Python over C for most algorithms. Everytime I sit down to write a code in C I give up after about 15 minutes because I find it too cumbersome and tend to move over to python. Passing matrices Pointers and so on seem to be useless time wasted that I could actually be utilizing to think about the algorithm itself. Now I know and have heard from a lot of people that C is a very important language and is the bread and butter of a lot of programmers out there. What I wanted to know was whether this approach of mine has any drawbacks/consequences/Disadvantages etc. This is not a Python vs C debate; This a question about how this specific practice of preferring python over C because of the ease of use will affect me or any other programmer/computer Scientist in the long run. * * * I'd love to hear from people who've used these languages in the industry/and or to develop large software/libraries etc.


How to maintain different, customized versions of the same software for multiple clients

we have multiple clients with different needs. Although our software is modularized to a degree, it's almost certain that we need to adjust every module's business logic here and there a little for each customer. The changes are probably too tiny to justify splitting the module into a distinct (physical) module for each client, I fear problems with the build, a linking chaos. Yet, those changes are too large and too many to configure them by switches in some configuration file, as this would lead to problems during deployment and probably a lot of support troubles, especially with tinker-type admins. I'd like to have the build system create multiple builds, one for each client, where changes are contained in a specialized version of the single physical module in question. So I have some questions: Would you advise letting the build system create multiple builds? How should I store the different customizations in source control, svn in particular?


Do companies hire software developers that are aspiring entrepreneurs?

There are developers out there that not only write code and solve problems, but aspire to one day be an entrepreneur and run their own company. They may participate in open source projects, go to various networking events/meetups, or even write code to help shape/start their own business outside of work. And, for example, an fully-candid interview with a prospective hire might go something like this: > Company: _Where do you see yourself in 5 years?_ > > You: _I see myself running my own software company in City Z, doing xx > projects, solving yy kind of problems._ This might be a red flag to a company, who may consider this kind of developer a high risk for leaving, and that they would take with them the experience of developing a particular software or specific industry knowledge. Should developers hide these kind of aspirations/traits from their current employers, or where they are interviewing? Is it unprofessional to mention these kind of things? Does it help or hurt their chance of getting hired?


iOS App Store Developers - What is the 'copyright name' of an app?

I understand that whenever you upload a new app, you can set the copyright name for the app. **Where is this name displayed?** Is this name displayed underneath the name of the app when searching in the app store? Or is that the seller name that you specify when you upload your first app?


Why is it rare to collect analytics/usage data in open source software?

So, I've been developing some analytic software at my work and also have started to take more notice to analytics in general. For instance, I recently installed Google Analytics on my blog(which is custom and open source). I mostly make open source software outside of work, so I think it might be cool to be capable of gathering some form of usage data and such on how my tools are used, opt-in only of course. However, this seems to almost never be done. Why? What's with the taboo of analytics in open source software?


In Java, what are checked exceptions good for?

Java's checked exceptions have gotten some bad press over the years. A telling sign is that it's literally the only language in the world that has them (not even other JVM languages like Groovy and Scala). Prominent Java libraries like Spring and Hibernate also don't use them. I personally have found one use for them (in business logic between layers), but otherwise I'm pretty anti-checked exceptions. Are there any other uses that I don't realize?


Functional tests only to testing the infrastructure layer, or test too the domain services without mocking?

This is a code example: My entities (Domain Layer):               class Account:         def __init__(name, author):             self.name = name             self.email = email      My repositories interfaces (Domain Layer):               class AccountRepository:         def add(self, account):             """ @type account Account """             pass              def find_by_name(self, name):             pass              def find_by_email(self, email):             pass              # remove, and others...      My domain services (Domain Layer):               class SignUpService:         def __init__(self, account_repository):             """ @type account_repository AccountRepository """             self._account_repository = account_repository              def create_account(self, username, email):             account = Account(username, email)             self._account_repository.add(account)              # other methods that uses the account_repository      My repositories strategies implementations (Infrastructure Layer):               class MongodbAccountRepository(AccountRepository):         def __init__(self, mongodb_database):             self._mongodb_database = mongodb_database              def add(self, account):             account_data = account.__dict__             self._mongodb_database.accounts.insert(account_data)              # and the other methods      So I can do: **A** :   * Functional test for MongodbAccountRepository, testing the add, and directly querying to mongodb to check if the data is persisted as i suppose.   * Unit test for SignUpService, mocking the AccountRepository   * **Pros:** Too quickly   * **Cons:** can I really suppose that if my infrastructure works fine, and my domain service works fine with mock, the real integration will work fine?.   * And if i'm introducing a bug in my mock object, and the test passes when should be failing? **B** :   * Functional test for SignUpService, using the real MongodbAccountRepository.   * **Pros:** I can be sure that SignUpService really works fine.   * **Cons:** too many tests (with all strategies, etc), too slow What do you think?


What features does MIT-Scheme have that make it ideal for SICP?

I've been thinking about trying to get through the SICP again, this time well- armed with a better idea of what the SICP is meant to accomplish, and being older and wiser than my first attempt back in university. I've been told by old hands that the MIT Scheme is the _only_ scheme I should think about using, and that other schemes lack features that make the SICP harder to accomplish. "There's a reason all the 'SICP-in-X' end with chapter 3. Other languages can't support what's in chapter 4." When I asked what's in chapter 4, the answer is, "You'll have to get through the first three chapters to understand." Which is very Zen, I admit, but not helpful. The only things I can think of that older lisps have is dynamic scope and fexprs, but those don't seem to be the issue. What features does MIT Scheme possess that makes it "ideal" for getting through SICP? (Other than that it's the target language of the book, of course.)


Start to understand an existing project for beginner programmer

I want to understand an existing project for improve myself more but i am not sure that project is overwhelming for me or not. I am not sure i am capable to understand it. I even think that i will be failed. When i look at projects, at a glance it makes me feel scary to see thousand line of codes . I don't even know where to start read codes.Do i have to follow by debugging or another else? Can you please guide me about this situation ? I am totally get confused for start. Edit : Few thing for specify about my question. I know C# language and I have learned some WEB technologies like ASP.NET MVC 2 and Web Forms but sure still there will be many thing which i still don't know. I call myself as beginner but it is just because lack of professional experience in this area. But my OOP understanding is enough good. I am thinking to improve myself on WEB so i am looking for WEB projects like blog engines which is simpler than others for starting.


Clarify the Single Responsibility Principle

The Single Responsibility Principle states that a class should do one and only one thing. Some cases are pretty clear cut. Others, though, are difficult because what looks like "one thing" when viewed at a given level of abstraction may be multiple things when viewed at a lower level. I also fear that if the Single Responsibility Principle is honored at the lower levels, excessively decoupled, verbose ravioli code, where more lines are spent creating tiny classes for everything and plumbing information around than actually solving the problem at hand, can result. How would you describe what "one thing" means? What are some concrete signs that a class really does more than "one thing"?


How to develop a career path for programmers in a small company?

I am working in a small software company, which has grown from 4 to just over 50 employees (1 to 12 developers respectively) in the last 4 years with me being the lead developer/manager of the development team. No developer has quit so far and during the last round of feedback interviews everyone emphasized that they like the environment, colleagues and their current tasks at hand. However, for the first time, a few people mentioned that they started to think about how to expand their horizon (beyond the component/team they are currently working on) or develop additional skill sets (in addition to "plain" programming), e.g., to look into technical pre-sales activities. These issues were all raised by developers who have been with the company the longest and had seen the wild early days. Since then we've established processes to improve stability and quality which seem to work okay and a certain part of the daily work load has shifted from "new and exciting" to "routine and maintenance", so I can understand that they are looking for additional challenges. I've read several questions on SO from developers concerning steps to improve their career, but I am now faced with the other side: **What kind of career path can I offer a developer in a small company like ours?** Obviously, those people provide a lot of our specific domain knowledge and are very valuable to the team, so I want to make sure I can keep them happy. Given that business constraints and tight resources in a small company don't allow for a lot of extra projects on the side, any suggestions on what kind of options I can offer them?


Specifying and applying broad changes to a program

**How do you handle incomplete feature requests, when the ones asking for the feature cannot possibly write a complete request?** Consider an imaginary situation. You are a tech lead working on a piece of software that revolves around managing profiles (maybe they're contacts in a CRM-type application, or employees in an HR application), with many operations being directly or indirectly performed on those profiles -- edit fields, add comments, attach documents, send e-mail... The higher-ups decide that a _lock_ functionality should be added whereby a profile can be locked to prevent anyone else from doing any operations on it until it's unlocked -- this feature would be used by security agents to prevent anyone from touching a profile pending a security audit. Obviously, such a feature interacts with many other existing features related to profiles. For example:   * Can one add a comment to a locked profile?   * Can one see e-mails that were sent by the system to the owner of a locked profile?   * Can one see who recently edited a locked profile?   * If an e-mail was in the process of being sent when the lock happened, is the e-mail sending canceled, delayed or performed as if nothing happened?   * If I just changed a profile and click the "cancel" link on the confirmation, does the lock prevent the cancel or does it still go through?   * In all of these cases, how do I tell the user that a lock is in place? Depending on the software, there could be hundreds of such interactions, and each interaction requires a decision -- _is the lock going to apply and if it does, how will it be displayed to the user?_ And the higher-ups asking for the feature probably only see a small fraction of these, so you will probably have a lot of questions coming up while you are working on the feature. How would you and your team handle this?   * Would you expect the higher-ups to come up with a complete description of all cases where the lock should apply (and how), and treat all other cases as if the lock did not exist?    * Would you try to determine all potential interactions based on existing specifications and code, list them and ask the higher-ups to make a decision on all those where the decision is not obvious?    * Would you just start working and ask questions as they come up?   * Would you try to change their minds and settle on a more easily described feature with similar effects? The information about existing features is, as I understand it, in the code -- how do you bridge the gap between the decision-makers and that information they cannot access?


I want to write a Todo list application for mac but I only have experience with C++

Do I learn objective C? Is using Cocoa the easiest and best way to make a UI?


At what point does caching become necessary for a web application?

I'm considering the architecture for a web application. It's going to be a single page application that updates itself whenever the user selects different information on several forms that are available that are on the page. I was thinking that it shouldn't be good to rely on the user's browser to correctly interpret the information and update the view, so I'll send the user's choices to the server, and then get the data, send it back to the browser, and update the view. There's a table with 10,000 or so rows in a MySQL database that's going to be accessed pretty often, like once every 5-30 seconds for each user. I'm expecting 200-300 concurrent users at one time. I've read that a well designed relational database with simple queries are nothing for a RDBMS to handle, really, but I would still like to keep things quick for the client. Should this even be a concern for me at the moment? At what point would it be helpful to start using a separate caching service like Memcached or Redis, or would it even be necessary? I know that MySQL caches popular queries and the results, would this suffice?


Storing a pass-by-reference parameter as a pointer - Bad practice?

I recently came across the following pattern in an API I've been forced to use:               class SomeObject     {     public:         // Constructor.         SomeObject(bool copy = false);              // Set a value.         void SetValue(const ComplexType &value);          private:         bool         m_copy;         ComplexType *m_pComplexType;         ComplexType  m_complexType;     };          // ------------------------------------------------------------          SomeObject::SomeObject(bool copy) :       m_copy(copy)     {     }          // ------------------------------------------------------------          void SomeObject::SetValue(const ComplexType &value)     {         if (m_copy)             m_complexType.assign(value);         else             m_pComplexType = const_cast<ComplexType *>(&value);     }      The background behind this pattern is that it is used to hold data prior to it being encoded and sent to a TCP socket. The copy weirdness is designed to make the class `SomeObject` efficient by only holding a pointer to the object until it needs to be encoded, but also provide the option to copy values if the lifetime of the `SomeObject` exceeds the lifetime of a ComplexType. However, consider the following:               SomeObject SomeFunction()     {         ComplexType complexTypeInstance(1);  // Create an instance of ComplexType.              SomeObject encodeHelper;         encodeHelper.SetValue(complexTypeInstance); // Okay.              return encodeHelper;              // Uh oh! complexTypeInstance has been destroyed, and         // now encoding will venture into the realm of undefined         // behaviour!     }      I tripped over this because I used the default constructor, and this resulted in messages being encoded as blank (through a fluke of undefined behaviour). It took an absolute age to pinpoint the cause! Anyway, **is this a standard pattern for something like this? Are there any advantages to doing it this way vs overloading the SetValue method to accept a pointer that I'm missing?** Thanks!


Requiring a specific order of compilaiton

When designing a compiled programming language, is it a bad idea to require a specific order of compilation of separate units, according to their dependencies? To illustrate what I mean, consider C. C is the opposite of what I'm suggesting. There are multiple `.c` files, that can all depend on each other, but all of these separate units can be compiled on their own, in no particular order - only to be linked together into a final executable later. This is mostly due to header files. They enable separate units to share information with each other, and thus the units are able to be compiled independently. If a language were to dispose of header files, and only keep source and object files, then the only option would be to actually include the unit's meta- information in the unit's object file. However, this would mean that if the unit A depends on the unit B, then the unit B would need to be compiled _before_ unit A, so unit A could "import" the unit B's object file, thus obtaining the information required for its compilation. Am I missing something here? Is this really the only way to go about removing header files in compiled languages?


Open source license limitations and compatiblity

I am new to open source licenses and it seems very confusing, therefore need some suggestions. We are developing an application which utilities existing components with following license types:   * Apache License v2   * LGPL v2.1   * MIT License   * BSD style license   * Mozilla Public License v1.1 Now my concern is:   1. What kind of distribution limitations our application might have from commercial perspective?   2. What kind of license possibilities we have for our application? (e.g. Apache, proprietary, GPL, etc.) Thanks!


How to Learn Doing it Right Way?

I am self taught web developer. I do not have any computer science degree from university. I know HTML5, CSS3, Javascript, PHP and some Python. But I am having difficulties about being efficient. When I create a project, I am buried into files, folders, bugs and todoes. Because I am managing multiple projects at a time, I totally feel stressed and not in control. I see real programmers whom have computer science degrees use utilities like Git for source management. They use Unit tests for testing and other tools for Debugging in an easy and quick way. I am sure there are lots of other tools they have which help them stay safe and calm while they manage their projects. But because I do not have any computer science degree, I do not know how to do things in a right and efficient way. I just do it, in an organized way. It works but it burns out me, too. I Googled a bit and find some books from Amazon about Project Management but I feel intimidated. The tools and resources I found also very scattered which seems getting them together to create an organized routine is also requires another expertise. As a self taught web developer what can I do to learn doing things right way? Do I need a computer science degree or a course about programming? Can I learn the right way by Googleing or from books?


What IDE features would you miss most if you didn't have them?

What features of your IDE would you miss most if you didn't have? Please list one one feature or group of related features per answer.


X509 certificate question on WCF

**My condition:**   1. A WCF service which is self-hosted and it's on a Win8 Machine.    2. Client is a WPF Program on another machine.   3. Then I follow the article on Codeproject about how to set X509 certificate for WCF. **Problem Description:**   1. Communication between Client and Service was OK when they are on the same Machine.   2. When I put the Client on another machine, exception occurs that it says "The caller is not authenticated by the service". I believe the cause of the exception above may be relevant to X509 Certificate. When I put the Client.exe on another computer, I just generate a new certificate for client, is it right? I want to know if the X509 Client certificate should be exported from the service Machine which has generated both client and server certificate, and then be imported into other Client Machine, or just use makecert.exe generate another certificate for other Client Machine? In short, can the certificate be generated by any machine or only by the machine having generated the service certificate?


Requesting Advice Regarding Storing Encryption Keys

I am using HMAC to hash some data before inserting it in a database and currently I have my key as a static field. Just wondering what the best practice regarding storing the key would be. Is having it in code good enough, or should it be in a configuration file. Thanks!


Solutions for implementing a full-duplex game server?

I am designing a game server which would be used for Android terminals. I've been searching for products or frameworks to use for two-way socket communication but haven't found anything worth mentioning. Simply, I want to implement the architecture below: ![Server architecture](http://i.stack.imgur.com/leKtu.png) In other words, one TCP connection from the client to the server, and another from the server to the client, in order to avoid always having to be connected. Just to be clear, my main aim is for the **server** to be able to send data to the **client** , **without** the client having to explicitly request it. I do **not** want the client to have to poll the server to see if there is any new data. What combination of design strategies, network protocols, and/or products or frameworks (if any) would be appropriate for implementing this architecture?


Are design patterns really essential nowadays?

I was reading "Coders at Work" and have faced the fact that some of the professionals interviewed in the book are not so enthusiastic about design patterns. I think that there are 2 main reasons for this:   1. Design patterns force us to think in their terms. In other words, it's almost impossible to invent something new (maybe better).   2. Design patterns don't last forever. Languages and technologies change fast; therefore, design patterns will eventually become irrelevant. So maybe it's more important to learn how to program properly without any particular patterns and not to learn them. EDIT: The point also was that usually when people face a problem and they don't have much time, they try to use a pattern. This means copying and pasting existing code into your project with minor changes in order to get it working. When it's time to change or add something, a developer doesn't know where to start because it's not his code and he's not deeply familiar with it.


How often do you actually use design patterns?

> **Possible Duplicate:**   >  Are design patterns really essential nowadays? I recently read a book on design patterns. A few of them seem very usefull in specific situations. Im not sure how much use they will be in everyday coding though. How often do you use design patterns in your everyday work? Should I be trying to find situations to apply them?


When should I use—and not use—design patterns?

In a previous question of mine on Stack Overflow, FredOverflow mentioned in the comments: > Note that patterns do not magically improve the quality of your code. and > Any measure of quality you can imagine. Patterns are not a panacea. I once > wrote a Tetris game with about 100 classes that incorporated all the > patterns I knew at the time. Why use a simple if/else if you can use a > pattern? OO is good, and patterns are even better, right? No, it was a > terrible, over-engineered piece of crap. I am quite confused by these comments: I know design patterns help to make code reusable and readable, but when should I use use design patterns and perhaps more importantly, when should I avoid getting carried away with them?


Are design patterns essential for good code?

Are design patterns (e.g. factory pattern, observer, etc...) required to be known to write good code? I often have no idea of what people mean when they talk about _inserting pattern name here_ pattern and sometimes I realize I‘ve implemented that pattern without knowing it even had a name. I‘m a self-taught programmer so I try to learn about patterns as I go, but are they necessary? I find them over-engineered sometimes, like just fancy design concepts that programmers sometimes overestimate and force themselves to use them even if they can write clean and working code that is however not a common pattern.


To design pattern, or not to design pattern

Design patterns are good, but complex. Should we use them in small projects? Implementing design patterns needs more sophisticated developers, which in turn raises project costs. On the other hand, they make code neat and clean. Are they necessary for small projects? **Update:** Should we insist on using design patterns when the team is not efficient at working with them?


What if I will not use Software Design Patterns?

What kind of problems may I face, if I won't use Software Design Patterns? Can you tell me about the problems of approaching the design using standard object-oriented techniques?


How do you get over tooling problems in a communal open-source project?

Two different teams (from different companies) are uniting to work on a communal open-source project. Agreeing on technical design is something we have no trouble with, but I'm struggling with tooling/workflow problems. I really like a BDD testing tool called `phpspec` (analogous to RSpec), whilst a lot of my teammates stick to what they know (`phpunit`) regardless of the pros and cons of either tool. How do you move forward with a project when members are in disagreement like this? Should you enforce a standard testing tool? Is there a way of using both? I think it boils down to whether members will break out of their comfort zones to learn new technologies that are better for the job. I'm of the strong opinion that you should always be willing to learn new things, but I get the impression that others are purely concerned with getting things done in the quickest way possible - thereby using tools they've used before.


What is a good way to familiarize myself with PHP, coming from an ASP.NET background?

Currently, I'm very comfortable with building tools/web apps in an ASP.NET environment. I'm not really looking to leave tbh, as I really like C#, ASP.NET, MVC 3, Visual Studio, etc. However, right now I know almost nothing about PHP and that seems like a deficiency that I'd like to rectify. Are there any books (or other learning methods) that would be a good resource to learn PHP? Obviously there are plenty of beginning PHP books, but I am already comfortable with much of what is involved with building a web page, and interested in focusing on PHP itself which might not be compatible with the scope of some beginning PHP books. I went through the PHP Manual quite a bit, and it doesn't seem to flow as smoothly as might be ideal. Is there a beginning PHP book that would be appropriate? I miss the cohesiveness that most books contain when looking through those samples. There is lots of info more, but it feels more like a reference while coding than a primary learning vehicle.


Is is possible to develop an application for both metro and classic style?

Is it possible to develop one application that can be be run in both: metro and classic style in Windows 8? I mean, application with the same core and two separate UIs, adjusted to currently used mode.


What's there in Eclipse, other than PyDev, for a Python developer?

Like many other people, I use Eclipse with the excellent PyDev plugin (available in the Eclipse Marketplace) to develop my Python projects. And like most people with the same setup, I came to PyDev without any prior Eclipse experience. What other tools, plugins, features, etc are there in Eclipse that could be useful for us Python developers? And/or, said another way, how could we become more proficient and make a better use of the Eclipse IDE for Python developing? I'll start adding my own 2€cents: EGit, or similar plugins for CVS, SVN, etc.., are good for integration with a version control system / repository. (even if I admit I'm usually just writing git command lines in the terminal).


Is is possible to do TDD without a test tool?

We want to implement a fairly rough outline of test driven development which involves a developer asking themselves the tests at each stage of the development process. I have read here that its impossible to perform TDD without a tool. Is this true?


CS Concentrations and Career Paths

I'm approaching the end of Sophomore year in college (Studying Computer Science), and very soon I'm going to have to decide on my concentration, but I honestly don't know what each concentration means. I basically have two questions:   1\. How much influence does your concentration have on your career path? For example, would a video game development company only look at people with a concentration in Game Development? 2.It would be great if you guys could, in a line or two, tell me what sort of jobs am I looking at for each of the concentrations? I need to pick at least two of the 9 below. \- Algorithms and Data Structures   \- Artificial Intelligence   \- Computer and Network Security   \- Computer graphics and vision   \- Human-Computer Interaction   \- Game Development and Design   \- Numeric and Symbolic Computation   \- Programming languages   \- Systems


Warn about 3rd party methods that are forbidden

Note: This question refers to code written in Java or C#. I am managing a couple of large projects where we have discovered issues (not necessarily bugs) with some 3rd party/SDK methods and have written our own extensions that should be used instead. We want developers to remember that using those methods is not recommended for this project. If we had been using our own libraries we could easily remove that method or mark it obsolete/deprecated but we cannot do so for libraries that we didn't write. As an example, we use a library that provides us with two overloads:               acme.calculate(int quantity_, double priceInUsDollars_);     acme.calculate(int quantity_, string currencyCode_, double priceInCurrency_);      We want developers to always use the first one and get price in US Dollars from our own standard FX rate systems. And it'd be nice to have the IDE (Eclipse/Visual Studio) warn the developers when they use the first one. A compiler warning will suffice too. Right now, as it stands, we have to rely on the code reviewers to spot such errors and as you can see that is not a reliable approach. One possible way I am prepared to go is to write my own check style check (http://checkstyle.sourceforge.net/writingchecks.html). But I was wondering if there was something simple that I could use. Does anyone know of ways to achieve an IDE/compiler warning of the sort I have described? Non IDE/compiler solutions are most welcome.


What modes of profit are open to programmers?

This is an important question because "apply for a job/internship" isn't a solution for everyone especially during economic stress periods when constant rejection can push good programmers into depression. Can people with experience briefly comment on other ways to get programming revenue:   * Creating "free for non-commercial" software   * Turning an idea into a startup with near-zero resources and **not flopping**   * Turning an idea into a startup with near-zero resources and coming out **employed**   * Using outsourcing sites and **actually** getting paid   * Making freeware and getting sponsors/advertisers (I know we all hate installer spam, but still)


What is better making a separate temporary table or inserting directly to big table?

I have a big table with 1,400,000 rows, and I need to insert 3000 rows daily in it. When I insert 3000 rows daily should   * I first insert to a temporary table than dump that temporary table to the main table.   * insert directly to the big table. Which approach is fast and why?


Asynchronous update design/interaction patterns

These days many apps support asynchronous updates. For example, if you're looking at a list of widgets and you delete one of them then rather than wait for the roundtrip to the server, the app can hide the one you deleted, giving immediate feedback. The actual deletion on the server will happen in the background. This can be seen in web apps, desktop apps, iOS apps, etc. But what about when the background operation fails. How should you feed back to the user? Should you restore the UI to the pre-deletion state? What about when multiple background operations fail together? Does this behaviour/pattern have a name? Perhaps something based on the Command pattern?


Is there an specific way or algorithm to decode protocols?

I am designing a simple logic analyzer, I know that the best way to decode a protocol like I2C, SPI, UART is whit something like an FPGA but I want to do it by software by now :) I am running on an OMAP4460 ARM proccesor. I would like to know if there is an special way of decoding protocols like I2C, SPI, UART or it is simply if() and flags as the normal way.


Are too many assertions code smell?

I've really fallen in love with unit testing and TDD - I am test infected. However, unit testing is normally used for public methods. Sometimes though I do have to test some assumptions-assertions in private methods too, because some of them are "dangerous" and refactoring can't help further. (I know, testing frameworks allow testing private methods). So it became a habit of mine that the first and the last line of a private method are both assertions. However, I've noticed that I tend to use assertions in public methods (as well as the private) just "to be sure". Could this be "testing duplication" since the public method assumptions are tested from the outside by the unit testing framework? Could someone think of too many assertions as a code smell?


Template rendering engine legitimate use of a singleton?

I wrote a standalone singleton class (scaffold) tonight that serves as a facade to a few other classes, including a template class and a view class. Templates and views are both named and instances of each are stored in the scaffold object. Templates can contain views and views can contain other views. A template and it's contained views is rendered when:               scaffold->render('template_name')      Making scaffold a Singleton seemed like a good idea because:   * I want to control when and how the object is constructed   * I only want one instance (the gui will only be rendered once, regardless of the template which is rendered)   * All state can easily be released from the scaffold class (if, for testing reasons or whatever, I wanted to) Does this seem like an acceptable use case? If not, what specific design considerations am I overlooking? No religious wars, please. I didn't include the language because I'm hoping for a language agnostic consideration, but I will say:   * Scripting language   * Single threaded


Why doesn't Python allow multi-line lambdas?

Can someone explain the concrete reasons why BDFL choose to make Python lambdas single line? This is good:               lambda x: x**x      This results in an error:               lambda x:         x**x      I understand that making lambda multi-line would somehow "disturb" the normal indentation rules and would require adding more exceptions, but isn't that worth the benefits? Look at JavaScript, for example. How can one live without those anonymous functions? They're indispensable. Don't Pythonistas want to get rid of having to name every multi-line function just to pass it as an argument?


Is learning C essential for Computer Science?

I am a front-end developer who barely even see a file with `.h` or `.c` extension. I know basic C syntax, I've learned it in Unreality but never was interested in such low level programming because it was simply too much setup for simple things. I am very interested in learning all aspects of Computer Science but I want to believe I do not really have to know a specific language in order to understand most of concepts in Computer Science. Yet when I start reading books and articles about fundamental Computer Science concepts like Data Structures and Algorithm Design it seems that I have to learn C, because all examples and even lessons are in C (and sometimes Java). My question is, is C as a programming language essential for Computer Science or we just happened to have all of our resources in CS written in C? Can one learn Computer Science without learning C?


How does Assembla compare to FogBugz + Kiln

I'm choosing a project management solution and narrowed it down to either Assembla or FogBugz + Kiln. These were my criteria:   * Hosted service but with an option to go to a custom installation (rules out e.g. Codebase HQ)   * Centered around projects, not repositories (GitHub, although having added some PM features recently, seems to be repo-centered)   * Git repository hosting a must, SVN + Mercurial nice to have   * Popular service with (at least somewhat) guaranteed continuity - both FogBugz and Assembla seem to be amongst the most popular PM solutions   * Wikis, discussions, code reviews, user management etc. The more features, the better. This rules out (otherwise a very nice service) BitBucket and others. Both FogBugz and Assembla seem quite feature packed. I'm looking for someone who has experience with both FogBugz and Assembla and could compare them. This is what I've gathered so far from feature pages / screenshots / random mentions on the web:   * FogBugz seems to have quite a nice UX. Assembla makers are certainly trying hard and the screenshots don't look that bad but it still feels less elegant.   * FogBugz is offered with Kiln which I'm sure is a nice product but I'd prefer Git over Mercurial. I know FogBugz can be used with other SCM services but I'd rather have one integrated solution out of the box.   * Assembla is cheaper, actually much cheaper should there be more than a few users. Maybe I'm wrong, these are just my first impressions. If someone could offer a more complete / educated comparison I would be grateful.


how to get clients and domain experts on board and interested

So I think this might be **me** soon!   Excuse my ignorance in this post, I am not formally educated and young! =S   (Taken from http://theoatmeal.com/comics/design_hell) ![alt text](http://i.stack.imgur.com/r3lVG.png) Im building an inhouse application for a bank and it might not be big but its the largest project I've worked on. ## Issues I can't do much about   1. There is tons of beaurocracy in doing anything, it took 4 months to get them to sign a contract with me.   2. I have to work with Finance managers, who have never worked with someone making software for them.   3. I am not usually taken seriously because I am young. ## My Problems   1. The managers don't give a crap about the Bank and they never bother to read my emails most of the time, or give me any input on mockups or demos. I spent 20 hours over 2 days on the last mockup and they would rather crap on the phone than attend the meeting!   2. New features keep coming and going like hot cakes and they just cannot decide which ones are important. Or they don't care to discuss it! And the top dogs keeps reminding me of the dealines!? ## My question So Im going straight to the top dogs to politely try to change things. These guys however are older and won't give me much time, **I need a very convincing, quick, succinct way to explain to them how important it is that their "managers" communicate with me and tell me what the heck they want and what they don't**   Any funny presentations or pictures like oatmeal would be really awesome to show the top dogs. ## Other Solutions I was thinking of   1. Signing up for teambox.com (as opposed to email!)   2. If in 3 days I dont get a response on a feature it is NO MORE!   3. I display features on a board and they get 5 secs to tell me if its important or not. Any more policies I should adopt? Any other ideas? Thanks so much, Gideon **EDIT** * * * In response to the first comment: The departmental heads (top dogs) are the people really looking forward to shiny software that will solve all their problems. They are more or less the stakeholders but I don't interact with them much, I only interact with their subordinates(the managers).


Has SSRS replaced Crystal Reports as a new standard for Visual Studio reporting tool?

I never used SQL Server Reporting Services (SSRS) before but used little Crystal Reports. My present project has extensive use of Crystal Reports for Visual Studio 2005. This choice brought some nasty issues of Crystal Reports in front. The very first report failed to print or export because of a bug. After wasting a week, I got stuck in another issue of reducing font size on print and export. Help in forums is also not coming soon. I want to know whether I should learn and switch to SSRS or migrate my project to Visual Studio 2010 with a higher version of Crystal Reports. Has SSRS replaced Crystal Reports as a de facto standard reporting tool?


Why is C++ preferred over C for commercial applications?

I program in C mostly. However, it is pretty obvious that many more commercial applications are done in C++. As far as I can tell, C++ is a very complex language, with seemingly convoluted syntax and too many constructs. C++ also encourages the abuse of Objects where structs and functions will do. In fact, the only significant advantage I see in C++ is the use of templated generic types (though, according to the developers of Go, generics are bad for programs). Basically, my question is, did I miss something? Or is C++ more popular purely by merit of luck or marketing? Edit: I'm sorry that I apparently asked a loaded question; in retrospect I can see that the way I worded it appears to be complete flamebait. What I meant was, since C++ has so many different constructs and paradigms available to it, why hasn't it been replaced by languages that do less but are better at that specific thing? For instance, both Java and C# are much better suited for OOP than C++ is, while C is much simpler for system-level programming, and something like lisp is more suited for functional programming. Why is C++ used over one or more of these other languages?


Should I decompress zips before I archive?

I am writing a small personal archiving tool. I frequently work with a lot of client databases for short periods, what my tool will do is in overnight batch jobs it will detach the database and zip up the database files and any extra files that where sitting in the folder that the database resided in and move it to a network storage drive. My question is quite frequently there will be zip files sitting inside the folder (the most common one would be the client's original backup before I did the processing on it). Would it be better to unzip the file to a unique sub- folder name, delete the zip, then compress the whole parent folder, or are compression algroithoms good enough that I could leave the file zipped (it was likely done with a 7zip Fastest setting) and my archiving (which will be a 7zip Ultra setting) will just compress (mostly) the difference between the two compression levels? If I can get another 1% off of a 20GB database file it may be worth it to do the decompression.


How do you structure your branches in TFS

I'm not sure if i should ask this question here, or on SO ... i'll cross post it to SO if this is the wrong place. My group at work has been trying to come up with a good process that we can use with TFS. I'm just wondering if some of you guys had some successful strategies with using TFS across multiple sites using multiple branches. One specific issue that we have is probably our release engine. On the simple side, a developer should be able to check in his/her changes into the DEV Branch, and then ok certain date (say a freeze date) the DEV Branch will be "reverse integrated" into the Main Trunk (QA) in which then the changes will be pushed to the Production branch. The issue arose when a user check into the DEV Branch, but he doesn't want those changes to be moved into QA (because maybe other portion of the code is not done yet) ... any thoughts on that? thanks in advanced


Best time to start writing technical blogs

I want to know how much time I should wait until I start writing a blog since, IMO, a newbie does not have that skills to write something substantial. I'm talking about technical blogs like writing about new C# features or Advantages of Ruby over other languages.


How to rewrite from scratch a code for which I own the copyright so I can use it on my job without losing the rights to the first version?

Well I don't want to make it open-source! That's the problem. But I do want to use it on my current job. Company did not agree to sign any alternative license with me and told me to rewrite everything from scratch so they will own it. :( So how can I do it in a safe way so later on the company don't come back to me and say that I am using the code I wrote for them, which will be similar to the first version I wrote and own the copyright, on my personal projects or even on another job? How would you rewrite a second version of a hash map without making it look like the first version? This sounds kind of hard to me. :(


I'm looking to really grasp OO once and for all. Any recommendations on a good Objected-Oriented book? I program in .Net, so if it's .Net oriented all the better. Regards,


Allocation problem identification

I have a matrix. I have a list of people who have to occupy n1,n2,n3 etc cells, different number of cells in different rows. I have to place the people in the cells. Occupying the same cell across rows is considered overlap. Overlap has to be minimized. I have people referring to this variously as an optimization problem, an allocation problem and even linear programming. I need to first get a consensus on what is this class of problem called. Second, I need to know what an efficient solution should look like, in terms of the big-o notation or anything else. Here is an example: There is a board of 4 x 4 cells. There are many pieces each of one color (R, G, B). Each color peice has to fill a number of columns in each row. A possible example:                     Row1   Row2   Row3   Row4     Red      1      2      3      2     Blue     2      2      0      0     Green    1      0      1      2      That is the input. The input arrangement could be different but it occupies the entire board... no cell is left blank. The count of same color pieces occupying a COLUMN should be minimized. One possible (bad) arrangement based on the input is this:                   1    2    3    4     1   r    b    b    g     2   r    r    b    b     3   r    r    r    g     4   r    r    g    g      This is bad because it actually maximises the count of colors in the same column. A better arrangement is like this:                   1    2    3    4     1   r    b    b    g     2   b    r    r    b     3   g    r    r    r     4   r    g    g    r      Overlap is unavoidable, but should be minimized, and provably so. I dont know if there is only one best solution or if there could be many solutions. Even if there could be many solutions, we need to come up with just one. As I think about it more, it looks like a loose version of eight-queens problem. I am getting worried because I keep seeing recursion and back- tracking. EDIT 1: I am thinking a relaxed version of sudoku puzzle generation.


Where and how to reference composite MVP components?

I am learning about the MVP (Model-View-Presenter) Passive View flavour of MVC. I intend to expose events from view interfaces rather than using the observer pattern to remove explicit coupling with presenter. **Context:** Windows Forms / Client-Side JavaScript. I am led to believe that the MVP (or indeed MVC in general) pattern can be applied at various levels of a user interface ranging from the main "Window" to an embedded "Text Field". For instance, the model to the text field is probably just a string whereas the model to the "Window" contains application specific view state (like a persons name which resides within the contained text field). Given a more complex scenario:   * Documentation viewer which contains:      * TOC navigation pane     * Document view     * Search pane Since each of these 4 user interface items are complex and can be reused elsewhere it makes sense to design these using MVP. Given that each of these user interface items comprises of 3 components; which component should be nested? where? who instantiates them? **Idea #1 - Embed View inside View from Parent View**               public class DocumentationViewer : Form, IDocumentationViewerView {         public DocumentationViewer() {             ...                  // Unclear as to how model and presenter are injected...             TocPane = new TocPaneView();         }         protected ITocPaneView TocPane { get; private set; }     }      **Idea #2 - Embed Presenter inside View from Parent View**               public class DocumentationViewer : Form, IDocumentationViewerView {         public DocumentationViewer() {             ...                  // This doesn't seem like view logic...             var tocPaneModel = new TocPaneModel();             var tocPaneView = new TocPaneView();             TocPane = new TocPanePresenter(tocPaneModel, tocPaneView);         }         protected TocPanePresenter TocPane { get; private set; }     }      **Idea #3 - Embed View inside View from Parent Presenter**               public class DocumentationViewer : Form, IDocumentationViewerView {         ...              // Part of IDocumentationViewerView:         public ITocPaneView TocPane { get; set; }     }          public class DocumentationViewerPresenter {         public DocumentationViewerPresenter(DocumentationViewerModel model, IDocumentationViewerView view) {             ...                  var tocPaneView = new TocPaneView();             var tocPaneModel = new TocPaneModel(model.Toc);             var tocPanePresenter = new TocPanePresenter(tocPaneModel, tocPaneView);             view.TocPane = tocPaneView;         }     }      **Some better idea...**


So what *did* Alan Kay really mean by the term "object-oriented"?

Reportedly, Alan Kay is the inventor of the term "object oriented". And he is often quoted as having said that what we call OO today is not what he meant. For example, I just found this on Google: > I made up the term 'object-oriented', and I can tell you I didn't have C++ > in mind > > \-- Alan Kay, OOPSLA '97 I vaguely remember hearing something pretty insightful about what he _did_ mean. Something along the lines of "message passing". Do you know what he meant? Can you fill in more details of what he meant and how it differs from today's common OO? Please share some references if you have any. Thanks.


How to calculate Sin function quicker and more precisely?

I want to calculate `y(n)=32677Sin(45/1024•n)`, where `y` is an integer and `n` ranges from 0 to 2048. How can I make this process quicker and more precisely? Now I want to show you a reference answer: Since `Sin(a+b)=Sin(a)Cos(b)+Cos(a)Sin(b)` And `Cos(a+b)=Cos(a)Cos(b)-Sin(a)Cos(b)`. So I can store `Sin(45/1024•1)` and `Cos(45/1024•1)` only.Then use this formula: `Sin(45/1024•2)=Sin(45/1024•1+45/1024•1)`, `Cos(45/1024•2)=Cos(45/1024•1+45/1024•1)`, `Sin(45/1024•n)=Sin(45/1024•(n-1)+45/1024•1)`, `Cos(45/1024•n)=Cos(45/1024•(n-1)+45/1024•1)` , This way maybe quicker without storing large array.


How can I stay focused and motivated on a project?

I'm working on starting my own software development business, but I've noticed that I have major issues getting projects out by their deadlines, and in general getting them out of the "almost-done" stage. I feel my problem is that I like complex programming too much, and I end up rewriting code to make it cleaner/more efficient/less error prone as a means of putting off more "boring" development. I end up with polished applications at the end, but I spend twice as long on the project as I should have. If I ever want my company to succeed, I need to work on staying focused on what actually needs to be done, so the question is: What techniques do you use to keep yourself focused and motivated on a project, in your career?


How to concentrate on one project at a time. Divide and Conquer doesn't work for me

> **Possible Duplicate:**   >  Tips for staying focused and motivated on a project I have serious issues on concentrating on one project at a time. I cant even follow the Divide and Conquer Approach. Once I start a project, I try to get the things done as neatly as possible but very soon I end up messing so many components of it. I try to do divide and conquer, but my approach doesn't work smoothly, and then I then wonder here and there in other projects. Sometimes I try spending so many hours for some trivial issues, which in-fact are not even issues. How do I avoid this jargon and be a smooth developer and have a nice workflow around my projects. I tend to loose my concentration on the current project and wonder in another project.


Is it more difficult to upgrade your certification from SQL Server 2008 to 2012 than to get it from scratch?

I was wondering about the new MCSA certification on SQL 2012 and how it seems to be more difficult to upgrade your certification from 2008 to 2012 than to get the 2012 from scratch. Reason I think that is true is because anyone with any MCTS SQL Server 2008 certification can upgrade it to a MCSA 2012 by passing 2 tests (457 and 458). If you try to get it from scratch, you need to pass 3 tests (461, 462 and 463 - which are pretty much the same as 432, 433 and 448 for SQL 2008). But the thing is, even though its one test less to upgrade, all the skills necessary to pass 461, 462 and 463 are squeezed on 457 and 458 so, it seems easier to get from scratch than upgrade. Any thoughts?


Creating a coding standards document

I work in a control systems company, where the primary work is SCADA and PLC, along with other control systems stuff. Softwre development is not really something the company does, apart from little bits here and there, until there was a decision to create an internal project management and appraisal system. This project has been taken on by people who came here as software people originally and we are mostly junior. The project started off small, so we only documented stuff like design, database stuff etc, but we never really agreed upon a coding format/conventions. We started using Stylecop to make sure we had well documented code, but I feel we need an official document for coding conventions/practices so we can continue a good standard and if there is any more major development work in the future, whomever works on it has a good baseplate. Therein lies the problem, I have no idea how to draft up a document for coding conventions and standards, all I can think of is examples of good vs bad practice (for example camel case when naming variables, avoiding Hungarian notation etc) we are all competent enough programmers (apparently) but we just don't have a charter for this kind of stuff. To put a point on it, my question is: **What are the key aspects and contents of a good coding standards document?**


how safe/sane is it to use git for deployment on my webapp production server?

I started with sftp, then switched to WebDAV and I'm currently using rsync through ssh to deploy any updates/upgrades from my development server into my production server. I'm still not very happy using this system and think using git to deploy may be better, mainly because of the possibility of rolling back any changes instantly with just one command. Appart from using ssh tunnel to pull and push to the production server (leaving the git service behind the firewall), I've also realized I have to edit .htaccess to deny web access to .git folder. Is this the correct approach, should I check anything else, do something in a different way, or should I go in a totally different direction?


Programming is my hobby and I've just downloaded VS Studio 2012 Express Desktop. Now I am going to register it but they want me to tell them business information > ![enter image description here](http://i.stack.imgur.com/YrryP.png) Are only companies and no private programmers allowed to use VS Studio 2012 Express Desktop? And what shall I type in these text fields?