JSON or XML for parsing for a Windows Store 8 applicaiton?

I am getting some data from Gov tracker (http://www.govtrack.us/developers/api) and creating a Windows 8 Store application.. I started out trying to use the HttpClient to get the JSON and then use Json2Charp.com to convert it to classes... But then I had no idea what to do with this giant class and the line                 var contacts = JsonArray.Parse(data);      would not work.. So now I requested it as XML and I am using XML to LINQ to slowly get what I need ..for example..                   var things = from x in xdoc.Descendants("person")                          select new Person                          {                              firstname = x.Element("firstname").Value                          };      But in this case and in general what is the easiest way? Is it using XML for this windows 8 application and using JSON to javascript applications? (since I always hear about how JSON fits so well with javascript) At the moment since I could not get the JSON deserialization to work I guess XML is easier in this case?


Is "WinForms" a widely-known and acceptable substitute for "Windows Forms" on a résumé?

I'm always trying to hone my résumé to the bare-bones essentials -- no fluff. I want to keep as many points as possible to a single line, and to this end I have used the term _WinForms_ in several places. I wanted to check my capitalization against other examples, but this term is not used on the official http://www.windowsclient.net site; it doesn't even appear in the Wikipedia entry. Can I reasonably expect someone looking for a .NET developer to _get_ that? Even if they're looking for web developers? Would you write it as I have (WinForms)?


How to transfer teams to an Agile programming methodology

My group has recently grown in size with the addition of several teams from different projects. We work using an Agile programming methodology: 2 week sprints, deliverable every sprint, 2-3 pushes to production every sprint for each team. How do I "convert" the newly added teams to this methodology and way of thinking with as little trauma and resistance from the members of these teams?         Note: I'm not asking if they want to change their methodology, they will have to operate this way to be in sync with the rest of the group. This is a different question than this one as all other teams already work using Agile programming.


Decouple GUI & Program logic

I have some windows c++ code (pure winapi c++, no MFC etc) that I would like to build a GUI for. My code does not know about windows GUI, it is completely decoupled from any type of UI. The question: How could I build a UI around the existing code. Ideally, I am imagining something like this: GUI <\--> Mediator <\--> MyExistingCode For example, `MyExistingCode.showmsg(char* msg)` would call `Mediator.MessageBox(0, 0, msg, 0);` I'm stuck at how to design the Mediator class (If that is the correct way of going about this). Is the Mediator an Interface?, Abstract Class?, Other? Is an MVC model the best way to go?


Learning Scala, feeling discouraged

I'm coming from a Java background and trying to learn Scala. At the moment I'm feeling pretty overwhelmed, there seems to be so much more to learn with Scala, so many different ways of doing the same thing. I was wondering if anyone has any advice on where to start, and how long it took them to feel reasonably competent in the language? Even little things like for loop comprehensions seem really powerful but it's just another piece of syntax you need to remember!


How Stack and Heap is allocated for threads under the same process in Windows?

Stack for different thread is different.but what about Heap. If Heap is different for different threads, then how they share objects?


Would using rainbow tables to detect weak user passwords feasible?

As I understand in most security breach where the list of hashed password are compromised, attackers do use brute-force to try to find weak password and, invariably, they always find quite some (like in the recent Github breach). If I'm not mistaken in most cases when a user creates an account, the password is sent, encrypted (due to TLS / SSL), to the website which then adds some salt and stores the hash + salt. Even in most sophisticated cases (like when bcrypt is used), upon account creation there's one point in time at which the server does have the password in cleartext. My question is: couldn't you use, at that very moment when you have the password in the clear that the user is trying to use for his new account, a gigantic rainbow-table on the server side to check for billions and billions of weak passwords in a split-nanosecond? Then if you detect that a weak password is used, you'd simply tell to the user that his password is too simple and that, no, using "edcrfvtgb1" isn't smart. I mean: if attackers manage to brute-force weak-password _even though they have to deal with the problem of the salt_ , couldn't servers benefit from the fact that, when the users creates a new account, they do know the password in the clear to simply look it up in a big rainbow table when the user creates his account? This doesn't seem hard to implement and seen harddisk sizes these days, it's probably not problematic to store a big rainbow table on the server side. Am I missing something obvious or would this help catch a _lot_ of weak passwords and, hence, mitigate the endless accounts compromise we keep seeing on a nearly daily basis?


asp.net mvc vs angular.js model binding

So I've noticed a trend lately of .net web developers using angular.js on the client side of applications and I've become more curious as I play around with angular and compare it to how I would do things in asp.net mvc. I'll give a quick example of what really got me thinking. I recently came across a situation at work (I work in a .net environment) where I needed to create a table bound to a collection of objects that had the ability to add and remove rows/items from the collection. I had an add button that created a new object and appended a row to the end of the table, and a remove button in each row to remove a particular object/row. Using asp.net mvc, I first found myself making an ajax call to the server for each operation, updating the server side model, and refreshing part of the page to show the result in the table. This worked but I didn't really like the idea of calling the server to update the model each time, so I tried to come up with a solution to do this on the client side. It turned out to be quite a task, as I had to generate the html on add with validation and all and the correct indexing for the model binding to work. It got worse on remove, as I ended up with a crazy string replace function to recreate the indexes on each item to satisfy the binding requirements (if an item other than the last is removed, the indexes are no longer correct). Now out of curiosity, I tried to recreate this at home in angular (which I had no experience with) and it took me all of about 10 minutes with simple functions to add and remove items from the client side model. This is just one example, but it seems to me that I'm able to achieve the same results with far fewer calls to the server in angular because of the fact that it binds to a client side model. So my question is, is this a distinct advantage of using a javascript mvc framework or am I somehow under utilizing the power of asp.net mvc and am I right in thinking that these operations should be done on the client and have no business requiring calls to the server?


Placing arguments on their own lines

This question applies to both parameters and arguments, since I've seen this style used in both. I usually write parameters like this               someFunction(arg0, arg1, arg2)      but I've recently noticed that many people write theirs like this               someFunction(     arg0,     arg1,     arg2     ) // the bracket doesn't have to be on its own line      I have a multi-faceted question here: 1) Is it standard practice, good practice, or negligible to put each argument on their own lines?   2) Are their exceptions to this style, like when there is only one argument?   3) What are the pros and cons of such a design?


Wrapping a map with instance or static method

I have a `java.util.Map<String, Object>` object which different types of values in it. I don't want to cast whereever I do a get operation over this. To do this, I created different classes wrapping this map and these classes provide different get methods which return values for different keys. There are two options for this:               public class Wrapper1 {         private final Map<String, Object> map;              public Wrapper1(Map<String, Object> map) {             this.map=map;         }              public MyObject getMyObject() {             return (MyObject)this.map.get("someKey");         }     }                       public class Wrapper2 {         private Wrapper2() {         }              public static MyObject getMyObject(Map<String, Object> map) {             return (MyObject)map.get("someKey");         }     }      As you see, in first one I'm creating an instance of Wrapper1 and access MyObject instance by instance method. In second, I give the map to a static method and access same MyObject instance. Which one will you prefer more and why? Also if this is a bad practice, please let me know. Thank you.


What is the point of the prototype method?

I am reading through _Javascript: The Good Parts_ , and struggled to get my head around the section on _prototypes_. After a little google, I came to the conclusion that it is to add properties to objects _after_ the objects declaration. Using this script gleamed from w3schools, I noticed that removing the line adding the prototype property had **no effect**. So what is the point? * * *               //Prototyping          function employee(name,jobtitle,born)     {     this.name=name;     this.jobtitle=jobtitle;     this.born=born;     }          var fred=new employee("Fred Flintstone","Caveman",1970);     employee.prototype.salary=null; //  <---  try removing this line     fred.salary=20000;      document.write(fred.salary);


Can you write a (dynamic) website using only XHTML and CSS?

I am more of a desktop developer that a web developer. Therefore I only know XHTML and CSS when it comes to the web (and C#, if that is in any way useful). I have a _little_ experience with ASP.NET with C# but I am in no ways an expert in it. Say I want to write a small website to give a preview to any new software I make. Is XHTML and CSS enough to make it? Will I _need_ to learn some server- side language? (or web development framework?) If so any suggestions? I don't want to create something as awesome as Facebook or Stack-overflow. Just a normal website, kind of like http://thenewboston.com.


Choosing colors for application

What is the best way to choose colors for LoB app, i need to style TreeView, dropdown's, textboxes and a pivot grid, so i need a bunch of colors, tried Kuler but it gives only 6 colors. So the question is how to do it without designer? PS. It's a silverlight app.


Who becomes the product owner?

A business has five requirements streams, with a "stream leader" (called _Product Manager_ , but this is an in-house term) per-stream and a backlog per-stream. If we wanted to follow Scrum more closely, as I understand it, best practise would dictate the identification of a single product owner managing a single backlog containing requirements from all five streams (it's all just stuff to be done, right?), from which work is pulled by a self-organizing development team. Can anyone lend any insight into how best identify the person to be the product owner and how best to explain and "sell" the modified approach to the existing stream leaders? NB: I realize this is a very difficult question.


How does package naming affects Android application once deployed

Are there conventions to follow when naming an application package for an Android application? I'm coding in Xamarin Studio, using .Net, so I feel far from this "com.myapp.etc" naming convention. Are there rules to follow when naming a package?


Is there a canonical book on dynamic programming?

At the moment in college I'm studying dynamic programming and I'm really interested in it. I want to go deeper and fully understand the topic so I can write good dynamic code. Is there a book out there that's the de-facto standard for describing best practices, design methodologies, and other helpful information about dynamic programming? What about that book makes it special?


Function before design, or a little of both?

When creating data-driven web pages, do you generally work on: A) functionality first B) presentation first? C) both at the same time I'm learning how to build css sites and wasn't sure of the best approach. There will be ajax calls and updates but that is pretty easy to implement. Thanks for your time and feedback.


