title: How can I get started on my first non-trivially sized Java project?

text: In a month, I have to hand in a Java project. I have to make an e-shop program which has two types of users (admin and normal users). The admin can add/delete/restock stuff in the shop while the normal user can watch products and buy them. In order to buy a product the customer has to make an account in that e-shop. I'm not the best Java student but I've made a plan of what classes I might use and this kind of stuff. But what I can't really figure out is how to:   1. make the users register to the e-shop   2. make different menus without doing a GUI, we are allowed to make a GUI but it is only a bonus and is not really required. By the way I haven't ever tried making a GUI.   3. how to make the program save things like the username and the products on the hard drive. I don't want anyone to do this for me, I just need some guidance, just to find out where to start and what I should look for.


title: Elemental access in arrays

text: I was reading up on data structures from Code Complete. This is when I stumbled through this piece about arrays: > **Think of arrays as sequential structures** Some of the brightest people in > computer science have suggested that arrays never be accessed randomly, but > only sequentially (Mills and Linger 1986). Their argument is that random > accesses in arrays are similar to random gotos in a program: Such accesses > tend to be undisciplined, error prone, and hard to prove correct. Instead of > arrays, they suggest using sets, stacks, and queues, whose elements are > accessed sequentially. Does this hold true for `System.Array` class in C#?


title: Trailing slash in RESTful API

text: I have been having a debate about what to do with a trailing slash in a RESTful API. Lets say I have a resource called dogs and subordinate resources for individual dogs. We can therefore do the following:               GET/PUT/POST/DELETE http://example.com/dogs     GET/PUT/POST/DELETE http://example.com/dogs/{id}      But what do we do with the following special case:               GET/PUT/POST/DELETE http://example.com/dogs/      My personal view is that this is saying send a request to an individual dog resource with id = `null`. I think the API should return a 404 for this case. Others say the request is accessing the dogs resource i.e. the trailing slash is ignored. Does anyone know the definitive answer?


title: Is learning C# easy when you already know C++?

text: I want to learn the C# language and I was wondering if prior knowledge of C++ would make it easier to learn? I have a large background in Java and am currently programming in (and therefore constantly improving on) C++. Would knowledge about the C++ syntax and structure help me understand C# more quickly, or is C# more akin to Java?


title: What does bootstrapping mean in the context of Laravel?

text: I see 'the bootstrap process' mentioned in Dayle Rees Laravel tutorial "Code Bright" but no explanation of what it actually means. The Wikipedia definitions on Bootstrapping in computing don't seem to have any particular relevance.


title: Non-Managerial Programming Progression?

text: I'm contemplating my future career. I have the idea that from a rank-and-file-programmer position, I can advance either along a management track or along a programming track. I'm really not interested in management, so I'd like to know what kind of opportunities there are to advance as a programmer. What kind of jobs are the logical next steps in the progression?


title: Is it good practice to store framework runtimes under source control?

text: I know a lot of software shops keep binaries under source control. However, our shop had come to store entire frameworks on the repository: DirectX runtime, CUDA, nVidia Optix, whatever. It is said to make a dev machine setup easier (supposedly, get latest and start coding). However, it considerably bloats the repository and burdens it with irrelevant history. I've never seen such a usage pattern. Do you consider it a good practice? [EDIT:] I have no problem with source-controlling isolated 3rd party binaries. The question refers to entire framework runtimes, typically consisting in 10+ binaries. As an extreme example, take Windows SDK (which we don't keep on the repository, thank god, but I see no difference in principle).


title: Is there a canonical book on requirements gathering?

text: Is there a book out there that's the de-facto standard for describing best practices, methodologies, and other helpful information on gathering requirements for software and database projects? What about that book makes it special?


title: Using PHP's ternary operator with only two arguments

text: I was recently reviewing some of my code and noticed that in a fit of absent- mindedness, I'd left a structure like the following:               $guid = empty($subscription->guid) ?  : $subscription->guid;      Now, this _wasn't doing what it's supposed to_ and is **wrong** , but since that property is always set now it was working fine, and there's no syntax error since 5.3 because of the following change: > Since PHP 5.3, it is possible to leave out the middle part of the ternary > operator. Expression expr1 ?: expr3 returns expr1 if expr1 evaluates to > TRUE, and expr3 otherwise. I wasn't aware of this change, and now I'm curious if I should be using it or not. This is something I was sorely missing from languages like ruby where you can do eg, `a = b || c` to get either `b` or `c` rather than a 'real' boolean. However, the syntax they've chosen for the ternary operator seems a little counter intuitive to me. Should I be using this in production code? It definitely threw myself when I saw it by accident.


title: How to write integration tests for a component oriented software platform

text: **Initial situation:** We are developing a software platform where products can be generated by configuring different components and adding additional ones. The platform is developed several years by a little developer team. Now the platform is more and more used, we get new developers as well as testers. We are currently developing a concept for developer. Cause is, that we do not have much developer tests for our components. The tester team uses automated UI testing tools to test the products emitted by the platform. **Our goal:** We want to motivate our team members to write more tests to achive   * shorten feedback cycles   * reduce bug count for new features   * reduce regressions **The question:** We want to begin figuring out brittle components. After we have found them, we want to write integration tests for the component which describes expected features. Now we have the following problem: We can test the component for itself and mock all dependencies to other components. We can test the component with all directly depend components. We can test the component with the completely dependency structure of it - so its dependencies and their dependencies... We can test the component in the context of different product configurations. Which one would be the best to achieve our goals and at the same time minimize the effort needed by our team members to configure the tests?


title: Options within OpenCV related to image difference analysis and reporting

text: **Scenario:** Stationary view with sequential timestamped samples in 2D-color where the comparison is only done between one pair of neighboring samples. **Background:**   * Have never used OpenCV before,   * Limited understanding of computer vision,   * Moderate experience scripting programs. **Questions:**   * Given the information provided, what additional information would be of use?   * What existing related analysis and reporting solutions within OpenCV should I look into more? * * * **UPDATES:**   * **What is the source of these images?** I've abstracted the intent of a problem to the degree in an attempt to avoid skewing how the answers conceptualize the related solutions. **Disclosure-of-Problem-Domain:** It's possible that I'm wrong about the value of abstracting the problem domain, and since it's already been guessed, I'll confirm the domain is any high-value automated GUI testing that is of relatively low-complexity. Currently, seems like simple regression testing based on pixel-for-pixel change which is then sorted by the percentage of pixels change on a pair-by-pair basis would be quick and produce value, but the template matching suggested by Martin Beckett might allow for cross-platform testing, though again not knowing much about OpenCV, or the domain of computer vision, it's hard to say complex or valuable such an approach might be currently.   * **What is the same?** Depends on the solutions OpenCV offers in the context of image difference analysis and reporting. Any artifacts related to the capture would/should be accounted for in the comparison analysis. Ideally, difference reporting should by default (or predictive coding) only profile material significant state changes in a way that allows the manual response to them to be prioritized.    * **What are the circumstances of the image capture?** All pairs are sampled within a highly controlled environment with the same stationary view/angle, lighting, exposures, focus, etc.


title: Really bad example projects that use sonar

text: When consideringen whether to use sonar or not, it would be great to see both good code as well as bad code that use sonar for static code analysis. I have browsed http://nemo.sonarsource.org/ looking for projects that have bad metrics. Unfortunately, I think that the really bad ones will probably not use code analysis at all. I have managed to find a few, but they are not as bad looking as I wanted to find. If one can find a really bad looking one and then compare it to a project with good metrics, then it would be easier to make a case as to why to use sonar in the first place. Are there any horror example projects with really bad metrics out there? I would prefer java projects. I found one with worse metrics than most, but even that isnt all that bad to me: http://nemo.sonarsource.org/dashboard/index/351728?did=1 BRs


title: Is it possible to encapsulate the object itself within a dynamic property?

text: I ask this question out of curiosity. Lets say the class Foo is a singleton and I want to call Foo instead of Foo.Instance to access the static object. Would it be possible to encapsulate the object itself within a dynamic property?   Would C# allow me to create a dynamic property that refers to anything but a property of the said object? Like so:               private static Foo _instance;          public static Foo this {         get {             if (_instance == null) {                 _instance = new Foo();             }             return _instance;         }     }     public void Bar(){}      this would allow me to call               Foo.Bar();        instead of               Foo.Instance.Bar();        If this is possible, then in witch situation would it be viable to encapsulate any kind of object like this whithout using heritage for example instead of:               class Ploof : List{}        we would have:               class Ploof {         private List _list;         public List this { get {  return _list; } }     }


title: What should a programmer learn first: Algorithms or Design Patterns?

text: I have new junior programmers (new graduates) who just joined my team, some of them do not know much about algorithms and design patterns. I am not sure which one should I teach them first?


title: How to convincing Programmers that 'being in the zone' [coding] isn't always beneficial for the project?

