Learning to program after a 9-5 job

I'm currently working as an IT administrator, but I'm thinking of making a slight career change into programming. I want to focus my time and effort into learning some web-based languages, but does it feel achievable when working full time to expect to make much progress after a long day's work? I love to read, but this is sometimes a hindrance. I have read on some resources that you will never make much progress unless you quit your 9-5 job and dedicate six months to getting a fundamental understanding.


How REST is used outside of the web

I was recently reading the Wikipedia article for Resource-Oriented Architectures (ROA) and stumbled across an article that made the assertion that, although REST is a technology that is very-well suited for web applications and web services, that it is nevertheless a standalone technology that can be used in non-web applications. This is the first I've ever heard of such a thing! I thought REST was a SOAP competitor, but that the two were strictly web service solutions. My question: can someone provide an example for how REST is used in something that isn't a web app? Like a Swing client, or a command line tool, or an EJB.


What effect does the utilization of pseudocode and comments have when a software engineer designs software?

I am a programmer by trade so in my English Class ENC 1102, when we were asked to come up with a discourse community in which we could relate the use of writing skills I thought about pseudocode and comments. So the question is as follows: What effect does the utilization of psuedocode and comments have when a software engineer or programmer designs software? I want to know how writing pseudocode and comments have had in your work process. Does it make it better, faster, worse? Share your experiences and opinions please.


Do you prefer conciseness or readability in your code?

Language shortcuts can often be used to make code more concise. For example, ternary and null coalescing operators can reduce the amount of code, but arguably to the detriment of readability: In C#:               Person newGuy = new Person();     if (boss == null) {         newGuy.Boss = GetDefaultBoss();     } else {         newGuy.Boss = boss;     }      is functionally equivalent to:               Person newGuy = new Person();     newGuy.Boss = boss ?? GetDefaultBoss();      but obviously a lot more verbose. **Where do you draw the line when it comes to conciseness vs readability?**


Noda Time vs Joda Time?

In the Noda Time User's Guide, the rationale section states: > the public API has been largely rewritten, both to provide an API which is > more idiomatic for .NET, and also to rectify some of the Joda Time decisions > which the Noda Time team view as "unfortunate". (Some of these are simply > due to having different goals; others I'd argue are really mistakes.) What are these decisions that are different/better? This would not count differences just for language syntax, but would include anything done to make the users less likely to make a programming error (library usability).


How do I create a potential shippable product (PSP) at the end of a sprint?

I'm running a team of 4 developers and 2 testers and trying to abide by the Scrum principle of creating a PSP with every sprint. That means I need to create a potential release with all the user stories that got to Done and store it on some publish server for the PO to do with as they please. My problem is how to technically create the build when some stories are not at Done at the end of the sprint? The code is checked in, but didn't completely pass testing. If I only check-in code that is Done, i.e. code complete-reviewed-tested, I run in to the possibility of diverging code bases and merges that may be disastrous. For instance Developers A and B work on different features that modify assembly X. Dev A finishes coding, pushes assembly X to test. The next day Dev B finishes coding and pushes assembly X to test. Feature A comes back with bugs, feature B is perfect. Oops, sprint is over. Now, how do I create a PSP with feature B but not A?


Resources on learning to program in machine code?

I'm a student, fresh into programming and loving it, from Java to C++ and down to C. I moved backwards to the barebones and thought to go further down to Assembly. But, to my surprise, a lot of people said it's not as fast as C and there is no use. They suggested learning either how to program a kernel or writing a C compiler. My dream is to learn to program in binary (machine code) or maybe program bare metal (program micro-controller physically) or write bios or boot loaders or something of that nature. The only possible thing I heard after so much research is that a hex editor is the closest thing to machine language I could find in this age and era. Are there other things I'm unaware of? Are there any resources to learn to program in machine code? Preferably on a 8-bit micro-controller/microprocessor. This question is similar to mine, but I'm interested in practical learning first and then understanding the theory.


Migrating from jdbc to MyBatis -- advice needed

I am working on a Java application (an ERP) that has grown pretty large, and will continue to grow for the next couple of years. We have been using Spring- JDBC for our DAO layer. But the amount of boilerplate code that needs to be written is slowing us down significantly, not to mention introducing silly bugs in the system. So now we're looking for a solution that will:   * Reduce the amount of time we need to spend on the DAO layer   * Doesn't have a very steep learning curve   * Gives us control over our queries, like we have with JDBC.   * We should be able port our existing code part-by-part, not all at once. I thought MyBatis would be a good choice, but I'm not sure if it would satisfy all our requirements. In particular, would it be able to work alongside our Spring-JDBC code without creating problems in transaction management, handling concurrency etc? Edit: Forgot to mention that we're using Spring-AOP for transaction management, which we'd prefer to continue with. Thanks!


What to do when the lead programmer is doing almost zero work?

I am currently working on a project with a small dev team. The problem is that the lead programmer is "working remotely", and does virtually no work. We have missed every deadline, and at this rate we will miss many more. The lead programmer is a great talker, and has convinced the CEO that everything is fine. It doesn't bother me that he gets paid for doing nothing. What bothers me is that he is harming every single employee and destroying the company. It's clear from our project management tool that the lead programmer hasn't delivered most of his tasks. The idea to critique the code and not the programmer ( My coworker is a nice guy, but his performance is sub-par. Do I tell my boss?) is great, but the problem is not the quality of the code. The problem is that code is not being created. I feel like I should tell the CEO what is going on, but I also feel like it's not fair to the lead programmer to go behind his back and tell the boss that he is not doing work. The other problem is that the boss is very direct. I think he will call the lead programmer and say, "This guy says that you aren't doing anything. What's going on?" The result will be that nothing will get solved and the lead programmer will get pissed off, making it difficult to work with him.


Parsing multiple file formats/protocols

We are starting a project where we will need to write parsers for a bunch of binary file formats, each of them representing very similar data (time-value series from different measurement devices). Since we are starting from scratch, I would like to get it right, and I see two possible approaches:   1. write dedicated, home grown binary parsers for each format separately, or   2. represent binary formats using a grammar, and then use some standard algorithms for lexical analysis/tokenization. Whenever I seek for advice on how to build a parser, I find most guys advocating the latter approach. However, I don't have much experience with formal grammars and languages, and I am afraid that there might be a learning curve before we get results. So, I basically have these questions:   * What is the problem with coding parsers "by hand"?   * Is there a practical "size limit" of a problem when it pays off to invest in learning the "formal approach"?   * Most parsing examples focus on textual files. What is the good way to specify grammar for a binary parser?


DVCS and different versions of the same Product

Let's say that we have an application, with two (or more) different versions. E.g. Professional and Lite editions. What would be the best way to keep the source under version control (DVCS in particular). The assumption here is that some or most of the code is common, but the Professional edition has some extra code as well. What would be the optimum way of versioning the code with a system like git or Mercurial?


Reinventing the Wheel, why should I?