Any tips to learn how to program with severe ADHD?

I have a difficult time trying to learn how to program from straight text- books. Video training seems to work well for me in my past experiences with PHP. I am trying my hardest to stay focussed and push through. Specifically I am looking to start indie game development. Over the last two weeks I have been trying to pick the "right" language and framework to develop with. I started going through Python, but I am not really enjoying the language so far. I am constantly looking through this website to compare this language to that, and keep getting distracted. Aside from all of this, is it possible to become a programmer when you have trouble focussing? Has anyone been through this that can recommend some advice?


maven release candidate builds

We build Java applications and use Maven to create snapshot and release builds (via Hudson). Normally, we build/deploy snapshot versions to our lab environment and when we're happy, we do release build and deploy that to prod. We've been wondering if we should also be doing release candidate builds. I'm not sure how a release candidate build actually differs from the snapshot builds. I've read about the release:stage goal in Maven, but not it didn't really answer the question. Do you use release candidate builds? What do you use them for and how do you go from snapshot to release candidate to release?


What are the disadvantages of using stored procedures, SSIS, and SSRS to implement business applications?

Recently, it was suggested that many projects (where I work) should be implemented using some combination of stored procedures (on SQL Sever / T-SQL), SSIS, and SSRS. In one specific project, SSIS would get a file from a SFTP server. The file contains the daily price of ten stocks. A data warehouse will store the daily price of each stock since inception. As of now, the prices go back twenty-five years. Stored procedures will have the business logic to calculate various performance numbers (i.e. return %) during arbitrary time periods such as the 5 year return at 31 December 2012. These stored procedures would be used by SSRS to create reports for the end users. What are the problems/issues using this approach? I feel that vendor (Microsoft) lock is an issue but I don't see that (unfortunately) being enough to change direction. Also, I have a concern about all the business logic being stored procedures. What are the arguments against/for putting this business logic (i.e. calculation of performance numbers) in stored procedures versus using Java (or some other OO programming language) with ORM (such as myBatis)?


DDD: How to reconcile a BoundedContext with REST/WebService DTO's?

I'm just starting to learn about DDD, and I'm trying to understand how Bounded Contexts can be reconciled with client facing API's like REST/WebServices that use DTO's. For example: your system exposes it's API to the public with a standard WebService, with CRUD style operations for DTO objects with many fields defined via a WSDL. You create a Bounded Context to handle your Domain's business logic, using a "non-anemic" domain model - so that your domain objects don't simply have a bunch of setters and getters - instead they have methods defined using vocabulary from your ubiqitious language. How would one reconcile the difference between their web service DTO and the Bounded Context? It seems to me this could add a huge amount of complexity, and I'm wondering if there are some well defined ways to solve this.


Using uniqueness types to implement safe parallelism

I've been interested in uniqueness types as an alternative to monads in pure functional languages for some time; unfortunately, this is kind of an esoteric area of CS research and online resources about programming with uniqueness types are few and far between. It's obvious how uniqueness types may be used to implement stateful data structures like references ("boxes") and arrays, though it escapes me how you might implement other common stateful data structures with them. Is it possible to implement, for example, locking with unique types? Can uniqueness types be used to share mutable data across threads? Is it possible to use unique types to build synchronization primitives (like mutexes), or is message passing necessary?


Is it dangerous to substitute unit tests for user testing? A co-worker believes we can reduce the manual user testing we need to do by adding more unit tests. Is this dangerous? Unit tests seem to have a very different purpose than user testing. Aren't unit tests to inform design and allow breaking changes to be caught early? Isn't that fundamentally different than determining if an aspect of the system is correct as a whole of the system? Is this a case of substituting apples for oranges?


How to refactor code that has 2 concerns

Say I have this code:                       if ($this->ship == "e") {                 $this->price->addLine($this->price->base * $this->price->e, 0, "Export");                 $this->price->total += $this->price->base * $this->price->e;                  } elseif ($this->ship == "d") {                 $this->price->addLine($this->price->base * $this->price->d, 0, "Domestic");                 $this->price->total += $this->price->base * $this->price->d;             }      I have multiple identical blocks of code like the above. I also have other code (other than `$this->ship`) that is similar in structure. Basically, this code adds a `Line` to a PDF, where the line says "Domestic" or "Export" along with other options. The code above also computes price for that line and adds it to the total. **My thoughts on refactoring this:** I want to remove duplication. I also want to abide by SOLID principles, i.e. separation of concerns. I see that code above does two things (computes price and adds a line item to PDF). I can surely split this code into two separate functions, but then I still end up with duplicated code -- I need to check if `$this->ship` equals `e` or `d` in both places. That is no good. If I need to add a 3rd option, I have to change code in two places. So then I can move my check for `e` or `d` into the main body of code, but still I have duplication because I will have               switch($this->ship)     {         case 'd': $cost = $this->getShippingCost($this->price->base, $this->price->d);break;         case 'e': $cost = $this->getShippingCost($this->price->base, $this->price->e);break;          }      I get these two long lines of code for basically a single character change. While maybe it is kind of acceptable, I am not quite liking it. If I need to change the number of parameters for example, or base parameter or etc, I will need to change it in more than one place. Basically, so far no matter what way I spin this code, I end up with some duplication somewhere. I mean if it is unavoidable, I guess it's okay. But here I come for advice on seeing if there is a way to separate the concerns, and remove duplication and have minimal number of places (ideally `one`) when I do need to change something. can this be done?


How bad is to have many directories where to save uploaded data instead of one?

I am using the following structure to save the images that users are uploading for their items:   * Images      * User_dir1        * Item_dir1          * Picture_file1         * Picture_file2     * User_dir2        * Item_dir2          * Picture_file3       * Item_dir3          * Picture_file4 Can I go on with this if I am going to have thousants of users and hundrets of items per user? Talking about performance will the Linux dedicated server have trouble in the future? Thanks!


Do employers prefer software engineering over CS majors?

I'm in grad school at a university that was one of the first to have a software engineering accredited program. My undergrad is in CS. An employer recently recruited at our university and hired 5 SE majors. None of them were CS. Do employers prefer software engineering majors? The reason I ask is because I can focus on many different areas during my graduate studies and really want to take the classes that will help me land a great job. Right now I'm either going to use CUDA and parallelize an advanced ray-tracer for a graduate project or do research on non-photo-realistic rendering in augmented reality. Pursuing these would leave very little SE classes in my schedule. If I went the software engineering route, I would probably either do research into data-oriented programming or software design complexity. Sometimes I think when I'm 40 and look back will it matter at all? For some reason I'm thinking not.


What benefits for the developer does the Ruby language offer that C# does not have?

What benefits for the developer does the Ruby language have that are not available in C# (preferably with code examples)?


MVC: What is the difference between a model and a service?

Why in some frameworks the logic layer is called "Model" whereas in some it is called "Service". Are they different from each other or just different by naming conventions? * * * UPDATE 1 The reason I'm asking is because in Zend Framework, a classical MVC framework, everybody uses the concept of Model. Now I'm learning AngularJS and it seems that the word Model disappeared and was replaced by the word service. What I noticed is that a service is more like a singleton that can be reused again and again (example: a REST client) whereas a model is more related to the data manipulations coming from the controller in the MVC pattern.


Difficulties for functional managers in Scrum

I am a Test/QA manager in an organization that gradually moves to Scrum. I don't appear in daily Scrum meetings because I don't want to interfere with the self-organization of the team. The problem with this is that I am becoming too disconnected with what the 5 testers who report to me do in the day to day. How can I coach and evaluate these testers? What if they don't do good work, or do too little work, how can I know this in a timely basis and act on it?


What is the benefit of offloading email to a transactional mail service?

Why do so many people recommend offloading email to a transactional service such as Mandrill, Postmark or Sendgrid? Is sending email via smtp really that much slower than sending a request out to said service? I imagine it has something to do with the rendering of the actual message, but I'd like a more informed reason.


Should I worry about 'Javascript piracy'?

If I write a client-side Javascript app (with a little bit of server interaction), how can I prevent people from copying the Javascript files to their own site? Should I, at all?


How can I practice implementing data structures and algorithms?

I just finished learning the basics on data structures and algorithms using Python and C, completing some of the exercises from the book I read. I feel that it is necessary to implement some of these data structures and algorithms to enhance my understanding about the material that I just learned, such as the red-black tree and priority queue. Are there any good websites with material for me to use when practicing?


Is it realistic to ask your team to take on a 100% automated test coverage goal as a stretch task?

In a financial services environment - is it realistic to ask your team of ten programmers to take on a 100% automated unit and integration test coverage goal as a stretch task for a legacy java system (>1.5M SLOC)? [as a two year goal in increments]


Is it more difficult to maintain moral ethics in IT industry..?