text: In this book review: http://books.slashdot.org/story/11/06/13/1251216/Book- Review-The-Clean-Coder?utm_source=slashdot&utm_medium=twitter > Chapter 4 talks about the coding process itself. One of the hardest > statements the book makes here is to stay out of "the zone" when coding. Bob > asserts that you lose parts of the big picture when you go down to that > level. While I may struggle with that assertion, I do agree with his next > statement that debugging time is expensive, so you should avoid having to do > debugger-driven development whenever possible. He finishes the chapter with > examples of pacing yourself (walking away, taking a shower) and how to deal > with being late on your projects (remembering that hope is not a plan, and > being clear about the impact of overtime) along with a reminder that it is > good to both give and receive help, whether it be small questions or > mentoring others. they talk about how 'being in the zone' - can actually be detrimental to the project. How do you convince your team members that this is the case?


title: Why is Mercurial considered to be easier than Git?

text: When looking at comparisons, it seems to me that there could be a 1:1 mapping between their feature sets. Yet, an often cited statement is that "Mercurial is easier". What is the basis of this statement? (if any)


title: How to systematize tagging in code?

text: There are several almost standard tags used in comments: **FIXME** , **TODO** , **BUGBUG**. Which other tags do you use and for what? Are there any standards on using them, i.e. format (supplementing with date and initials), revising procedures, etc?


title: Should a view call a function?

text: Should a view call a helper function? Say I pass in data from the DB to the view. The data is a unix timestamp. Should I make a call in my view to convert it to a human readable TS or should I convert it in the controller before passing it in? OR should I make a method in the model that converts... Looking for a "best practice" or "secure coding" concerned answer.


title: Selenium-Nunit Program Structure

text: My office has a suite of web reporting engines written in VB. All in all there's about 300 reports with varying displays depending on the data being input into them. I'm trying to establish an efficient way to deal with such a major diversity, but am struggling with creating a system that won't be a nightmare to code/maintain. What I've considered doing is:   1. On program launch, read the steps required for each test page. This may have multiple tests for the same page with varying inputs.   2. Write each iteration of the test in XML file under $env:temp/testname   3. Use the TestCaseSource attribute of Nunit to funnel every related xml file as a source. My major stumbling block has been how to get that data to the Nunit framework. Is Nunit really appropriate for what I'm trying to do, or is it too static?


title: Version control and data provenance in charts, slides, and marketing materials that derive from code ouput

text: I develop as part of a small team that mostly does research and statistics stuff. But from the output of our code, other teams often create promotional materials, slides, presentations, etc. We run into a big problem because the marketing team (non-programmers) tend to use Excel, Adobe products, or other tools to carry out their work, and just want easy-to-use data formats from us. This leads to data provenance problems. We see email chains with attachments from 6 months ago and someone is saying "Hey, who generated this data. Can you generate more of it with the recent 6 months of results added in?" I want to help the other teams effectively use version control (my team uses it reasonably well for the code, but every other team classically comes up with many excuses to avoid it). For version controlling a software project where the participants are coders, I have some reasonable understanding of best practices and what to do. But for getting a team of marketing professionals to version control marketing materials and associate metadata about the software used to generate the data for the charts, I'm a bit at a loss. Some of the goals I'd like to achieve:   1. Data that supported a material should _never_ be associated with a person. As in, it should never be the case that someone says "Hey Person XYZ, I see you sent me this data as an attachment 6 months ago, can you update it for me?" Rather, data should be associated with the code and code-version of any code that was used to get it, and perhaps a team of many people who may maintain that code. Then references for data updates are about executing a specific piece of code, with a known version number.   2. I'd like this to be a process that works easily with the tech that the marketing team already uses (e.g. Excel files, Adobe file, whatever). I don't want to burden them with needing to learn a bunch of new stuff just to use version control. They are capable folks, so learning something is fine. Ideally they could use our existing version control framework, but there are some issues around that. I think knowing some general best practices will be enough though, and I can handle patching that into the way our stuff works now. Are there any goals I am failing to think about? What are the time-tested ways to do something like this?


title: How to estimate sprint velocity with varying team capacity?

text: We are a small team of 4 devs rather green in Scrum. Coming from all over the country, we often take odd days off or whole weeks off to go home. Therefore our team capacity changes dramatically from one iteration to another due to annual leaves, which leads to very different velocities from one iteration to another. How do we account for team capacity when estimating velocity at the Planning Meeting? Historical data will reflect very different capacities and we cannot wait one whole year to derive an average for our estimate velocity.


title: How to estimate a timeboxed spike using story points?

text: So my team and I are quite new to Scrum and today moved from estimating in Ideal Hours to Story Points. All seems sound rationale, BUT with timeboxed activities. Here is the case, we have an extremelly complex User Story that needs a spike so to explore underlying technical unknowns. With Ideal Hours it would be easy: timebox it to one ideal day (8 ideal hours). Now we want to account the exploratory work towards our velocity. So, the pressing question is how do we give Story Points to a timeboxed activity? Constraint: we do not know how to translate this 1 ideal day into Story Points because our historical data is badly collected and does not reflect reality.


title: Implementing scrum-but for first time: how to deal with technical pre-requisites?

text: After working Scrum(ish) in a previous workplace, I am trying to implement it in my new place of work for a brand new project (I am no scrum expert). We have some pre-requisites to code before we can begin working on the stories (which are being groomed in the mean time). Things like database design, api design, etc. We plan to use two week iterations and it's just not clear to me how the first one (or two) can provide something useful to the customer and "potentially shippable" if we first have to "lay down some groundwork" ? Any ideas on how to treat this? \-----edit / rephrase----- How do we incorporate initial non client-visible preliminary work (e.g., database design, api, etc) into the Scrum process?


title: Could anyone suggest me some image manipulation techniques to be added to my image viewer?

text: I'm trying to develop a small image viewer just as an exercise to sharpen my programming skills. So far , all the features that I could think of adding to it are zooming in and out, inverting the colors of the image and resizing. Could anyone suggest me a few more features?? You are also welcome to suggest anything which has not been implemented yet. I would like to take it as a learning challenge. Thanks.


title: How should I store an old project?

text: As a freelancer, I come across many projects. Its almost impossible to store a backup of all of the projects on my laptop. What are some better options to store them?


title: How do I create a mutually-incompatible type library in Java?

text: Folks, this seems like it should be straightforward, but I'm drawing a blank here. As a simplified example, consider an abstract class called Number with an abstract method add(). I want to create two concrete subclasses, Integer and Float, with method signatures Integer.add(Integer other) and Float.add(Float other). A Float can NOT be added to an Integer. What should the method signature of the abstract add() method in the Number class be in order to enforce this constraint at compile-time?


title: Why are off by one errors so common and what can we do to prevent them?

text: It seems that off-by-one errors are one of the most (if not the most) common programming errors (see What are common mistakes in coding?, and conventional wisdom). What is the reason these are so common, is it something to do with how the human brain works?   What can we do to prevent falling prey to the off by one errors?


title: register variable in C and C++

text: I know the concept of register variable and it's use cases but there are few questions in my mind based on what I have tried.   1. I cannot access the address of a register variable in C though I can do it C++! Why? Is there any issue in accessing the addressing of a register variable?   2. Suppose if I declare a string variable in C++ as register, then where will that variable be stored? What is the point in declaring the storage class of non-numeric data types such as 'string' in C++ to be register?? **UPDATE:** I thought that C++ allows us to fetch the address of a register variable, as I was not getting any error in my program which is as follows:               #include<iostream>     #include<time.h>          using namespace std;          clock_t beg, en;          int main(){              int j, k=0;              beg=clock();         for(register int i=0;i<10000000;i++){             /*if(k==0){                 cout<<&i<<endl;    // if this code is uncommented, then C++ rejects the recommendation to make 'i' as register                 k++;             }*/         }         en=clock();              cout<<en-beg<<endl;              cout<<&j<<endl<<&k;              return 0;     }      What I have observed is, if I make the variable 'i' as register and don't try to print the address using '&i' then C++ accepts the recommendation and stores 'i' in register, this can be infered from running time of for loop which will always be around 4-12 ms if 'i' is in register. But if I try to print address of variable 'i' then though I don't get any error but C++ rejects the recommendation and this can be infered from the time of execution of loop which is always more than 25 if i is not register!! So, basically I cannot fetch address of a variable with storage class as register!! WHY?


title: What are some standard design methods to add GUI to a command line app?

text: I have an embedded linux c application that runs with a simple CLI. I am now tasked with creating a GUI that accomplishes the same functionality as the command line program. I am not an accomplished GUI designer and the majority if my experience is in deeply embedded c coding. My initial thought is to use qtcreator to create the GUI, but there are several issues I'm ruminating over.   * Moving forward I want to maintain both the CL program and the GUI program, and preferably even have them be the exact same executable that can be launched in either mode. Unless this is a bad idea?   * My code is in C so far, and qt is natively c++   * I would like a direct correlation where button presses in the GUI call the same functions that I call from the CLI   * How do I best do this cleanly and efficiently? Is there some other thecnology or library that simplifies this? I don't have to use qt if there is something better.


title: Understanding how Code works is the way to actually 'Learn' programming, right?

text: I have a friend who is struggling with learning how to program (he wants to make games; as do I). Several books, tutorials, etc. His mentality is he has to memorize the code itself, as in the exact syntax for a program. I believe he's wrong, and that it's more about understanding what the code does and how to apply it elsewhere. Unfortunately, I'm still in the learning phase myself, so I haven't been much help to him. I'm hoping to get some advice from more experienced programmers on the matter. BTW, The language we're learning is C#, as it's compatible with Microsoft's XNA Framework.


