title: What's wrong with comments that explain complex code?

text: A lot of people claim that "comments should explain 'why', but not 'how'". Others say that "code should be self-documenting" and comments should be scarce. Robert C. Martin claims that (rephrased to my own words) often "comments are apologies for badly written code". My question is the following: What's wrong with explaining a complex algorithm or a long and convoluted piece of code with a descriptive comment? This way, instead of other developers (including yourself) having to read the entire algorithm line by line to figure out what it does, they can just read the friendly descriptive comment you wrote in plain English. English is 'designed' to be easily understood by humans. Java, Ruby or Perl, however, have been designed to balance human-readability and computer- readability, thus compromising the human-readability of the text. A human can understand a piece of English much faster that he/she can understand a piece of code with the same meaning (as long as the operation isn't trivial). So after writing a complex piece of code written in a partly human-readable programming language, why not add a descriptive and concise comment explaining the operation of the code in friendly and understandable English? Some will say "code shouldn't be hard to understand", "make functions small", "use descriptive names", "don't write spaghetti code". But we all know that's not enough. These are mere guidelines - important and useful ones - _but they do not change the fact that some algorithms are complex._ And therefore are hard to understand when reading them line by line. Is it really that bad to explain a complex algorithm with a few lines of comments about it's general operation? What's wrong with explaining complicated code with a comment?


title: Would you rather make private stuff internal/public for tests, or use some kind of hack like PrivateObject?

text: I am quite a beginner in code testing, and was an `assert` whore before. One thing worrying me in unit testing is that is often requires you to make `public` (or at least `internal`) fields that would have been `private` otherwise, to un-`readonly` them, make `private` methods `protected virtual` instead, etc... I recently discovered that you can avoid this by using things like the PrivateObject class to acces anything in an object via reflection. But this makes your tests less maintainable (things will fail at execution rather than compile time, it'll be broken by a simple rename, it's harder to debug...). What is your opinion on this ? What are the best practices in unit testing concerning access restriction ? edit : consider for instance that you have a class with a cache in a file on disk, and in your tests you want to write to memory instead.


title: Is there a canonical book on C Programming in GNU/Linux?

text: I am looking for a good ebook (or two) for learning the C programming language, specifically programming in a GNU/Linux environment. I'm not a beginner programmer, but I have almost no experience in this particular area. I need to learn both the fundamentals of C and the GNU toolchain (gcc, gdb, and make). For the C language side, I know K&R comes highly recommended, but it doesn't seem particularly practical for me given that it won't describe modern best practices, current libraries, or any particulars about GNU/Linux programming. Is there a book out there that's the de-facto standard for describing best practices, design methodologies, and other helpful information on C Programming in GNU/Linux and covering the GNU toolchain? What about that book makes it special?


title: Bluetooth or Bump API for membership card functionality?

text: I am looking to implement membership card functionality inside a mobile application for a local coffee shop. The idea is to make payments at the point of sale, and deduct the amount from the client's prepaid account. I was looking into NFC functionality, but only a few devices support them (and most are not available in Montreal yet). The other idea is to use the Bump API, which would work great for iOS and Android. The last resort would be to use Bluetooth somehow. Any thoughts on any of these approaches, or for those who have tried this, any pros and cons for these ideas.


title: Implementing basic data structures in programming interviews

text: I have been preparing to do my first technical interview in a month, and I have a question about implementing common data structures like stacks or linked lists. I plan to do the interview in either Python or Java but I am not sure which one to use yet. I was practicing and tried to implement a stack in Python, using already built-in lists. However, lists in Python already have all stack methods, while there is still some work to do when arrays in Java are used to implement a stack. If I am asked to implement a stack and my language of choice is Python, what should I do? Should I define Node class? Would I not even be asked to implement such low-level data structure in Python anyway?


title: Is duplicate syntax for defining named functions a bad language design decision?

text: I am modelling a programming language for fun, and the syntax is heavily influenced by Scala - specifically function definitions. I have encountered a design problem because my language **does not differentiate** between functions defined via the `def` syntax (class methods) and anonymous functions assigned to values (created using `=>`) - it removes the differences in both implementation and behaviour. The result is that the following two definitions mean the same thing:               def square(x: Int) = x*x          val square = (x: Int) => x*x      There is no reason for the latter form (immediate anonymous function assignment) to be used in any normal situation - it's simply _possible_ to use it instead of the `def` form. **Would having such duplicate syntax for defining named functions hurt the orthogonality of the language or some other design aspect?** I prefer this solution because it allows for short and intuitive definitions of methods and named functions (via `def`), and short definitions of anonymous functions (using `=>`). Edit: **Scala _does_ differentiate between the two** \- anonymous functions are not the same as methods defined with `def` in Scala. The differences are relatively subtle though - see the posts I linked before.