is it more difficult to maintain moral ethics in IT industry? or it is just that this industry has its own code of conduct?. I have another profile with karmas close to a thousand. This posting is something personal, so I am posting it as anonymous. I am a software engineer.I quit my job in a service-based IT company nearly 4 months back. I have some mood disorder problem. I worked there for over an year. Worked on one project from kick-off to sign-off and worked on one phase of next very similar project. I quit the job because I needed flexibility in work timings and be able to work from home say once a week or now and then (to cope up with my health issue). This job was very low salary paying for my resume and work was very chaotic and unsatisfying in my project (on which I worked end to end) and had lost hope for better work. I didn't find any mentors or role models in the team.This being service based company, I felt like I was to give status on each day. It is true that I have to struggle to meet deadlines because of my problem. But by working on weekends/late nights, I was meeting these. But people didn't perceive it in that light.And I feel that with time, I am only growing and learning in terms of discipline and my problem is like any other health problem for which people need accommodation at work, but qualify for job. I was sincere in my work. and given this flexibility I can do my job. If not excel then at least meet expectation. I quit it, because when being on the job, my mind was always stressed and I couldn't think of what would be better job for me as a next job move, so I needed time to figure it out. Near the end, I was also feeling burned out from the project and I wanted to work on my health. For 2 months, as planned I took a break (break from career worries and career planning, but I spent my time reading things basic things which I wanted to learn like about country,culture,religion,spirituality etc) makes basis for long term peace. May be I have some degree of attention deficit disorder and I would feel blanked out on such issues. and I wanted to spend one month from my life imprinting such knowledge in my brain. then I studied for a month.(I prepared for Google,took onsite interviews,(and got rejected) so focussed on data structures,algorithms preparation along with general OS concepts) and took my focus off from applying to other places etc. Now, gradually before I realized its been a 4 months gap. When job consultants call me, they ask me why I left my previous company without any job offer in hand. I give them 3 true reasons that I wanted to work for product based company, project was over, and I was looking for a break of 2 months. They don't like these reasons. and some don't even send my resume to HR, I think. it is putting me off. What is code of conduct in IT industry? People don't do their share of work sincerely, leave project in between. get careless in work in their notice period. Is this acceptable? or may be I am surrounding by people who give me such tricks and it makes me feel that in general this is how people think. like a friend joined a company, worked there for 1 month, didnt like it and left it and didn't show it his resume and had other company waiting for him with their offer. I am thinking if I should start working on some open source project, which might count as work.or if I should recourse to a lie (and update my resume accordingly) like I had a fracture when I was about to join a new company and so had to take break and that job offer elapsed or some other health issue (which is not long term like mental health or sth) or a problem in my family consultants openly ask me if I am single or married. and some dont show interest because I am single(and of marriageable age as in India ,going by when I did undergrad) and so they think that soon I will get married and being a female is likely to relocate.some consultants openly ask if I have any other job offer in hand. Some say that companies give and set salary depending on if I am employed or not working. I listen to people saying that it becomes easy to negotiate salary once I have other job offers in hand. Is that more ethical that what I have done? I mean , salary should be set on the basis of ones experience,compatency etc rather than competing offers. I feel its difficult to maintain ones ethics during job hopping, career advancement etc in this industry. I am beginning to feel frustrated and am seeking advice from people who have undergone something similar. I think software professionals all over the world may relate it to some degree. I am based in India, so if somebody also wants to chip in with India specific advice, please feel free.


What does HATEOAS offer for discoverability and decoupling besides ability to change your URL structure more or less freely?

Lately I've been reading about Hypermedia as the Engine of Application State (HATEOAS), the constraint that is claimed to make a web API "truly RESTful". It boils down to basically including links with every response to the possible transitions you can make from the current state. Let me illustrate what HATEOAS is based on my understanding - and please do correct me if I missed something.               /         GET: {             "_links": {                 "child": [                     { "href": "http://myapi.com/articles", "title": "articles" }                 ]             }         }          /articles?contains=HATEOAS         GET: {             "_items": [                 { "uri": "http://myapi.com/articles/0", "title": "Why Should I Care About HATEOAS?" },                 { "uri": "http://myapi.com/articles/1", "title": "HATEOAS: Problem or Solution?" }             ],             "_links": {                 "self": { "href": "http://myapi.com/articles", "title": "articles" },                 "parent": { "href": "http://myapi.com/", "title": "home" }             }         }              POST: {             "title": "A New Article",             "body": "Article body",             "tags": [ "tag1", "tag2" ]         }          /articles/0         GET: {             "title": "Why Should I Care About HATEOAS?",             "body": "Blah blah blah"             "tags": [ "REST", "HATEOAS" ],             "_links": {                 "self": { "href": "http://myapi.com/articles/0", "title": "article" },                 "parent": { "href": "http://myapi.com/articles", "title": "articles" }             }         }      HATEOAS is claimed to provide two major benefits:   1. The entire service is discoverable starting form the root URI, documentation is no longer needed.   2. The client is decoupled from the server which can now change the URI structure freely. This eliminates the need for API versioning. But in my view, a service is a lot more than its URI structure. To use it effectively, you also need to know:   * what query parameters you can use and their possible values   * the structure of the JSON/XML/whatever documents you need to send in your POST/PATCH/etc requests   * the structure of the response sent by the server   * the possible errors that might occur   * ... Based on the above, HATEOAS only solves a tiny fraction of the discoverability and coupling problems. You still need to document the above four aspects and clients will still be strongly coupled to the server because of them. To avoid breaking clients, you still need to version your API. The only benefit it provides is that you can change your URL structure more or less freely (by the way, what happened to the principle "Cool URIs don't change"?). Is my understanding correct?


URIs and Resource vs Resource representation

URL is an URI which identifies a resource by location. _Resource representation_ is a view of resource's state. This view is encoded in one or more transferable formats, such as XHTML, Atom, XML, MP3 ... URIs associate resource representations with their resources a) So I assume URI identifies a _resource_ and not _resource representation_? b) I've read that relationship between an URI and _resource representation_ is _one to many_. Assuming we're talking about URL, how can a single URL address more than one _resource representation_? thank you


When and how a programmer should start own business?

The title says it all but here's some explanation of what I want to know: Let's suppose a programmer has around 5 years of experience in multiple, mainstream languages. Also suppose that the programmer has worked in different positions from junior developer to senior s/w engineer to a team lead. How would he know this is the time to stop working for others and start his/her own business. How important the technical skills and requirements are in addition to of-course financial requirements. The second part of question is, if he decides to role own company, how he should take a start? Ok, here's some more info: I am single, have no expenses other than my own mobile bills and university dues. Also there's no house rent for me since we have a joint family system (this is not only common but also appreciable in my culture and community). I noted that most people have supposed that I want to build a new _product_ or _web site_. While I appreciate getting your ideas on this, can you people also throw some light on another aspect? What if I would like to build a new, small software shop (or software house as we call it here)?


How to maintain encapsulation with composition in C++?