title: Learning C# and stuck in a rut

text: I've been learning C#/.NET 4.0 for about 2/3 months, it's my first serious programming language (I've looked at PHP, HTML, CSS, JavaScript, and VBA before but never massively in depth) and I'm starting to become a bit stuck:   * I have hit a ceiling with my learning due to lack of a 'big' project...   * Lack of working on complex projects is giving me doubts in my abilities... 2 weeks ago I had an interview for a Junior Programmer job, and managed to answer most of the questions that were answered of me, but I still didn't get the job due to lack of practical experience, I'm unsure of what to do! As I said before, I wouldn't mine contributing to an Open Source project, but I don't know where to start, I presume the 'big' projects only want good coders :( Is there any form of online programming test that will show me how 'good' (or 'bad') I am at the moment? :) Thanks for any help.


title: What is considered best practice for printing usage / help (--help)?

text: When writing tools for the CLI of UNIX, how should I make the program print out help and/or usage? I usually use `fprintf(stderr, "help text here");`, but there are several issues with that.   * First, I'm not sure, whether I should use `stderr`. Is that OK, or should I use `stdout`?   * As you can imagine, the help text is quite long, depending on how many options the tool has. Now, I usually, just put several `"strings like that\n"` in the second parameter. This however, fills my source code with fifty or more lines of help text. It is not easy manageable at all. What should I do instead?   * When a tool is not written in C or a C-like language, I tend to use here-docs where possible (most prominently with Perl). I can't use that in C, but is there something like that, that I could use?   * I was considering putting it in a `headerfile.h` inside a `#define HELP "help text here"`, I've never seen it in the wild, don't know whether I should actually use that. Ideally, I could put the text in an external file, and include it. Using `#include` for that seems wrong, though. What should I do then? The idea is, to have a help text, that is easily manageable. Having it inside the source code isn't really convenient.


title: Conquering Complexity: Valuable techniques

text: Software development techniques exist to solve problems. I think a key problem we face is conquering complexity. Also, software developers must often classify and understand complex systems, separating accidental complexity from essential complexity. I believe that sufficiently useful definitions of these terms all exist on Wikipedia. My question is: What techniques are most valuable in conquering complexity, as a professional software developer, and/or software architect? Answer examplar; a blog post on conquering complexity that seems to be coming at things from a java/c++/OOP centric perspective.


title: Inheritance/OO design question

text: This will probably wind up being a fairly simple question, but it needs some background first... I'm modelling various hardware switches, which can be turned on and off. The switches are configurable, allowing a user to specify the numeric values that are sent to the hardware to signal that it should turn on or off. This is the `Switch` class:-               public class Switch     {         public Id { get; set; }         public SwitchConfig Config { get; set; }              public void TurnOn()         {             WriteToSerialPort(Id, Config.OnValue);         }               public void TurnOff()         {             WriteToSerialPort(Id, Config.OffValue);         }      }          public class SwitchConfig     {         public int OnValue { get; set; }         public int OffValue { get; set; }     }      So far so good. I now need to model a new type of switch that can not only be turned on and off, but can also have a temperature threshold set, so it seems sensible to inherit from the `Switch` class. The configuration will also need extending to include min/max permitted temperatures, e.g.:-               public TemperatureSwitchConfig : SwitchConfig     {         public int MinTemperature { get; set; }         public int MaxTemperature { get; set; }     }      The specialised switch class will look something like this:-               public TemperatureSwitch : Switch     {         public void SetTemperature(int temperature)         {             var temperatureSwitchConfig = Config as TemperatureSwitchConfig;                  if (temperature < temperatureSwitchConfig.MinTemperature                 || temperature > temperatureSwitchConfig.MaxTemperature)             {                  return;             }                  WriteToSerialPort(Id, temperature);         }     }      It doesn't feel "right" where I'm having to cast the `Config` property. I'm sure there must be a slicker OO solution to this, but I think "analysis paralysis" has set in and I can't see the wood for the trees! Or am I worrying over nothing - is the casting an acceptable solution in this scenario?


title: Are 'Architect' and 'Developer' separate roles?

text: Is it actually possible to develop software without also architecting it?


title: Barter vs. Cash for a Retailer's eCommerce Site

text: I am putting together a proposal for a local store with both a brick-n-mortar and web presence. It's an upscale shop that also happens to be one of my wife's favorites. I am considering offering the option of barter for part of the payment. I have two questions in this regard: What would be a reasonable "exchange rate" for such a transaction? That is, in lieu of $1000 cash money, I should ask for about how much in store credit? **_In your own experience,_** has using barter introduced any complications into the client relationship? Are there particular pitfalls to be concerned about?


title: Development team roles splitted each time more

text: I've been noticing the roles in a development team has been splitted each time more. I remember some time ago, there was a mix between backend and frontend developers. But since the restful APIs has become so popular the tendency seems to be in splits more. Currently in my case, we have a designer who makes the layout, html and css, a javascript developer who only treat with javascript, a Java backend guy and someone on the database side. I know often it depends on the company, there are still several companies which mix the roles. But there is a tendency. How do you see the future of frontend and backend developers? Bearing in mind mobile development, web development. How the frontend and backend will be divided? for who knows about these ones. Is not the technologies such as: JSF and TAGLIBs on Java and others similar in different languages going against the tendency?


title: Managing UAT / Defect and Bug raising

text: I'm looking for assistance in figuring out the best approach to managing User Acceptance Testing (UAT) and how users raise defects/bugs - I've been in the situation before of having to deal with a free for all in that every small error is raised as a bug which takes valuable time from actual bug fix whilst I sift through lots of invalid defects/bugs. Don't get me wrong, i'm not trying to short shift users by saying "not a defect" but trying to make the process smoother so that things get fixed.


title: How important is it to clean up someone else's code when faced with a tight deadline?

text: (I'm talking about HTML / CSS code (not programming languages) but I think we also face the same issue as with programmers.) I am the senior front-end designer in a team and I often have to re-work my juniors' output in tight deadlines. I am faced with 2 problems:   1. Their coding style is a bit of a mess.    2. The aesthetics are not good. Their coding style, I find, is a mixed bag with no proper convention / standard. I am torn between cleaning up the code or just dealing with their code (even copying how they do things). I do find it frustrating to follow their coding style as I feel I might learn bad habits. But then, that is the fastest way of meeting the deadline. For those with much more experience, which is more effective? Should I save the clean-up for later? Or clean-up along the way as I make the changes? (I don't want to sound arrogant though but such is the reality. It will take them more years to write better code. I know, I wrote messy code when I was starting.)


title: How to include incomplete math grad program on entry-level programming resume

text: I am creating a resume so that I can start applying for entry-level programming positions. How can I include my time spent as a graduate student of pure mathematics since I did not complete my degree and am not currently enrolled? Should I attempt to include this? I have been given conflicting advice on this. Also, without this information I have a huge gap in finishing my BS and today. About me: I have a BS in Mathematics and Computer Science. As an undergraduate, I became more interested in pure mathematics than computer science. After graduating, I became a graduate student in mathematics. However, I was forced to drop out mainly due to the university cutting my GA position due to lack of funding (I am from Illinois). It has been nearly three years since I left my graduate program. Since then I have bounced around a bit in dead-end jobs while trying to figure out what sort of career would fit me best. I studied actuarial science, tried to create an internet start-up and spent time trying to figure out how I was qualified to be an industrial engineer.


title: What is this programming style? "Monoid-ic"?

text: In a moderately old blog post, Conal Elliot makes an interesting (if less than serious) argument that C is a purely functional language, by drawing a parallel between the combination of the C preprocessor and C itself, and that of Haskell's pure expression language and its impure IO action values. It's observed further down that the phase separation between C's components actually makes what `cpp` does quite different from Haskell, though, so `cpp+C` is not monadic after all. In real programming projects, C programmers prefer to minimize their use of `cpp` as far as possible. The macro language may be capable of amazing things, but it's a fairly hostile programming environment. So as far as I can tell this concept is mostly unexplored from a C perspective. However, building on the example of C, we could envisage a language where the primary way of programming is for the developer to write a purely functional program which _builds a fixed sequence_ of action values and strings them together into a finished program. Distinct from Haskell's model in that the functional program only exists at "compile time", with a clear separation between the two stages of evaluation and execution; distinct from C's model (or Lisp's) mainly in the emphasis on the "macro" stage as the _primary_ programming tool (and with a macro stage that isn't.. y'know, horrible - rather, it looks and runs like the full-fledged language), with the end program consisting of a fixed sequence of "action" building-blocks that the developer is discouraged (or even prevented) from authoring directly.   * Does this programming paradigm exist? If so, what is it called and what are existing examples of it? Is there any literature on this topic? ("Metaprogramming" is the obvious answer, but that seems too broad and off- target: `cpp` or C++ templates as they're currently lightly-used also fall under that, while Haskell IO doesn't.)


title: Is there a mature, easy-to-use CQRS framework that is not Azure-specific, not outdated, or not well adopted?

text: I've been doing research on .net implementations with CQRS. Either everything I've seen so far is do-it-yourself, azure-specific, outdated (i think), or not well adopted Problems:   * Scritchy - is not well adopted   * NCQRS - appears to be a bit older? it also requires a DIY-ish setup - meaning, you need to create several projects yourself (not all that terrible though).   * https://github.com/gregoryyoung/m-r \- more of a theoretical demo than a production framework   * LOKAD.CQRS - mostly azure specific   * https://github.com/MarkNijhof/Fohjin \- again, more of a demo than framework I'm working on a new project. It will be hosted in AppHarbor. I would like to use a CQRS approach. I would prefer to use an awesome framework rather than write/copy it myself.


title: Microsoft's Software Development Engineer in Test position

text: I was curious about MS's Software Development Engineer in Test (SDET) position. I've heard a lot of people speak negatively and positively about this position. I was wondering if any current or previous SDETs could comment on a couple of issues. 1) Is career development in any way hurt by this position within and outside of MS? 1.5) Is it harder to get hired as a developer at another company after being an SDET? 2) Within MS culture, how is the SDET position viewed with respect to PM or SDE? Is it respected or looked down upon? 3) If you worked as an SDET, did you like it?


