Design pattern for logging changes in parent/child objects saved to database

I’ve got a 2 database tables in parent/child relationship as one-many. I’ve got three classes representing the data in these two tables:               Parent Class     {         Public int ID {get; set;}         .. other properties     }          Child Class     {         Public int ID {get;set;}         Public int ParentID {get; set;}         .. other properties     }          TogetherClass     {         Public Parent Parent;         Public List<Child> ChildList;     }      Lastly I’ve got a client and server application – I’m in control of both ends so can make changes to both programs as I need to. Client makes a request for ParentID and receives a Together Class for the matching parent, and all of the child records. The client app may make changes to the children – add new children, remove or modify existing ones. Client app then sends the Together Class back to the server app. Server app needs to update the parent and child records in the database. In addition I would like to be able to log the changes – I’m doing this by having 2 separate tables one for Parent, one for child; each containing the same columns as the original plus date time modified, by whom and a list of the changes. I’m unsure as to the best approach to detect the changes in records – new records, records to be deleted, records with no fields changed, records with some fields changed. I figure I need to read the parent & children records and compare those to the ones in the Together Class. Strategy A: If Together class’s child record has an ID of say 0, that indicates a new record; insert. Any deleted child records are no longer in the Together Class; see if any of the comparison child records are not found in the Together class and delete if not found (Compare using ID). Check each child record for changes and if changed log. Strategy B: Make a new Updated TogetherClass               UpdatedClass     {         Public Parent Parent {get; set}         Public List<Child> ListNewChild {get;set;}         Public List<Child> DeletedChild {get;set;}         Public List<Child> ExistingChild {get;set;} // used for no changes and modified rows     }      And then process as per the list. The reason why I’m asking for ideas is that both of these solutions don’t seem optimal to me and I suspect this problem has been solved already – some kind of design pattern ? I am aware of one potential problem in this general approach – that where Client App A requests a record; App B requests same record; A then saves changes; B then saves changes which may overwrite changes A made. This is a separate locking issue which I’ll raise a separate question for if I’ve got trouble implementing. The actual implementation is c#, SQL Server and WCF between client and server - sharing a library containing the class implementations. Apologies if this is a duplicate post – I tried searching various terms without finding a match though. * * * Update based on comments from svick and TimG: To track change would the base class be something like:               public class ChangedRowBase         {             public enum StatusState             {             New, Unchanged, Updated, Deleted         };              protected StatusState _Status;              public StatusState Status         {             get             {                 return _Status;             }         }              public void SetUnchanged()         {             _Status = StatusState.Unchanged;         }              public void SetDeleted()         {             _Status = StatusState.Deleted;         }          }      Then my Child class would have something like:                   public int SomeDumbProperty         {             get;             set             {                 base.Status = StatusState.Updated;                 // Missing line here to set the property itself             }         }              private int _SomeIntelligentProperty;              public int SomeIntelligentProperty         {             get { return _SomeIntelligentProperty; }                  set             {                 if (value != _SomeIntelligentProperty)                 {                     _SomeIntelligentProperty = value;                     base.Status = StatusState.Updated;                 }             }         }      The idea being that the intelligent one detects if there has indeed been a change; otherwise using the dumb one the client app would need to either detect change and only update if there has been a change, or use the setter anyway flagging a change which actually didn't occur. I also know that my dumbproperty doesn't work (or compile) right now. If I want code in the getter or setter, does this mean I need to define a separate private variable myself ? I know the short hand {get; set;} does this behind the scenes.


How to learn the basics

I have been programming for 2 years in python, Java and C#. I have developed two programs that is being used by a IT-company I worked for and use programming/a programmers mind to solve almost every problem I counter. But still I feel I am missing something in my curriculum (selftaught mostly). When programming I usally do the most often mistake of never changing my solutions to problems in my code. Because I dont know the lowest principals in programming. I often give up on new projects I start because of this. I see codes from others and I shiver when I think back to my code afterwards. What are the basics in programming? How can I learn this? And which principals in programming is the building blocks to actually become a better programmer?


What file extension do you use for your template/view files in PHP?

I'm building a Model-View-Controller framework, and it has come time to decide how I will be creating and using view templates and layouts. Some frameworks use special extensions for these files. CakePHP uses `.ctp`. I have heard-of/seen `.tpl` files, though I've never used them myself. There is the `.inc` extension, which doesn't feel right, and of course, I could stick with plaon ol' `.php`. For that matter why not `.awesome`? What do you use for your template files? Is there any benefit to using a special file extension for these files? Are you partial to a certain extension for nostalgia or convention alone? They're typically (and will be in my project) already in their own directory, so I assume there must be _some_ reason they are differentiated by their extension in projects like CakePHP.


Is there a canonical resource on bouncycastle?

It doesn't matter if it is Java or .NET. Is there a resource out there that's the de-facto standard for describing best practices and other helpful information on bouncycastle? What about that resource makes it special?


Where does one draw the line between inspiration and plagiarism?

Suppose one would like to use in an iOS app only one function from a GPLv3 library that contains a large number of them. One cannot simply link the whole library beacuse otherwise the resulting software, having to be GPLv3, would be incompatible with the App Store. Can one "take inspiration" from the source code of the library to write a function that would perform the same task? I understand that this is a fine line, but I wonder if there is a rule of thumb.


Figuring out the Call chain

Let's say I have an `assemblyA` that has a method which creates an instance of `assemblyB` and calls its `MethodFoo()`. Now `assemblyB` also creates an instance of `assemblyC` and calls `MethodFoo()`. So no matter if I start with `assemblyB` in the code flow or with `assemlyA`, at the end we are calling that `MethodFoo` of `AssemblyC()`. My question is when I am in the `MethodFoo()` how can I know who has called me? Has it been a call originally from `assemblyA` or was it from `assemlyB`? Is there any design pattern or a good OO way of solving this?


What technologies or techniques senior developers of today should *unlearn*

Many questions here about learning new things. But what about `unlearning`? When we used to develop software 10 or 20 years ago very differently, we counted RAM in bytes, libraries were very rare, IDE was an unknown word and Merise was king. **What should we unlearn today? What bad habits we should get rid of?** EDIT: **unlearn** doesn't mean **forget**. Rather to use old techniques that was useful in the past, use the new technologies (such as GC for memory management). But your past knowledge will always be useful today.


Starting a User Group C#/.net

Inspired by this question, I have looked into user groups within my area in England, and there does not seem to be one at all for a few hundred miles. I would like to look into the possibility of setting one up in a local city, but I have no idea what the format should be. My questions are: What is the purpose of a user group? Is it to simply network or are there expectations for presentations, informal learning, etc? How and where does one promote a user group? Is it run as a free enterprise or is there usually a charge to allow for investment back into the meetings? Thanks.


Is it necessary to make a portfolio website for web developer

I have worked on around 15-20 sites . I have used different skills / languages on there. So i am confused how should write those in my resume . Or should i create a portfolio website where i have screen shots of those sites where i have wroked. Then do i need to mention about sites or just give the link in my resume


Is there an open source license that prohibits public hosting, so I can avoid competition?

I am thinking about open sourcing my project, but I want to prohibit public hosting, so noone will put up an alternative website with my code on it, and compete with my site. Internal networks, like libraries etc. would be welcome to use it. Are you aware of such a license? I guess this would be even more restrictive than AGPL.


What are the Vital Things noticed in an Experienced Programmer Resume by a firm?

Hai Friends, Tell me or share with me , i am developer with one year experience, now i want to modify my old fresher resume to an experience resume, so i want to know what are the primary things must be in an experienced resume which is attracted by the firm.


Manage the persistence of entities on iOS in several places: CoreData on the device, iCloud and on a REST API

For the needs of a project, I would persist the datas contained in Core Data in several places depending on the state of the user.   * If the user is logged to my API -> Persist the datas on my API.    * If the is logged on iCloud -> Persist the datas on iCloud    * In all case -> Persist the datas on the device. Indeed, with this schema, the datas could be saved on the device, on iCloud and on my API. We need to duplicate datas to be able to keep the last datas avalaible even if the user is not logged on iCloud or the API. * * * Here is an implementation of how I think this feature will be implemented. To uniformise the process of executing CRUD requests I think to create a `PersistenceManager` which permits to execute CRUD requests for entities depending the sate of the user. (If he's logged on the API or on iCloud or nowhere). Here there are some methods that the `PersistenceManager` will implement: **Save request** This method will save an entity depending on the state of the user. If the user is logged to the API: persist on the API If the user is logged to iCloud: save on iCloud In all case -> Save on the device with Core Data. Each datas stored will have a timestamp to be sure to get the last version of the data. **Read request** This method will retrieve entities only from de device in asynchronous mode. For each Save, Update or Delete request executed, if the user is logged to the API or with iCloud, one or both will send a notification to clients application where the user is logged to retrieve datas from API or iCloud and store them into Core Data. Then the data that the user want to read is returned by Core Data. To retrieve notification from the API, I think use socket through my API and my iOS app to communicate. But I don't know how can I do the same mechanism for iCloud. Any suggestion ? **Update request** Same mechanical than for the save request but for update datas. **Delete request** Same mechanical than for the save request but for delete datas. * * * I'm not familiar with these problematics, and I would like have your advices on it. Thanks a lot !


Decoupling Threads

It's not uncommon to hear of decoupling the UI from program logic, or database design/access from program logic...or even program logic from itself. However, I've never heard of an approach to generalizing or abstracting away the details of threading tasks to the logic (aside from Tymeac, an Android- specific package). Honestly, with all of the details going into managing threads, I don't expect many solutions to work well anytime soon, so... My question is, how do you write threads that aren't joined at the hip to the processes that use those threads? What do you normally do when requirements change in an already complicated multi-threaded application? Is there a design approach to this that I should read? I ask this because we are the dawn of the "bagillion"-core era in computing. Eventually, a good methodology will have to exist to manage 1k+ cores and even more threads here in the next couple of decades.


Interface hierarchy design for separate domains

There are businesses and people. People could be liked and businesses could be commented on:               class Like     class Comment          class Person implements iLikeTarget     class Business implements iCommentTarget      Likes and comments are performed by a user(person) so they are authored:               class Like implements iAuthored     class Comment implements iAuthored      People's like could also be used in their history:               class history     class Like implements iAuthored, iHistoryTarget      Now, a smart developer comes and says each history is attached to a user so history should be authored:               interface iHistoryTarget extends iAuthored      so it could be removed from `class Like`:               class Person implements iLikeTarget     class Business implements iCommentTarget          class Like implements iHistoryTarget     class Comment implements iAuthored          class history          interface iHistoryTarget extends iAuthored      Here, another smart guy comes with a question: How could I capture the `Authored` fact in `Like` and `Comment` classes? He may knows nothing about `history` concept in the project. By scalling these kind of functionallities, interfaces may goes to their encapsulated types which cause more type strength, on the other hand explicitness suffered and also code end users will face much pain to process. So here is the question: Should I encapsulate those dependant types to their parent types (interface hierarchies) or not or explicitly repeat each type for every single level of my type system or ...?


F# performance vs Erlang performance, is there proof the Erlang's VM is faster?

I've been putting time into learning functional programming and I've come to the part where I want to start writing a project instead of just dabbling in tutorials/examples. While doing my research, I've found that Erlang seems to be a pretty powerful when it comes to writing concurrent software (which is my goal), but resources and tools for development aren't as mature as Microsoft development products. F# can run on linux (Mono) so that requirement is met, but while looking around on the internet I cannot find any comparisons of F# vs Erlang. Right now, I am leaning towards Erlang just because it seems to have the most press, but I am curious if there is really any performance difference between the two languages. Since I am use to developing in .NET, I can probably get up to speed with F# a lot faster than Erlang, but I cannot find any resource to convince me that F# is just as scalable as Erlang. I am most interested in simulation, which is going to be firing a lot of quickly processed messages to persistant nodes. If I have not done a good job with what I am trying to ask, please ask for more verification.


Why did the Sun engineers decided to make Java only call by value?

Is there any specific reason they decided to go with Call by value? Is it for simplicity?


Server side C# MVC with AngularJS

I like using .NET MVC and have used it quite a bit in the past. I have also built SPA's using AngularJS with no page loads other than the initial one. I think I want to use a blend of the two in many cases. Set up the application initially using .NET MVC and set up routing server side. Then set up each page as a mini-SPA. These pages can be quite complex with a lot of client side functionality. My confusion comes in how to handle the model-view binding using both .NET MVC and the AngularJS scope. Do I avoid the use of razor Html helpers? The Html helpers create the markup behind the scene so it could get messy trying to add angularjs tags using the helpers. So how to add ng-model for example to @Html.TextBoxFor(x => x.Name). Also ng-repeat wouldn't work because I'm not loading my model into the scope, right? I'd still want to use a c# foreach loop? Where do I draw the lines of separation? Has anyone gotten .NET MVC and AngularJS to play nicely together and what are your architectural suggestions to do so?


Database-stored configuration management

Developing database-backed software, often one finds it convenient to store stuff in the database which one might traditionally express in code, but which is useful to store in the database (so that it can be changed without requiring a reload of the application). For instance, one might have processes which send automated email using a template; it makes sense to store this template in the database, so that the text can be tweaked by the users without having to change the code/redeploy/etc. However, these templates are "important"- they are required for the correct operation of the system, and for instance, if they become malformed or missing, the underlying functionality would probably stop working. As they live now in the database, they don't outside version control- you might add audit tables to have change history about this information, but revisions/etc. are separate and independent from your main code's revisions. How do you handle this kind of stuff? Not putting this kind of stuff in the database and make changes go through development/change control/deployment cycles? Or something else? Cheers, Álex


What is the Mars Curiosity Rover's software built in?

The Mars Curiosity rover has landed successfully, and one of the promo videos "7 minutes of terror" brags about there being 500,000 lines of code. It's a complicated problem, no doubt. But that is a lot of code, surely there was a pretty big programming effort behind it. Does anyone know anything about this project? I can only imagine it's some kind of embedded C.


What language do companies like NASA use to create their applications?

So obviously NASA need programmers to develop applications for them, be it VOIP applications, applications for control of machines and AI, etc. But in what language do they actually use for this? I'm 15 and plan on studying Software Engineering in University and my dream job is to program for NASA, astronomy is a huge hobby of mine. I have a need to learn things before I am of the "recommended" age, for example I have been studying post-grad Astrophysics in my free time. As a result of this I would like to know what programming language NASA use so I can begin to learn the basics and see if it is something I may enjoy. Please do not say `Live you life as a kid` as I have seen people say such things before, this is how I enjoy to live my life and absolutely love programming. I just feel that, like in many things, if I learn it at a younger age I will have greater experience when I am older - yes I have aspirations like you wouldn't believe (Haha). I am thinking of learning how to program an Arduino, or Engduino as we may be witnessing in my Computer Science classes, but is this at all related to the type of programming NASA do. I understand that NASA will be programming MUCH, MUCH, MUCH more advanced programs than I, but to just get the sense of bringing a inanimate object to life would be an achievement to me. So yeah, what programming language do they use, what would you recommend I study in University to follow up such a dream?


Serpent Algorithm thats implement Cipher

How must i change the Standard Implemplementation of the Serpent Algorithm that i can use it with the javax.crypto.CipherInputStream or javax.crypto.CipherOutputStream? I must implement/extends the Cipher class and when i do it, what must i change? The Original Implementation of the Serpent Algorithm is here http://www.cl.cam.ac.uk/~rja14/serpent.html Exist a Implementation of the Serpent Algorithm that's implement Cipher? I found the Java implementation of the Algorithm on the Page of its Creator. The Problem in this is: i can't use it with javax.crypto.CipherInputStream or javax.crypto.CipherOutputStream. I try to use the ObjectOutputStream to write a Configuration File, but i would like to encrypt it with the Serpent Algorithm. The same is with the reading of this Configuration file. I don't want to use API's like the BouncyCastle and flexiprovider because they create a to heavy boilerplate which i don't need. What is the best practice to use a finished (final and tested) Algorithm that dont extends/implements Cipher and it should be used in javax.crypto.CipherXxxStream?


Are you able to close your eyes and focus/think just on your code?

I have some colleagues at work, they arrive at the morning, switch off email, phone, close the door, etc. Then they close their eyes and during 30 minutes try to focus on their programming (C++, C, etc) and remember what they did yesterday. Then and somehow the process or imagine the code on they mind, with closed eyes. And some time later they just grab pencil and dump code on a sheet of paper or on their IDE (Kdevelop, Visual Studio, Eclipse, etc). Some of these guys are really effective and develop very complicated code. Me, I can not do this and I wonder if some of you can do something similar, and in case, if you could give some advice on how to be able to focus so deep in a codde or problem. Thanks


What should be used to diagram an application's internal architecture?

I have an application that has several dependencies, including a Matlab library and a Microsoft Windows Media Player ActiveX control. How would I graphically depict the internal architecture of this application for documentation purposes? Would a UML structure diagram be appropriate? If so, would it be as simple as the following: ![enter image description here](http://i.stack.imgur.com/77xN8.png)


Help with MVC design pattern?

I am trying to build a java program for user login but I am not sure if my MVC design is accurate. I have the following classes:   * LoginControl - servlet   * LoginBean - data holder java class with private variables getters and setters   * LoginDAO - concrete java class where I am running my SQL queries and doing rest of the logical work.   * Connection class - java class just to connect to the database   * view - jsp to display the results   * html - used for form Is this how you design a java program based on MVC design pattern? Please provide some suggestions?


Is masking really necessary when sending from Websocket client

The current Websocket RFC requires that websocket clients mask all data within frames when sending (but server is not required to). The reason the protocol was designed this way is to prevent frame data from being altered by malicious services between the client and server (proxies, etc). However, the masking key is still known to such services (it is sent on a per frame basis at the beginning of each frame) Am I wrong to assume that such services can still use the key to unmask, alter, and than re-mask the contents before passing the frame to the next point? If I'm not wrong, how does this fix the supposed vulnerability?


Email Content creation | Proper design

Working on an E commerce application where we need to send so many email to customer like   * Registration email   * Forget Password   * Order placed There are many other emails that can be sent, I already have `emailService` in place which is responsible for sending email and It needs an Email object, Everything is working find, but I am struck at one point and not sure how best this can be done. We need to create content so as it can be passed to `emailService` and not sure how to design this. For example, in Customer registration, I have a `customerFacade` which is working between `Controller` and `ServiceLayer`, I just want to delegate this Email Content creation work away from Facade layer and to make it more flexible. Currently I am creating Registration email content inside `customerFacade` and some how I am not liking this way, since that means for each email, I need to create content in respective Facade. What is best way to go or current approach is fine enough?


Standards for how developers work on their own workstations

We've just come across one of those situations which occasionally comes up when a developer goes off sick for a few days mid-project. There were a few questions about whether he'd committed the latest version of his code or whether there was something more recent on his local machine we should be looking at, and we had a delivery to a customer pending so we couldn't wait for him to return. One of the other developers logged on as him to see and found a mess of workspaces, many seemingly of the same projects, with timestamps that made it unclear which one was "current" (he was prototyping some bits on versions of the project other than his "core" one). Obviously this is a pain in the neck, however the alternative (which would seem to be strict standards for how each developer works _on their own machine_ to ensure that any other developer can pick things up with a minimum of effort) is likely to break many developers personal work flows and lead to inefficiency on an individual level. I'm not talking about standards for checked-in code, or even general development standards, I'm talking about how a developer works locally, a domain generally considered (in my experience) to be almost entirely under the developers own control. So how do you handle situations like this? Are the one of those things that just happens and you have to deal with, the price you pay for developers being allowed to work in the way that best suits them? Or do you ask developers to adhere to standards in this area - use of specific directories, naming standards, notes on a wiki or whatever? And if so what do your standards cover, how strict are they, how do you police them and so on? Or is there another solution I'm missing? [Assume for the sake of argument that the developer can not be contacted to talk through what he was doing here - even if he could knowing and describing which workspace is which from memory isn't going to be simple and flawless and sometimes people genuinely can't be contacted and I'd like a solution which covers all eventualities.] **Edit:** I get that going through someone's workstation is bad form (though it's an interesting - _and likely off-topic_ \- question as to precisely why that is) and I'm certainly not looking at unlimited access. Think more along the lines of a standard where their code directories are set up with a read- only share - nothing can be changed, nothing else can be seen and so on.


Do validate non-input data from a client?

One of our developers has an opinion that all client data should be validated before using it. Even non-input data. Say, our web service has an internal protection against database injections. Examples: machine generated codes, various integers, indexes, calculated values. We use ORM (Django). As I know there is a next approach in Django: validate only values entered as primary strings (usually via web forms). For example: is there any reason to create validation rules to validate numbers if we know that there is 500th error (if the data are wrong) in the beginning of handling request? I think no. But probably I'm wrong. Do my position requires to be changed?


What is the name of this design pattern?

I have been using this "design pattern" (may or may not be an "official" design pattern) for a while and I wanted to know if it had a name (so that I could name my classes after it). Example in PHP code (though applies to any language) (the example is stupid please don't mind):               interface Formatter {         public function format($variable);     }          class IntFormatter implements Formatter {         public function format($variable) {             echo (string) $variable;         }     }          class StringFormatter implements Formatter {         public function format($variable) {             echo '"' . $variable . '"';         }     }      Now the pattern I want to know if for this class:               class FormatterDispatcher implements Formatter {         private $formatters = [];              public function setFormatter($type, Formatter $formatter) {             $this->formatters[$type] = $formatter;         }              public function format($variable) {             $type = gettype($variable);                  return $this->formatters[$type]->format($variable);         }     }          // Now in the code:     $formatter = new FormatterDispatcher();     $formatter->setFormatter('int', new IntFormatter());     $formatter->setFormatter('string', new StringFormatter());          $formatter->format($variable);      As you can see, it's just a proxy to other implementations of the interface. It will select the implementation to use based on the class of the parameter (here I used primitive types for simplicity's sake). So what is the name of this pattern? PS: in a language that supports Generics, the code would definitely look better, but I guess the spirit would be the same.


Laravel 4: Binding/linking two users together

I'm building a unittest system. At some point I want to bind two users together in order to make an assignment for those two. So when the admin chooses to link two students together the system should figure out how to, maybe using the ID numbers of the both users. I have an idea on how implement this, but not very clear.


How do I get a job as a game developer?

I'm an entry-level programmer just out of college. As I've found out, I don't really enjoy working on "boring" applications like networking, firewalls, and such. My dream job would be something like a game developer. What should I be focusing on to move into games development? Are there specific technologies or languages that I should know?


calculate complexity of LinkedHashSet

I have an `ArrayList<LinkedHashSet<String>> setOfStrings` for example this arraylist internally is composed like:               positionX[hello,car,three,hotel,beach]     positionY[.....]     ...      I want to find car inside this data-structure, so I did it               for (Iterator<LinkedHashSet<String>> iterator = setOfStrings.iterator(); iterator.hasNext();) {          LinkedHashSet<String> subSet = iterator.next();         if (subSet.contains("hotel"))             System.out.println("found");     }      The for iterate over the entire `arrayList` and the complexity in the worst- case is O(n), but I'm confused on the complexity of the method `contains()` of set. In according of `javadocs` this method is executed in **constant time** , but I've heard that in certain cases the complexity might become `O(n)`. Saying that, I'm not sure about the complexity of this snippet algorithm. Can someone provide me an explanation of that?


Rectangle class java.lang.Object

Can someone please explain to me the difference or benefits rather to using the rectangle class               ex. Rectangle r1 = new Rectangle(x,y,w,h);       versus the graphics class drawRec method?               g.drawRec(x,y,w,h);      I'm thinking that you can create a new object outside of paint() or paintcomponent() which gives creating an object more options and maybe the associated methods is a bonus? I'm just speculating though because the tutorial I was going through switched from using one to the other without explaining why. I believe I understand how to use them just not when it's better to use which. Please try to keep your responses at the beginner level seeing as how I'm just starting out but of course any assistance is GREATLY appreciated. Thanks!! Here is a code segment of what I'm working with:               public void paintComponent(Graphics g){          g.drawImage(yellowBall, xCoor, yCoor, this);         Rectangle r1 = new Rectangle((boardXSize/2), (boardYSize/2),50, 50);         g.setColor(Color.red);         g.fillRect(r1.x, r1.y,r1.width, r1.height);              repaint();          }


finding high end software contracting jobs

I've been contracting for about 3 years now. I am currently a contractor for a web firm. This is a hourly position. I want to find larger projects. I had read that some people are able to only do one or two jobs a year and be set on that. I want those types of jobs, and I want to hire people to take on these jobs as well, but I have no idea where to start. I highly doubt places like odesk post these types of contracts. Where can I find them? How can I make good money and live comfortably while working for myself?


What would the ultimate developer training class look like?

I think today's typical/traditional 3-5 days developer training classes aren't so great, as you tend to forget half of it shortly after. It's too much one way communication and not enough interaction. Also brain research has shown that this kind of setup is usually not optimal for efficient learning. For clarification, I am referring to professional, commercial, paid classes. However this could also be applied for any kind of studies. How could the ultimate developer training package be setup to really make sure you learn what you are supposed to learn? Would that be more:   * Multimedia?   * Exercises?   * Homeworks?   * Spread out over time instead of 3-5 compact days?   * Group projects?


Can a Guy with Embedded System Background go into Game Development

Well, I finished my Masters in Embedded Systems, and I am working in GUI development, and working with graphic tools and images and GUI's keep me glued to my seat more than working on code for MUP/MUC . And I want to give game development a Fair chance, try out developing a game from scratch using basic libraries then tryout the same in a free/open source game engine and there is a good chance I may fall in love with it, but it is poissible for a person with an Electrical and Electronics Bachelors and Embedded Systems Masters ( just a years experience in the field) go into game development and be successful in the profession. And I asked the same question @ stackoverflow.com (wrong place to ask ) http://stackoverflow.com/questions/13794822/can-a-guy-with-embedded-system- background-go-into-game-development/13794943#13794943 And I received good but a very generic answer. I would be happy to know the actual pro's and con's of a master's in embedded systems migrating to Game Dev


Difference between Atomic Operation and Thread Safety?

From the discussion I've seen it seems that _atomic operation_ and _thread safety_ are the same thing, but a lot of people say that they're different. Can anyone tell me the difference if there is one?


What exactly do I need to do if I use a LGPL licenced library?

I have read this questions and answers, but I still don't understand what exactly do I need to do if I dynamically link with a library that uses a LGLP licence (the SDL library in my case). If I understand LGLP text correctly, I need to somehow provide the source for the library. Is this enough? If not, what else needs to be done?


How do you make a manager understand Agile?

I have a problem with a senior director who doesn't understand iterative development (much less Agile). He is insistent that our software design specification (SDS) be complete before any line of code is written. Complete, to him, means all functional detail is there. Also, being a former Cobol programmer, he wants to see "modules" and flowcharts. This is a Java web app for crying out loud! Anyway, I'm trying to find a simple place to gently point him to show that the SDS need not be 100% complete before we begin coding (nor can it be complete). Any suggestions? Thanks!


Is it acceptable to decompile someone else's code for the purpose of learning what they did, and how they did it?

I am not talking about stealing code, or reusing someone's for profit. But I am assuming that if a program or plugin is distributed in a format where I can't readily view the source, that is a deliberate action on the part of the programmer. Is it acceptable to look anyway, for the purpose of learning? And if so, are there limitations to that freedom?


What percentage of change is considered artistic license vs. a clone in video game development?

I'm a "weekend coder" developer making mobile apps and games and I've had the desire to make my own version of a game made for the Commodore 64 back in the early 80's by a small publisher e.g. Not EA Games or similar. The game hasn't been ported / released on any platform since. I want to make my version because it was fun to play but I can obviously create much better graphics now (the original had 8 colors at most, and requires a good imagination to transform a character image in the game into something with 4 limbs and a head). Since it will take effort to make from scratch, and the game will be different when done I'd like to charge 99 cents to users... But I have fears of being sued should the original developer pop out of the woodwork from somewhere. Here's a breakdown of original vs. My game intentions. Original game was a 2D side view game (think original Mario bros) with 3 screens that flipped when you crossed the edge. You could collect items, there were AI players that "chased" you, ladders, and some ride-able objects... All within a specific theme. My version would also be a 2D sideview, but be a sidescroller with at least 3 but maybe 4 or 5 "screens" worth of content. Images would be all original, have a nice 3D look to them, full color, shadows and lighting effects. You would still collect items but they would be all different, and you'd still get chased etc. but I'd try as best as possible to make my game unique... and of course it would have a different name. To a video game enthusiast that played this game in the early 80's they'd be able to proclaim..."oh man this game reminds me of **___ _**!" I don't think they would declare it to be a "ripoff" or "just a clone" though. Are there documented cases where a developer has been sued successfully for copying another game?.. And if so just how close was it? Likewise is there a statute of limitations?... This game is pushing 30 years old... Or is the answer just build it and see?


Queues and threading

I am developing a new project where I will be constantly checking a webpage for data and adding this data to a queue for processing. This data will then be removed from the queue and added to a list if it hasn't already been added. This list will then be stored in the database. I was wondering about how to use threads as I am relatively new to programming? I think it would be ideal if I had a thread constantly checking the webpage for data, a thread processing the queue and a thread for processing the list. Any suggestions on whether this method is the most effective or not and how to achieve this would be much appreciated.


Comparing strings against a pool of words

I am creating an app where the user enters 8 characters. After he enters the string I have to see if it is an eight letter word. If not, check if contains a seven letter word etc. I am checking against a given pool of 150k+ words. I only care about the longest possible match. Is there a better way then this one:   * WordPool.Contains(word.substring(0,8))   * WordPool.Contains(word.substring(0,7)),    WordPool.Contains(word.substirng(1,7))   * WordPool.Contains(word.substring(0,6)),    WordPool.Contains(word.substirng(1,6)),   WordPool.Contains(word.substirng(2,6))   * etc... _Edit_ I forgot to add that I am checking against an english dictionary. So far I am using this:               for(i = 8; i >= 3; i--)       for(j = 0; j <= 8 - i; j++)           if(words.contains(word.substring(j, i))              //do something      **Edit 2** I have been using the approach defined above just with a minor change. I am using a few background agents which all search for a word of a certain length. They all then return a result and I just pick the one which gives the user the highest score.


Should I reuse variables?

Should I reuse variables? I know that many best practice say you should not do it, however later when different developer is debugging the code and have 3 variables that look a like and only difference is that they are created in different places in the code he might be confused. unit-testing is a great example of this. However I do know that best practice are most of the time against it. For example they say not to "overide" method parameters. Best practice are even are against nulling the previous variables (in Java there is Sonar that has warning when you assign null to variable that you don't need to do it to call garbage collector since Java6. you cant always control what warnings are turned off, most of the time the default is on)


Is it OK to use same variable to store similar stuff sequentially?

Say I have a variable name `len` in a function and several strings. Can I use this to store length of those strings one after the other or should I create separate variables? Basically this:               size_t len;     len = string1.size()     ....//some code     len = string2.size()     ...//more code      versus               size_t str1len, str2len;     str1len = string1.size()     ....//some code     str2len = string2.size()     ...//more code      All are local variables within a function BTW.


Topics that should  be learned before graduating with a CS Degree

Feeling slightly underwhelmed with the content in my degree path of Computer Science at my University, I have been attempting to learn on my own. I am looking for direction into topics that will be helpful to know when going into the working world. As a senior I've learned basics of data abstraction, and basics of C++, vb.net, and php.


Real world analogy for a clustered index

A db index is analogous to a table of contents. This helps me understand db index in an easy way. My question is are tehre any real world analogies for a clustered index?


Apache License 2.0 and source code recompile

I am not a licenses expert so I got confused a bit... The license Apache 2.0; Does it allow to get source codes and modify them for new projects? I mean modify source codes (some its parts) and recompile them?


Is it wrong to push messages from server to client in a client-server application?

I practically never see any web application where server pushes messages to the client. While pushing messages from server to client is hugely used in multiplayer games, why this model is so underused in web apps? Is it wrong? Does it destroy the client-server model?


Can testers peer review the developers' design and code?

I am a junior developer for a small business using scrum / agile development. A long-term goal of ours is to be appraised at CMMI lvl 2. We have a team of 3 senior developers who implement user stories and a handful of junior developers for support. We are moving towards a "three amigos" methodology, especially in regard to separating the duties of development and testing (the third amigo being the product owner / business stakeholders). This way our senior developers can focus on implementation and our junior developers can focus as impartial testers. We are using peer reviews as a specific practice for verifying work products, such as source code. This paper, http://repository.cmu.edu/cgi/viewcontent.cgi?article=1208&context=sei, describes on p. 19 that an optimal peer review process for design and code ranges from 50-65% of the time spent designing and coding. **My question is this** : is it appropriate for our testers to peer review the developers' design and code? An advantage would be that the developers can spend more time implementing user stories. A disadvantage would be that the testers may sacrifice their objective/impartial view of the system, since peer reviewing creates a shared ownership of the code.


Is it valid to initialize an instance of a class within the same class?

I was wondering if it's valid to initialize an instance of a class within the same class? For example:               public class Person()     {         string name;        string age;        public Person getPerson()        {             Person p1=new Person();            //some logic here            return p1         }     }      I ended up doing that for a part of my code at work and thus wanted to know if there are any potential problems with doing something like this.


When defining Product Backlog items, is it s a bad idea to describe what will be part of the user experience?

First, I am using the TFS 2010 SCRUM template. I am wondering if this is a bad idea... I started defining a PBI for User Interface Elements. Basically, this will hold all the tasks that developers will be assigned when developing UI elements for a web application. Since this has to do with user interaction and usability I was thinking it may be OK, however my struggle is that it also can be considered functionality and may not fit as a PBI.


What is the best way to estimate when using Agile with Scrum? Hours or Story Points?

I was at a company that switched us over from Hours to Story Points for our estimations. I remember it being difficult to understand it, and we all chaffed against the idea. However, once we figured out how to do it and started doing it, I think our estimations became much more accurate. We were much better able to complete our sprints on time and to better be able to estimate duration of remaining work. Once a couple weeks had passed, we had a good idea of our individual teams’ velocities and could then translate the story points into days and weeks of work. We then used that to know what we could complete within a given time-span. I guess the same could work if estimating in hours, as long as it is understood that each team will have a different number of hours per week in their velocity. One team may do 200 hours, while another may do 150 hours on average. This doesn't mean one team is working any harder than the other, it just means that they estimate hours differently, or that some team members may not have as much time available to work on the project, for instance, they may always be pulled into bug fixes, or help on other projects, which reduces their available time for this project. Anyway, what do you think? And why? Which is best? Hours, or Story Points?


Searching in a repository

I'm very new to source control management and one thing puzzles me: is it possible to search through the whole repository for a string? For example I'm tracking one file, which has 100 commits and I would like to see all the version of the file which contain "xyz" inside. Is this possible? I'm using various GUI clients and non of them has this..? Yes, they can search trough commit messages but I want to find a version even when the commit message does not contain the string. To put it differently, which GUI client has such a feature? I don't care about which SCM it uses - git, hg, bazaar, all are fine.


Should I use branches for example uses of a github repo?

I'm working on a Github repo called Designemplate at https://github.com/benwatkinsart/Designemplate and was thinking of developing some example uses of the CSS file to show how it's used. Should I use a branch called examples and store them there?


Do you have to have boxing of primitives in OO language?

Is boxing of primitives required in OO languages to keep them consistent with the rest of the object system (generics etc.)? Or is it avoidable - is it possible to avoid any additional performance cost of having both primitives and objects in a language? One solution I can come up on the spot is having references big enough to store values of every possible primitive type. Are there other (better) solutions and are there implemented in popular languages?


Unit testable code: method visibility vs test complexity

I can't decide how to refactor code right. Let's say I have a complex hypothetical logic piece:               public class ImageService     {          public void UploadImage(VectorData data) {              var image = ConvertVectorDataToImage();              var thumbnail = CreateThumbnail(image);              SaveThumbnail(thumbnail);              SaveImage(image);              SendEmail(image);              ...          }     }      _(If something in example is out of single responsibility, let's pretend, that I could make up a better example)_ If I make UploadImage visible (public), then writing tests become complicated. They tend to be long, hard to read and if you would like to avoid code duplication, then logic in tests appears. If I make all those small pieces visible, the API becomes messy (because in my example, the only interesting thing to everyone is UploadImage method). Even worse, after some time people will tend to use those small methods, because they are public, not because they should be used outside the class. So my question is, how do you balance between visibility and test complexity? Or am I doing something wrong in first place?


Is 'Aurora' a good release paradigm?

As we all know, there is 'alpha', and 'beta' release status. Mozilla Firefox, however, labels its releases differently: 'nightly', 'aurora', 'beta'. Is this an example to follow? Is aurora the new alpha? Does it create confusion, since it is basically public beta testing with a cool name and cool icon?


The best way to open source my website

I'm creating a website where trust is a big issue, I want to prove by making it open source I actually do what I claim. Question 1. If I make my source code open, how can I prove the actual website runs on this code? But I also have a dilemma, it is a commercial project and I don't want others to run off with it and claim it theirs. So I think I need a correct license. Question 2. What license is best for me? Currently I'm thinking about GPL v3.


Are object oriented programming languages procedural?

Procedural programming means coding the application is a series of tasks. Do A, then do B, then Do C. And often wrap these tasks in procedures or functions that can be easily called and run several times in the code. Object Oriented Programming is also often done by doing A, then doing B, then doing C. But objects are used (and correct me if I'm wrong because I'm not sure) as sophisticated ways to store, manipulate and hide data. This affects significantly the design of the program. But the overall flow of the application is still do A, then do B, then do C. Do you agree? If so, would you say that OOP is essentially a type of Procedural Programming?


Validating best practices, property vs dto, simple type vs object

Consider a user profile page. User can add many emails to his/her profile (something like GitHub's profile page). So, theoretically, user hits the plus button, then enters an email address, and clicks the save button. Now we have some dispute in our team over how to validate this email address. Some developers (including me) believe that we should validate this simple string via an extension method:               bool isValid = newEmail.IsEmail();      They argue that any validation mechanism other than a single method call would be overhead, and an anti-pattern (against KISS principal). While others argue that this email should first be added to a new instance of `UserEmail` DTO, then that DTO should be passed to a the relevant validator:               UserEmail userEmail = new UserEmail() { Email = newEmail };     bool isValid = new UserEmailValidator().Validate(userEmail);      The second group argues that validating a single property makes no sense, because a property can't exist on its own. Thus we should always validate an object, not a property (I mean, value type properties, like strings and integers, etc.) I searched but didn't find good resources on the net in favor or against these methods. What disadvantage could each approach have? I would be grateful if somebody point me to the right direction and show us best practices for validation.


Discovering elegant ways of coding

I read this thread on programmers today and thought that looked like a really elegant way of coding. I would like to discover more neat methods of coding. What are the best ways of discovering new elegant ways of coding? (Im already aware of the standard design patterns)


What are programmers made to do in spare time in jobs?

Well, with no prior job experience I am completely ignorant of how things happen at software companies. I want to know what programmers are made to do when there is nothing to do? Lets consider Facebook or Twitter. Now it is quite improbable that Facebook people have something or other feature in mind to be implemented. So software developers are quite expected to have some time when there is nothing to do. Are they free to do anything in this?


Observer pattern: "Web of observers" - Is this ever in use?

I had an idea (which I'm sure already exists), to create a sort of 'network of observers/subjects'. I would like to describe how it works and than ask several questions about it. Say we have 5 objects: Objects **A** , **B** , **C** , **D** and **E**. Objects **D** and **E** need to observe objects **A** , **B** and **C**. With the regular Observer pattern, both **D** and **E** would register as observers to **A** , **B** and **C**. This means both **D** and **E** would have to register three times as observers, creating **six** observer-subject relationships total. ![enter image description here](http://i.stack.imgur.com/OR0ii.png) The idea is to add another object in the middle, let's call it Object **O**. It implements both the Observer and Observable interfaces. It registers as an observer to objects **A** , **B** and **C**. Objects **D** and **E** register as observers to object **O**. Whenever objects **A** , **B** and **C** notify object **O** , object **O** notifies it's own observers - **D** and **E**. Thus creating a sort of network. This network has a total of **five** observer-subject relationships. ![enter image description here](http://i.stack.imgur.com/4LjjX.png) **As I see it, this has two main benefits:**   * **The less important benefit:** This solution allows for less observer-subject relationships, and thus (I think) creates less complexilty in the system. In this simple description the number of relationships only gets reduced by one, but the more observers and subjects there are, the bigger the benefit.   * **The more important benefit:** Please consider an application with two groups of objects, group A and group B. **All objects in group A need to observe all objects in group B.** If we decide to add an object to group B, than using regular Observer we'd have to update a lot of code to register all objects in group A as observers to the new object. With the 'network' solution (which I'm sure has a different name), we only register the 'middle' object (object **O** ) as an observer to the new object in group B, and all objects in group A would be notified when the new object in group B changes state. **My questions:**   1. **Is this solution ever in use in professional projects?** Did you **ever encounter this** in use? Or is it just a cool idea but never used in practice?   2. What would you say are this pattern's disadvantages?   3. Does it have more advantages that I'm not aware of?   4. Does this have a name?


Where do I start to learn systems analysis?

Though I learned Systems Analysis in college, I feel like I am out of date. All I really remember is certain aspects of the SDLC which I realize is a little passé. I've been on the implementation end of the development process for the past five years, and I am wanting to explore design and perhaps do a few projects of my own. So I have two questions. What is the most popular design methodology? And what book would be a good place to start for someone who wants to learn that methodology. I know quite a lot of methodologies and patterns (PRISM, MVVM, UML, etc..), but I am having a very hard time picturing the overall process of design. Also, is there a website that offers sample requirements documents? That's the hardest part of starting your own projects is finding something to do.


Unit testing and Test Driven Development questions

I'm working on an ASP.NET MVC website which performs relatively complex calculations as one of its functions. This functionality was developed some time ago (before I started working on the website) and defects have occurred whereby the calculations are not being calculated properly (basically these calculations are applied to each user which has certain flags on their record etc). Note; these defects have only been observed by users thus far, and not yet investigated in code while debugging. **My questions are:**   * Because the existing unit tests all pass and therefore do not indicate that the defects that have been reported exist; does this suggest the original code that was implemented is incorrect? i.e either the requirements were incorrect and were coded accordingly or just not coded as they were supposed to be coded?   * If I use the TDD approach, would I disgregard the existing unit tests as they don't show there are any problems with the calculations functionality - and I start by making some failing unit tests which test/prove there are these problems occuring, and then add code to make them pass? Note; if it's simply a bug that is occurring that can be found while debugging the code, do the unit tests need to be updated since they are already passing?


The need for Explicit Type Conversion in C#

Consider the following code:               DerivedClass drbObj = (DerivedClass)obj;      Here `obj` is of type `Object` and this is reasonable since Object is the base type of every Class in C#. Here, since the type of `derObj` is defined at compile time, what is the need to explicitly use type conversion here. Can't the compiler predict on it's own that it will be of `DerivedClass`. I understand that, the Conversion type doesn't have to match the `Derived` type, but for practical purpose, it will only be as useful as the `Derived` type. Could someone explain with a small, hypothetical example, as to why the Explicit Type Conversion is necessary when a reference of type Object is being assigned to a derived class. From what I know, in C, there is no need to do perform Explicit type conversion from `void*` to any pointer and the compiler can handle it, based on the type of the pointer to which the converted value is being assigned.


How can I overcome the communication problem(oral language)

I am a junior developer who living in Korea. I think I am quite passionate and active. and I want to be one of famous developer all over the world. For spreading my area, I try to join Open Source Projects. But the problem is always _English_. I often can't understand what the member are speaking at the IRC channel. As all you know, for resolving an issue We have to discuss in detail. So English is a big problem for me. And there's no oriental among my Opensource members. How can I solve this communication problem? if you know someone who can overcome this problem, please give me your opinions. Thanks in advance.


How do I share different files in a git repo with different people?

In a single directory with a Git root folder, I have a bunch of files. I am working on one of those files, X.py, with my friend Alice. The other files I am working on with other people. I want Alice (and everyone else) to have access to X.py. I want Alice to only have access to X.py though. How can I achieve this with Git? Is there a way I can split a directory into two repos? That sounds rather cumbersome. Maybe I could add a remote repo that Alice can access containing X.py?


Is it necessary to understand what's happening at the hardware level to be a good programmer?

I'm a self-taught programmer, just in case this question is answered in CS 101. I've learned and used lots of languages, mostly for my own personal use, but occasionally for professional stuff. It seems that I'm always running into the same wall when I run into trouble programming. For example, I just asked a question on another forum about how to handle a pointer-to-array that was returned by a function. Initially I'm thinking that I simply don't know the proper technique that the designers of C++ set up to handle the situation. But from the answers and discussions that follow I see that I don't really get what happens when something is 'returned'. How deep a level of understanding of the programming process must a good programmer achieve?


method to allow me ability to freely modify my classes, but make them immutable to others?

I am creating the model part of an MVC architecture. My one class will provide all the accesses to allow one to fetch system state. I want most of this state to be immutable as it shouldn't be changed and I don't want anyone accessing my model to be able to break the state by making a foolish change. However, The objects representing the state have a bit of a tree structure. object A contains a set of B which contains a set of objects C which contain a set of Object D etc etc. Due to the nature of how I have to fetch the data I can't build the structure from the bottom up; the bottom most 'chid object' will be generated after all the others are completed. This is making it rather inconvenient to build the immutable objects in an intuitive manner, I want to add a set as my last phase of building but I can't if I already built immutable objects. I know of three approaches, but not sure I like any. One is a builder patern, but keeping track of all the builders for a complicated structure until I'm done seems like it could be very ugly. Second is to have a sort of 'clone' method that builds a new immutable object by cloning the old but adding a newly provided set to it (what is this pattern called again?). This gets ugly when I try adding the child most element to the set since I need to pretty much rebuild the entire tree with 'new' immutable objects to add one value. The third, and so far easiest, solution is to just get rid of the tree structure and make them make a call to my model to get the data they want. so instead of calling myObject.getChildren they call Model.getObjectChildren (myObject). This one will work, but darn it I wanted the pretty tree structure for my immutable state. Is there some other way to conveniently build up my state in a manner where my Model can freely modify the state while being built; but still have in immutable when it's finally published to the Controller? ps. I'm running in java if that matters.


How do you efficiently keep your tests working as you redesign?

A well-tested codebase has a number of examples, but testing certain aspects of the system results in a codebase that is resistant to some types of change. An example is testing for specific output--e.g., text or HTML. Tests are often (naively?) written to expect a particular block of text as output for some input parameters, or to search for specific sections in a block. Changing the behavior of the code, to meet new requirements or because usability testing has resulted in change to the interface, requires changing the tests as well--perhaps even tests that are not specifically unit tests for the code being changed.   * How do you manage the work of finding and rewriting these tests? What if you can't just "run 'em all and let the framework sort them out"?   * What other sorts of code-under-test result in habitually fragile tests?


Testing for equivalence of two programs in different architectures (Sequential, Multi Processor, Multi Core)

I've found a question that I'm having trouble to realize. It's as follows: Consider the program               P ::           x := 1;           y := 1;           z := 1;           u := 0;          and the program          Q ::           x,y,z,u := 1,1,1,1;           u := 0;      Which of the following is true? (only 1 option is correct)                1. P and Q are equivalent for sequential processors.      2. P and Q are equivalent for all multi processor models.      3. P and Q are equivalent for all multi core machines.      4. P and Q are equivalent for all networks of computers.      5. None of the above.      At a first glance it appears that option (1) is true. But in order for P & Q to be equivalent, their respective instructions are to be executed sequentially, they themselves can be executed in any order (even parallelly). Which holds true for options (1) & (2) [or even with option (3)]. > E.g: P is being executed on processor-1 & Q is being executed on processor-2 > (parallelly), but their individual instructions are being executed > sequentially on their respective processors. In such a case both of them are > equivalent, which makes option (2) true. Here is where ambiguity comes in. Can anybody help me ?


Ruby on Rails: Converting a Rails 3 app to Rails 2?

I just recently learnt ruby on rails using ruby 1.9.2 and rails 3 using Michael Hartl's tutorial. I'm making an application which I wanted to host on my preexisting server. However, I found that they still do not support rails 3 as it breaks compatibility with mongrel. My question is: How difficult will it be to port my whole Rails 3 app onto Rails 2 if need be? Keep in mind that although I understand rails 3 quite well by now, I have never used rails 2 and do not have any idea of the differences between them.


Good coding problem for teaching and practicing how to write good unit tests?

Every once and a while I find myself teaching others some techniques useful for writing effective unit tests (usually in Java where many people find writing tests challenging). However, I have yet to find a small-but-not-too- small problem to use to demonstrate the techniques. Likewise, I have not yet found a great problem we can use to practice writing tests. Some problems I have tried have felt completely unrealistic or irrelevant to real life. Does anyone know of a great problem I can use which is small but complex enough and realistic enough to use to teach and practice with? In this case _small_ = _low enough complexity to be a approachable for most developers_ , not necessarily _easy to finish in a short amount of time._ It is okay if we don't finish implementing a solution during the workshop.


Is experience in business analysis useful when moving into a programming career?

_**Note: If you want the gist of this post, skip to the last two paragraphs._** Before expanding on the question, just a short preamble:   * I figured that the Programmers Q&A network was a better place to ask this question than StackOverflow. **I might be wrong**.   * This is cross-post of a question I asked on Quora some time ago. The general gist of the answers was that, **even though it might not necessarily help you to actually land a job in programming, experience in business analysis will most likely benefit a programmer**. Main reasons for this included:     * the "ability to understand and empathise with the business side of [a] company's operations";     * the idea that the business analysis skill and mindset "might map pretty well to [programming] and help you pick up skills more quickly"; and     * that "analytical skills are critical to being a good programmer".   * Someone elsewhere on this network asked whether "[i]s it more important to focus on a business domain or programming stack/technology". This question resonates with one element of my question, as it asks about whether to focus on specific domain knowledge (e.g. beer brewing) versus specific technology stacks (e.g. barrel ageing, double dropping, etc.). The other element contained in my question (additional to the value of specific domain knowledge) is the value of **general analytical thinking (that can be applied to any business domain) for a programmer**.   * Another guy on this network (sorry, can't paste the hyper-link as I'm already capped at 2 per post at my current reputation level) asked "[h]ow much system and business analysis should a programmer be reasonably expected to do?". He states that in most jobs he held there were no formal business or systems analysis roles. The programmers were expected to play those roles. Consequently, he would often **"lose out to guys who may be average programmers but have a much better understanding of the business processes"**. I guess that, by merit of asking the question, the asker already contributed toward answering mine - business analysis knowledge (i.e. both general analytical thinking skills as well as specific business domain knowledge) and experience ("embracing and internalising a customer-oriented approach" as stated in one answer) is useful to a programmer. So here's **my question in a bit more detail** : I currently work as a consultant for a consulting house. I primarily do business analysis work in the financial industry (to get a good idea about what it is I actually do, consider looking at what the International Institute of Business Analysis has to say). I have been at it now for one and a half years, straight out of university, where I obtained a degree in informatics (which is a fancy word for business analysis). **I am considering a career move into programming**. The question: will my qualification in business analysis, and one and a half years of experience working as a business analyst, add any value to a prospective career in software development. **Another question that naturally follows** : I do realise that, as pointed out by the answers on Quora, that it might not actually help me to _land_ a job in programming. So what _would_? (Obviously I do have a plan, but I'm keen to hear what the community has to say.) Feel free to ask questions or recommend edits to the question, and thanks in advance!


Is there an Editor that I can run code using SSH

I need an editor where I can edit my code client side, then highlight part of it and run the highlighted code on the connected server. An Example of this would be SQL management studio, but I need it for shell scripts and other languages. UltraEdit does something close with a copy-paste mechanic, are there any others?


Facebook contest and vote(like) exchange

**UPDATED** we are running a contest using a facebook application to connect with facebook and identify users. a user follows through the standard facebook procedure to allow the application and login. the user then can vote for any entry only once. the vote is saved to avoid the same user voting twice. since the contest has a cash prize we face the problem of vote exchange. vote- exchange is the process where one individual goes to a group-page-forum-etc and trades his voting to another contest, for people voting for his entry in our contest. in essence "buying" votes. they achieve higher number through fake profiles (another problem) so we are faced with:   1. how to detect this vote exchanging    2. how to detect fake facebook profiles   3. in general how to safeguard such a procedure (with or without facebook) right now we are looking for the blindingly obvious violations   1. Very similar emails(john1@ , john2@)   2. Sudden spike in votes (in terms of timing and vote count)


Community blog sites

I'm considering writing a blog about my experiences while programming. Unfortunately, I doubt I'll be able to post regularly. What I'm wondering is if there are any good software development blogging sites that incorporate posts from multiple people, allowing each one to post at their own rate and, because there's a number of them, wind up with enough content that it's worth visiting them? Context: There are three types of posts that I'd likely create:   * Personal thoughts on various topics (I think language feature X is important because..., etc)   * Personal experience with a given language/framework/etc (I had problems with framework X because...)   * Personal experience trying to solve a specific problem (Here's what I needed, here's the problems I ran into, and here's how I solved it) Edit: Of course, I mistyped the title as "community glob sites" at first. That doesn't bode well for my blogging performance ;)


version control workflow for environment with shared code

I work at a company that is looking into "upgrading" our version control system. We have about 200 websites that operate in their own directories. However, all of these websites use the same shared code. We basically use the 200 directories for the display code (html/css) and then the shared code for the processing and database queries. Its a little more detailed but I'll leave it at that for now. We also have a backend system that primarily uses shared code only. We currently have multiple programmers and multiple coders/designers that all need access to the code on a regular basis. Unfortunately our shared code isn't exactly modular, so it is hard to split something off into a "project" when something needs done since so many files are hit. I am basically looking for suggestions on the best workflow available for a version control system. As far as we can tell from research, git seems to be the way to go. But being the version control newbies that we are, we still have concerns on general workflow. Can anyone give me any advice on this topic? **Edit:** I'm trying to be a little more detailed, hopefully I answer some questions from the comments. Pretty much anyone is allowed to change any code at any time. If a change is made to shared code then it is immediately applied to the central code base. We don't really have a versioning scheme. We used to in the past but it was never enforced when new developers were brought on board. The shared code is clearly separated from the rest of the code. There are a few files in our system that get edited a lot. We are constantly "stepping on each other's toes" with these files. These files are very important to our system. I'll be the first one to say this is not an ideal work situation. We are well aware these files need to go. We are in the planning process of modularizing them but we would still need to consider them when choosing a versioning system. I guess another good thing to mention is the fact that we have a large number of files. This isn't ideal either but its happened primarily from not having a sound version control system put in place. Many developers over the years would just save a back up of a file if making a significant change. This is another reason we want to move away from the current scheme. Thanks for your responses already.


Recommendations for implicit versus explicit line joining

I would like to know recommendations about Implicit Line Joining versus Explicit Line Joining in Python. In particular, do you favor one form over the other? What do you recommend as the general default? What criteria do you have for choosing one over the other, and if you do have a preference of one, when do you make exceptions for the other? I have an answer in mind for this question that reflects my own biases, but before I post my own answer I would like to know what others think... and if you can have a better set of criteria than what I have in mind, then I'll certainly accept your answer over my own. Some of the recommendations may be generalized to this choice in other programming languages, but my own bias is somewhat stronger in Python due to some language-specific features, so I'd like to know both the general and the Python-centric reasoning you may have on this topic. For some background, the discussion happened around a particular question on stackoverflow, but I thought it was more appropriate to move the discussion over to here as a question to avoid cluttering up the answer on SO with this tangent since it has veered off-topic from the original question. You can look at that question and its answers for the example code snippets that got the discussion going. Here is a simplified example:               join_type = "explicit"     a = "%s line joining" \         % (join_type)     # versus     join_type = "implicit"     b = ("%s line joining"          % (join_type))


Is defining every method/state per object in a series of UML diagrams representative of MDA in general?

I am currently working on a project where we use a framework that combines code generation and ORM together with UML to develop software. Methods are added to UML classes and are generated into partial classes where "stuff happens". For example, an UML class "Content" could have the method DeleteFromFileSystem(void). Which could be implemented like this:               public partial class Content     {         public void DeleteFromFileSystem()         {             File.Delete(...);         }     }      All methods are designed like this. Everything happens in these gargantuan logic-bomb domain classes. Is this how MDA or DDD or similar usually is done? For now my impression of MDA/DDD (which this has been called by higherups) is that it severely stunts my productivity (everything must be done The Way) and that it hinders maintenance work since all logic are roped, entrenched, interspersed into the mentioned gargantuan bombs. _Please refrain from interpreting this as a rant - I am merely curious if this is typical MDA or some sort of extreme MDA_ **UPDATE** Concerning the example above, in my opinion Content shouldn't handle deleting itself as such. What if we change from local storage to Amazon S3, in that case we would have to reimplement this functionality scattered over multiple places instead of one single interface which we can provide a second implementation for.


Software design approach for large relational database

I am working on a personal side project that will utilize a complex and large relational database. During the design of the database I had some co-workers give advice to how I should approach my application; they advised to use the entity framework. From what I've read and what I am watching it sounds like the entity framework is the right tool for the job. However what I have come to programmer.stackexchange for is to ask whether or not somebody who has just going going in their career should do. Let me rephrase; I have 3 years web design / development experience (html/css/js/php/mysql) and now about 1 year experience with actual software engineering C#/VB. So the question is should I utilize the entity framework or should I build this rather complex and ambitious project without the entity framework; ergo building all the SQL that will handle massive amounts of relational data? The reason why I ask is because I want to get the most ROI (knowledge and experience) from the project. Once again... thanks!


From a design perspective, what are the best practices for logging?

I want to add logging to an application I'm currently working on. I've added logging before, that's not an issue here. But from a design perspective in an object-oriented language, what are the best practices for logging that follow OOP and patterns? _**Note:_** I'm currently doing this in C#, so examples in C# are obviously welcome. I would also like to see examples in Java and Ruby. * * * **Edit:** I'm using log4net. I just don't know what's the best way to plug it in.


How to use the Decorator pattern to add little functionality to big objects?

This question regards the usage of the Decorator pattern to add little functionality to objects of large classes. Following the classic Decorator pattern, please consider the following class structure: ![enter image description here](http://i.stack.imgur.com/FCyEd.png) For example, imagine this happens inside a game. Instances of `ConcreteCharacterDecorator` are meant to add little functionality to the `ConcreteCharacter` they are 'wrapping'. For instance, `methodA()` returns an `int` value representing the damage the character inflicts on enemies. The `ConcreteCharacterDecorator` simply adds to this value. Thus, it only needs to add code to `methodA()`. The functionality of `methodB()` stays the same. `ConcreteCharacterDecorator` will look like this:               class ConcreteCharacterDecorator extends AbstractCharacterDecorator{              ConcreteCharacter character;              public ConcreteCharacterDecorator(ConcreteCharacter character){             this.character = character;         }              public int methodA(){             return 10 + character.methodA();         }              public int methodB(){             character.methodB(); // simply delegate to the wrapped object.         }          }      This is no problem with small classes containing two methods. **But what if`AbstractCharacter` defined 15 methods?** `ConcreteCharacterDecorator` would have to implement all of them, even though it's only meant to add little functionality. I will end up with a class containing one method that adds a little functionality, and another 14 methods that simply delegate to the inner object. It would look like so:               class ConcreteCharacterDecorator extends AbstractCharacterDecorator{              ConcreteCharacter character;              public ConcreteCharacterDecorator(ConcreteCharacter character){             this.character = character;         }              public int methodA(){             return 10 + character.methodA();         }              public int methodB(){             character.methodB(); // simply delegate to the wrapped object.         }         public int methodC(){             character.methodC(); // simply delegate to the wrapped object.         }         public int methodD(){             character.methodD(); // simply delegate to the wrapped object.         }         public int methodE(){             character.methodE(); // simply delegate to the wrapped object.         }         public int methodF(){             character.methodF(); // simply delegate to the wrapped object.         }         public int methodG(){             character.methodG(); // simply delegate to the wrapped object.         }         public int methodH(){             character.methodH(); // simply delegate to the wrapped object.         }         public int methodI(){             character.methodI(); // simply delegate to the wrapped object.         }         public int methodJ(){             character.methodJ(); // simply delegate to the wrapped object.         }         public int methodK(){             character.methodK(); // simply delegate to the wrapped object.         }         public int methodL(){             character.methodL(); // simply delegate to the wrapped object.         }         public int methodM(){             character.methodM(); // simply delegate to the wrapped object.         }         public int methodN(){             character.methodN(); // simply delegate to the wrapped object.         }         public int methodO(){             character.methodO(); // simply delegate to the wrapped object.         }          }      Obviously, very ugly. I'm probably not the first to encounter this problem with the Decorator. How can I avoid this?


Why do game developers prefer Windows?

Is it that DirectX is easier or better than OpenGL, even if OpenGL is cross- platform? Why do we not see real powerful games for Linux like there are for Windows?


How to tell client I no longer want to work on his project

This is probably going to sound messed up, but here it goes. I've been working on a project for a client for a while now. I wasn't given any details except for "It has to be an XYZ plugin and interface with ABC product". Which was fine, but now we're towards the end (I think) and it's just dragging out. I don't have any time to spend on it and I'm already over schedule by 3 months. Trying to get the client to describe to me how he would like to be able to navigate the data (a UI issue) is just difficult. I've submitted mock ups on what I think he wants but his latest response is "you should look at XXX product", it has similar functionality. Of course, I looked at it and it looks similar to what I submitted, but I don't think that the way I've built the framework is going to support what he is now describing to me. We've had good communication throguh out the process but he doesn't know what he wants. I explained how I was going to build the framework and he agreed, so it isn't a bad choice on my part about design. When I go over what I think are finalized modules, he says, "You should have done it this way" which requires me to go back and rework code and UI. Some smaller items could have been better thought out by me, but the big things are how I interpreted his requirements and I've gone over this module several times during development. I've already received final funds last month so i'm working for free at this point. I no longer want to deal with this project. I've already received payment. I've done other successful projects with this client before and he has a lot of other projects he wants to do. What the heck should I do? I don't want to work on this project anymore. I don't want to ask for any more money (money isn't really the issue). I don't want to make him mad either. I know it looks like I want to have my cake and eat it too. If you think I should call it quits, how should I do it given the circumstances?


Is the rule of 10% code is comments still valid?

I've used some older languages before C# and I always felt the need to comment what I was doing so it is clear for anyone who reads the code. But now that I use C# decently, I often feel that it's a pain to write most of the comments because I feel like I state the obvious. So unless I do complicated formulas or algorithms, I'm not sure how I should comment. Microsoft has reached such a readability in C#, I'm mesmerized. Do you have the same feeling? How do you write your comments so they are not pure redonduncy? Have you changed your commenting habbits / best practice?


Books or help on OO Analysis

I have this course where we learn about the domain model, use cases, contracts and eventually leap into class diagrams and sequence diagrams to define good software classes. I just had an exam and I got trashed, but part of the reason is we barely have any practical material, I spent at least two good months without drawing a single class diagram by myself from a case study. During the exam the teacher gave us the domain model, two or three use cases on some vital system operations and a glossary. We had to model up a class diagram and some sequence diagrams for these. The thing is, the jump from real-life modeling to OO classes didn't seem clear to me.      I handle the GRASP principles pretty well, but I lack practice. I could use something that gives a pre-made analysis and asks you to draw the OO design in form of class diagrams or something. I know it varies from one person to another, but some concepts should always make sense. I'm not here to blame the system or the class I'm in, I'm just wondering if people have some exercise-style books that either provide domain models with glossaries, system sequence diagrams and ask you to use GRASP to make software classes? I could really use some alone-time practicing going from analysis to conception of software entities. I'm almost done with Larman's book called "Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, Third Edition". It's a good book, but I'm not doing anything by myself since it doesn't come with exercises. I've been programming in OO for four years now in Java and C++. It was oriented on business applications. I've also spent 6 months on UML syntax in a crash course in college. It's just that I don't understand how they can expect me to define software entities from use cases into class diagrams if I've done like one or two in my life.


How strictly do you follow the "No Dependency Cycle" rule (NDepend)

A bit of background: As a team lead I use NDepend about once a week to check for the quality of our code. Especially the test-coverage, lines of code and cyclomatic complexity metrics are invaluable for me. But when it comes down to levelization and dependency cycles I am a bit ... well concerned. Patrick Smacchia has a nice blog post which describes the goal of levelization. To be clear: Under "dependency cycle" I understand a circular references between two namespaces. Currently I am working on a Windows CE based GUI framework for embedded instruments - just think of the Android graphics platform but for very low end instruments. The framework is a single assembly with about 50.000 lines of code (tests excluded). The framework is split into the following namespaces:   * Core Navigation & Menu Subsystem   * Screen Subsystem (Presenters / Views / ...)    * Controls / Widget Layer Today I spent the half day on trying to bringe the code to proper levels [thanks to Resharper no problem in general] but in all the cases some dependency cycles exist. So my question: How strictly do you follow the "No Dependency Cycle" rule? Is levelization really that important?


Using XSLT for messaging instead of marshalling/unmarshalling Java message objects

So far I have been using either handmade or generated (e.g. JAXB) Java objects as 'carriers' for messages in message processing software such as protocol converters. This often leads to tedious programming, such as copying/converting data from one system's message object to an instance of another's system message object. And it sure brings in lots of Java code with getters and setters for each message attribute, validation code, etc. I was wondering whether it would be a good idea to convert one system's XML message into another system's format - or even convert requests into responses from the same system - using XSLT. This would mean I would no longer have to unmarshall XML streams to Java objects, copy/convert data using Java and marshall the resulting message object to another XML stream. Since each message may actually have a purpose I would 'link' the message (and the payload it contains in its properties or XML elements/attributes) to EXSLT functions. This would change my design approach from an imperative to a declarative style. Has anyone done this before and, if so, what are your experiences? Does the reduced amount of Java 'boiler plate' code weigh up to the increased complexity of (E)XSLT?


How to comment the file system?

When certain parts of code are unusual or unclear, common practice is to leave a comment explaining why it is so. However, sometimes a filesystem may have unusual configuration, such as a directory with 0477 privileges. **Is there any convention for leaving comments about this?** I am writing a 'Developers Wiki' for the company as that would be the place for such things. However I would prefer something **more standard if it exists** and more accessible when, for instance, the next guys has to SSH in from home in the middle of the night and he might not think to check the wiki (or even have access to it).


Is it true that "Real programmers can write assembly code in any language."?

> Real programmers can write assembly code in any language.   >  (Larry Wall). As far as I can make out, Mr. Larry Wall is trying to say that to a real programmer any language can have the same functionality as ASM. But I seriously do not understand. How can you write assembly code in high level languages like Perl, Python, Java and C#? Languages like Perl and Python don't even have pointers. Or Does he mean something else? What is Mr. Wall actually trying to say?


How would I make a compiler in C++?

This probably been asked for but I can't google "How to make a compiler in C++" because I will just get "How to compile C++" as the results. Anyway, for my question, I'd like to make a simple programming language in C++. Now I understand basic file IO stuff but what I don't get is how to build a EXE. The problem here is I don't know how EXEs exactly are "planned out", granted that most people don't. I was going to simply parse the language into assembly and assemble it using an assembler. But I don't want to do that, I want to actually compile it directly into a EXE. Does anyone know how this would be done? PS: To all you people who say making a compiler is virtually impossible, it's a fairly fast process, it's just implementing OOP features that's hard


Can you actually produce high quality code if you are sleep deprived?

I have heard about programmers coding for two days without sleep and drinking coffee and Red Bull. Also in movies like The Social Network, in a scene they show that Mark Zuckerberg has been programming for 36 hours. Also it's said that in companies like Facebook, Google, foursquare, etc. they can code for more than 24 hours without sleep. Is this really true? Can you actually produce high-quality code if you are sleep deprived? _Can things like Red Bull make up for sleep?_


What are the best practices to use NHiberante sessions in asp.net (mvc/web api) ?

I have the following setup in my project:               public class WebApiApplication : System.Web.HttpApplication     {         public static ISessionFactory SessionFactory { get; private set; }              public WebApiApplication()         {             this.BeginRequest += delegate             {                 var session = SessionFactory.OpenSession();                 CurrentSessionContext.Bind(session);             };                       this.EndRequest += delegate             {                 var session = SessionFactory.GetCurrentSession();                      if (session == null)                 {                     return;                 }                      session = CurrentSessionContext.Unbind(SessionFactory);                 session.Dispose();             };         }              protected void Application_Start()         {             AreaRegistration.RegisterAllAreas();                  FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);             RouteConfig.RegisterRoutes(RouteTable.Routes);             BundleConfig.RegisterBundles(BundleTable.Bundles);             var assembly = Assembly.GetCallingAssembly();             SessionFactory = new NHibernateHelper(assembly, Server.MapPath("/")).SessionFactory;         }     }          public class PositionsController : ApiController     {         private readonly ISession session;              public PositionsController()         {             this.session = WebApiApplication.SessionFactory.GetCurrentSession();         }              public IEnumerable<Position> Get()         {             var result = this.session.Query<Position>().Cacheable().ToList();                  if (!result.Any())             {                 throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));             }                  return result;         }              public HttpResponseMessage Post(PositionDataTransfer dto)         {             //TODO: Map dto to model             IEnumerable<Position> positions = null;             using (var transaction = this.session.BeginTransaction())             {                 this.session.SaveOrUpdate(positions);                      try                 {                     transaction.Commit();                 }                 catch (StaleObjectStateException)                 {                     if (transaction != null && transaction.IsActive)                     {                         transaction.Rollback();                     }                 }             }                  var response = this.Request.CreateResponse(HttpStatusCode.Created, dto);             response.Headers.Location = new Uri(this.Request.RequestUri.AbsoluteUri + "/" + dto.Name);             return response;         }              public void Put(int id, string value)         {             //TODO: Implement PUT             throw new NotImplementedException();         }              public void Delete(int id)         {             //TODO: Implement DELETE             throw new NotImplementedException();         }     }      I am not sure if this is the recommended way to insert the session into the controller. I was thinking about using DI but i am not sure how to inject the session that is opened and binded in the BeginRequest delegate into the Controllers constructor to get this                   public PositionsController(ISession session)         {             this.session = session;         }      **Question:** What is the recommended way to use NHiberante sessions in asp.net mvc/web api ?


Are you allowed to "copy" the GUI/Features of another application

I'm making a app which is based heavily on another application that serves a similar purpose. I'm not actually planning on selling it, but I'm wondering whether it would even be legal for me to sell it. I don't borrow graphics from the other application, but I have a very similar color scheme, virtually the same features (I added a few, but not really significant), and a very similar interface layout. Obviously, I'm not borrowing any code (It's written in Objective-C and mines written in Java). Again, I'm not actually planning on selling it, I was just wondering in the hypothetical. I'm not sure whether it's just the code that's copyrighted or the actually design itself.