I am designing a class `Master` that is composed from multiple other classes, `A`, `Base`, `C` and `D`. These four classes have absolutely no use outside of `Master` and are meant to split up its functionality into manageable and logically divided packages. They also provide extensible functionality as in the case of `Base`, which can be inherited from by clients. _But, how do I maintain encapsulation of`Master` with this design?_ * * * So far, I've got two approaches, which are both far from perfect: ## 1\. Replicate all accessors: Just write accessor-methods for all accessor-methods of all classes that `Master` is composed of. This leads to perfect encapsulation, because no implementation detail of `Master` is visible, but is extremely tedious and makes the class definition monstrous, which is exactly what the composition should prevent. Also, adding functionality to one of the composees (is that even a word?) would require to re-write all those methods in `Master`. An additional problem is that inheritors of `Base` could only alter, but not add functionality. ## 2\. Use non-assignable, non-copyable member-accessors: Having a class `accessor<T>` that can not be copied, moved or assigned to, but overrides the `operator->` to access an underlying `shared_ptr`, so that calls like               Master->A()->niceFunction();      are made possible. My problem with this is that it kind of breaks encapsulation as I would now be unable to change my implementation of `Master` to use a different class for the functionality of `niceFunction()`. Still, it is the closest I've gotten without using the ugly first approach. It also fixes the inheritance issue quite nicely. A small side question would be if such a class already existed in `std` or `boost`. * * * # EDIT: Wall of code I will now post the code of the header files of the classes discussed. It may be a bit hard to understand, but I'll give my best in explaining all of it. ## 1\. GameTree.h The foundation of it all. This basically is a doubly-linked tree, holding `GameObject`-instances, which we'll later get to. It also has it's own custom iterator `GTIterator`, but I left that out for brevity. `WResult` is an enum with the values `SUCCESS` and `FAILED`, but it's not really important.               class GameTree     {     public:         //Static methods for the root. Only one root is allowed to exist at a time!         static void ConstructRoot(seed_type seed, unsigned int depth);         inline static bool rootExists(){ return static_cast<bool>(rootObject_); }         inline static weak_ptr<GameTree> root(){ return rootObject_; }              //delta is in ms, this is used for velocity, collision and such         void tick(unsigned int delta);                   //Interaction with the tree         inline weak_ptr<GameTree> parent() const { return parent_; }              inline unsigned int numChildren() const{ return static_cast<unsigned int>(children_.size()); }         weak_ptr<GameTree> getChild(unsigned int index) const;         template<typename GOType>         weak_ptr<GameTree> addChild(seed_type seed, unsigned int depth = 9001){             GOType object{ new GOType(seed) };             return addChildObject(unique_ptr<GameTree>(new GameTree(std::move(object), depth)));         }                                                    WResult moveTo(weak_ptr<GameTree> newParent);         WResult erase();              //Iterators for for( : ) loop         GTIterator& begin(){             return *(beginIter_ = std::move(make_unique<GTIterator>(children_.begin())));         }         GTIterator& end(){             return *(endIter_ = std::move(make_unique<GTIterator>(children_.end())));         }              //unloading should be used when objects are far away         WResult unloadChildren(unsigned int newDepth = 0);         WResult loadChildren(unsigned int newDepth = 1);              inline const RenderObject& renderObject() const{ return gameObject_->renderObject(); }              //Getter for the underlying GameObject (I have not tested the template version)         weak_ptr<GameObject> gameObject(){             return gameObject_;         }         template<typename GOType>         weak_ptr<GOType> gameObject(){             return dynamic_cast<weak_ptr<GOType>>(gameObject_);         }              weak_ptr<PhysicsObject> physicsObject() {             return gameObject_->physicsObject();         }          private:         GameTree(const GameTree&); //copying is only allowed internally         GameTree(shared_ptr<GameObject> object, unsigned int depth = 9001);              //pointer to root         static shared_ptr<GameTree> rootObject_;              //internal management of a child         weak_ptr<GameTree> addChildObject(shared_ptr<GameTree>);         WResult removeChild(unsigned int index);              //private members         shared_ptr<GameObject> gameObject_;         shared_ptr<GTIterator> beginIter_;         shared_ptr<GTIterator> endIter_;              //tree stuff         vector<shared_ptr<GameTree>> children_;         weak_ptr<GameTree> parent_;         unsigned int selfIndex_; //used for deletion, this isn't necessary         void initChildren(unsigned int depth); //constructs children     };      ## 2\. GameObject.h This is a bit hard to grasp, but `GameObject` basically works like this: When constructing a `GameObject`, you construct its basic attributes and a `CResult`-instance, which contains a `vector<unique_ptr<Construction>>`. The `Construction`-struct contains all information that is needed to construct a `GameObject`, which is a seed and a function-object that is applied at construction by a factory. This enables dynamic loading and unloading of `GameObject`s as done by `GameTree`. It also means that you have to define that factory if you inherit `GameObject`. This inheritance is also the reason why `GameTree` has a template-function `gameObject<GOType>`. `GameObject` can contain a `RenderObject` and a `PhysicsObject`, which we'll later get to. Anyway, here's the code.               class GameObject;     typedef unsigned long seed_type;               //this declaration magic means that all GameObjectFactorys inherit from GameObjectFactory<GameObject>     template<typename GOType>     struct GameObjectFactory;          template<>     struct GameObjectFactory<GameObject>{         virtual unique_ptr<GameObject> construct(seed_type seed) const = 0;     };          template<typename GOType>     struct GameObjectFactory : GameObjectFactory<GameObject>{         GameObjectFactory() : GameObjectFactory<GameObject>(){}         unique_ptr<GameObject> construct(seed_type seed) const{             return unique_ptr<GOType>(new GOType(seed));         }     };          //same as with the factories. this is important for storing them in vectors     template<typename GOType>     struct Construction;          template<>     struct Construction<GameObject>{         virtual unique_ptr<GameObject> construct() const = 0;     };          template<typename GOType>     struct Construction : Construction<GameObject>{         Construction(seed_type seed, function<void(GOType*)> func = [](GOType* null){}) :             Construction<GameObject>(),             seed_(seed),             func_(func)         {}              unique_ptr<GameObject> construct() const{             unique_ptr<GameObject> gameObject{ GOType::factory.construct(seed_) };             func_(dynamic_cast<GOType*>(gameObject.get()));             return std::move(gameObject);         }              seed_type seed_;         function<void(GOType*)> func_;     };               typedef struct CResult     {         CResult() :             constructions{}         {}              CResult(CResult && o) :             constructions(std::move(o.constructions))         {}              CResult& operator= (CResult& other){             if (this != &other){                 for (unique_ptr<Construction<GameObject>>& child : other.constructions){                     constructions.push_back(std::move(child));                 }             }             return *this;     }              template<typename GOType>         void push_back(seed_type seed, function<void(GOType*)> func = [](GOType* null){}){             constructions.push_back(make_unique<Construction<GOType>>(seed, func));         }              vector<unique_ptr<Construction<GameObject>>> constructions;     } CResult;                    //finally, the GameObject     class GameObject     {     public:         GameObject(seed_type seed);         GameObject(const GameObject&);              virtual void tick(unsigned int delta);              inline Matrix4f trafoMatrix(){ return physicsObject_->transformationMatrix(); }                   //getter         inline seed_type seed() const{ return seed_; }         inline CResult& properties(){ return properties_; }         inline const RenderObject& renderObject() const{ return *renderObject_; }         inline weak_ptr<PhysicsObject> physicsObject() { return physicsObject_; }          protected:         virtual CResult construct_(seed_type seed) = 0;              CResult properties_;         shared_ptr<RenderObject> renderObject_;         shared_ptr<PhysicsObject> physicsObject_;         seed_type seed_;     };      ## 3\. PhysicsObject That's a bit easier. It is responsible for position, velocity and acceleration. It will also handle collisions in the future. It contains three Transformation objects, two of which are optional. I'm not going to include the accessors on the `PhysicsObject` class because I tried my first approach on it and it's just pure madness (way over 30 functions). Also missing: the named constructors that construct `PhysicsObject`s with different behaviour.               class Transformation{         Vector3f translation_;         Vector3f rotation_;         Vector3f scaling_;     public:         Transformation() :             translation_{ 0, 0, 0 },             rotation_{ 0, 0, 0 },             scaling_{ 1, 1, 1 }         {};         Transformation(Vector3f translation, Vector3f rotation, Vector3f scaling);              inline Vector3f translation(){ return translation_; }         inline void translation(float x, float y, float z){ translation(Vector3f(x, y, z)); }         inline void translation(Vector3f newTranslation){             translation_ = newTranslation;         }         inline void translate(float x, float y, float z){ translate(Vector3f(x, y, z)); }         inline void translate(Vector3f summand){             translation_ += summand;         }              inline Vector3f rotation(){ return rotation_; }         inline void rotation(float pitch, float yaw, float roll){ rotation(Vector3f(pitch, yaw, roll)); }         inline void rotation(Vector3f newRotation){             rotation_ = newRotation;         }         inline void rotate(float pitch, float yaw, float roll){ rotate(Vector3f(pitch, yaw, roll)); }         inline void rotate(Vector3f summand){             rotation_ += summand;         }              inline Vector3f scaling(){ return scaling_; }         inline void scaling(float x, float y, float z){ scaling(Vector3f(x, y, z)); }         inline void scaling(Vector3f newScaling){             scaling_ = newScaling;         }         inline void scale(float x, float y, float z){ scale(Vector3f(x, y, z)); }         void scale(Vector3f factor){             scaling_(0) *= factor(0);             scaling_(1) *= factor(1);             scaling_(2) *= factor(2);         }              Matrix4f matrix(){             return WMatrix::Translation(translation_) * WMatrix::Rotation(rotation_) * WMatrix::Scale(scaling_);         }     };          class PhysicsObject;          typedef void tickFunction(PhysicsObject& self, unsigned int delta);          class PhysicsObject{         PhysicsObject(const Transformation& trafo) :             transformation_(trafo),             transformationVelocity_(nullptr),             transformationAcceleration_(nullptr),             tick_(nullptr)         {}         PhysicsObject(PhysicsObject&& other) :             transformation_(other.transformation_),             transformationVelocity_(std::move(other.transformationVelocity_)),             transformationAcceleration_(std::move(other.transformationAcceleration_)),             tick_(other.tick_)         {}              Transformation transformation_;         unique_ptr<Transformation> transformationVelocity_;         unique_ptr<Transformation> transformationAcceleration_;              tickFunction* tick_;          public:         void tick(unsigned int delta){ tick_ ? tick_(*this, delta) : 0; }              inline Matrix4f transformationMatrix(){ return transformation_.matrix(); }     }      ## 4\. RenderObject `RenderObject` is a base class for different types of things that could be rendered, i.e. Meshes, Light Sources or Sprites. _DISCLAIMER:_ I did not write this code, I'm working on this project with someone else.               class RenderObject     {     public:         RenderObject(float renderDistance);         virtual ~RenderObject();              float renderDistance() const { return renderDistance_; }         void setRenderDistance(float rD) { renderDistance_ = rD; }               protected:         float renderDistance_;     };          struct NullRenderObject : public RenderObject{         NullRenderObject() : RenderObject(0.f){};     };          class Light : public RenderObject{     public:         Light() : RenderObject(30.f){};     };          class Mesh : public RenderObject{     public:         Mesh(unsigned int seed) :             RenderObject(20.f)         {             meshID_ = 0;             textureID_ = 0;             if (seed == 1)                 meshID_ = Model::getMeshID("EM-208_heavy");             else                 meshID_ = Model::getMeshID("cube");         };              unsigned int getMeshID() const { return meshID_; }         unsigned int getTextureID() const { return textureID_; }          private:         unsigned int meshID_;         unsigned int textureID_;     };      I guess this shows my issue quite nicely: You see a few accessors in `GameObject` which return `weak_ptr`s to access members of members, but that is not really what I want. Also please keep in mind that this is **NOT** , by any means, finished or production code! It is merely a prototype and there may be inconsistencies, unnecessary `public` parts of classes and such.


Should a special version of a website be developed for tablet users?

Does the desktop browser version of a web site always suffice for the tablet version(assuming no flash)? or is it common for websites to have a special tablet version that is different from both desktop and phone?


Has research been done on the effectiveness of Planning Poker as an estimation technique?