title: Should I add MSDN notes or Stack Overflow links to source code?

text: > **Possible Duplicate:**   >  Is it OK to put a link to Q&A sites in a program's comments? I'm creating a powershell / C# host and want to add the following comment               // This method cannot be called multiple times on a given pipeline. The state of the      // pipeline must be NotStarted when Invoke is called. When this method is called, it     // changes the state of the pipeline to Running.      // see http://msdn.microsoft.com/en-us/library/windows/desktop/ms569128(v=vs.85).aspx     if (pipeline.PipelineStateInfo.State == PipelineState.NotStarted)     {         Collection<PSObject> results = pipeline.Invoke();     }      Is this an appropriate comment? What would you improve about it?


title: Besides polymorphism, what's compelling about OOP?

text: When I first came to OOP (at first in Java, and then C++) after years of working in C and VB, it was amazing. The idea of extending existing behaviour and operating generically over things of related types was very appealing, and I almost immidiately saw why it was that I wanted this. That is, my motivation for OOP was subtyping polymorphism and inheritance. Fast forward to today, and I regularly get to use ad-hoc polymorphism solutions (typeclasses and duck typing) which solve the problems subtyping originally appealed to me for in very elegant ways. I have access to parametric polymorphism in most of my environments. Programming generically with these different sorts of polymorphism gives me all the extensabiltiy and re-use inheritance ever did, and more. So, my question is: why should I still care about OOP? What uses of OOP have you found that are really great besides inheritance and subtyping? Also, "because it's popular and you will have to use it" does not count. I already am quite familiar with OOP, and use it in my day job because the code base uses it. For a new project, or for myself, that's what I'm asking about.


title: Upgrading in java web development

text: I'm a java web developer for nearly 3 years. Always trying to learn more and be better but still I feel that the amount of knowledge is not that good as I want. The knowledge in some places still seems to be non-systematic and don't provide a very strong base to solve the problems as good as I want to do it. The example I have is my senior developer, whose solutions are always more efficient and beautiful. So, the question is rather simple and hard the same time. What is the right way to get my knowlege be more systematic and therefore improve it's quality. I understand that there is no practically good answer for the all java programming, so let's focus on the modern java web or nearly web technologies:   1. JSF 2.0   2. JPA2 and Hibernate as persistence provider   3. Web services   4. and Java SE as a core. What methodologies or books or learning technics lead to the strong knowledge base within the given knowledge area?


title: WinRT: How usable will it be?