So I have this problem, it may be my OCD (i have OCD it's not severe.....but It makes me very..lets say specific about certain things, programming being one of them) or it may be the fact that I graduated college and still feel "meh" at programming. Reading This made me think "OH thats me!" but thats not really my main problem. My big problem is....anytime im using a high level language/API/etc. I always think to myself that im not really "programming". I know I know...it sounds stupid. But Like I feel like....if i can't figure out how to do it at the lowest level then Im not really "understanding" it. I do this for just about every new technology I learn. I look at the lowest level and try to understand it. Sometimes I do.....most of the time I don't, I mean i've only really been programming for 4 years (at college, if you even call it programming.....our university's program was "meh"). For instance I do a little bit of embedded programming (with the Atmel AVR 8bits/Arduino stuff). And I can't bring myself to use the C compiler, even though it's 8 million times easier than using assembly......it's stupid I know... Anyone else feel like this, I think it's just my OCD that makes me feel this way....but has anyone else ever felt like they need to go down to the lowest level of the language to even be satisfied with using it? I apologize for the very very odd question, but I think it really hinders me in getting deep seeded into a programming language and making a real application of my own. (it's silly I know)


Developing wheel reinventing tendencies into a skill as opposed to reluctantly learning wheel-finding skills?

I am more of a **high-level wheel reinventor**. I definitely prefer to make use of existing API features built into a language and popular third-party frameworks that I know can solve the problem, however when I have a particular problem that I feel capable of solving within a reasonable time **I am very reluctant to find someone else's solution**. > ## Here are a few reasons why I reinvent: > >   1. **It takes time to learn a new API** >   2. **API restrictions might exist that I don't know about** >   3. **Avoiding re-work of unfamiliar code** > I am conflicted between doing what I know and shifting to a new technique I don't feel comfortable with. On one hand I feel like following my instincts and getting really good at solving problems, especially ones that I would never challenge myself with if all I did was try to find answers. And on the other hand I feel like I might be missing out on important skills like saving time by finding the right framework and expanding my knowledge by learning how to use a new framework. * * * I guess my question comes down to this: My current attitude is to stick to the built-in API and APIs I know well* and to not spend my time searching github for a solution to a problem I know I can solve myself within a reasonable amount of time. _Is that a reasonable **balance** for a successful programmer?_ *Obviously I will still look around for new frameworks that save time and solve/simplify difficult problems.


Does your company have a coding standard?

I recently saw that Microsoft released a coding standards document (All-In-One Code Framework Coding Standards) and it got me thinking... The company that I work for has no formal coding standards at all. There are only a few developers and we have been together long enough to have evolved into similar styles and its never been an issue. Does the company you work for have a documented coding standards? If no, why not? Does having a standard make a difference? Is it worth writing a standard from scratch or should you adopt another standard as your own (ie. make Microsoft's standards yours)?


sets of numbers that sum to a certain number?

I was asked this in an interview, and I'm not sure what the answer is or how to approach the problem. > Find a pair of numbers that sum up to zero (or any other number), then find > three (and then four) numbers that sum up to zero.


web vs desktop? (php vs c++?)

I need to write a simple file transfer mechanism (that isn't ftp). Firstly, it must have a GUI. Secondly, it must not be dropbox. Third, it may not use any paid libraries, and hopefully, it uses open source components. The question that came to my mind is, where is everyone moving, from desktop to web, or from web to desktop? Would it be more useful to be experienced in say, C++ than in PHP (or vice versa)?


The perfect crossfade

I find it hard to describe this problem in words, which is why I made a video (45 seconds) to illustrate it. Here's a preview of the questions, please have a look at it on Vimeo: http://vimeo.com/epologee/perfect-crossfade ![Using a linear crossfade the resulting image will have a 'dip' in transparency. How can I prevent this?](http://i.stack.imgur.com/EkLXN.png) The issue of creating a flawless crossfade or dissolve of two images or shapes has been recurring to me in a number of fields over the last decade. First in video editing, then in Flash animation and now in iOS programming. When you start googling it, there are many workarounds to be found, but I really want to solve this without a hack this time. **The summary:**   What is the name of the technique or curve to apply in crossfading two semi- transparent, same-colored bitmaps, if you want the resulting transparency to match the original of either one? Is there a (mathematical) function to calculate the neccessary partial transparency/alpha values during the fade? Are there programming languages that have these functions as a preset, similar to the `ease in`, `ease out` or `ease in out` functions found in ActionScript or Cocoa? **Update:** In addition to the video, I've made a sample project (requires Xcode and iOS SDK) and posted it on github. It shows the same animation as the video but this time with squares: https://github.com/epologee/StackOverflow- Example-Code


Breaking down CS courses for freshmen

I'm a student putting together a slide geared towards freshmen level students who are trying to understand what the importance of various classes in the CS curriculum are. Would it be safe to say that this list is fairly accurate?   * Data structures: how to store stuff in programs    * Discrete math: how to think logically    * Bits & bytes: how to ‘speak’ the machine’s language   * Advanced data structures: how to store stuff in more ways    * Algorithms: how to compute things efficiently    * Operating systems: how to do manage different processes/threads


When we say "sanity" when referring to user input, are we talking about the cleanliness of the input or whether or not it is sane?

I often hear people say they "sanitize input," which would mean make it clean. I understand this to mean "clean of potentially damaging contents," where the function that does the sanitizing would do something like character escaping. But then I hear things like "sane input," which to me, means the input isn't a string where a double was expected, or "January Third of Nineteen Ninety Five" where "1995/01/03" would have been correct. This represents a matter of formatting. Then we have "sanity functions," which handle user input to make it usable by the backend of the software. Can this refer to both types of input validation? Does it only deal with the formatting (like "sane input"), or with cleanliness of the input (like "sanitized input")? Are they two different classes of operations, or does sanity in this case just refer to both? I always thought it referred to sanitizing it (if that actually means something different than making it sane) since I thought "sanity" was a root for "sanitize." But I just looked it up and can't find any definition of "sanity" that has anything to do with cleanliness or sanitization. Is there idioms for each of these operations that I don't know about, or is it always just "sanity functions" which do both of these things? Would it be confusing to see "sanity" and "safety" functions?


Object oriented EDI handling in PHP

I'm currently starting a new sub project where I will:   1. Retrieve the order information from our mainframe   2. Save the order information to our web-apps' database   3. Send the order as EDI (either D01b or D93a)   4. Receive the order response, despatch advice and invoice messages   5. Do all kinds of fun things with the resulting datasets. However I am struggling with my initial class designs. The order information will be retrieved from the mainframe which will result in a "AOrder" class, this isn't a problem, I am not sure about how to mold this local object into an EDI string. Should I create EDIOrder/EDIOrderResponse/etc classes with matching decorators (EDIOrderD01BDecorator, EDIOrderD93ADecorator)? Do I need builder objects or can I do:               // $myOrder is instance of AOrder     $myOrder->toEDIOrder();     $decorator = new EDIOrderD01BDecorator($myOrder);     $edi = $decorator->getEDIString();      And it'll have to work the other way around as well. Is the following code a good way of handling this problem or should I go about this differently?               $ediString = $myEDIMessageBroker->fetch();     $ediOrderResponse = EDIOrderResponse::fromString($ediString);      I'm just not so sure about how I should go about designing the classes and interactions between them. Thanks for reading and helping.


What did Bjarne Stroustrup mean by his characterization of C and C++?

There's a quotation by Bjarne Stroustrup that says: > C makes it easy to shoot yourself in the foot; C++ makes it harder, but when > you do, it blows away your whole leg. I've often come across this quotation when reading library documentation and tutorials; particularly ones that wrap C functions in C++ classes, or are wrappers to C libraries. But what did he mean by this?


What can I do when the interviewer doesn't know the answer to his/her own question?

Yesterday I had a terrible experience in an interview. Interviewer asked me about pure virtual function. I said, It may or may not have definition in base class, but derived classes should provide definition unless they also want to be abstract class. But interviewer kept on asking that "Can pure virtual have definition !!! ???"... I said yes. Again he said "Pure ?" I said yes. It is allowed, derived classes can explicitly call that function if they want that particular behavior. He sent me out. I am sure that he doesn't know the fact that pure virtual function can have definition. How to deal with this kind of Interviewers ? After asking 2nd time, should i lie that it can't have definition ? :) Or i should stick to my words and loose the job opportunity ?


At what age could I reasonably teach my children about programming?

In case my child would be interested in what I am doing... At what age could I reasonably teach my child what programming is? What is your experience with teaching them to program if they want to? Are there great articles about this?


How to bill a client for frequently-interrupted time

I find that when I'm working on hourly-billable projects (in particular, those that are research/design/architecture-oriented as opposed to straight coding) that I'm easily distracted by any number of things (email, grab a drink (loss of focus, but nature happens), link off the webpage I was reading, wandering mind (easy when the job calls for a lot of thinking), etc.) This results in very fragmented time, far too incremental IMO to accurately track with a timeclock, and some time very gray. I frequently end up billing for only some fraction of the elapsed time I spent in order to feel fair, but sometimes it takes a really long time to put in an 8-hour day. By contrast, when I've worked for salary I've not worried about whether I'm actively working at any given minute, I just get the job done, and I've never had anything but stellar reviews/feedback from past salaried employers, so I think I get the job done well. I personally believe in an 80/20 cycle: I get 80% of my work done during an inspired 20% of my time. But I have to screw around the other 80% of the time in order to get that first 20%. So the question: what billing/time-tracking policy can I adopt in order to be fair to my hourly customers without having to write off my own less-productive 80% that a salaried employer is willing to overlook in light of the complete package? Note: This question is not about how to be more productive or focused. It's about how to work around whatever salient limitations that I have in a way that's both fair to me and to my customers. **Update** : A little clarification (to pre-emptively stop some righteous indignation): I currently have a half dozen different project/client groups. It's not a great situation and I'm working at reducing it down to two, but that's my current reality. It's very easy to get off on a thread related to a different project than the one I'm clocking, and I'm not always conscious of it at the time. [I did not intend the question to mean that I was off playing games or making personal calls, etc., and have adjusted wording above to be clearer. Most of the time. I am only human, and sometimes the mind does force you to take a break! :-)]


Integer sign and compilation via C

I'm writing a compiler that uses the time-honored strategy of using a C compiler as the back end, and I'm trying to figure out exactly how to handle integer sign. I'm using machine word integers as the default (translating into `intptr_t` and `uintptr_t` in the generated C), and while for myself I would prefer to make the default unsigned, I probably don't have much choice about making it signed just because that expectation is so widely ingrained. I'm defining the result of integer overflow to be wraparound (at least by default, might add an option to throw an exception later), but in C, signed integer overflow is undefined behavior, so I can't just emit code that performs signed integer arithmetic. It seems to me there are two options:   1. Emit signed integers, but convert to unsigned for all arithmetic operations except division and right shift (these are the only ones where the difference matters, and also the only ones that can't overflow - **edit:** except for `INT_MIN` / -1; I had been considering that in the same category as division by zero, but of course it is strictly speaking an overflow).   2. Emit unsigned integers, but convert to signed for division (resisting the temptation to make division of negative numbers undefined behavior), right shift and comparison other than equality.   3. Emit signed integers anyway, use `-fwrapv` when using GCC as the backend, and hope other C compilers either don't take advantage of signed overflow being undefined, or provide a switch to disable such optimizations. Does the third option work (e.g. are there any C compilers where you can't make signed overflow wrap)? If not, which of the first two is likely to involve less code and opportunity for error? Is there anything I'm missing?


Average size of in-house web development team for U.S. companies?

When I graduated, I thought getting into a web development job meant I get to work in a group of at least a handful of developers, and seniors can teach this young Padawan their tricks of the trade. In my experience, when I get hired as a junior web developer I'm usually have really limited contact and collaboration with one or two other developers (because we seldom work on the same projects), or sometimes I'm the only one that knows how to code. I've grown to hate these "lone wolf" positions and would rather work in a highly collaborative environment full of other programming geeks. Most of these places tend to outsource technical work, and I prefer face-to-face communication with peers in my dept. I like the small-company culture but at the same time, there's such a thing as too small, to the point where there's little actual technical work done in- house so I can't get any expert advice. Because my experience is anecdotal, I don't think I am getting the big picture as to the sizes and structures of web dev companies. So my related questions... Is my lack of experience with large in-house teams due to the fact that I mostly get hired by consulting firms that do client work? Do companies that create their own products have a vastly different structure? What should I look for in a company if I want to get into a larger, in-house development team?


Get/Post Controller Logic Best Practice

In an ASP.NET MVC project (Razor), I have a Get request, which loads two properties on a model, dependent on the property passed into the action method. So if the parameter has a value, the Group property is supplied data. But if not, the Groups collection property is supplied data. In the post action method, when I process the data, to repopulate the view, I have to provide similar logic, and could getaway with returning `Action(param)` (the get response) to the caller. My question is, based on experience, is that a good practice to get into? I see some downsides to doing that, but adds the lack of code redundancy. Or is there a better alternative?


How to generalize a classes that has identical function plus some additional function

I have some designing problems with my project. To illustrate my problem, I'll use the following two classes from my project.               public class RAM_UserManagement{       private Map<int,User> userList;       public User addUser(User user){//do stuff}       public User deleteUser(User user){//do stuff}       public User updateUser(User user){//do stuff}       public List<User> getAllUser(){//do stuff}       public User getUserById(int userId){//do stuff}     }          public class RAM_ServiceManagment{       private Map<int,Serivce> serviceList;       public Service addService(Service ser){//do stuff}       public Service deleteService(Service ser){//do stuff}       public Service updateService(Service ser){//do stuff}       public List<Service> getAllSerivces(){//do stuff}       public Service getServiceById(int id){//do stuff}       public Service getServiceByStatus(ENUM_STATUS status){//do stuff}       public Service getServiceByUserName(String Name){//do stuff}     }      As you can see, from the nature of these classes they both doing exact same thing with some extra functionality. I am trying to generalize it by creating an interface. This is what I have in mind               public interface IStorage<T>{       public T add(T item);       public T delete(T item);       public T update(T item);       public List<T> getAll();//This is where I am struggling..     }      So CUD operation in both classes are ok to implement but the R(Read) method in both classes varies. In RAM_ServiceManagement I have extra getAll, getById, getStatus, getByName than the other class. How can I generalize this? or generalization cannot be applied here at all? Really appreciate if you can give some suggestion. Thanks


As a programmer, what would you use a personal Wiki for?

Do any programmers out there keep a personal wiki? Either locally or online. What do you use your wiki for? or what might you use one for? I was thinking of starting a personal wiki as a place to record documentation and and other documents for my personal projects, and various notes etc, but how else is a personal (maybe private) Wiki useful to a programmer/developer? What type of things would you put in a personal Wiki?


Programming toolset for restricted typing ability?

This is a cousin to the question Programming with Speech Recognition for Typing Instead of the Keyboard: I program in Visual Studio 2010, and I find that programming takes a much greater toll on my hands than typing text does. I attribute this to (1) the extensive use of punctuation and other characters away from the home row, and (2) the extensive use of multi-key command such as Ctrl+Shift+B. So a question in three stages:   1. What programming language is "easiest" to type? BASIC? COBOL?   2. What editor/IDE is easiest (from a typing standpoint) for the edit/compile/execute roundtrip (and perhaps debugging)?    3. Is there a combined solution that's powerful enough to create, say, a web application? Ideally I'd like to hear about ideas for completely mouse-free solutions, compatible with (say) a one-handed chording keyboard.


I am now ready to publish my commercial Android/IPhone/Anything application - what disclaimers should I use to protect myself?

I have now written my last line of code and I am ready to publish my application to the Android Market, what disclaimers should I add to protect myself as a developer from customers who purchase my application, to prevent being sued by stupid people? It might be a harsh question, but how does developers protect themselves when publishing their software? Developers or small companies (for example all these iPhone/Android developers) that can't afford hiring a small army of lawyers, what should they do? Any solid text I can use?


OOP for unit testing : The good, the bad and the ugly

I have recently read Miško Hevery's pdf guide to writing testable code in which its stated that you should limit your classes instanciations in your constructors. I understand that its what you should do because it allow you to easily mock you objects that are send as parameters to your class. But when it comes to writing actual code, i often end up with things like that (exemple is in PHP using Zend Framework but I think it's self explanatory) :               class Some_class     {         private $_data;              private $_options;              private $_locale;              public function __construct($data, $options = null)         {             $this->_data = $data;                  if ($options != null) {                 $this->_options = $options;             }                  $this->_init();         }              private function _init()         {             if(isset($this->_options['locale'])) {                 $locale = $this->_options['locale'];                      if ($locale instanceof Zend_Locale) {                     $this->_locale = $locale;                 } elseif (Zend_Locale::isLocale($locale)) {                     $this->_locale = new Zend_Locale($locale);                 } else {                     $this->_locale = new Zend_Locale();                 }             }         }     }      Acording to my understanding of Miško Hevery's guide, i shouldn't instanciate the Zend_Local in my class but push it through the constructor (Which can be done through the options array in my example). I am wondering what would be the best practice to get the most flexibility for unittesing this code and aswell, if I want to move away from Zend Framework. Thanks in advance


What are good techniques for keeping your place in code?

I understand using _bookmarks_ to remember a single point in your code. However, how does one keep track of the _flow_ of the code they are investigating? Eg: multiple bookmarks and the order in which they were made. Example: >   1. Bug report: "Collisions aren't working on the corners of walls" > >     1. Reproduction of the bug puts it down to certain polygons not > colliding. >     2. The collision code was written by an unavailable dev. So > investigation goes something like: > > > ![Schema of a flow](http://i.stack.imgur.com/TBzUT.png) During the investigation, especially when reviewing non-code items such as Google, one may reasonably be expected to loose their place in the code ( _Have I already looked at this code path?_ or _Which code path was I investigating? There are multiple that lead to this function_ , etc). The same goes for unavoidable interruptions (Boss: _I need [Lengthy Pointless Report] NOW_ , etc) It would be useful to have a resource of techniques or tools for providing a way to keep track of one's place in the code. * * * _Edit_ : The above example is meant as a potential illustration, not as an actual problem that needs answering. Another way to phrase this question is: When learning a new system, how do you keep track of where you are up to in learning the code? It's not about understanding _why_ the code does what it does (which is what comments should be for), but _how_ it does it (which is only learned through reading the code, not comments).


Methodologies/tools for when developing on your own

Suppose you have to develop a medium+ sized software, fully on your own. Like if it was a personal project you want to accomplish. What methodologies/tools would you use to define what needs to be developed, learned and have a global idea of what the system is as well in its details? Basically to keep yourself in track and not get lost on the way.


What naming conventions do you use for php classes?

I really like using `ClassNames` and `memberNames` as convention but I am not sure how I would name the file containing a class. I like making my classes defined in a file with the exact same name as the class. But I also like making php files all lowercase. So I am conflicted. If I have a class called `ProductGroup` should that be defined in `ProductGroup.php`, `productgroup.php`, or `product_group.php`? I know there is no right answer, so I am looking for what is most common or your opinion of which to use.. which do you use?


Web Project Class Architecture

I think this is a good question for here but I'm not 100% sure. Please flag if it's too vague. I've worked on many websites where common framework classes are overridden. Since I work mostly in .net these days examples would include Page, Masterpage, UserControl, DbContext ect. I believe this could apply to any language though. Sometimes I can see why it's done, I overrode entity framework's DbContext to include some logging code. Allot of the time though I don't see why these base classes were created. Because I've inherited most of the sites I can't really ask why. My question: Is it a good idea/practice when creating a new site to Override the common framework classes mentioned above? Would doing so be considered more of an old style?


Any experience with "beginner's mind" in pair programming?

The article "Promiscuous Pairing and Beginner’s Mind" (PDF) suggests that you put someone in the pair that knows the least about the particular area of the code base. It also suggests that you swap **out** the senior member of the pair every 90 minutes or so. Not only will the newbies learn about that area of the code but they will also think differently compared to someone who already knows the area. Does anybody have experience with this strategy? Does it have any connection with reality? I found other questions about when to use pair programming and whether to accept a job where pair programming is required, but I didn't find any that are specifically about promiscuous pairing and this "beginner's mind" strategy. If you are unfamiliar with pair programming, there are interesting articles on Wikipedia and c2.com.


How to properly diagram lambda expressions or traversals through them in Architecture Explorer?

I'm exploring a piece of code in Architecture Explorer in Visual Studio 2010 to study the relations between methods. I noticed a strange behavior. Take the following source code. It generates a hello message based on a template and a template engine, the template engine being a method (a sort of strategy pattern simplified at a maximum for demo purposes).               public string GenerateHelloMessage(string personName)     {         return this.ApplyTemplate(             this.DefaultTemplateEngine, this.GenerateLocalizedHelloTemplate(), personName);     }          private string GenerateLocalizedHelloTemplate()     {         return "Hello {0}!";     }          public string ApplyTemplate(         Func<string, string, string> templateEngine, string template, string personName)     {         return templateEngine(template, personName);     }          public string DefaultTemplateEngine(string template, string personName)     {         return string.Format(template, personName);     }      The graph generated from this code is this one: ![enter image description here](http://i.stack.imgur.com/khnYr.png) Change the first method from this:               public string GenerateHelloMessage(string personName)     {         return this.ApplyTemplate(             this.DefaultTemplateEngine, this.GenerateLocalizedHelloTemplate(), personName);     }      to this:               public string GenerateHelloMessage(string personName)     {         return this.ApplyTemplate(             (a, b) => this.DefaultTemplateEngine(a, b),             this.GenerateLocalizedHelloTemplate(), personName);     }      and the graph becomes: ![enter image description here](http://i.stack.imgur.com/bWuuh.png) While semantically identical, those two versions of code produce different dependency graphs, and Architecture Explorer shows no trace of the lambda expression (while Visual Studio's code coverage, for example, shows them, as well as Code analysis seems to be able to understand that the link exists). How would it be possible, without changing the source code, to:   * Either force Architecture Explorer to display everything, including lambda expressions,   * Or make it traverse lambda expressions while drawing a dependency through them (so in this case, drawing the dependency from `GenerateHelloMessage` to `DefaultTemplateEngine` in the second example)?


What is O in Big O?

What is Big and O in Big O notation? I've read the definitions and it doesn't tell what is _O_ pronounced as 'oh'. For example - I understand that _O_ (n) is complexity of a linear algorithm where n could be the number of operations. but what is an _O_?


"Joel test" for B2B hardware/software developers

I discovered the Joel test recently and applied it to my team. However, I but found hard to apply some points to my company since we are developing small chips with both "wired" and programmable algorithm. > 5: Do you fix bugs before writing new code? Since we cannot patch the hardware/software once delivered, we cannot tolerate any know bug, and a whole team of senior developer are building tools used for tracking them. This point should be for example "do you have 2 different implementations for each of your products, and are you testing test against each other?" > 12: Do you do hallway usability testing? We don't develop UI. This point seems irrelevant. How can we adapt this test to the kind of development we do?


How good are (or have to be) programmers after study / education?

Since I don't have much practical experience and I'm not studiing computer science directly (rather multimedia focused programming) I really would like to know how good (and maybe how old) People are before they are taking their Jobs. Coming from Germany, it is not unusual to know little to nothing really useful (practically) when done with study. You just prove you're generally capable of leaning things and learn the real stuff after University. Or does that differ in Computer Science? Or to put it in another Question: Is the average computer-science first time employee capable to program serious things?


Which is the best style: for loop with unused control variable and expensive termination condition?

Which style is best when you have a for loop with an unused control variable and a computationally expensive termination condition? The number of iterations is important, but the control variable (n) is not used within the loop.               //1     for(int n=0; n</*termination condition*/; n++) {      //do something     }          //2     int limit = //termination condition     for(int n=0; n<limit; n++) {      //do something     }          //3     for(int n=/*termination condition*/; n>0; n--) {      //do something     }      Option 1 will cause the condition to be evaluated on each iteration of the for loop, which is not performant. I tend to use option 2, since it is performant and explicit. Option 3 is performant and concise.


Implementing Command Pattern in Web Application

I'm looking to implement the command pattern in a web application (asp.net c#)... Since the commands come in text format from the client, what is the best way to translate the string to a command object? Should I use reflection? Currently I just assume the command that comes in matches the file name of a user control. This is a bit of a hack. Rather than have a select case statement that says if string = "Dashboard" then call Dashboard.Execute(), is there a pattern for working with commands that originate as strings?


Any good examples of visualizations of performance test data?

I run some basic performance tests in `C#` on simple methods, but there are also legacy monolithic pieces written in `C#` as well as other languages. So, when testing, I often end up working with a black box that takes a number of parameters. I can write code to get a bunch of sample data out, but making sense of it (e.g. presenting it visually is a challenge). I think that most people will not bother looking at a bunch of data or a bunch of poorly done graphics. It better tell a story at a glance. I can draw pretty 2d graphs, surfaces, heat maps, surface heat maps, what have you. I am hoping to make the graphics so useful, that, when a somewhat trained eye looks at it, they can say "I think we have a problem there. It should not be that slow when we change from 5 to 10 securities." or "This piece is running 20% longer than last month. What feature is killing the performance now?" I do not have much experience with presenting complex data in a good way, but I know that clever tricks do exist. Good examples are shown here: http://www.datavis.ca/gallery/timelines.php The Napoleon’s March is a great one, as it packs many-dimensional data onto a 2D piece of paper. Can you suggest any good examples of how to visualize performance test data?


Is it possible to tag only a portion of a git push?

I'm very new to git, but last week I installed it, set up bitbucket, and pushed my current project to my first bitbucket repo. All went well and I'm pleased with git as a simple, powerful, yet free way to back up my source code offsite, as well as keep track of my changes. My next step is to keep track of actual version numbers. I'm developing in Visual Studio, where the version numbers live in the project's assembly information. I've read that version numbers are usually tracked in git with tags, so I went to tag my commit with the current version number I'm on. At this point I realized that the project that I linked to my bitbucket repo contains two projects, an application and a set of web services. At this moment they share the same version number, but most likely in the future they will have differing version numbers. Right now each of these projects is in their own folder in the repo's root directory. Is there a way for me to mark one of these directories with one tag, and the other directory with another? Or should I step back and create two separate repos, one for the application, and the other for the web services?


Optimal number of years per job

Some developers keep their job for too little, as if they have commitment issues. Some keep their job for too long, as if they're afraid to leave their safety zone. What is the optimal number of years a developer should keep a job?


Why don't Python and Ruby make a distinction between declaring and assigning a value to variables?

Two of the most popular dynamically typed scripting languages, Python and Ruby, do not make a distinction in syntax between the declaration of a variable and assignation of a value to it. That is in both languages, declaring a variable `n` and assigning a value to it would look like so:               n = 10      And assigning a new value to the variable later on would look just the same. This creates two major problems:   1. A typo in a variable's name when changing it's value would create a new variable and cause bugs.   2. It makes the intentions of the code less clear. Hard to know where a variable is first declared and used, might make the code more confusing. What I don't understand is why these languages don't have a `var` keyword to use on declaration, to make a distinction between a declaration and an assignment. This doesn't make the language any less dynamically typed, and I see no drawbacks. What is the advantage of not having to explicitly define a variable?


Sorting an array when values are decreased by each swap

Recently in an interview I come across a question: > We have an unsorted array, we need to sort it with minimum number of swap. > We have in sort a 'tax' of 1 is deducted from the number we are swapping. so suppose initially we have an array as               2 4 1 3 5     ^   ^      on swaping say 2 and 1, the new state of the array is:               0 4 1 3 5  // 'tax' of 1 is deducted from 1 and 2      ^   ^      // so we have 0 and 1 at there place after the swap      So we need to sort the array in min. number of swap. Any suggestions regarding the algorithm design? I thought of doing this with merger sort but still not sure if this is the best approach.


PHP: frequent file system write

I am building a game based on PHP and MySQL. Basically there is a player-vs- player mode but I figured I should add a player-vs-computer mode as well, since players may not be online at all times, especially in the beginning. Basically it is a combat type of game where players have up to 2 characters and can fight each other, taking turns. I decided to save the computer's units on the filesystem instead of in a database. There are different monster camps which players may attack. If multiple players attack the same camp, separate instances are being created. However what I'm having my doubts about is whether I should save the full unit information in the instance or just the properties that can change in the course of battle. Let me give an example. Here's the unit class               class Unit {         // Generic         protected $id = null;         public function getID(){ return $this->id; }              public $owner = null;         public $name;              // Vitality         public $HP          = 100;         public $HPmax       = 100;         public $energy      = 100;         public $NRGmax      = 100;              // Physical         public $strength    = 0;         public $endurance   = 0;              // Psychical         public $knowledge   = 0;         public $wisdom      = 0;             // ...     }      And here's how the file structure looks like               /PvC/prototypes/     /PvC/clones/      in prototypes are saved the preset settings of individual units, while in clones are saved the instances that the players are fighting against currently. How it works at the moment is in clones I save `serialize($computer->units)` which inserts the complete full information of the unit. My concern is that some properties, such as name, owner and others, will never change during the battle, so rewriting those each time is pretty pointless. And the instance file is getting rewritten pretty often I'd say, with almost every single request during battle. In order to avoid that continuous overwriting I could serialize only the properties that can change during battle and then load the unit from the prototype as is, then overwrite that with the properties from the clone. However the problem with that is that I'm loading 2 files instead of one, then loading a bunch of data from the first file that I won't use, and is going to get overwritten. I know this is not really something that would matter, as file size will rarely exceed 10kb, but it is just bugging me so bad. What are your thoughts on this, I'm open for advice. Thanks!


Extending Internet Explorer to use a credit card machine and cash drawer

I have a software application which is currently a win forms application using an embedded IE web browser control. The win forms application provides access to an attached credit card machine and cash drawer to the web site running in the IE web control. Its does this by creating JavaScript objects in the IE web browser control which the web applications calls to do operations such as perform a credit card swipe or open a cash drawer. Those js objects are mapped to methods in the win forms application which then interacts with the devices. Its a pretty cool solution except that the embedded IE web control lacks all of the great development tools of a standard web browser window. So... I want to move the web application to being used in a normal web browser window (sticking with IE is fine for this client) while still having access to the credit card machine and the cash drawer. So my question is this... What solution is best or even possible?   * Active X Control - I do not really like this option   * Java Applet   * Flash   * Create an IE Extension - with an IE extension is it possible to do something like we are doing with our current solution? - Preferred option if possible Does anyone have any experience with this or any ideas? Thank you very much for your help!


Do we achieve 100% Persistence Ignorance solution if we're not using ORM's POCO objects to model the Domain?

Persistence ignorance is ability to retrieve/persist standard objects, where standard objects are considered as classes focused on particular business problem and thus don't contain any `infrastructure-related logic`. In DDD a _Repository pattern_ is used to achieve PI. Assuming we don't use ORM's POCO objects to model the _Domain_ , then our _Domain objects_ don't have to adhere to design requirements of a particular O/RM ( such as using _default constructor_ or marking properties as `virtual` ). Such _Domain objects_ would be considered _Persistence Ignorant_. But if we want these _Domain Objects_ to also support features such as _lazy loading_ , then their properties must contain some logic which at some point would need to check whether related data was already loaded and if it wasn't, it would contact the appropriate _Repository_ and request the related data. Now even though these _Domain Object_ are completely unaware of how they are being persisted and as such their _Domain_ is completely decoupled from the underlying _DAL provider_ , couldn't we still argue that such _Domain Objects_ contain `Infrastructure-related logic` and thus still violate _PI_? Thank you


Why do Haskell functors only have derived types in their target category?

In Haskell, the Functor typeclass functor is defined as follows (see e.g. Haskell wiki):               class Functor (f :: * -> *) where       fmap :: (a -> b) -> f a -> f b       As far as I understand (please correct me if I am wrong), such a functor can only have as target category a category constructed using a type constructor, e.g. `[]`, `Maybe`, etc. On the other hand, one may think of functors having any category as target of a functor, e.g. the category of all Haskell types. For example, `Int` could be an object in the target category of a functor, not just `Maybe Int` or `[Int]`. What is the motivation for this restriction on Haskell functors?


Standards in Enterprise Development

Is it perhaps time for enterprise systems to be developed to strict enforced standards? Many books list optional 'standards' and best practices, but these are purely suggested practices. Still, every time I look at the code for an enterprise system I have not been a part of, I spend a lot of time trying to work out the architecture. Should we not have some form of ISO accreditation for our systems? We could have a selection of standard architectures such as Domain Model, Transaction Script etc, but once we choose one of these, we have to follow a strict architectural template. Systems could be audited to ensure we are working to these standards, and our companies would carry this accreditation. This would be better for developers because when we take on legacy work that was written by another company, we will not have to spend time deciphering the architecture. It would benefit clients because they would know that if they used the services of an accredited development company, they could used another company to maintain/amend it, and not be tied to the original developers.


What do you optimize for?

Generally speaking, what type of optimizations do you typically slant yourself towards when designing software? Are you the type that prefers to optimize your design for   * Development time (i.e., quick to write and/or easier to maintain)?   * Processing time    * Storage (either RAM, DB, Disc, etc) space Of course this is highly subjective to the type of problems being solved, and the deadlines involved, so I'd like to hear about the reasons that would make you choose one form of optimization over another.


Why does C# allow properties in interfaces?

In C#, the following code is valid               interface I{         int property{get;set;}     }      Which doesn't make any sense to me. This seems to break one of the most important principles of interfaces: lack of state (in other words, no fields). Doesn't the property create an implicit private field? Wouldn't that be really bad for interfaces?


Downsides of GNU LGPL v3 vs. GNU LGPL v2.1?

Firstly, I realize that this is a programming Q&A site, and not a place for legal advice.... Just trying to get a basic idea of what the downsides to using an LGPLv3 library might be. What are the differences between GNU LGPL v2.1 and GNU LGPL v3? In particular, I know that regular GPLv3 has many anti-drm and anti-patent clauses. In principal I don't have anything against these clauses, but I will these suddenly apply to the main application if I choose to use an LGPLv3 library. The rules of LGPL v2.1 seems to only apply to the library that you use or modify. It says nothing about the main application. (Assuming no static linking etc.) Thus, in the niche-market software provider where I work, we regularly use (and contribute to) LGPL licensed libraries, without needing to open-source our main application. Does this change in LGPLv3? The question http://stackoverflow.com/questions/1108238/differences-between- gnu-lgpl-v2-1-and-gnu-lgpl-v3 got a couple of answers, but none that address any new obligations that the main application might have. To clarify: I'm asking about the LGPL v3, not plain GPLv3. Do any of the Tivoization / patent grant requirements "bleed through" from an LGPLv3 library to the host application?


Relation and differences between SGML, XML, HTML and XHTML

1. I was wondering what "profile" means in Wikipedia: > XML is a profile of an ISO standard SGML, and most of XML comes from SGML > unchanged.   2. According to http://xml-tips.assistprogramming.com/sgml-xml-html-xhtml-all-together.html: > HTML is a subset of SGML. > > XML is a highly functional subset of SGML. > > XHTML extends and subsets HTML. Does "one being a subset of another" mean that code in the first is also syntactically correct and semantically the same as in the second? As in the sense of elementary set theory,     * are HTML, XML and XHTML all different subsets of SGML?     * do XML and HTML almost not intersect each other?     * is XHTML a superset of both XML and HTML?   3. Can I expect some more concise and clear summation of the differences in the purposes of the four and/or when to use which, than the link above? I am really confused about the clear line between their intended purposes.   4. According to http://xml-tips.assistprogramming.com/sgml-xml-html-xhtml-all-together.html: > XML is not a single Markup Language. It is a metalanguage to let users > design their own markup language. I was wondering how to understand XML and HTML are both subsets of SGML, but HTML is a markup language while XML is not a markup language but a metalanguage for designing markup languages? Are SGML and XHTML both also metalanguage for designing markup language?   5. As in both links mention that HTML is an applicaiton of SGML as well as a subset of SGML, and XHTML is an application of XML. I wonder what differences are between saying one language is an application of another, and one language is a subset of another? Thanks and regards!


Should I comment Tables or Columns in my database?

I like to comment my code with various information, and I think most people nowadays do so while writing some code. But when it comes to database tables or columns, I have never seen anyone setting some comments, and, to be honest, I don't even think of looking for comments there. So I am wondering if some people are commenting their DB strcuture here, and if I should bother commenting, for instance when I create a new column to an existing table?


Can a lone programmer become a mid or senior level programmer without a mentor?

**Question:**   Can a mere entry level programmer become a mid or senior level programmer working in a company as the only programmer without a mentor? **Background:**   I was hired as an entry level programmer for a mid size company that does not do programming except for internally. I am regarded as a genius inside the company with a decent salary but after 2 years I decided I wanted to move to an actual software company. The interview processes have been extremely demoralizing because even though I have wrote intra-company enterprise applications these interviews have made me aware of how little I actually know.


Free tool to design Java user interfaces

While in the process of developing GUIs for my Java project, I am wondering if there is something that lets you visually design your GUI for Java and correspondently generates the needed code, just to speedup the task. I am using Eclipse, and I already tried Window Builder, but I'm not keen on the code it produces. Does anyone know some alternatives (possibly non-commercial)?


When applying for an entry level programming position, how do I include my coding examples?

I will soon begin the process of applying for entry level programming positions. As of now I have no professional coding experience, so all I have to show is some personal projects and code samples to show what I am capable of. How do I present such things as code samples, my specific work on collaborative projects, personal projects, etc, to a prospective employer? Something like a digital business card? a web link on the resume to a page where it is all laid out? links to individual project pages? Basically, is there a preferred method for listing or displaying what I have done aside from just a few lines on a resume describing it?


What's the Content-Security-Policy-friendly way to hand data from the server to the browser on page load?

When developing for the web, I often find myself wanting to pass a few variables from the server scripts to my javascript - data pulled from a database, and set differently on different pages running basically the same code. (Typically, this is something along the lines of `example.com/slideshows/1` needing to know that that slideshow 1 has 8 images, and what their urls are, but that's just a random example; I'm looking for a general answer.) My normal approach is to include a short block of inline javascript that sets a few global variables or calls some initializer functions, which is straightforward and effective. It is not, however, Content Security Policy- friendly, since inline javascript is blocked by default, and not without reason. (I know the policy can be set to allow inline javascript if you have access to it, but even if you do that opens potential security issues.) I need a strategy that plays nicely with proper CSPs. I know that it could be done with an ajax call, but that's overkill for something that only needs to be set once, and adds an extra call that slows down the page load. In some cases, like the slideshow I mentioned, this could be handled by having the javascript examine other dynamically-constructed page elements to reconstruct the desired data, which is fine, but not a very general solution. What's the best way to handle this? (I almost posted this question on SO, but it seems kind of subjective; I can think of ways to do this, I just don't _like_ any of them.)


Organizing Business and Presentation entities

**Background** I am developing a WPF project. This is the basic structure:   * **User Interface** (WPF Project);   * **Interfaces** (class library, contains all the interfaces and the entities used by the application;   * **Modules** (every module contains the logic of a specific argument, e.g. File Management, and can eventually contains Wpf User Controls). In the WPF Controls, to facilitate the binding operations I have created a BaseViewModel class which contains a Raise method that automates the binding mechanism (for further details, I used a technique similar to that one described in this article). * * * **The problem** Understand which is the best way to separate Presentation form from the Business form in the entities classes. * * * **The case** In the **Interfaces** project I have, for instance, the class `User`               public class User     {         public virtual string Name { get; set; }              // Other properties     }      In one of the modules I need to use the `User` class and to bind its properties to the User Interface controls. To do so I have to use a custom implementation of the `get` and `set` keywords. At first point, I thought to create a class in the Module called, for instance, ClientUser and override the properties that I need:               public class ClientUser : User      {         private string name;              public override string Name { get { return name; } set { Raise(out name, value); } }              // Other properties     }      The problem is the Raise method, which is declared in the `BaseViewModel` class, but due to C# single inheritance constraint, I can't inherit from both classes. Which is the right way to implement this architecture?


How do I access a web service from Windows 8.1 mobile app?

Over the last few months, I've been making a Windows Phone 8.1 Runtime application. I have little experience with this (although a decent amount of other programming experience), but I've managed to make my way through. Now, however, I've hit a wall. What I need to do is, from the mobile app, send a query to some sort of web service, which will do some things with the query based on a database and return a result. The problem is I have zero experience with any sort of web service, and although I am fairly confident in my ability to work out how to do it once I know what I'm doing, the last few days I've been running into the issue of what exactly I should be doing. There's a lot of options that I can hardly distinguish between, and not a lot of introductory explanations to which one should be used where. There's also this issue which keeps coming up: http://social.msdn.microsoft.com/forums/windowsapps/en- US/9ab43a4c-499a-4f2e-81e5-c1ab5acbe9bf/wcf-add-service-reference-not- supported-for-windows-phone-81-xaml-applications?forum=wpdevelop So in all, I'm left not really knowing in what direction I should be heading. On the web service-side, should I be making a WCF application? ASP.NET? On the phone-side, should I be accessing the web service using an HttpClient? StreamSocket? Something else? Does it matter? Really, what I'm asking is -- what are the differences between these options, and which ones will work for what I'm trying to do?


Which tips helped you learn touch-typing?

I've been learning touch-typing for about two weeks now, and I'm really commited to mastering this skill. Eventhough I'm doing ok with prose already, I'm struggling with **programming syntax** and even more with **keybindings**. Those stray you away from the home row more than regular words, and aren't as easy to practice. So I often hunt and peck in order to just get it out, but when reverting to old habits like this, I find it hard to get back into the touch-typing mindframe quickly. One little trick that has helped me so far when getting lost is to reposition every finger on its home row key, and mentally visualize the layout bias of the keyboard, ie the backslash kind of alignment of key columns. It's hard to describe though and probably a bit weird... Hope you guys have better tips !


What is an inconsistent state?

I've been trying to experiment with coded user interface testing (CUITS) lately and I get the following error whenever I try to create one. > The following package failed to load: C:\Users[File Path Goes > Here]\Microsoft.VisualStudio.TestTools.UITest.Extension.IE.dll. Coded UI > Test is now in an inconsistent state. Remove this package and restart Visual > Studio to work with Coded UI Test. I have a question on Stack Overflow about the error, which seems to have no solution, but that made me wonder, what exactly is an inconsistent state? I have never encountered this error before and I have not seen a good explanation of what it means.


Whats the difference between syntax and grammar?

I understand the difference between syntax and semantics - **syntax** - how the symbols are combined to form a valid expression or statement.   **semantics** - the meaning of those symbols that form an expression or statement. But what is the grammar? for example: Sometimes I hear people say that some construct is "grammatically incorrect but syntactically it is correct" what does it mean?


Advantage of Learning Lisp for a Python Programmer

I am primarily a Python, Java, C++ programmer, and I've gained a recent interest in functional language. I'm thinking of picking up a LISP dialect: Clojure. Now, I've been working through tutorials and whatnot, but I've noticed that beyond syntax differences, I don't feel that I am learning any fundamentally different way of solving problems. So, are there any advantages of learning Clojure after Python in the way I can write programs?


Problem Understanding the IEEE definition of Software Engineering

**Background** _Software engineering is the application of a systematic, disciplined, quantifiable approach to the design, development, operation, and maintenance of software, and the study of these approaches; that is, the application of engineering to software._ My instructor, when explaining this definition has told me that the terms "systematic", "disciplined" and "quantifiable" imply "one after another, structured", "repeatable", and "measurable" among various other possible interpretations. However, it's the second part of the definition that confuses me. When talking about what "operation" implies, he described it this way: _"it's the process of maintaining the software, like updating or patching pieces of it. Earlier we used to remove the whole software and change the source, recompile it and install it back. This part of definition is more or less of historical significance - the way engineering was thought of in other disciplines like Mechanical Engineering."_ **Question** I am really confused about what the definition implies about SE.   * If "operation" was just the process of maintaining the software, why include it in the definition independently?   * If not, What do the terms "Operation" and "Maintenance" imply in the definition?   * Don't maintenance and Operation and everything come under development? Let's say we are developing an automatic updater component of a software for maintenance, doesn't that mean we are "developing" the "maintenance" part too? Why include the other two in definition then? Please explain me what SE really means. Thank You!


Legal proof of when a feature been implemented

For various reasons I need to supply "proof" my company's lawyer that I implemented a feature by a certain date. I have used source control since the late 90s and even the oldest databases are still working. I also have the all the old setups. Our release notes are not always as clear as they could be and most of them are not dated but organized by revision number. I figure rather than guessing I as other software developer if they know what is typically provided in this situation given what I have. I am particularly confused when a feature is spread among several source files. One feature we need to document is not just dependent on an algorithm but the UI as well and there a half-dozen files that were modified to this. **Update** By Completed, the feature was tested and released to the customer and it worked. And listed in the release notes. Also I already handed the lawyer the release dates, and the release notes (when they existed). However that was not sufficient. I need to show how I got dates. I got them out of my source control databases (Sourceforge, Subversion, Mercurical) so how to I put data that in my source control in a form that a non-technical layman can understand. Note: If you wondering why we have multiple database it is because the software in question been in continuous development since the late eighties.


How does the GPL static vs. dynamic linking rule apply to interpreted languages?

In my understanding, the GPL prohibits static linking from non-GPL code to GPL code, but permits dynamic linking from non-GPL code to GPL code. So which is it when the code in question is not linked at all because the code is written in an interpreted language (e.g. Perl)? It would seem to be too easy to exploit the rule if it was considered dynamic linking, but on the other hand, it would also seem to be impossible to legally reference GPL code from non-GPL code if it was considered static! Compiled languages at least have a distinction between static and dynamic linking, but when all "linking" is just running scripts, it's impossible to tell what the intent is without an explicit license! Or is my understanding of this issue incorrect, rendering the question moot? I've also heard of a "classpath exception" which involves dynamic linking; is that not part of the GPL but instead something that can be added on to it, so dynamic linking is only allowed when the license includes this exception?


Why should one use a single-use temporary variable?

Let's say we have a class called 'Automobile' and we have an instance of that class called 'myCar'. I would like to ask why do we need to put the values that our methods return in a variable? Why don't we just call the method? For example, why should one write:               string message = myCar.SpeedMessage();     Console.WriteLine(message);      instead of:               Console.WriteLine(myCar.SpeedMessage());


Data Flow Diagrams - Difference between Lines and Arrows

I'm currently working with Visio to create Data Flow Diagrams for a System Analysis and Design class but I'm unsure what the difference between `\------` and `\------>` is. I can connect 2 shapes together with a line (process, entity, data store) but does the single line connecting the two mean data flow? Do I need to explicitly use the data flow arrow to show which way data is flowing? (There doesn't seem to be tags for this topic, maybe im in the wrong place?)


A metric to measure the cost of cut and paste programming

I'm hunting a metric to measure the cost of cut-and-paste programming. We already use tools to detect duplicated code - but if we don't clean up our duplicated code, how much will it cost us? We know that the DRY principle, Don't Repeat Yourself, is a core principle of Extreme Programming. How can we actually measure the impact of non-DRY code on our projects? I'm referring to the simplest duped code problem of the same expressions in two or more places. Other cases of duplication such as the same logic written differently in different places is trickier to detect. I'm hunting a metric, a solid number that I can offer management. I am aware of the "WTF" metric of Robert Martin, but that is not precise enough. What is the purpose of insisting on a metric? Management is insisting on this metric and they won't be dissuaded. I'm really afraid that they may mandate that duplicated code be reduced on each sprint. Because we are so pressed to deliver, developers will find the duplicated code and hack it so it does not get detected. This would be a ticking time bomb!


Is it better to have separate Create and Edit actions or combine Create and Edit into one?

We are using ASP.NET MVC 2 with a Controller/View Presentation Layer and Model consisting of A Business Logic Layer, Data Access Layer [Stored Procedures and classes/methods to talk to the stored procedures]. In the business layer and above for most purposes Edit seems to be capable of representing both the creation of an object and the editing of an object. This coincides well with our Repository Design Pattern that defines a "Save" method. We can simply check in the stored procedure if the ID is 0 and then create a new object if it is 0 otherwise we can just update the existing object, since the category id should match one. **The primary point of discussion is if it makes the most sense to split Edit that includes Creation into it's separate parts of Create and Edit beyond the DAL layer.** An obvious example can be shown as routes: _Create_ - http://someurl/somearea/edit/0 _Edit_ - http://someurl/somearea/edit/254 **vs.** _Create_ - http://someurl/somearea/create _Edit_ - http://someurl/somearea/edit/254 **Are there any established standards or best practices in regard to this?** I know this is a small detail, but I think it's logistically an important one.


How to commit in-progress refactoring?

So, I have this big project, which is in the process of being refactored by me. I am changing a lot of stuff, so there is no chance to get it to compile some time soon. I am living in a special git branch which I named `cleanup` (which is going to get merged into `master` eventually, of course). The problem is, that I/we have the policy to never commit non-compiling code (ideally it should also work, but it must compile and link, at the very least). So, until I am finished with this huge task, I am unable to commit anything (for review or for bookkeeping).   This is not the way I like to work (I believe most people commit at least once a day or so). What do you think? Is there a solution I am overlooking?   Can I later tell git to aggregate commits or something? I could live with non- compiling commit as long as they _stay_ in the `cleanup` branch. ## Edit To the subject of pushing/committing: I am aware that it is a huge difference, but later, there will be broken revisions, when I merge my stuff into `master`. So if you browse through the history (or `git bisect` ...) then the "local" revisions will be world accessible. So only committing locally and not pushing is not the best solution, because it will cause you trouble later on (when the subject is closed and forgotten for some time). In short: Local commits will be pushed eventually. The global history should not show non-compiling commits.


What is the limit to the number of a class methods?

In different design books that I read, sometimes big emphasis is put on the number of methods that a class must have (considering an OO language, as java or C# for instance). Often the examples reported in those books are very neat and simple, but rarely they cover a "serious" or complex case.   **However the range seems to be between 5 and 8.** In a project I developed a class "Note", with its attribuse as properties: Title, Desctiption, CreateDate, etc.   Then some basic methods like: getRelations (if the note is assigned to different documents), getExpiryDate, ect. However proceeding in the development of the application, more functionalities were required, and, therefore, more methods. I know that the less methods a class has, the more loosly coupled it is. That is indeed a good advantage in terms of modularity and reusability, plus easier to edit.   By the way if in our context there is no need (or even sense) to create sub- classes and all the needed functions are related to that class, how many methods can we further attach? I agree that having more than 15 methods, then maybe a little re-design might be required.   But even in that case, if deleting some of the methods or inheritance is not an option, which would be the proper way?


How to Identify the Programmers with the Appropriate Skill Sets?

I'd appreciate help in fleshing out a set of criteria or "outline" for determining the most appropriate programmers for my situation as well as avenues to find these programmers. I've put together a fully functional web application, which is build using jvm based languages, HTML, CSS, and JavaScript. My background is in Finance and CS, and as a result I'm very comfortable with development/IT. In the initial stage, I need to: sure up security, refactor the current code base, and implement two relatively simple features. As I'm finishing my project/business plan I'm struggling with what criteria to use in order to identify the programmers I need. At a high level, I know I need 2-3 (backend) programmers:   * 1 "Senior" or "Expert" programmer   * 1 to 2 "Mid-level" or "Competent/Proficient" programmer(s) I know I should (and I will) find programmers that have worked on similar-type projects, but beyond that I'm unsure what criteria to look at. For example, should the senior/expert programmer have 10 years, 15 years or more of experience?


Extending a struct. Using helper classes rather than composition

I have a struct which I want to add static methods to. Yes, you guessed right I'm talking about `Datetime`. It's a pretty typical requirement to add MyCustomParse. It happens to return `Datetime?`, so it's not a constructor, but it's in that area, a static method that returns an instance. The content of this method has already been written and currently happy lives as a instance method of a class that uses it. I want to bring it out of that class so I can use it elsewhere. Traditionally I would put it in a **helper class** (which is what I've done here), but apparently they're evil. What I really want to do is tie `Datetime.MyCustomParse(mystring)`. But the only way I can see is **to make a new struct that composes`Datetime`**. I then add in my method, write the implicit conversions and then put in all the other `Datetime` methods etc. **This would be a pain to code** (Being verbose also causes problems wrt xml docs and naive code coverage metrics, if that counts for anything). I have considered **extension methods** , but I don't think the methods make sense on instances. **What is the strict OO position? Do I get a pass on writing methods that should belong to classes in separate helper classes** when I want to extend structs in this fashion? **What is the pragmatic position** (I'm not saying OO isn't pragmatic), is this code you would write, or have I missed a trick?               internal static class DateTimeHelper     {              public static DateTime? MyCustomParse(string utcDateTimeText, string[] formats)         {             DateTime utcDateTime;             if (DateTime.TryParseExact(utcDateTimeText, formats, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out utcDateTime))             {                 return utcDateTime;             }                  return null;         }     }      PS I know there are more nuanced views on helper classes, but I still feel I need to justify my use here.


"positively formulated" vs. "reads as english sentence" style logic

Sorry, I'd be happy to have someone improve the title of this question. What are the benefits and downsides of "positively formulated" logic vs. having it "english readable". I'm looking for a generic position that can be placed into code guidelines. Examples of what I see as "positively formulated" logic               if ($obj->isValid()){               if ($found){                    if ($first){         //do nothing     }else{         doX();     }          $this->useFields(array('a','b'));      Examples of what I see as "negatively formulated" logic               if (!$first)         doX();     }          $this->unset(array('d','e','f','g'));      Whereas if focusing on "English readable" I would see this as good:               if (isValid()){                         if ($found){      and this is not "English readable"               if ($l){                    if (isValid() || !isActive()){         doX();     }


Practical considerations for HTML / CSS naming conventions (syntax)

**Question:** _what are the practical considerations for the syntax in`class` and `id` values?_ Note that I'm not asking about the _semantics_ , i.e. the actual words that are being used, as for example described in this blogpost. There are a lot of resources on that side of naming conventions already, in fact obscuring my search for practical information on the various _syntactical_ bits: casing, use of interpunction (specifically the `-` dash), specific characters to use or avoid, etc. To sum up the reasons I'm asking this question:   * The naming _restrictions_ on id and class don't naturally lead to any conventions   * The abundance of resources on the semantic side of naming conventions obscure searches on the syntactic considerations   * I couldn't find any authorative source on this   * There wasn't any question on SE Programmers yet on this topic :) * * * Some of the conventions I've considered using:   1. `UpperCamelCase`, mainly as a cross-over habit from server side coding   2. `lowerCamelCase`, for consistency with JavaScript naming conventions   3. `css-style-classes`, which is consistent with naming of css properties (but can be annoying when Ctrl+Shift+ArrowKey selection of text)   4. `with_under_scores`, which I personally haven't seen used much   5. `alllowercase`, simple to remember but can be hard to read for longer names   6. `UPPERCASEFTW`, as a great way to annoy your fellow programmers (perhaps combined with option 4 for readability) And probably I've left out some important options or combinations as well. So: what considerations are there for naming conventions, and to which convention do they lead?


What is the Best Practice for creating a secure login in a client - server appllication?

It's been a while I have been thinking on what could be the best scenario for creating a secure login in a client-server application running on internet or any other networks ! So I became with the idea to ask this question on programmers and I hope that this question will make awareness of new aspects of threads and security here by some kind of brain storming , I am really interested in good and new anseawres . Thanks in advance for your participation .


What do I need to know re. Javascript frameworks?

I recently asked this question on SO, which quickly became downvoted and closed. Clearly I lack a deeper understanding of JS, which I'm hoping you'll help me fill here. I'm a perfectly capable web developer and have built plenty of visually and functionally pleasing websites but am struggling to get to grips with how I should be handling JS. Up until now, I've only really used jQuery for form validation or providing AJAX functionality to forms/other page elements. There seems to be a lot of hype around JS frameworks - backbonejs, emberjs, etc, but when I look into them, it looks like they're just good for if you intend to build full applications in them. I'm happy using PHP/Symfony and just want to use JS to give my web applications a nice interactive/responsive 'feel'. Are the aforementioned frameworks any use to me, or am I right in just sticking with jQuery?


Experience w/ eLance (and similar sites)

I'm considering freelancing via eLance.com (or another similar site) to help pay the bills while developing games (that will eventually pay the bills). **What's working through elance like?** Any recommendations or strategies? Any feedback is appreciated.


How can I best study a problem to determine whether recursion can/should be used?

In some cases, I fail to see that a problem could be solved by the divide and conquer method. To give a specific example, when studying the find max sub- array problem, my first approach is to brute force it by using a double loop to find the max subarray. When I saw the solution using the divide and conquer approach which is recursion-based, I understood it but ok. From my side, though, when I first read the problem statement, I did not think that recursion is applicable. When studying a problem, is there any technique or trick to see that a recursion based (i.e. divide and conquer) approach can be used or not?


how much time do you spend on Unit testing?

In a company I used to work for, executives insisted that the code coverage with unit tests must be 99% or more. This resulted in writing more tests than code. It took us literally 3 days to write tests for a single class that took a day to implement. As a result, however, I learnt a lot about TDD, testing tools, practices etc. In the company I worked for afterwards, unit testing was an unknown thing. It was something someone maybe heard before. I struggled to introduce them to concept of unit testing, but without effect. Now, as a self-employed, I wonder - how much time is **really** necessary to spend on unit testing? Being mostly iPhone/Android developer, which parts of the code should be covered in tests?


Is NAN suitable for communicating that an invalid parameter was involved in a calculation?

I am currently working on a numerical processing system that will be deployed in a performance-critical environment. It takes inputs in the form of numerical arrays (these use the `eigen` library, but for the purpose of this question that's perhaps immaterial), and performs some range of numerical computations (matrix products, concatenations, etc.) to produce outputs. All arrays are allocated statically and their sizes are known at compile time. However, some of the inputs _may_ be invalid. In these _exceptional_ cases, we still want the code to be computed and we still want outputs not "polluted" by invalid values to be used. To give an example, let's take the following trivial example (this is pseudo- code):               Matrix a = {1, 2, NAN, 4}; // this is the "input" matrix     Scalar b = 2;     Matrix output = b * a; // this results in {2, 4, NAN, 8}      The idea here is that 2, 4 and 8 are usable values, but the NAN should signal to the recipient of the data that that entry was involved in an operation that involved an invalid value, and should be discarded (this will be detected via a `std::isfinite(value)` check before the value is used). Is this a sound way of communicating and propagating unusable values, given that performance is critical and heap allocation is not an option (and neither are other resource-consuming constructs such as `boost::optional` or pointers)? Are there better ways of doing this? At this point I'm quite happy with the current setup but I was hoping to get some fresh ideas or productive criticism of the current implementation.


Models, collections...and then what? Processes?

I'm a LAMP-stack dev who's been more on the JavaScript side the last few years and really enjoying the Model + Collection approach to data entities that BackboneJS, etc. uses. It's helped me organize my code in such a way that it is extremely portable, keeping all my properties and methods in the scope (model, collection, etc.) in which they apply. One thing that keeps bugging me though is how to organize the next level up, the 'process layer' as you might call it, that can potentially operate on instances of either models or collections or whatever else. Where should methods like find() (which returns a collection) and create() (which returns a model) reside? I know some people would put a create() in the Collection prototype, but while a collection operates on models I don't think it's exactly right to create them. And while a find() would return a collection I don't think it correct to have that action within the collection prototype itself (it should be a layer up). Can anyone offer some examples of any patterns that employ some kind of OOP- friendly 'process' layer? I'm sorry if this is a fairly well-known discussion but I'm afraid I can't seem to find the terminology to search for.


Why is Big O taught instead of Big Theta?

Big O notation provides an **upper bound** to a function whereas Big Theta provides a tight bound. However I find that Big O notation is typically (and informally) taught and used when they really mean Big Theta. e.g. "Quicksort is O(N^2)" can turned into the much stronger statement "Quicksort is Θ(N^2)" While usage of Big O is technically correct, wouldn't a more prevalent use of Big Theta be more expressive and lead to less confusion? Is there some historical reason why this Big O is more commonly used? Wikipedia notes: > Informally, especially in computer science, the Big O notation often is > permitted to be somewhat abused to describe an asymptotic tight bound where > using Big Theta Θ notation might be more factually appropriate in a given > context.


Message Passing: How to detect and/or handle "dead ends"

I'm playing with a mental model for distributed actor system that communicates using messages. In this, it is possible for an actor to create another actor. I've encountered one specific situation where I'm not really sure how to resolve. Consider this sequence of events:   1. Actor 1 requests creation Actor 2. As part of the "construction", it passes its own ID.   2. Actor 1 requests its own deletion.   3. System sends KILL message to all Actors who subscribed to {Actor1|KILL}   4. Actor 2 is created, saves ID of "1" sent to it as construction parameter.   5. Actor 2 attempts to send a message to Actor 1.   6. ???   7. Actor 2 detects that Actor 1 is gone, and reacts. Since Actor 1 and 2 can be on physically different machines, querying "Does Actor X exist?" every time (or before every time) you attempt to send a message will introduce latency that shouldn't be there in the typical case. Similarly, blocking until you know "Send Success" or "Send Fail" seems like a bad idea. It also seems that litering code with `if(send() == fail) { ... }` is ugly and error-prone. Are there known solutions for robustly and cleanly handling these sorts of situations?


Is there an advantage for a C programmer to have read K&R?

This question has been haunting me because I'm now reading Kernighan & Ritchie's: The C Programming Language (K&R) but I meet a lot, and I mean A LOT, of C programmers that have never read it. So, my question is: Is there an advantage to reading K&R? Should be a necessity?


Online error reporting without network access

I have developed an application for android requiring no permissions, but the biggest downside of this is that I don't have error reporting. So, I was playing around for the past week with any alternative options which would allow error reporting without network permissions and without privacy risks. So I came up with the following: Errors could be reported through a custom Google Play API, but would only be displayed once more than n users would have triggered the same error and displayed only in the aggregate sense. This (I believe) would prevent exploitation where an app could use this as a method to communicate private data. N would be defined by something along the lines of `max(10,number_of_users * 0.001)` or something along those lines. So my question is, would such an architecture be safe or am I overlooking possible exploits? If not it seems a huge waste android lacks such an API as right now virtually every app requires network access for exactly this reason. A similar API could then also be used for rudimentary statistics, once again without the up and downsites of user identifiable analytics like with Google Analytics for android.


Liskov substitution principle when implementing two unrelated interfaces

Suppose I have two unrelated interfaces with the same method:               interface Table {         /**          * @param width (0 < width <= 100)          */         void setWidth(int width);     }          interface Square {         /**          * @param width (50 <= width <= 10000)          */         void setWidth(int width);     }      Then I create a class which implements both of these interfaces:               class SquareTable implements Square, Table {         void setWidth(int width) {             precondition = ...             if (!precondition)                 throw new PreconditionFailedException("Precondition failed: ...");         }     }      How precondition expressions should be combined to satisfy Liskov substitution principle? Should they **and** 'ed or **or** 'ed? I.e. what should be written instead of `...`:               width > 0 && width <= 10000 // using OR     width >= 50 && width <= 100 // using AND      And which rule should be used for postconditions?               interface Table {         /**          * @return width (0 < width <= 100)          */         int getWidth();     }          interface Square {         /**          * @return width (50 <= width <= 10000)          */         int getWidth();     }          class SquareTable implements Square, Table {         int getWidth() {             postcondition = ...             if (!postcondition)                 throw new PostconditionFailedException("Postcondition failed: ...");         }     }          width > 0 && width <= 10000 // using OR     width >= 50 && width <= 100 // using AND


What are the prerequisites for learning Go

I am considering learning Go. As far as I know about it, it's a systems language geared toward parallel programming. (correct me if I'm wrong)   * Should I have a very good understanding of C in order to be good Go programmer?   * How much systems concepts (*nix OS concepts) I need to master before delving into Go   * What other things I should know/learn before starting Go


Acceptable dependencies in a service-oriented architecture, internal to a team

In a service-oriented architecture, subsystems can depend on each other in different levels:   1. Database level => Foreign keys to enforce data integrity across services on deletions and updates (cascade), and views which use tables from other services to increase performance   2. Code reuse => like DLL references in .NET platform, to reduce the amount of code, and to follow DRY   3. Service usage => To enforce business centralization; Each service can use any other service in a mesh-like scheme   4. UI reuse => To facilitate consistency in UI and take UX higher Which of these dependencies are encouraged and which are not?


Coding style for chained function calls

A common thing you need to do is to take a value, do something with it by passing it to a function, and then do some more with the return value, in a chain. Whenever I run into this type of scenario, I get unsure about how best to write the code. As an example, let's say I have a number, `num`, and need to take the floored square root of it and turn it into a string. Here are a few possibilities (in JavaScript). I might simply pass `num` to one function at a time, and replace `num` with the return value:               function floorSqrt(num) {         num = Math.sqrt(num);         num = Math.floor(num);         num = String(num);         return num;     }      This is nice since I don't need the original `num` any more, but in practice it might be confusing to start with one thing (a number) and end up with something completely different (a string). I can save each step in a new variable:               function floorSqrt(num) {         var sqrtNum = Math.sqrt(num);         var floorSqrt = Math.floor(sqrtNum);         var stringNum = String(floorSqrt);         return stringNum;     }      Although it seems wasteful to declare all those variables and come up with good names for them. Or I can just do it all as a one-liner:               function floorSqrt(num) {         return String(Math.floor(Math.sqrt(num)));     }      But for more than two functions that approach gets incredibly unreadable, almost like code golf. It seems to me like the most beautiful way to do this would be with some stack-based language, which might look something like this (pseudo code):               [sqrt floor toString]      Is there a way to do something similar with JavaScript? List some functions, run one at a time, and use the return value of each one as the argument for the next? The closest is how some libraries like jQuery or Underscore.js allow you to chain methods, something like this:               function floorSqrt(num) {         return _.chain(num).sqrt().floor().toString().value();     }      I'm sure many wise people have thought wise things about this. What are some thoughts on pros and cons of the different styles?


Should a persisted and 'finished' by state transaction be editable to any user

This question has been bugging me for a while. I came from a background where I taught that when a transaction reached some state (FINISHED, PRINTED, etc) it should no longer be opened for modification even to admin users. But here I am, fixing their human-input error barbarically by deleting a row in database and/or changing the current item's state to it's previous one. At some point they even make a mistake in inputting a transaction date, and just realized it somewhere later. And it's really annoying. Should a software, especially an enterprise one, gives a user all the freedom they requested? If so, what good does a transaction state for? Update : Here, by transaction I mean a Transaction object which usually consisted a reference to Master object and it's own attributes, not database transaction.