Although it is a commonly held opinion that planning poker improves the accuracy of project estimations (a small sample of which demonstrated on this question), has any defined research been done on the subject? More specifically, I am looking for non-circumstantial information showing that planning poker would be an improvement over traditional estimation techniques.


Can I run both .Net and Java framework in one computer?

I have .NET 2.5 installed in my computer unit, as a beginner I used VB.net As I went along I've also installed new .dlls that would help me with my VB.net programming Now, I want to study java as well, leading to Android programming. If I install the JDK 7.0, can I still be able to program in VB.net? Will installing JDK overwrite .dlls essential to the .NET framework? Should I get a new developing PC that focuses with JAVA/Android development?


Requirements specification for Multi-Channel website

The company I'm working on has a RUP-like software development process, with very heavy documentation. Right now we're doing a Multi-Channel web site -it's intended to be seen in Desktop, Tablets and Smartphones- and every version of the site has a particular flow of events and content. I don't see in RUP an artifact were this differences are documented. I'm aware that Uses Cases must be implementation agnostic -we can't mention any device specific terms- so maybe there's something in the Design discipline that serves that purpose. If there's nothing like that in RUP, It would be nice to know how another Software Process document requirements for Multi-Channel sites.


When is it appropriate to start using the next revision of a tool when dogfooding?

Specifically, I am working on a tool that integrates a DVCS and build system, but I image the challenge I am facing would arise for anyone developing a "meta" tool (compiler, VCS, build system, test runner, etc.) that they wish to develop through "dogfooding". **My question is:** in a scrum-style release process using the branching workflow, at what point do I start using a newer version of the tool in the development cycle of the tool? I'm looking for a process to create balance between:   * constantly use the `develop` version of the tool: I find I am breaking my own development as changes get incorporated.   * constantly use the `master` version of the tool: any issues I uncover through dogfooding are issues that have already been released.


How to practice ATDD if design is not yet emerged from TDD?

Despite being very stakeholders friendly, ATDD aimed to provide a "stop" line when a feature has just been done. This avoids wasting time to add non-focused (and sometimes useless) code. That's why some teams start by establishing a walking skeleton of the application, and directly specifying with an acceptance test the first required feature. Let's suppose this first acceptance test (not representing a relevant first acceptance test, just being an example): _**Given Michael has just been created in the application, his status should be left to non-activated._** I want to write my acceptances tests focusing on business logic directly (use- cases), not dealing with GUI for business rules. Thus my question would be...how to write it? since I don't even already know what is a "User", what is a status etc... Indeed, shouldn't it be the role of TDD to emerge the design and therefore these components? But if I firstly practice TDD in order to emerge them, the benefit of ATDD (as a stop line) would disappear. I imagine that it would be more consistent to write some acceptance tests (before entering TDD cycle) when the project has well progressed, since all main components would already be designed. To sum up, should I always write my acceptances test BEFORE my TDD cycle?


Read-only class properties

When is recommended to use `read-only` properties -- if the language allows me? Are _public_ read-only properties meant to replace `getter` methods or at least the _Magic Methods_ like what is available as __get() in PHP for example? What is the use of a _private_ read-only property?


Is it possible to analyse the API surface of a set of class libraries to automatically determine inter-assembly dependencies?

I'm sure we've all been in the situation where we've inherited code that was "overly public", becomes obsolete or needs to be refactored. In these situations, it is easy to spend many days analysing the API surface to see where methods or classes are consumed; with the .Net runtime, it seems logical that it should be relatively trivial to map these inter-assembly dependencies, but there doesn't seem to be any tools out there that do this already? For example, let's suggest that we have a CRM class library that encapsulates the interface to all the customer data; it's not unreasonable that a quotations application may rely on this, but it seems non-trivial to identify on _which bits_. A naive approach would be to say that the public interfaces (types, etc.) is the API surface, but it may be the case that some of these interfaces are only public for consumption in a particular use case, that may become invalid. Is it possible to automatically determine and map the inter-assembly dependencies for a given set of assemblies?


Soft Real Time Internet Aplication

I am building a tutoring application that multiple students can sign into the same session with a tutor. My question is, for example, if I sent out a command to draw a line, do I need to wait to see that all connected students propagated the command. Now, it relies that requests will be processed in order. But consider this. If I draw one point, drag and draw another point, it will draw a line. But if I don't wait to see if each step propagated to all students' screens successfully, a student might receive an instruction of drag, draw, draw. However, waiting for each connected user's input seems to be a very slow approach. Is there any way I can solve this efficiently? Or is this a problem at all?


Real-time stock market application

I'm an amateur programmer. I'd like to develop a software application (like Tradestation), to analyse real-time market data. Please teach me if the following approach is correct, ie the procedures, knowledge or software needed etc:   1. Use a DB to read the real-time feed from data provider: what should be the right DB to use? I know it should be a time serious one. Can I use SQL, Mysql, or others? What database can receive real-time data feed? Do I need to configure the DB to do this?   2. If the real-time data is in ASCII form, how can it be converted to those that can be read by the DB and my application? Should I have to write codes or just use some add-ins? What kind of add-in are needed?   3. How should I code the program to retrieve the changing data from the DB so that the analysis software screen data can also change asynchronously? (like the RTD in excel)   4. Which aspects of programming do I need to learn to develop the above? Are there web resources/ books I can refer to for more information?


What is the difference between string.c_str() and &string[0]?

What are the differences between `string.c_str()` and `&string[0]`? Regarding performance my guess is that `&string[0]` is a little faster than string.c_str() as it doesn't require a function call. Regarding safety and stability common sense tells me that `string.c_str()` should have some checks implemented, but I don't know, that's why I'm asking.


Our version of Agile isn't working. Tips?

I work on a small team of 4 developers. We are implementing a version of Agile that seems to continuously provide us with the same difficulties, week after week, and I'm looking for suggestions that can help us improve our process. The background: We generally do 2 week sprints, and each sprint we tend to underestimate our work, and we get in trouble with our manager because we're behind schedule. We start off each sprint by tasking out the stories that our manager creates for us. Sometimes he throws in the tasks too and we estimate them. We don't use story points. We use the software Urban Turtle to "manage our sprints", which is essentially just stories and tasks, and the associated burn down. We don't plan for a release at the end of a sprint. The most common issue that occurs is that we plan for a task in the beginning of a sprint only to discover it's much larger in scope, but still high in the priority, so we need to work additional hours on it. The second most common issue is that one of us runs into a technical problem that slows down the hours burned, causing a roadblock. The only suggestion provided to us is to be more proactive in adjusting our estimates and providing updates during standups in the morning so we can adjust for the extra time needed. However, there seems to be something fundamentally wrong with the way we're doing things. Perhaps there's a disconnect between the expectations of the manager on a project level and the expectations on a sprint level. Because we're making these sprint iterations according to a project plan, and therefore extending a sprint or deferring items screws up the project plan. So as developers we are being encouraged to perform Agile by extending estimates when necessary but also complete the sprint on time, which is confusing. This can't be an uncommon problem, so I'm hoping those wiser than I out there have a suggestion or two on how we can stop running into this same problem every sprint. It's frustrating.


Coming up with tokens for a lexer

I'm writing a parser for a markup language that I have created (writing in python, but that's not really relevant to this question -- in fact if this seems like a bad idea, I'd love a suggestion for a better path). I'm reading about parsers here: http://www.ferg.org/parsing/index.html, and I'm working on writing the lexer which should, if I understand correctly, split the content into tokens. What I'm having trouble understanding is what token types I should use or how to create them. For example, the token types in the example I linked to are:   * STRING   * IDENTIFIER   * NUMBER   * WHITESPACE   * COMMENT   * EOF   * Many symbols such as { and ( count as their own token type The problem I'm having is that the more general token types seem a bit arbitrary to me. For example, why is STRING its own separate token type vs. IDENTIFIER. A string could be represented as STRING_START + (IDENTIFIER | WHITESPACE) + STRING_START. This may also have to do with the difficulties of my language. For example, variable declarations are written as `{var-name var value}` and deployed with `{var-name}`. It seems like `'{'` and `'}'` should be their own tokens, but are VAR_NAME and VAR_VALUE eligible token types, or would these both fall under IDENTIFIER? What's more is that the VAR_VALUE can actually contain whitespace. The whitespace after `var-name` is used to signify the start of the value in the declaration .. any other whitespace is part of the value. Does this whitespace become its own token? Whitespace only has that meaning in this context. Moreover, `{` may not be the start of a variable declaration .. it depends on the context (there's that word again!). `{:` starts a name declaration, and `{` can even be used as part of some value. My language is similar to Python in that blocks are created with indentation. I was reading about how Python uses the lexer to create INDENT and DEDENT tokens (that serve more or less as what `{` and `}` would do in a lot of other languages). Python claims to be context-free which means to me that at least the lexer shouldn't care about where it is in the stream while creating tokens. How does Python's lexer know it's building an INDENT token of a specific length without knowing about previous characters (e.g. that the previous line was a newline, so start creating the spaces for INDENT)? I ask because I need to know this too. My final question is the stupidest one: why is a lexer even necessary? It seems to me that the parser could go character-by-character and figure out where it is and what it expects. Does the lexer add the benefit of simplicity?


Where should tests' log files go?

My application has a rather non-trivial, yet standard, log configuration.   It includes a console appender and a rolling size-based file appender. When I'm running the tests, thru the IDE or with maven, where is the least surprising place to save the log files?