text: WinRT: is it really about calling WIN32 (wrapped in COM (exposed as .NET)) via _a proprietary extension_ of C++? That looks like a lot of wrappers and layers between the developer and the actual functionality. Does anyone trying to go with it stand a chance at profoundly understanding the ecosystem (if his last name isn't "Petzold")?


title: Why do certain sites prevent spaces in passwords?

text: It seems less common with newer websites, but many websites I need an account on (like for paying bills, etc.) prevent me from creating a password with spaces in it. This only makes things more difficult to remember, and I am aware of no database or programming restrictions on spaces in passwords, encrypted or (heaven forbid) otherwise. Why, then, is the spacebar so commonly discriminated against when it comes to signing up for a site?


title: Code to simulate a users actions, such as logging in

text: I've recently begun working on a PHP application, replacing another developer. I believed the application was using an API to communicate with a remote service but when I looked through the code I found that it was using a set of functions to actually log in, fill out forms and submit them as a user might do in a browser. My intention is to replace this code, to use the services API instead. I've considered leaving the code as is and not replace it. It makes me wonder though is this a common practice in the software industry? To have a programme simulate a users actions in a browser to perform a set of actions? It feels to me that this is clever but poor programming, Have any other developers seen this? Edit: Sorry, should have added this in the first place, the code I describe isn't part of a testing suite, its live code.


title: Advice for an ambitious student on building your own kernel

text: I'm a very ambitious university student who wishes to learn pretty much everything there is to know about computers (bash me if you want, I love learning). Recently I thought it would be a fun project (albeit a lengthy one) to design and build my own kernel. I got some basic info and I've gathered that I need to master Assembly and C/C++ to really make this work. While I'm working on those, I'd like to learn HOW a kernel actually works from a programming perspective. I've spent hours browsing the linux kernel's code but that can only take you so far. What are the basic steps in building a kernel? Things you need to address? Order or doing things? I know I'm biting off a lot but I'm determined enough to handle it.


title: What functionality does WebStorm contain which RubyMine does not?

text: I am looking at buying Rubymine as I am doing a small amount of ruby, but a large amount of html5/javascript. I was going to get Webstorm as I do have a lot of pure html5/js based frameworks/apps that I am working on, however I then read that WebStorm/PhpStorm/Rubymine etc are all based on their IDEA framework, and made out like each framework contained the functionality of WebStorm anyway, other than a few features which were not there out of the box but could be added through plugins. The main features that interest me about WebStorm are:   * JS Unit testing from IDE   * JS Lint/Hint coverage within UI   * DOM/JS Refactoring/Intellisense   * Coffeescript support   * SVN/Git integration   * FTP and remote sync (although not as important as the rest) So given the above, would Rubymine provide the above functionality too? as I would rather have 1 IDE which I can do both in, than having 2 IDEs which have a lot of overlapping functionality. Is there any specific functionality which is ONLY within Webstorm but not in any of the other IDEs?


title: Return Types from Service Interfaces in Service Layer: Mapper required for UI Layer objects?

text: I am designing a component based system using JSF2 on top of Spring's IoC Container. It is to employ a service layer between a controller and the domain/business layer (I anticipate the controller is nothing more than the JSF Servlet binding in the web.xml file). The rationale for the service layer (which conforms to an interface for each service) is to allow for the services to be changeable. It has occurred to me that the return types of the objects from the service layer objects are likely to be business objects from the business layer, which would then be used in the backing beans for the JSF view to populate the UI components on the pages. _Ideas:_   * Is it acceptable as a standard practice for these business layers,   say a Customer() object coming back from a FindCustomerService, to   just be passed back to a Presentation Layer backing bean? Can the Presentation Layer know about the Business Objects or are these not a part of the Service/defined for use in the Service Interface and therefore part of the contract for a Service implementation?   * Alternatively, should I be thinking about representing components on   the UI using a generic set of UI classes within the backing beans, which are then mapped to the return types coming back from the Service Layer in another layer between the   Controller and the Service Layer? (This would likely require re-engineering if a Service was changed?)   * Perhaps it is a standard practice to return using standard language scalars and object return times from the service layer to avoid the need for a translation layer? First SOA project. Figured this would make a nice question for archive and links to appropriate patterns would be greatly appreciated.


title: When do you use new technology and complicated design principals in an LOB app (using WPF)?

text: I'm building an LOB app for a very big and serious client, the app itself is not big but my client is so I have to get it right. I'm generally tempted to always use the latest stuff out there and learn as I go, sometimes this ends up in good productivity. Like when I wrote most of with WCF Data Services over asmx services, and then I used Silverlight over ajax/asp.net, these turned out to be a good decisions although there was initial pain in getting off the ground. Specifically I'm thinking of using WPF over win forms, I've never used WPF, but would the learning curve out-weigh the benefit? Also generally would this kinda thing be a bad move when we're really tight on time? **Second:** When it comes to design principals like for **example** using MVVM in my case. Would that again be an over kill for a small app? (4000 lines as a bad estimate?) Sure my code won't be testable but would I even need such a small app to be testable? Overall I'm trying to keep my base code neat and my UI layer thin. **My question is:** Just generally, I want to know, how many serious devs/small companies out there, move to newer technologies or hard core design patterns, practices, frameworks (Prism, CAB) or models (MVVM) for smaller apps? How do make a call for >> complexity + learning curve _vs_ benefit **Edit** * * *   1. I'm I have about 1-2 months tops, a lot of base code and almost all planning & design is done.    2. Its a fixed fee I'm billing which sucks, but they are starting to have a few plans to build more functionality on top.    3. I (sole dev) will be maintaining it.   4. Partly I want to choose WPF to provide a better more professional look too, to get them to buy more updates/upgrades on functionality from me.   5. I actually tried writing my own crazy MVC framework in win forms, it was a mess, I have a "feeling" my code will be better in WPF?   6. Any thoughts on using MVVM Light?


title: Does pair programming ever turn into lengthy unproductive discussion?

text: I was just thinking about pair programming and one thought just crossed my mind that surely at some time two coders are not going to agree and it would kind of turn into a lengthy (maybe heated) discussion about an implementation of a paradigm or algorithm, etc. I expect these might be 'religious' wars over stuff? Does this happen? Having never 'pair programmed' ever, is this something that occurs? Are there processes to stop lengthy discussions?


title: MVC : Fully populated models or Partially Filled Models?

text: This one has haunted me for so long. When doing MVC programming what do you think is the better programming practice? Should one use fully populated models or the partially filled ones, especially when I know that for this particular task I am going to need only 2 fields from the model object which has 5 others? Sometimes it just seems criminal to fill a list of 20 model objects with all values from database when you know that you are going to need only a few of them. Of course partial model means that you will have to write one more method in your DAO apart from the one which fetches everything. Which mean more code to maintain? On the other hand pulling everything from DB with fully populated models means one method serves all but this is obviously going to give you some performance overhead. I can see ORM (such as Hibernate or ActiveRecord of Rails) favoring trends in MVC programming and databases like Google’s BigTable full models is accepted trend. But what if you are still using good old JDBC? Hardware is cheap, development is costly. Is that really true even when the app needs to scale to few hundred thousand requests per hour?


title: Inheritance from the objects themselves

text: Making new inheritance hierarchy with the help of C++ I think about: > Why there is no inheritance from the class objects? Abstract example (on > abstract C++): >   >   >     struct Foo { int v; Foo(int a) : v(a) {} }; >     struct Buz : public Foo(2) { ... } >   > > So, the `Buz` is inherited only from instance of `Foo` \- `Foo(2)`. Can such idea be useful? Is there any possible implementations or related ideas?


title: Is Language-Oriented Programming practical?

text: I read this article on Language-Oriented Programming. He points out some weaknesses in the modern procedural/OOP approaches to programming, and suggests a new programming paradigm that will solve them I am all for small, loosely coupled program parts: It is much better to learn a lot of small things, all of which you will use, than a couple of big things, that you only use bits and pieces of. Reading the article, I got the impression that the author was promoting one of two things:   * A multitude of easily creatable scripting languages   * A single, easily extensible language that can rewrite itself to meet the programmer's needs If he is suggesting the second, I would reply with "Already been done!" and give Lisp as an example. As Paul Graham suggests, languages seem to be continually moving toward this anyway. As far as the first is concerned, I think this is a good idea, if there is an underlying language that ties them all together. That seems to me to be the weak spot: communication between the languages. Would you use calls, which is a procedural concept or message-passing, which reminds me of interprocess communication? I would welcome the opportunity to work with small domain specific languages, if it's easy to use them all at the same time. Would this approach (LOP) be practical?


title: Parallel Class/Interface Hierarchy with the Facade Design Pattern?

text: About a third of my code is wrapped inside a Facade class. Note that this isn't a "God" class, but actually represents a single thing (called a `Line`). Naturally, it delegates responsibilities to the subsystem behind it. What ends up happening is that two of the subsystem classes (`Output` and `Timeline`) have all of their methods duplicated in the `Line` class, which effectively makes `Line` both an `Output` and a `Timeline`. It seems to make sense to make `Output` and `Timeline` interfaces, so that the `Line` class can implement them both. At the same time, I'm worried about creating parallel class and interface structures. You see, there are different types of lines `AudioLine`, `VideoLine`, which all use the same type of `Timeline`, but different types of `Output` (`AudioOutput` and `VideoOutput`, respectively). So that would mean that I'd have to create an `AudioOutputInterface` and `VideoOutputInterface` as well. So not only would I have to have parallel class hierarchy, but there would be a parallel interface hierarchy as well. Is there any solution to this design flaw? Here's an image of the basic structure (minus the Timeline class, though know that each Line has-a Timeline): ![enter image description here](http://i.stack.imgur.com/JEwCv.png) NOTE: I just realized that the word 'line' in `Timeline` might make is sound like is does a similar function as the `Line` class. They don't, just to clarify.


title: How do you unit test a User Interface?

text: I use JavaScript with JQuery for a Rails application. I have some dynamic behaviour in this one. As a Ruby developper, I like TDD/BDD, specialy with RSpec. For the moment, I test my JavaScript manualy. It's not the best way because a change, somewhere, can break the code somewhere else. The is a lot of avantages of using TDD. Testing in javascript seems to be complicated because it should test a lot of user interaction. I can test the behaviour in complete integration, with Capybara for example, but my tests will be very slow. For example, I have a form with dynamic behaviour. In this form, I have 5 or 6 dynamic fields which change if I select an option, choose a radio button or check a checkbox. In some cases, there is ajax calls. For this form, I think I can make about 20 tests just for a form. Is it really usefull to have this tests? So, what's your rules for a standard web application?


title: What is the proper aproach of Subversion when using DLL

text: **Background:**   Our team develops a solution and it includes a number of projects. Most of the projects are built as DLLs and those DLLs are used by the rest of the projects. Currently we uses Subversion for our code management and I ask others to remove DLLs from Subversion because we do not need to keep the history of the DLLs. So I ask my team to update their source every morning from Subversion and build each project to get DLL with yesterday submitted changes. **Issue:**   This procedure was very good in the beginning f the project. but now each project of the solution getting bigger and bigger.Also gets more time to compile. now each developer waste around 20 mins each morning for build solution in their local computer. Now I'm thinking again to ask each developer to submit their built DLLs to Subversion at end of the day and the next morning the rest of the users can download these DLLs directly from Subversion. But I feel something is wrong with this procedure. Because Subversion waste space keeping the history records of each DLLs. Now I'm searching for a better solution. Do you guys have any idea over your experience?


title: Automatic generate code: "derived work"?

text: For example, I've GPL software. I'm the author of this GPL software. This GPL software has, between its code, Doxygen comments. These Doxygen comments are written to generate a CC-BY-SA html page, in order to upload this generated documentation in my project website under CC-BY-SA license. But, the Doxygen documentation output is a "derivate work"? After all, this documentation is based on my GPL source code. In this case, the documentation must be GPL. But, I want the documentation is CC-BY-SA, because it is documentation. GFDL doesn't help. GPL code can't become GFDL (the opposite yes). If this output is really a derivate work, I think, creates a strange situation, because, if I distribute my work, the recipient users can't legally distribute the generated documentation: while with my work I can do I want, the users don't, thus, they have to distribute any derivated work with the same license I offer them. What is the solution?


title: Why is the code section called a text section?

text: The section of an executable that contains code is sometimes called the `.text` section. In segmented memory architectures, a segment mapped as code is sometimes called a text segment. The unix error message “text file busy” (`ETXTBSY`) means “this file is a program that is being executed”. How did _text_ come to mean _executable (machine) code_? An ideal answer would: explain the connection between the word and its meaning; provide a citation for the origin or at least the history of the term; give some idea of which communities use it.


title: How to network effectively to get a job

text: I have been working for 5 years at the same company now. I want to go and find a new job. Finding jobs or getting interview calls has been difficult, there are have far and few. And to compound the problem I need work permit(H1b) to work. My question is how do network with other programmers and increase my chances of getting a job/interview. And secondly how to increase my network?? thanks


title: NP hard/complete

text: I have never been very clear on this concept. Please help: At the end of the day, we should want to identify useful problems for which we don't have polynomial solution so far and only have exponential solutions.We want to keep finding if we can find a polynomial solution to these problems and the use of reductions is only to be able to identify new only exponential solvable problems with help of existing known exponential problems.?? Why is concept of determinism and non determinism brought into this whole concept of exponential and polynomial solvable problems?? How is this notion useful? What do we call the problems for which we have only exponential solution so far, but we haven't been able to find reduction to a known NP - hard/complete problems..?? Thanks,


title: Why Use Scala over Java

text: I am totally into Scala as a language ... and still I struggle with why any company should switch from Java to Scala. Is Scala just syntatic sugar on top of the JVM or are there fundamental improvements in Scala over Java that would improve real world applications?


title: Declarative UML

text: I'm looking for something along the lines of WebSequenceDiagram for other kinds of UML diagram types -- use cases and class diagrams in particular. For example, the service would accept plain text input such as:               user = Actor();     admin = Actor();     register = UseCase(user);     post = UseCase(user, admin);     post_poll = UseCase(user, admin).extend(post);      ...and get the corresponding image output, without having me worry about laying out the result.


title: Object behaviour or separate class?

text: When it comes to OO database access you see two common approaches - the first is to provide a class (say "Customer") with methods such as Retrieve(), Update(), Delete(), etc. The other is to keep the Customer class fairly lightweight (essentially just properties) and perform the database access elsewhere, e.g. using a repository. This choice of approaches doesn't just apply to database access, it can crop up in many different OOD scenarios. So I was wondering if one way is preferable over the other (although I suspect the answer will be "it depends")! Another dev on our team argues that to be truly OO the class should be "self- contained", i.e. providing all the methods necessary to manipulate and interact with that object. I personally prefer the repository approach - I don't like bloating the Customer class with all that functionality, and I feel it results in cleaner code having it elsewhere, but I can't help thinking I'm seriously violating core OO concepts! And what about memory implications? If I retrieve thousands of Customer objects I'm assuming those with the data access methods will take up a lot more memory than the property-only objects?


title: What license is HTML released under?

text: All products seem to be released with a license, I'm curious to know how one would go about finding out the license of technologies like HTML, CSS and JavaScript?


title: Encapsulation in Domain Driven Design models?

text: I am using EF Code First and I had a model like below.               public class Account     {         [Required]         public string AccountNo { get; set; }         [Required]         public decimal Balance { get; set; }     }      I used a Service class to withdraw and deposit amount to Account. Then I came across this and realised that Account is Anemic. So I happily added Withdraw and Deposit methods to Account.               public class Account     {         [Required]         public string AccountNo { get; set; }         [Required]         public decimal Balance { get; set; }         public void Withdraw(decimal amount)         {             // TODO: Check if enough balance is available             Balance -= amount;          }         public void Deposit(decimal amount)         {             Balance += amount;          }      } I was very happy with this until I realised that this does not implement encapsulation correctly. You should not be able to modify the Balance directly - you should use Withdraw and Deposit methods. But in my solution you can modify the Balance directly. But I cannot make Balance a readonly property as I am using EF code first approach and readonly properties won't result in the column being created in the database table. I thought of leaving Account as anemic and create a higher level Account class which implements encapsulation and Withdraw/Deposit methods. But in that case the higher level class would not have validation data annotations and I won't get the free functionality provided by the framework. What is the solution?


title: Java solution for mutual authentication with smart card

text: I need to develop a Java solution for mutual authentication between Tomcat 6 (server) and SmartCard "IDGo 300" (client). In order to do this I thought of the following scheme: 1.Tomcat (server) send to SmartCard (client) the request of his digital certificate (signed by CA). 2.Client enters PIN and selects an available certificate on the smart card, then the Applet sends his certificate (signed by CA) to Tomcat. Tomcat verifies the digital certificate and, if it is correct, sends the certificate back. 3.The applet verifies the certificate of the server, and, if the certificate is correct, sends a confirm to server. The server gives full access to the client to use the web application. I have some questions: 1.Is this scheme feasible? 2.I would like to manage everything through my applet and when the client disconnects the smart card, he loses access to the server.


title: Standard practices for access control (design pattern)

text: I'm looking at my interface design and I am struggling to decide which is the most "correct" way to implement role-based access control, given a `user` and a `subject` that the `user` would like to access. * * * As far as I can see I have three core options (with a fourth being a bastardisation of the first three and a fifth being a tweak of the fourth):   1. Query the `subject` with a list of permissions that the `user` has - `subject.allowAccess(user.getPermissionSet)`   2. Query the `user` with a list of permissions that the `subject` requires - `user.hasPermissionTo(subject.getRequiredPermissions())`   3. Query a third-party to locate the intersections of permissions - `accessController.doPermissionSetsIntersect(subject.permissionSet, user.getPermissionSet())`   4. _Query either the`subject`/`user`, while delegating the "decision" to a third-party class_   5. Have the `user` attempt to access the `subject` and throw an error if access is not permitted * * * I am leaning toward option four - Have the `subject` contain an `accessController` field, where calls to `subject.userMayAccess(User user)` delegate the operation a la:               class Subject {         public function display(user) {             if(!accessController.doPermissionSetsIntersect(this.permissionSet, user.getPermissionSet())) {                 display403(); //Or other.. eg, throw an error..             }         }     }      .. but then this raises further questions:   * should the `accessController` be a field vs a static class..?    * Should a `subject` _know_ what permissions are required to be able to view it?   * where does the principle of least knowledge come into play here, with respect to calling `subject.display()`? Should callers of `subject.display()` ever know that access control is in effect? (where `subject.display()` is a final "template method")   * have `subject.display()` manage access control, throwing an exception where the user does not have the required permission? * * * What would be considered "best practice" in this situation? Where should responsibility for performing the checks actually occur? As this is somewhat both an academic excercise which will then progress into implementation, references to design patterns would be appreciated.


title: When should I pass value as class variable and when as a method argument?

text: Is there a general rule of thumb, when we should pass a value as as class variable and when as a method argument? Or is it just a choice of the developer? For example -- are there any reasons, why following (PHP code):               class SomeClass     {         public function __construct()         {             $this->id = $_GET['id'];             $this->showMessage();         }              public function showMessage()         {             echo 'The ID is '.$this->id;         }     }      is better (or worse?) than this:               class SomeClass     {         public function __construct()         {             $this->showMessage($_GET['id']);         }              public function showMessage($id)         {             echo 'The ID is '.$id;         }     }      Note, that I'm only asking about differences between passing value as class variable vs. passing as method argument. Please, don't point out, that I should never operate directly on superglobals in PHP. I know, that this is wrong. I used it here, to simplify the example.


title: Where or when to start to write your own PHP framework?

text: First of all, I know that reinvent the wheel is, _usually_ , a bad idea, but I want to write a PHP framework **to learn OOP in PHP and to understand MVC** in my free time. Said that, I have to do two webs with few and simple database interactions, the basic funcionality of the webs is to show information. I want to use my own framework in those webs, but I don't know where or when to start. Should I start doing the framework first and then the webs? or should I start doing one web, then the framework and then the other web?


title: Why are dark color schemes in editors so popular?

text: Nowadays, almost everybody is using a dark color scheme in their code editor - dark background with light text. Even most web based editors (e.g on Github) feature dark color schemes. I honestly don't see the benefits. The human eye is much better at reading dark text on a bright background. Also, black on white color schemes work much better when you're in a brightly lit environment. I'm currently sitting in an office with the sun shining through the window. I can read the text in my editor (gVim with dark text on white background) just fine, but on the linux console it's much harder. Editing text in console vim is almost impossible for me. The whole thing seems a bit like a strange hype to me, started by the default settings in certain IDEs/editors. But maybe I'm just weird.. ;) Anyway, so why is everybody using these?


title: Martin Fowler's Refactoring book: switch statement is using other object's data, why is that bad ? A deeper explanation is sought for.

text: In the code sample below the Rental object is using Movie's fields to do a switch statement. Martin says : this is a bad idea but he does not give any deeper explanation as to why ? Of course, you can say that this means a lot of coupling between Movie and Rental, or that Movie is badly encapsulated but those are just (almost meaningless) words, again, they don't explain the why? They don't go to the root of the question, so to say. They don't provide much understanding. What I would like to know if there is a deeper, more general design principle why having a switch on Rental is a bad idea ? In other words, how does Martin knows that the switch statement is on the wrong object ? Where does he get this insight from ? What is his thought process ? ![enter image description here](http://i.stack.imgur.com/ZRfY8.png)


title: Login using email or username?

text: Is registration login using email a better idea than username to identify the user?


title: How to draw a spiral using segments of varying circles?

text: I have an old plotter that can't handle printing true spirals. I need help with developing an algorithm to approximate a spiral. Here's a LISP sub-script that I have written which uses semicircles of varying radii to draw a spiral:               (setq inner_radius 1e3)  ; The spiral grows from inner radius to outer radius     (setq coil_thickness 35) ; This is the half-pitch of the spiral, pitch is 70     (setq outer_radius (+ 2.4e3 (* 2 coil_thickness)))     (while (< inner_radius outer_radius)             (setq P1 (list 0 inner_radius))             (setq P2 (list inner_radius 0))             (setq P3 (list 0 (* -1 inner_radius)))             (setq P4 (list (- (- inner_radius) coil_thickness) coil_thickness))             (setq P5 (list 0 (+ inner_radius (* coil_thickness 2))))             (command "ARC" P1 P2 P3) ; Draws a 3 point arc through P1, P2 and P3             (command "ARC" P3 P4 P5) ; Draws a 3 point arc through P3, P4 and P5             (setq inner_radius (+ inner_radius (* coil_thickness 2)))     )      I am using `AutoCAD` to implement the script. The code here is a cop-out - I can implement a true spiral in `AutoCAD` but the plotter, which will plot this, is dated and is not able to handle a true spiral. It can handle just circle arcs and line segments. I am seeking a method which can implement a better approximation of the spiral. For instance, I tried thinking about quartcircles (instead of the semicircles I have used in the above sub-script) but couldn't come up with a viable scheme.


title: AlienTiles optimistic heuristic function

text: Hello I am trying to use the alienTile problem described at www.alientiles.com using the A* algorithm but I cannot find any good heuristic function so far. In alien tiles you have a board with NxN tiles, all colored red. By clicking on a tile, all tiles in the same row and column advance by a color, the color order being red->green->blue->purple, resetting to red after purple. The goal is to change all tiles to the specified colors. The simplest goal state is all the tiles going from red to green, blue or purple. The board doesn't have to be 7x7 as the site suggests. Is there any good point to start because I am completely frustrated about how I am supposed to handle the problem


title: Should I create Use Cases or create Class Diagrams first?

text: So I'm designing an Education Management System(more info)and I'm wondering if I should be creating the Use Cases or the Class Diagrams first?


title: Java's advantage in shopping cart platform

text: Open source PHP shopping carts platform/framework occupy most top list. They are hot, and we want start quick. So, we are going to make decision between Magento and Opencart, PHP programmers would be happy to this end. While my Java programming colleges feel not so happy, they were selling Broadleaf commerce or JadaSite. But more online reading and discussion pushing us to this way. PHP shopping carts get more use and so tested more and they get support multiple shops and multiple vendors. What will be Java's advantage in this open source field? Or should we believe Java can give decent infrastructure in long run?


title: How to refresh/keep up to date content in the browser without overloading the server

text: I am not very educated on this topic of programming so I am seeking any advice/knowledge. I am coding a web app in PHP, and this particular task requires updating the display after the server has new information available. So, one seemingly-bad solution is to have a repeating AJAX request that spams the server on an interval, and updates when it gets new data. This puts a lot of stress on the server, so it seems unviable to me. We attempted to use Ratchet (http://socketo.me/) but could not really figure it out. Is this overcomplicating this, or is there another way we can solve this problem while still keeping server load as "practically" minimal as possible. There are websites like Facebook/most social media that dynamically show new data as it's available -- I assume they also use something that minimizes requests to the server? Or is this assumption incorrect?


title: Help with Seminar on Software Testing

text: All, I need to give a small seminar(about 20mins duration) to a class on Software Testing. Given the time constraint, I wanted to seek opinion from everyone as to what primary topics should I cover in this seminar. Also, if any references to software testing documents/videos would be helpful.


title: Are monads a viable (maybe preferable) alternative to inheritance hierarchies?

text: I'm going to use a language-agnostic _description_ of monads like this, first describing monoids: > A **monoid** is (roughly) a set of functions that take some type as a > parameter and return the same type. > > A **monad** is (roughly) a set of functions that take a _wrapper_ type as a > parameter and returns the same wrapper type. _Note those are descriptions, not definitions. Feel free to attack that description!_ So in an OO language, a monad permits operation compositions like: > `Flier<Duck> m = new Flier<Duck>(duck).takeOff().flyAround().land()` Note that the monad defines and controls the semantics of those operations, rather than the contained class. Traditionally, in an OO language we'd use a class hierarchy & inheritance to provide those semantics. So we'd have a `Bird` class with methods `takeOff()`, `flyAround()` and `land()`, and Duck would inherit those. But then we get into trouble with flightless birds, because `penguin.takeOff()` fails. We have to resort to Exception throwing and handling. Also, once we say that Penguin is a `Bird`, we run into problems with multiple inheritance, for example if we also have a hierarchy of `Swimmer`. Essentially we're trying to put classes into categories (with apologies to the Category Theory guys), and define semantics by category rather than in individual classes. But monads seem like a much clearer mechanism for doing that than hierarchies. So in this case, we'd have a `Flier<T>` monad like the example above: > `Flier<Duck> m = new Flier<Duck>(duck).takeOff().flyAround().land()` ...and we would never instantiate a `Flier<Penguin>`. We could even use static typing to prevent that from happening, maybe with a marker interface. Or runtime capability-checking to bail out. But really, a programmer should never put a Penguin into Flier, in the same sense they should never divide by zero. Also, it's more generally applicable. A flier doesn't have to be a Bird. For example `Flier<Pterodactyl>`, or `Flier<Squirrel>`, without changing the semantics of those individual types. Once we classify semantics by composable functions on a container -- instead of with type hierarchies -- it resolves the old problems with classes that "kind of do, kind of don't" fit into a particular hierarchy. It also easily & clearly allows multiple semantics for a class, like `Flier<Duck>` as well as `Swimmer<Duck>`. It seems like we've been struggling with a impedance mismatch by classifying behavior with class hierarchies. Monads handle it elegantly. So my question is, in the same way that we've come to favor composition over inheritance, does it also make sense to favor monads over inheritance? (BTW I wasn't sure if this should be here or in Comp Sci, but this seems more like a practical modelling problem. But maybe it's better over there.)


title: How do you report "startup experience" on your resume?

text: Say you've spent a significant amount of time (5 years) serially starting up companies, with enough success to keep going for 5 years, but not enough to retire rich. And now, with a mortgage and a serious relationship, burned out, you're trying to dust off your resume and get a regular, 9-5 job. How would you record/report on your work experience at the startups? Making a list of technologies sounds silly (it'll get out of hand on account of size), and very incomplete (with very small, early stage startups, there is a _lot_ more work to go around than just hacking away at code). A regular programming job also seems like a waste (with all of the mix of experience that comes from working at a startup, giving up on the additional skills learned along the way doesn't feel quite right) so reporting on the experience as one would on a regular programmers' resume might not be the correct thing.


title: Titles: Programmer Level I, II, and III

text: > **Possible Duplicate:**   >  What personal milestones can you use to measure growth in your programming > abilities? I am looking for the criteria of what makes a programmer a level I, II, and III? What are topics that you would expect to be known/understood/mastered at each level?


title: What is the job title hierarchy amongst software engineers?

text: > **Possible Duplicate:**   >  What does the suffix after software engineer/developer job titles mean? > (i.e. Software Developer III)   >  work advancement titles I've been struggling to understand job hierarchy in software engineering. The system is further complicated because of the lack of consistent naming conventions when assigning roles: for example, some companies just have a "senior software developer" position while others have Software Engineer I, Software Engineer II, Software Engineer III, and so on. Even in the top level positions, we have things like "Principal Software Engineer" vs. "Staff Software Engineer". What is the standard hierarchy for software engineers? Is there a generally accepted pecking order?


title: work advancement titles

text: After some googling I was unable to find out hierarchy of different titles in career development. Especially the connection between Senior Engineer and Software Specialist is unclear to me. Which one is higher? Most of all I would like to see links pointing to some career development paths from the trainee to the highest boss, and what kind of different routes there are including technical and managerial paths.


title: How to access an encrypted INI file from C on an embedded system with little RAM

text: I want to encrypt an INI file using a Delphi program on a Windows PC. Then I need to decrypt & access it in C on an embedded system with little RAM. I will do that once & fetch all info; I will not be consutinuously accessing the INI file whenever my program needs data from the file. Any advice as to which encryption to use? Nothing too heavyweight, just good enough for "Security through obscurity" and FOSS for both Delphi & C. And how can I decrypt, get all the info from the INI file - using as little RAM as possible, and then free any allocated RAM? **[Update]** I am currently using an Atmel UC3, although I am not sure if that will be the final case. It has 512kB falsh & 128kB RAM. For an INI file, I am talking of max 8 sections, with a total of max 256 entries, each max 8 chars. I chose INI (but am not married to it), because i have had major problems in the past when the format of a data fiel changes, no matter whether binary, or text. For tex, I prefer the free format of INI (on PC), but suppose I could switch to `line_1=data_1, line_2=data_2` and accept that if I add new fields in future software erleases they must come at the end, even if it is not pretty when read directly by humans. I suppose if I choose a fixed format text file then I never need get more than one line into RAM at a time ... **[Verdict]** I will go with either TEA or AES (tbd). I will split the functionality into two parts: 1) decrypt into a plain text file, 2) parse that as an INI file and if I hit memory problems then change to a `line_1=data_1, line_2=data_2` format. Thanks for your help.


title: patented algorithm

text: What does it mean when an algorithm is patented? Am I allowed to use it as long as I am not making money out of it? I am asking because I am working on a project and I happened to discover a feature detection algorithm that I want to implement, but then it is patented by someone. Can I use the algorithm? It is for a school project


title: If I wanted to build a search engine, how would I start?

text: Can somebody point me into the right direction? I really don't have experience writing code but I'm a fast learner. I'm not trying to say it will be easy but I hope somebody can help me...


title: What are the pros and cons of HTML5, native and hybrid mobile app approaches?

text: I want to develop a mobile application .. I read lately an article on Telerik Forum : it compares among three types of mobile application and I don't know which one should I select to begin with .. [FROM Telerik] ![enter image description here](http://i.stack.imgur.com/YA81J.jpg) To make the choice which one I should select, I need to better understands the pros and cons of each architecture choice listed in the above diagram. What are the pros and cons of each architecture approach?


title: Which algorithms and data structures should a developer absolutely know?

text: I want to be a successful enterprise Java developer. With what algorithms and data structures should I be well versed? What books would you recommend to me? To be a successful Java developer, do I need to know all the advanced algorithms such as those given in CLRS? Can you suggest a list of the topics that I should learn in the descending order of their priority? Must I know:   * Searching?   * Sorting?    * Graphs/Trees? etc?


title: How to manage pair- programming code check in user identification?

text: How do you identify users when a programming pair checks in code? I heard a complaint that, often a junior dev will be at the keyboard, using his/her account, but is not going to be the best person to ask questions about the code being checked in (the more senior dev is likely to have the best answer). Is this really a problem? Seems like a programming team could think of some way to identify pairs and get the necessary information in their version control software. I also think they're not benefiting from this process if both programmers don't know what their code does.


title: Single quotes vs double quotes

text: I just started a job where I'm writing Python after coming from a Java background, and I'm noticing that other developers tend to quote strings using single quotes (`''`) instead of double quotes (`""`). For example:               line1 = 'This is how strings typically look.'     line2 = "Not like this."      Is there a particular reason for this other than personal preference? Is this the proper way to be quoting strings? Specifically, what I want to know is if there is some type of standard or accepted best practice that drives this style of coding.


title: Best practices / Design patterns for code generation

text: I'm working on a ground up code generator project, but I feel I might be reinventing the wheel. Does anyone know where I can find some best practices guidelines or design patterns for code generation?


title: Tool to visualize values from variables during the execution of a program in C

text: I just need to see what is stored, in realtime, in some particular variables and struct used by an application written in C. I need something like the stack tracer that comes with the ADT plugins for Eclipse as part of the Android sdk.


title: Work Item type for refactoring duplicate methods (i.e. turning them into 1)

text: Given that you have two identical methods (signatures, body, input/output) that you wanted to refactor into just one, what type of Work Item from the MS Agile template would be most appropriate? Task, Bug, Quality of Service, Risk? Why?


title: Importance of theoretical knowledge alongside hands-on ability

text: I am obsessed with good code practices, clean code and most of all secure. I often find myself searching for the best way to do something, constantly asking for code review and looking for ways to improve my code. In practice I can manage (been doing PHP for a couple of months) but the theoretical part is my weak spot. I know what most of the concepts mean, I understand them but if someone would ask me to explain something I often find it difficult. This means that if I were to look for a job and the interviewer would ask me questions, they would immediately think I don't know much about the subject. Is this going to be a big disadvantage for me? Should I seriously start to learn the theoretical part more?


title: Can I provide a GPL app, with different licenced logo?

text: I want to provide my app under GNU GPL v3, but I would be glad if people couldn't change its name or its logo. Can I provide my app under the GNU GPL v3 licence, while the app's name and logo are under another type of licence like CC BY-NC-ND 3.0? (The logo and name is used in the app source and design.)


title: Take dynamic PHP array, package up as separate files inside a single zip file

text: I have this dynamic data in PHP, but for each array record, I want to allow a downloadable option to save a zip archive of all records (each as a separate file). These are actually DNS zone records that are housed in a database. It wouldn't make much sense if they're in a single text file, so I'm looking to somehow have the data exported as separate files inside the zip. I could save them to disk, but know there's a way in PHP to use the headers to force a download of data as a certain filetype. What I don't know is how to zip that data on the fly. Maybe I can't, and will have to save each to a temp folder, then zip the contents of that folder, then delete the contents after downloaded. Thought maybe the community might have an idea of where to start. Thanks!


title: when is it necessary or when should a controller be async

text: When is it absolutely necessary for a controller to be async? Should all controllers be async or is it bad practice to make all of them async unless it is necessary. Just looking for some general guidelines.


title: What language has integrated "list insertion" as part of code *syntax*?

text: Many programming languages permit natural manipulation of strings, and some languages permit the manipulations of lists too. More often then not (always?), these operations are done as _procedure_ calls, or as _member_ functions. Many programming languages do implement in syntax the fairly typical set _{prepend, replace, append}_ on **lists** (and/or _strings_ ). I would like to know if there as/was a programming language that has a syntax that minimises/rationalises/orthogonalises the **insertion** syntax of items into a **list** by syntax design? Python - as a simple example - has only: http://stackoverflow.com/questions/18033339/python-insert-operation-on-list               mylist.insert(10,'5')      Note: In python _list_ **insertion** is implemented as a _member_ function. **But:** Python **does** have some syntactic sugar for _removing_ elements from a **_list_** : e.g.               del mylist[4:7]      I like to know of any languages actually try to **integrate** (or have **strategy** ) for list **insertion** as part of the **syntax**? **An example of insertion by construction:** Here is some code from a fairly typical "Brand X" language, demonstrating typical prepend/replace/append operations {or operators, vis-à-vis syntatic sugar}, notice there is no obvious syntax for {in place} inserting (or removing) from the middle of a list. {It has to be done "by construction", or by calling a procedure}               # Demonstration of prefix, replace and append operations to a string {or list} #     string s := "23XX78";     "1"    +=: s;    # Prefix a char "1" to the string "in place" #     s[4:5] := "46";  # In place replace a char at pos 2 in a string #     s      +:= "9!"; # Append a string "9!" char to the string #         #        Although inserting into a list is intuitive,        * it is by construction (hence prone to typos/index-flips)       * it is not "in place"       e.g. ...     #     s:=s[:4]+"5"+s[5:];          print(s)      Output: "123456789!" Another example for strings:               s[:4]+="5"


title: Short function names for often used function or general concept

text: I am a bit in a dilemma: Let's suppose I have a very general function and a specialization of it for convenience reasons. Let's also assume that the specialized function is used 90 per cent of the time, hence being "the common case". Should I use a shorter function name for the general case (e.g. `do`) and a longer one for the special (`do_something_special`) or the other way around (e.g. `do_something_general` and `do`)? When applying Larry Wall's words (make simple things easy and hard ones possible), I'd use a shorter form for the more often used case. EDIT: Just to make this a bit more clear: in this example, `do` is just a placeholder for a short, descriptive name. Of course it could be longer, e.g. `run_task` or `process_file`. What I want to know is, if I have a function called `run_task_in_specific_way` that is used most of time should actually be called `run_task` (although being more specific) or the general abstraction. EDIT 2: To clarify once more: The functions I am talking about are neither providing more than one functionality nor should they be replaced by a class- based design. The reason is: they _are_ abstract in the same sense as qsort, e.g. taking callable from users to fulfill a specific action. Wrapping them into some auxiliary class does not make much sense.


title: Sleeping Barber Problem (with multiple barbers)

text: The Sleeping Barber Problem is a classical synchronization problem that many of you may be familiar with or at least heard of. It's based on the premise that a barber (a thread) sleeps when there are no customers (each customer is a thread) in the waiting room (which is a semaphore). If there is someone, he cuts his hair (symbolizing some processing) and the costumer leaves. If, then, there is no one in the waiting room, the barber goes to sleep. When another customer arrives, he then must wake up the barber. I have made a implementation of this using the following basic-idea (pseudo- code, only using `sem_wait` and `sem_post`1 for smooth reading)               Semaphore Customers = 0;     Semaphore Barber = 0;     Mutex accessSeats = 1;     int NumberOfFreeSeats = N;           Barber {         while(1) {             sem_wait(Customers) // waits for a customer (sleeps)             sem_wait(accessSeats) // mutex to protect the number of available seats             NumberOfFreeSeats++ // a chair gets free             sem_post(Barber) // bring customer for haircut             sem_post(accessSeats) // release the mutex on the chair             // barber is cutting hair         }     }          Customer {         while(1) {             sem_wait(accessSeats) // protects seats so only 1 thread tries to sit in a chair if that's the case             if(NumberOfFreeSeats > 0) {                 NumberOfFreeSeats-- // sitting down                 sem_post(Customers) // notify the barber                 sem_post(accessSeats) // release the lock                 sem_wait(Barber) // wait in the waiting room if barber is busy                 // customer is having hair cut             } else {                 sem_post(accessSeats) // release the lock                 // customer leaves             }        }     }      However, now that I'll implement this problem with multiple barbers, my head got stuck. I went on Wikipedia to see if I could find something about it, but the only thing that I found there was this > _A multiple sleeping barbers problem has the additional complexity of > coordinating several barbers among the waiting customers._ and I couldn't figure this out by myself. In which case I'd have this complexity? By several barbers going to the waiting room to see if there is anyone there and then taking (more than one barber) a single customer? Would I need an extra semaphore here? 1sem_wait() locks the semaphore. sem_post() unlocks it


title: What's the most effective way to share code between .NET applications?

text: In our work, we have several different .net applications that share a lot of base functionality. We've built these applications using a clean n-tier architecture, but we've hit that moment where we realize that we've re- implemented the same functions several different times. Obviously this violates DRY, and we would like to correct that. We're already using Nuget to some success for common glue code (wiring up IoC, logging, settings), but we also would like to share our data and business layers between all our applications. The idea is that the UI would only deal with the parts of the business layer it actually needs. This seems like a straight-forward problem at first, but ongoing development could provide some pitfalls and we're not sure how to proceed. Let's say we make our One Business Layer to Rule Them All. For brevity, I'll call it "Foundation." We port our applications to use the Foundation, and everything is runnding great. The Foundation is distributed to light UI layers via nuget, and we're looking good. But then we start adding features to our applications, and we run into trouble. Let's say we're working on Project A and we add a new feature that requires changes to Foundation. We make the changes to foundation (Foundation-A) and push them out to the nuget feed as an unstable package. Project A gets the latest nuget package, and all is good. Meanwhile, another developer is working on Project B. He gets the latest Foundation from source control, but takes it from a stable branch, so that it doesn't have Project A changes in it. He makes changes and created Foundation-B. And all is good. But then we discover that Foundation-A and Foundation-B implementation functionality that could actually share code, so we combine them. Meanwhile Foundation-C is floating out there with it's own changes. Eventually, Foundation-B is ready for production, so we push it out. But then we need to update Production A, B, & C with the new foundation, so we update the nuget packages and deploy (as long as nothing breaks). This seems like it could work, but we're worried about working with different database schemas and keeping everything synchronized between the various branches of the Foundation repository as well as the Project A, B, and C repositories. It seems like it will probably take a lot of manual work, which opens up the possibility for errors. I would like this as automated as possible. Here's the stack we're using: C#, TFS with Continuous Integration, Nuget. Our applications are all various types of ASP.NET applications. We're willing to look at different SCM's if it will make things easier. I'm looking for ways to keep Nuget sane with our different source code branches. We don't want to accidentally push development code into production because we reference the wrong Nuget Package.