title: How to handle sorting of complex objects?

text: How would one sort a list of objects that have more than one sortable element? Suppose you have a simple object `Car` and car is a defined as such:               class Car {         public String make;         public String model;         public int year;         public String color;         // ... No methods, just a structure / container     }      I designed a simple framework that would allow for multiple `SortOption`s to be provided to a `Sorter` that would then sort the list.               interface ISorter<T> {         List<T> sort(List<T> items);         void addSortOption(ISortOption<T> option);         ISortOption<T>[] getSortOptions();         void setSortOption(ISortOption<T> option);     }          interface ISortOption<T> {         String getLabel();         int compare(T t1, T t2);     }      Example use               class SimpleStringSorter extends MergeSorter<String> {         {             addSorter(new AlphaSorter());         }              private static final class AlphaSorter implements ISortOption<String> {             // ... implementation of alpha compare and get label         }     }      The issue with this solution is that it is not easily expandable. If car was to ever receive a new field, say, currentOwner. I would need to add the field, then track down the sorter class file, implement a new sort option class then recompile the application for redistribution. Is there an easier more expandable/practical way to sort data like this?


title: What is the benefit of switching on Strings in Java 7?

text: When I was starting to programme in Java, the fact that switch statements didn't take strings frustrated me. Then on using Enums, I realised the benefits that you get with them rather than passing around raw values — type safety (which brings easier refactoring) & also clarity to other developers. I'm struggling to think of a situation where with SE7 I'll now decide to use a switch with strings as inputs rather than Enums. If they are implemented via switching on whole strings (e.g. rather than partial or regex matches), it doesn't seem to offer less reason for the code to change. And with IDE tools and the read-write ratio of coding, I'd be much happier auto-generating an extra Enum than passing around string values. What benefit do they bring to us as programmers? Less boiler-plate? It doesn't feel like the language was crying-out for this feature. Though maybe there's a use-case I'm overlooking.


title: Real-World node.js

text: I am 14 years old, and have been studying web/app/software development. I am trying to learn a backend language, and am considering node.js. I have heard awesome things about it, plus I like that fact that I can already use the JS I know in it. However, I am concerned that it may just be a "trendy/hip" technology, and that it may not be being used in the real-world that much. Are people really applying node.js in production? Or is it just hip right now?


title: What do you call a cron that cksums all your files and writes them to a database?

text: It is a way to take inventory of many cgi scripts and web applications in a Software Service environment. It will be a way of creating changelogs and to keep track of which customers have which programs and will use diff and cksum to notice, compare and identify versions. It "takes inventory", but we actually have inventory systems for non software companies (distributors, etc). So I would prefer not to have confusing names. Edit: We do not use a code repository. So this is not as much for compromised file checking (although it is pretty cool that will be covered), but it is really more as a replacement for a repository and as a way to keep track of which customers have what products to make sure we don't get out of sync with billing. We actually make most of our modifications live. Since these are not public systems, it does not matter that much. If it is public, we either create copies of the program or we run the program on a PC and then test it and then upload it to be live.


title: Unit testing data access objects

text: I have recently started using test-driven development and unit testing, and it has paid off immensely in the areas where I have aplied it. One area that it has been helpful in is database access. When I abstract away the data access, the testing of methods that need the data become almost ridiculously easy. However, I haven't been able to find or figure out a way to test the DAOs themselves. (It would be self-defeating to abstract them out!) A DAO should in theory just move data back and forth between the database and the application; can this be considered too simple to test? I have experimented with setting up a Derby database on my local machine for tests, but it's difficult to automate starting the server, creating the databases, and creating the tables. Is there any way to automate testing of data access objects?


title: Why does the Scrum guide say no testers?

text: I have been reading the Scrum Guide from scrum.org and it says: > Development Teams do not contain sub-teams dedicated to particular domains > like testing or business analysis. In its literal translation this means that there are no testers which is confusing. How can they be suggesting this?


title: When using an ORM should mappings be defined in the code file?

text: Doctrine offers three ways to define the object mapping properties: in XML, in YAML and as inline docblock annotations in the code. The Doctrine documentation doesn't give any advice on choosing among them, but I'm specifically wondering if there is a generally accepted for best practice with regard to keeping mapping metadata for an ORM system in the file where the objects are defined versus keeping it in a separate data file. Is there?


title: How to create in Python Tkinter a widget that would act like a choice tree?

text: I would like to know if there is such widget in tk (or in any different standard Python 3 module), or how to create it: ![enter image description here](http://i.stack.imgur.com/sg5g9.png) Of course it doesn't have to look like this, but it should offer same functionality. Unfortunately PyQT, wxWidgets or any other non standard modules I cannot use.


title: What unit test frameworks exist for Java?

text: I've used TestNG and JUnit. What other frameworks are out there? What makes them special and/or different from the rest?


title: FP and OO orthogonal?

text: I have heard this time and again and I am trying to understand and validate the idea that FP and OO are orthogonal. First of all, what does it mean for 2 concepts to be orthogonal ? FP encourages immutability and purity as much as possible. and OO seems like something that is built for state and mutation(a slightly organized version of imperative programming?). And I do realize that objects can be immutable. But OO seems to imply state/change to me. They seem like opposites. Does that meant they are orthogonal ? A language like Scala makes it easy to do OO and FP both, does this affect the orthogonality of the 2 methods ?


title: Test Driven Development: A good/accepted way to test file system operations?

text: I am working on a project at the moment that generates a table (among other things) based on the contents of a file-system, and and in turn does some meta-data modifications on the things it finds. The question is: how should tests be written around this, or set up? Is there a easy way to mock this out? Or should I setup a "sandbox"?


title: Solution organisation

text: I have been working on asp.net applications for 6 years but almost all of it has been extending and maintaining existing applications. I now have the need to develop a new application and I am scratching my head :( There is a lot of material on Software Design principles and patterns but not much content on organisation. Should the various layers be in separate namespaces, folders or projects? I do have plan to create WCF in future so having Service layer as project makes sense but I am unsure of how many projects I should have? By default, MVC 3 web site has Models and Controllers in the same project does it make sense to separate them to different projects? I would be very very appreciative if someone can post screen shot of well organised MVC 3 solution. I understand this probably depends on personal preference and project size but I need some kind of guidance. Our main application has over 70 projects in a mammoth solution...Please help me avoid this. Many thanks.


title: Does a License Change for OSS cover all versions, including previous releases?

text: If we decide to use a piece of open sourced software that is currently released under a license that allows inclusion in an internal closed source system, what protection are we offered if the owners of the open source software decide to change the license? Typically I'm thinking of where the new license does not allow inclusion in closed source software (I think the PDF generation api iText did this back in 2009). Can the new license be applied retrospectively to the old versions? I'm guessing it can, but often isn't. We are just looking at worst case scenario, would we be in a position where we could just continue using an old version for as long as it suited and then make a decision about the future - or would we be in a position where we'd have to decide to either pay the commercial fee that is often available or find a different "free" alternative.


title: If I want my client program to be free software, do I also have to release the server software as free software?

text: Imagine I've written a game and I want to make it free software. Am I also required to make the game server software free software because the game uses it to connect to other players to play against? Imagine I've written a stock ticker and I wish to make it free software. Can I charge for the subscription to the stock information, even though the software serves little purpose without paying for such a subscription? I'm also interested in revenue sources for free software that go beyond charging for distribution or support, that counteract one person purchasing your software and then distributing it themselves and undercutting your prices.


title: Does understanding functional programming help in understanding popular javascript libraries?

text: I am not experienced in javascript. I try to use some popular javascript libraries such as jQuery, Angular.js and Meteor.js. I wonder if understanding the logic of functional programming (in javascript of course) will help in understanding and using these libraries better?


title: Unit test strategy for layered (or derived) method calls

text: Forgive the title -- it needs work. I am struggling to find better English to express my issue. Edits encouraged. Example to describe my issue: ## Checker Method I have an argument checking method called `public static void StringArgs.checkIndexAndCount(String, int, int)`. Given a string, an index, and a count, confirm the string is not null, and the index & counts are reasonable. Unchecked (runtime) exceptions are used to report errors. There is a battery of unit tests written to check all angles of this method. ## Layered (or Derived) Method The checker method is called by other methods, such as `public static String removeByIndexAndCount(String, int, int)`. The first line of this method checks the arguments by calling the above checker. ## Unit Test Strategy When I write unit tests for the second/layered/derived method, how do I account for the existing set of unit tests for the checker method? It seems to violate duplication/copy-paste principles to simple re-add the same unit tests (modified slightly) from the checker method to the second method. Please advise. My code is Java, but I don't think that particularly relevant, as this same issue could occur in any language.


title: How do we call database table entity in Java?

text: For each database table, I create an entity (object) which contains all columns of the database as Class fields. Now, how do we call these entities in Java? I could not find an official term so I read on forums that people refer to them as `entities`, `models`, etc. I'd like to know either Java standardized term or Java community accepted term.


title: Using Mock for event listeners in unit-testing

text: 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....


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

text: 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.


title: Is SOA an Utopia?

text: 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 ?


title: Front-End Java Web App Framework

text: 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?


title: Using Completed User Stories to Estimate Future User Stories

text: 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?


title: Using a random string to authenticate HMAC?

text: 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?


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

text: 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.


title: ruby for desktop app or web app development

text: 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.


title: Becoming a part-time freelancer

text: 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?


title: Do employers and headhunters maintain a database somewhere about programmers?

text: 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.


title: Application Architecture

text: 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


title: Communication between View and Model

text: 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?


title: What is a Service Locator?

text: 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?


title: JavaScript codes complexity and maintainability

text: 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


title: Is speed a parameter for responding emails of technical tests?

text: 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.


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

text: 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?


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

text: 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.)


title: How do you handle time series .Net?

text: 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?


title: Encapsulating a single property

text: 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?


title: Spring Controllers and Services

text: 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?


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

text: 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.


title: Exception handling in WIn Forms application

text: 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)


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

text: 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.


title: Best way to let users/visitors alter the website design

text: 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?


title: Red flags of unpaid IT internship

text: 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?


title: Django REST + Backbone/Ember/Angular Implementation Method

text: 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.


title: Flags with deferred use

text: 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?


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

text: 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


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

text: **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?


title: How small is the footprint of a small C compiler?

text: 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?


title: Websockets VS SSE

text: 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?


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

text: 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.


title: Validating data to nest if or not within try and catch

text: 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?


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

text: 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?


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

text: 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?


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

text: 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.


title: Payments and open source core developers

text: 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?


title: When one should read 'Code Complete'?

text: 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 ?


title: Is splitting up programming tasks a good idea?

text: 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?


title: Preferring Python over C for Algorithmic Programming

text: 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.


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

text: 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?


title: Do companies hire software developers that are aspiring entrepreneurs?

text: 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?


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

text: 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?


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

text: 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?


title: In Java, what are checked exceptions good for?

text: 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?


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

text: 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?


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

text: 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.)