Under which circumstances will development advance faster with many contributors compared to few?

I saw an interview with Joel Spolsky, where he says that Fog Creek Software intentionally keep their teams small (I believe as in four-five guys). The reason for this is to avoid a lot of the communication needed between the team members if the teams are larger. If one compares this to open source projects, where there can be hundreds (or thousands?) of contributors. Whether they are a team, is, though, arguable. There are probably also examples of something in between, with team sizes of 20 developers. My question is: What kind of software is most suited for getting developed by small teams, and what kind of software is suited for large teams?


How to level up as a PHP developer

I've been doing PHP for 4 years now. 2 years at school and 2 years at work. But I feel like I'm stagnating. Here are some things that I currently know about PHP:   * Basics (variables, control structures, arrays, loops, sessions, cookies, file manipulation)   * Database Integration (MySQL)   * OOP - I only know of the basics (creating classes, inheritance, objects, private, public and protected class variables)   * MVC   * A few frameworks (CodeIgniter, Laravel)    * PHPUnit (Assertions)   * Templating (Smarty)   * Using PHP with AJAX   * Building Wordpress plugins   * API Integration That's pretty much it. My question is what's next? What do I do to level up my skills as a PHP developer. What are the things that you can recommend that I would do in order to improve (Books, tutorials, etc.). What other PHP tools you can recommend that I should try and use. Thanks in advance!


Legal concern over "borrowed" code

A company my friend works for (let's call him Me) recently unveiled a new face for their internal "networking" website. This new face looks remarkably like Facebook, and indeed, examination of the source code reveals that it's almost identical: The code, class names, and even the fonts are the same. There is also no indication that Facebook is in any way involved or aware. I know this is unethical, but is it illegal? I can't find anything concrete about this to help Me decide what to do about it. EDIT: We're talking front-end code. It does not appear to be linking to Facebook in any way.


"Forgot Password" - How to handle this?

I read this answer and found a comment insisting not to send password by email: > passwords should not be able to be retrieved by email, I hate that. It means > my password is stored in plain text somewhere. it should be reset only. This raises me the question of handling Forgot Password option? At any cost the raw password must be displayed in any UI so that user will be able to read it. So what would be the way to handle "Forgot Password"


Real-time collaborative text editing (ie gdocs) - is it a viable software development tool?

"Google Docs" allows for real-time, collaborative document editing. Multiple document viewers are able to simultaneously read and change a document's content so that one user's updates are instantly applied and visible to all other viewers.   * Are there any software/web-app IDEs that facilitate this type of collaboration for writing code?   * Which processes (ie pair programming) stand to benefit from a system like this and which don't?    * Does this model for collaborative editing present a viable alternative to the current source control systems generally used by teams of software developers working on a single code base? Related but less general


What to do with old programming books?

I have about 1000 or so programming books, but a good selection are on languages/frameworks that are dated, like Django 1.1, Symfony 1.3, or HTML 4 and CSS 2. I just got them all back from storage and was sorting through what ones are of no use to me. So, I was wondering. Dated programming books are unlikey to be of any value to go through the hassle of selling them. Ideally I'd like to give them away but I can't find anywhere online to distribute them. Any ideas on what to do with them?


I've seen a lot of offices with sticky notes on whiteboards or even all over the walls. We don't use them in our company, I am currently considering starting using them, but I don't know how. How are sticky notes used by developers as a project management aid?


What implementation do you use when dealing with operators in .Net?

My question is in a sense a follow up of this post on Time Series in .Net. Ideally, you would like to expand the basic `TimeSeries<T>` class by something like `NumericTimeSeries<T>`, where you would want to make sure that the type `T` implements the common numerical operators `+`, `-`, `*`, `/', ... I am not sure what would be the most intelligent way to do this. My first idea is to create an abstract class `Number`, with abstract methods `Add(Number n1,Number n2)`, `Multiply(Number n1,Number n2)`, `Subtract(Number n1,Number n2)`, `Divide(Number n1,Number n2)` (and so on). I would then call these methods in the operator overloads. I can then create concrete classes such as `IntNumber`, `DoubleNumber`, `MatrixNumber`, `ComplexNumber` (and so on). The problem is that in the methods implementation, I would have to make an awful `switch` to determine what the class of each parameter is, and it's not very elegant. Would you have done it the same way? Has something already be done? In F# I would use and inline functions, or pattern matching using discriminated unions. But what should I do in C#? **EDIT** : There was an awesome answer by Olivier Jacot-Descombes. However, I would like to specify a feature. The numbers can apply the operator between them (you can multiply a matrix with a scalar for example). The problem with this is that you cannot know in advance the type of the result; multiplying a vector (transposed) and a vector returns a double...


good c++ editor

I'm going to teach teenagers some C++ code. I need an editor which is simple and has built in compiler. We tried CodeBlocks but when we installed it in the machines, the text got reversed, I'm not sure what the reaoson is. I would be great if the file size of the editor will not be large. We need just simple features: **-Text highlight.** **-Compile and run.** **-easy to use** **-Should run on Windows XP.**


Product Owner Role in Scrum

I am learning about Agile Methodology i.e. Scrum. I have a very basic knowledge of Scrum. Please guide following:   1. What is role of `Product Owner` in daily Scrum, if he/she is part of this meeting?    2. In real world scenario `Product Owner` is the person who is customer. A team member can be nominated as `Proxy` of product owner?    3. Can we say that `Project Manager` who directly interacts with customer is nominated as proxy of `Product Owner`?    4. When we use term `External Stakeholders Engagement`, are we referring to `Product Owner` or else?


How does using a LGPL gem affect my MIT licensed application?

I am developing an open source ruby application under the MIT license. I am using this license because I don't want to place any restrictions on the users of the application. Also I can actually read and understand this license. I recently started using another ruby gem in my project (require "somegem"). This ruby gem is under the LGPL license. Do I have to change anything about my project because I am using this other ruby gem that is licensed with LGPL? My project does not contain the source code for the other gem and it is not shipped with my project. It is simply listed as a dependency so that ruby gems will install it and my project will call into it from my code. Additionally, it would be helpful to know if there are any licenses I need to "watch out for" because using them would affect the license of my project. There are some other post about this topic but phrased in different ways. Since I find this license stuff tricky I am hoping to get a answer directed at my situation. Thank you,   Corsen


Designing software functions which are both pausable and restartable

Consider the following situation: One hardware device, two applications (1 C# application, 1 Firmware). The C# application sends frames to the firmware and the firmware executes scripts.   * C# -> transmit frame[x]    * FW -> receive frame[x]    * FW -> execute script relating to frame[x]    * FW -> before finished, a FW event is triggered forcing moving parts to stop (safety precaution). C# requirement after such events are raised:   * Poll FW for status, if status == stopped, send a resume fame.   * Caveat: the C# logic therefore needs to adjust itself to being "restarted". ### So this is the situation I have; but what I'm seeking advice with is how I should design a class which can handle the pausing and restarting of tasks an unlimited number of times. While I can write convoluted methods which are hard to maintain through a chain of logical statements, I'm struggling with finding a design which is reusable and clean. Such scenarios are true for ~50 unique tasks, so finding a solution I can apply everytime would save a lot of headache. Anytime a script is restarted or resumed, a physical user can easily cause a safety trigger stop, therefore a solution needs to be robust. While I'm sure recursion would be a first good step, I'm worried that the stack limits has the potential to introduce errors. ### Clarification: In my bid to simplify things, I seem to have omitted too much. Apologies. **Firmware:** Software running on a physical device which controls the hardware. I have no control over this code-base and it was designed independently while allowing USB communication. **Synchronization:** There is very little or no synchronization between the C# application and the firmware. My C# code will send a frame of bytes which match up to a specification document for the firmware, and if the frame is valid, the firmware will reply saying it received the frame and will begin the work. After that, there is no direct synchronization. A task described by a frame typically has two attributes: the time it takes to execute (need to manually observe) and an end target status (complete with status identifiers). Currently I poll the firmware for the status until the target status is reached or until time-out. **Recursion:** What I meant by that was (`if not complete` -> `callSelfAgain()`) **Pause:** User has done something to the device, wait here until they fix (can happen at ANY time during the time the firmware is running its jobs). **Restart:** The user has amended the state, now start the job from the beginning (or where we left off [task dependent]).


Getting my younger brother started on programming

My younger brother is 13 years old, I started programming when I started to develop Android applications when I was 15, last year my brother gained an interest in it and he would always pestering me about letting him make something himself, so I wrote him a few tutorials and he built himself a small application that had a few buttons that did something, I think you put in your dob and it would tell you what day you were born on, he took a couple of days building up to his final application, maybe even a week, learning everything he needed. Since then he hasn't really done much more because I have been engulfed in work and such where I have my own programming problems to sort out. I told him that when he was my age (I am 17) that he should be better then me, he was a bit sceptical about this however. I dont think he has as much logical reasoning as I would think he needs to solve more complex problems, but shouldnt that just develop over time as it did with me? He has been pestering me for the past week or something to write him more tutorials, but I didn't have time. All I had with me was a playlist I had downloaded from `the new boston` from youtube for C++, it's about 73 videos. He is currently about 20-30 videos in, he has come to ask me a few questions about it and thats it. Should I have really properly started him with C++? Should I stop him now and start him again on python or ruby? I know that C++ shouldn't really be a beginners language, especially for someone who is only 13, by the time this question is answered will probably be up to learning about inheritance or something. * * * Some people may see this as not a real question, but it is, and should be used as a reference for others. I want to know, should I start him on a different language whch is more easy? What language then? And would it be better for me to teach him myself (I would make time) or just continue him with `the new boston`? There are a few more questions throughout this question but these are the main ones. * * * Part of the question people seem to be neglecting is me asking whether I should change what language he is learning to another, or since he is already pretty far through the tutorials should I just leave him with C++ and he can learn the other languages freely by himself?


How can you have normal life when you're too passionate?

Let me put this straight. I am quite passionate about programming. I am single and have plenty of time outside work. I haven't slept for 5 full hours for at least a month, as I am involved in multiple projects at work (most of them volunteered) and some open-source projects as well. I know that I am not a gifted programmer and work at a slower phase, but I always get a high (like what runners get) when I see my code working and being used by people. This high is driving me work crazy of late, as other aspect of my life like dating, meeting up with friends, workout takes backseat. Apart from a great reputation I enjoy at my work place, there is nothing to show substantial :-( I can barely sleep, as my mind keeps bouncing ideas even when sleeping. Also, I crave for people's attention at work these days to make up for my personal life and this makes me take up other's work as well. Everyday I start telling myself to work for fixed hours and focus on other beautiful aspects of life, but indeed fail miserably. I know all this sounds like a big rambling, but Iam sure there are people in this forum who would've went through a similar phase in life. How did you overcome it? I don't want to be nerd with no friends. I have been working for 6 years after school and 27 years old male. How to maintain normal life when your work and passion has become your obsession and addiction? **Update:**   Thanks for all the wonderful answers posted. It really helped me to put things in perspective. I definitely feel better now and signed up for gym few days back. Also I leave my work laptop at office, to avoid working late at nights:-) Anyway I started sleeping for 8 hrs and it feels good. Working out regularly feels great :-)


How can I improve the workflow between developer and designer with Expression Blend?

We use WPF and Expression Blend 4. I'm trying to improve our workflow by tutoring one of our designers to use it for styling and animation. Slowly but surely I get the impression Blend in itself is to technical for the designer in question. I myself use it only occasionally (it's great for Visual States for instance) because a lot of things are easier done in code or not possible at all in Blend alone. It seems a developer with design experience is a lot more productive with it than a sole designer. Are there any good resources or advice as to how I can improve this workflow?


Do dependency injection frameworks pose a dependency risk?

I have been refactoring an existing system to use dependency injection, and that work has been going smoothly. After a while I noticed that a large number of in-house libraries became dependent upon the DI framework I used. As a result the entire project now depends upon this third-party framework. I saw an irony in decoupling all the dependencies by making them dependent upon a shared library. My first reaction was to create a wrapper library around the dependency framework. Therefore, I could replace this framework if needed. After estimating the work involved I realized that the resulting API would be to similar to the existing framework, and therefore make replacing it more difficult. So I abandoned the idea. My concern is that the DI framework I'm using becomes obsolete or needs replacing. Does there exist a development pattern when working with DI that reduces the coupling between a project and the DI framework?


OOP and database applications, Is it worth it? and when do i need it?

I have been coding small to medium size applications for several years now, mostly business applications or database-driven applications, In each new project i feel tempted to start with the database design and then write the code that sends/retrieves data to/from the database, MVC frameworks are really helpful to organize my code for web applications. But that's it for me. I could argue that any application is more or less the same, stores and retrieves data. And i think having a good database design makes the job a lot easier, **So what else do i need? And why? Any examples?** **I am trying to improve my skills and knowledge to be able to handle bigger projects** , I find OOP, OOAD and software design/architecture really interesting, but i don't know why on earth i would need them in data-driven applications (i know it's me!), I find a lot of articles talk about design patterens, business objects, serive layers, architecture and more, but when i think of any new application, it's always the same, I have a good database design and then i am ready to go, if the client needs more feature, i modify the database strucutre or add new tables/views , add new screens/web pages then i am done. **What is wrong with that approach?** For instance, there was a directory web application i was asked to do, i thought of designing the objects first then converting them into a database structure using ORM, but i found it time consuming, i wondered why i had to design both the objects and the data, and i went for my old approach to save time and effort. I know it's me, I know I am mistaken, but i think having more layers or tiers between the GUI and database is an extra effort and extra time, **so when does it matter? When is it worth it?** so i am asking: **What is the use of OOP in developing business/database applications? Any example would be appreciated** In other words **When do i have to separately design both the objects and the database schema? and what are the benifits? Any example??** thanks


in multi-tenant systems what is the correct practice for segregating each tenants data from each other?

I am a first-time azure developer and I am taking over a single-tenant cloud system and have been tasked with converting the system to multi-tenant. What is the correct practice to separate each tenant's sql server data? Its a data collection & reporting system. Each tenant will want to build and run their own custom reports on the data. So in multi-tenant, how are tenants prevented from seeing each others data?


The inheritance argument of zope.interface (providedby vs isinstance)

What limitations does inheritance of an interface through an abstract base class present that are addressed by zope.interface? In the following talk given in 2010 by Jeff Rush about interfaces, at 11:50 Jeff argues that with providedby you are free of the inheritance hierarchy. Why is this important? If I wanted to use an interface and inherit behavior from another base class, Python grants me the opportunity to do so with multiple inheritance. I understand that multiple inheritance should be avoided, and a compositional design to be considered as an alternative, but in this case I'm not inheriting behavior from the abc but rather just an interface, so I'm not really multiple inheriting in the behavioral sense. I don't understand the inheritance argument.. Thanks in advance for sharing your insight.


How does someone with a business degree become a software consultant?

I'm a 4th year computer engineering student from a reputable university in Toronto and i'm curious as to how some of these software consulting positions with the large firms (Accenture, Deloitte, IBM, etc.) accept business grads as well as comp-sci and computer engineers? How does a business grad consult on software without having a background in software? Besides communication skills and other soft skills, what separates me from a business grad for these positions? Thanks.


Dollar Sign Blues: Javascript and PHP

I grew up programming C++ and Java where everything was safe and beautiful. Compilers made sure to keep me in check if I ever strayed. Of course, everyone did a little Perl in college, but I didn't inhale. Kids these days are all about PHP on the backend and Javascript on the front. In trying to be hip, I do the same (for web development). The problem I keep running into is I accidentally add a dollar sign ($) in front of regular variables in Javascript and of course no one says anything because that's legal syntax often used for jQuery objects. Are there any debugging tools or dev tricks to catch this dollar sign confusion? Do you often make the same mistake, and how do you deal with it emotionally? Chrome dev tools don't always see this is a Javascript error. I use PhpStorm and Emacs for development, but those don't catch my stupidity, although I suspect Emacs does but chooses to not tell me about it out of spite. If you think this question is ridiculous, I think you are right. But we live in a world where a variable has a dollar sign in front of it. In such a world, nothing is ridiculous.


Can I apply SOLID concepts to entire solution designs rather than just the internal components?

So maybe the quick answer is 'Yes' absolutely (or no I suppose), but let me explain my question angle to get a better derived answer. We all commonly use SOLID design principals when making up the pieces and parts of our applications. Don't make a _class_ do too many things, don't make an _Interface_ too large, use abstraction not concretions, etc. Is it OK to apply this mentality at an abstract level when thinking about solutions, services, etc.? The main problem: I'm struggling with the request to have a single service do all things related to a specific business domain. Add to this multiple teams would all have their hands in the pot of the same application to add whatever functionality needed. I have a service being built out with many good architecture and design principals in mind and believe totally that lots of 'additional' functionality could be bolted on vertically within the same framework and solution. After all this one of the reasons why we spend time architecting solutions to be loosely coupled and allow scalability with rather ease. So you might say, "go for it, if the framework can handle it then add away!" Something is not sitting right with me and I would be concerned with a behemoth of an application/service that tries to do everything. I tried doing searches about "applications that do too much" or "services that have too many responsibilities" but not much came up. When I start thinking about the SOLID principals, I think having a service that does _everything_ related to a specific business domain might not be a good idea and may cause issues on down the road with maintainability and stepping on each other's toes. Is it correct to use SOLID principals when looking at entire solution functionality? Is creating a service like http://www.mycompany.com/api/[everyMethodPossible] correct, or could I be doing something that is incorrect? Thanks!


Public domain contributions to open source projects

Are there any gotchas in contributing public domain code to an open source project? My understanding is that the existence of a copyright gives a project the right to enforce its license. And public domain code is, by definition, non-copyrighted. What I'm specifically curious about: If an employee of the US government writes source code while on official duty and the federal agency releases it, that code is by law in the public domain. So, in particular, I'm wondering if there would be any issues if a federal agency/employee wants to contribute to an open source project.


Java memory management (thunks/lazyness)

If I want to create an infinite list of integers in Java like so:               ArrayList<Integer> list = new ArrayList<Integer>();     for(int i = 0;;i++){         list.add(i);     }      I run out of memory. My understanding is that we allocate some memory for _i_ , _list_ , and every time we add _i_ to the list, we allocate more memory for it. But, by using a thunk, I can create an infinite list which will not eat all of my memory:               infList(final int start){         return new InfiniteList (          start,          return new InfiniteList.LazyTail(){eval(){return infList(start+1);}}         );     }      (I adapted source from here). How does this work? I know I am delaying the evaluation of the expressions : start+1, start+1, start+1 ... but do I end up with a list of something like this: [start, eval(){start+1}, eval(){start+1}, eval(){start+1} ... ] Are the 'eval(){...}' object references? Do they take up space in memory? Will I eventually run out of memory with this implementation (I tried, but memory allocation was not budging)? Do I only start using memory, say, if I wanted to system.out.print integers, then they would have to be evaluated, and some memory allocated?


Detecting IEnumerable "State Machines"

I just read an interesting article called Getting too cute with c# yield return It made me wonder what the best way is to detect whether an IEnumerable is an actual enumerable collection, or if it's a state machine generated with the yield keyword. For example, you could modify DoubleXValue (from the article) to something like:               private void DoubleXValue(IEnumerable<Point> points)     {         if(points is List<Point>)           foreach (var point in points)             point.X *= 2;         else throw YouCantDoThatException();     }      Question 1) Is there a better way to do this? Question 2) Is this something I should worry about when creating an API?


iOS Development: What are some reasons I should to use XAuth to authenticate a twitter user?

I see many people using XAuth in their app to authenticate twitter users and I'm wondering what are some situations that I would want to use XAuth in my own apps. Thanks so much for your wisdom!


Array of pointers in C++.

I am not understanding the output of this ,               #include <iostream>     using namespace std;           // pointers and arrays      char ch1 = 'a' ,  ch2= 'b';          char ch3[6] = {'c', 'd', 'e', 'f', 'g' , 'h'};          char *ptr[3];           int main ()     {         ptr[0] = &ch1 ;              ptr[2] = ch3;         cout << &ch1 << endl;     }         The out put is abcdefgh . isn't &ch1 supposed to give the address of ch1 ? I cannot make sense why the output should be abcdefgh.


The Jitter (the just-in-time compiler) in ASP.NET

I know that C# gets compiled to an IL then after that to a machine code depending on the machine using just-in-time compiler. My question will go to ASP.NET. Is it the same? Does it require 3 steps? First your files is converted or compiled to MSIL then when you open a page for example in the browser it is coverted to machine code using the jitter?


How to handle returns when incorporating coupons or discounts in Point of Sale?

What is the proper way to handle determining the amount to return to a customer when dealing with coupons and discounts applied to receipts? **[Scenario A]** A receipt contains items each with their own price. A returned item would give back the amount spent for that item.               ItemA $25     ItemB $75     =====     Total: $100          a) Return ItemA: $25     b) Return ItemB: $75     c) Return ItemA, ItemB: $100      **[Scenario B]** What is the proper way to handle calculating the amount to return per item when we include a global discount or coupon applied to the entire receipt?               $10 global coupon for every $100 spent          ItemA $25     ItemB $75     ItemC $120     ItemD $15     =====     Subtotal: $220     Coupons: $20     Total: $200          Return ItemA: $?     Return ItemB: $?     Return ItemC: $?     Return ItemB, ItemC, ItemD: $?      **[Scenario C]** Coupons tied directly to items on receipts make it easy to calculate the amount to return per item like in Scenario A.               $10 coupon for ItemB only          ItemA $25     ItemB $75     --Coupon: $10     ItemC $120     ItemD $15     =====     Subtotal: $220     Coupons: $10     Total: $210          Return ItemA: $25     Return ItemB: $75 - $10 = $65     Return ItemC: $120     Return ItemB, ItemC, ItemD: ($75 - $10 = $65) + $120 + $15 = $200      **Things to think about:**   * Multiple returns per receipt (e.g. Monday return ItemA, Tuesday return ItemB)   * Global discounts - applied to entire receipt   * Item discounts - applied only to specific items   * Coupons that give discount for minimum amount spent - what if a returning part of a receipt negates the minimum requirements?


Is it wise for a high level developer to spend time studying assembly?

It is clear that the knowledge of low level stuff is very important in our work. But in a situation where you're already developing commercial software on a high level, _and_ when you already have a chosen direction but don't have any assembly skill, isn't it more reasonable to focus on studying stuff related to your direction? Or is there a reason you should spend some time to learn the low-level basics anyway? When is it too late, and when it is not? And if it is _not_ too late, then how would one go about learning optimally (in the sense of not spending excessive time to get some depth and understanding)?


How to handle errors best addressed in a higher abstraction layer and dependent on state inferred in current layer?

I have a use-case that can be repaired, but the logic for repairing it is best done in a higher level of abstraction. Just throwing exception/failure is ugly because it's hard to pass back up through the stack the information needed for the parent-layer to know how to fix it. To explain the the specifics, I have a program that controls multiple pieces of hardware. The 'top' layer is responsible for calculating how to task each piece of hardware to work together, how to generate 'paths' of data across hardware etc. My next layer includes threads for each individual device. each device thread generates and caches device state (fetched from hardware and config files). Devices process requests from the application, figure out how to update the hardware to make those requests happen, and then will modify the cached state to reflect the changes made. Finally I have plugins which send physical requests to hardware. This works fine usually, requests are sequential to avoid data race issues. We only pass information down layers, we have no way of getting async updates back up the layer. However, it's very unlikely, but possible, that someone could physically change the hardware without going through our control system. We will wait until the plugin detects an error trying to handle a request, and only then try updating our state for that piece of hardware to see if a change caused the failure (constant monitoring is a later feature). My problem is that when a change is detected on one device, that usually means a change was made to connected devices. When I detect this, I want to trace the change to connected device, update their state etc until I found all changes (this doesn't require updating _all_ devices, just connected ones). Each device thread is only responsible for one device, so they can't trace the change through other devices without propagating the exception up a layer. However, I need to know exactly what changes were detected on the device to know which connected devices I should be refreshing the state of. If I just throw an exception, this knowledge is lost and must be recalculated, which is a small but real cost due to time it takes to communicate with hardware. The tempting thing to do is to call a method in my application layer saying "this change was detected, go update everything else related to it". However, this makes drivers aware of the layer above them, which is not good. Another option is to simply propagate the error up and let my application layer notice the error and then go back to the same device to ask what changed and update all it's state, then re-calculate the changes to be made and make the request back down to the device level. The first is an obvious code smell, the second seems like more code, redundant logic, and small speed penalties (it takes a little time to get state from hardware). Are there some other options?


How can I find a good open source project to join?

I just started working a year ago, and I want to join an open source project for the same reasons as anyone else: help create something useful and develop my skills further. My problem is, I don't know how to find a project where I'll fit in. How can I find a beginner-friendly project? What attributes should I be searching for? What are warning signs that a project might _not_ be the right fit? Are there any tools out there to help match people with open source projects? There's a similar question here, but that question has to do with employment and is limited to PHP/Drupal.


How to find just starting OpenSource project and Join or find programmers for own?

Is there any place on the web where can I join a team when they are just starting their project? Is there any place where developers can make groups for projects? I know there are some /dev/forums where you can have luck to find something interesting in some topic ... but the chances there are really low. I know that you can find some projects on CodePlex or GitHub but they will be already started projects and it's not so easy to understand and join it ... I want to find some place where new ideas comes to new teams. So ... maybe starting project must already have a good base, but not to big base and then project leader must Promote it and find developers who like the idea ? Sometimes that is really hard to catch such promotions.


How does an (experienced) beginner jump into open source?

> **Possible Duplicate:**   >  How can I find a good open source project to join? I've heard allot about open source software and would love to help the community and gain experience in software development. The problem is, I'm kind of a beginner. I have some experience in Obj- C, Java, and Ruby. How can I be useful, and how can I, say, fix bugs ? Could you recommend some simple software that I could look at and learn from, then try to help?


How should a student go about extra-curricular activities involving programming?

> **Possible Duplicate:**   >  How can I find a good open source project to join? I'm currently a student in high school, and my passion is in programming and computer science. I love it, and I think I'm fairly good at it (at least compared to the average person of my age). I've taken a number of AP courses, especially in mathematics, and I also have taken AP Computer Science; though I've been reading books on computer science and programming since a fairly young age. I was wondering what an appropriate way would be to go about extra-curricular activities involving programming (or computer science). I'm looking to go to a decent college, and I know many of them look for people who pursue their interests, and I want to find a way to show that I really am pursuing my interests. I've heard that open source projects are a good way, but how can I prove that I actually contribute to a project? And how would I go about finding an appropriate project to join that will allow me to join? Are there any alternatives to open-source projects?


Open Source Projects for Beginning Coders?

> **Possible Duplicate:**   >  How can I find a good open source project to join? After working as a molecular biologist at the bench for many years, I lost my job last year and am thinking about a career change. I've been using open- source software and doing Linux system administration since the mid 90s, and have written/improved some small shell/Perl/PHP scripts, and am very comfortable building from source, but never progressed to creating non-trivial programs _de novo_. I want to move to actually learning real programming skills and contributing back to the community, with the possible eventual goal of getting into bioinformatics as a career in the future. I'm a stay-at-home dad now, so I have some time on my hands. I've done a lot of research on languages, and have settled on Python as my major focus for now. I'm set up on GitHub, but haven't forked anything yet. I've looked around OpenHatch some, but nothing really grabbed me. I've heard the advice to work on what you use/love, but that category is so broad that I'm having trouble finding any one thing to get started on. What are your suggestions for getting started? How do you pick a project that will welcome your (possibly amateurish) help? With a fairly limited skill set, how do you find a request that you can handle? What are common newbie mistakes to avoid? Any other advice?


Examining source code for maliciousness and security vulnerabilities

What are some techniques in determining if a particular piece of source code is malicious or vulnerable to malicious attack? I am currently using cppcheck and I am waiting on an install of Rational AppSource. Aside from that and reviewing the US-CERT Secure Coding Guidelines, what else should I be looking at? This is for a very large codebase (150K SLOC).