title: Start to understand an existing project for beginner programmer

text: 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.


title: Clarify the Single Responsibility Principle

text: 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"?


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

text: 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?


title: Specifying and applying broad changes to a program

text: **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?


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

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


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

text: 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?


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

text: 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!


title: Requiring a specific order of compilaiton

text: 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?


title: Open source license limitations and compatiblity

text: 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!


title: How to Learn Doing it Right Way?

text: 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?


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

text: 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.


title: X509 certificate question on WCF

text: **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?


title: Requesting Advice Regarding Storing Encryption Keys

text: 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!


title: Solutions for implementing a full-duplex game server?

text: 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?


title: Are design patterns really essential nowadays?

text: 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.


title: How often do you actually use design patterns?

text: > **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?


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

text: 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?


title: Are design patterns essential for good code?

text: 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.


title: To design pattern, or not to design pattern

text: 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?


title: What if I will not use Software Design Patterns?

text: 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?


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

text: 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.


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

text: 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.


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

text: 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.


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

text: 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).


title: Is is possible to do TDD without a test tool?

text: 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?


title: CS Concentrations and Career Paths

text: 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


title: Warn about 3rd party methods that are forbidden

text: 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.


title: What modes of profit are open to programmers?

text: 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)


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

text: 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?


title: Asynchronous update design/interaction patterns

text: 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?


title: Is there an specific way or algorithm to decode protocols?

text: 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.


title: Are too many assertions code smell?

text: 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?


title: Template rendering engine legitimate use of a singleton?

text: 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


title: Why doesn't Python allow multi-line lambdas?

text: 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?


title: Is learning C essential for Computer Science?

text: 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?