How to create interest in programming?

I am student of 3rd year software engineering, and I find myself nowhere in field of programming. I know basics of programming languages like C, C++, Java, Visual Basic, HTML, JAVAScript, CSS and PHP. But every time I sit in front of my computer and start coding in any of the languages, I feel frustrated and distracted and I just shut it down. I have lost interest in everything and I am worried about my future. I am worst at creating logics. So can anyone help me or guide me to make me create my interest in programming?


OOP when using a GUI Designer

I usually do database and web development but at the moment I'm learning desktop development with Mono and Gtk# using using the MonoDevelop IDE. I'm also using the Stetic GUI Designer inside MonoDevelop to create the GUI. **What are the best practices when using a GUI designer to encapsulate extra logic that is related to a widget used in the GUI designer?** For example I may use a TreeView widget but I'll also need to have logic specific to how the cells render, deleting selections of rows, etc. My first thought would be to simply extend the Treeview like so:               public class MyTreeView : TreeView {}      But I don't think I can do that and still use the GUI Designer (correct me if I'm wrong). What I'm doing now is making a class that has the TreeView as a member of it:               public class MyTreeView      {         private widget;              private MyTreeView(TreeView treeView)         {             this.widget = treeView;         }     }      Am I on the right track or is there some special and fancy pattern or C# language feature that I don't know of that I should be using instead?


How to share code as open source?

I have a little program that I wrote for a local group to handle a somewhat complicated scheduling issue for scheduling multiple meetings in multiple locations that change weekly according to certain criteria. It's a niche need, but I wouldn't be surprised if there are other groups that could use software like this. In fact, we've had requests from others for directions on starting a group like this, and if their groups get as big, they might also want special software to help with scheduling. I plan to continue developing the program and eventually make it an online web app, but a very simple alpha version is completed as a console app. I'd like to make it available as open source, but I have no idea what kind of process I should go through first. Right now, all I have is Java code, not even unit-tested thoroughly. I haven't shown the code to anyone else. There is no documentation. I don't know where I would put the code so others could access it. I don't know anything about licensing it. I don't know what kind of support people will expect from me if I release it as open source. I have no idea what else I should worry about. Can someone outline for me (or post an article(s) that outlines) the process of taking open source software from "coded" to "completed / available"? I really don't want to embarrass myself by doing things weirdly.


Why Apple doesn't "force" the user to update by installing the needed API updates when the user downloads a new app?

I was here programming in iOS with a class that's available only for iOS 6, and I was wondering: why should I implement my app to handle multiple operating systems when my app will be distributed by Apple through the App Store, and so they could just include/install whatever iOS source needed for my app? In the old days updates to the operating systems came through CDs, and so it made sense that programmers could not expect everybody to have the latest OS, and that OS updates had to be clumped together into major releases and be few and far between. But in the age of the internet, and especially on iOS where both the user and the software developers are forced to buy and sell apps through the App Store, shouldn't we just expect the new APIs to be downloaded on the background when installing new apps? and changed to the OS to happen incrementally rather than in major releases?


Why scalability issues cannot be solved by more servers ?

I know that big websites suffer from scalability issues and I guess that more servers (hardware) can help to handle scalabililty issues but I see that big websites are stuck about scalability even if they can handle the cost of new servers. So why can big companies not handle scalability issues by more servers?


What problems are stack oriented languages well-suited and ill-suited for?

Stack-oriented programming is a pretty non-widely used paradigm (well, PostScript gets used under the hood a bit here and there). This in mind, what problems are stack-oriented languages good at? What would they do better than [paradigm] does? Also, for what problems are they a bad choice? Is stack-oriented programming just a niche paradigm?


How to choose between Tell don't Ask and Command Query Separation?

The principle Tell Don't Ask says: > you should endeavor to tell objects what you want them to do; do not ask > them questions about their state, make a decision, and then tell them what > to do. > > The problem is that, as the caller, you should not be making decisions based > on the state of the called object that result in you then changing the state > of the object. The logic you are implementing is probably the called > object’s responsibility, not yours. For you to make decisions outside the > object violates its encapsulation. A simple example of "Tell, don't Ask" is               Widget w = ...;     if (w.getParent() != null) {       Panel parent = w.getParent();       parent.remove(w);     }      and the tell version is ...               Widget w = ...;     w.removeFromParent();      But what if I need to know the result from the removeFromParent method? My first reaction was just to change the removeFromParent to return a boolean denoting if the parent was removed or not. But then I came across Command Query Separation Pattern which says NOT to do this. > It states that every method should either be a command that performs an > action, or a query that returns data to the caller, but not both. In other > words, asking a question should not change the answer. More formally, > **methods should return a value only if they are referentially transparent > and hence possess no side effects.** Are these two really at odds with each other and how do I choose between the two? Do I go with the Pragmatic Programmer or Bertrand Meyer on this?


mobile app data copyright question

I want to develop a mobile app for itinerary of major sport event. My confusion is whether there will be a copyright problem in sharing the schedules, venue of matches, player statistics and ticket information etc. on my application, or whether I should make it either a free app or a paid one. If I use official sports news channel information then would there be any issue?


Roles configuration strategy

We're close to start new project using `sf2`, and, probably, `FosUserBundle`. Keeping that in mind - what's the best strategy to define roles? App will be used by multiple divisions inside our company (every division has it's manager and regular employees), as well as external users, that can be divided into 3 groups (for now). I'm comming up with two possible solutions:   1. **each role represents specific action in app** , i.e.: adding new task action is described as `task_new` role. Selected users get this role to be able to add new task.   2. **each role represents user ability and every action checks if user has this ability** i.e.: when new task is being added, controller checks if current user has role `task_access` role. I ~~really~~ somehow like approach to this problem in our current app - there's one place where only admin has access granted, with list of all registered actions. Users are divided into about 10 groups and all you have to do is to check that this group has access to this action. In this case no code-juggling is required, but I'm afraid it will generate some limitations or roles overgrowing in new app. What I'm really afraid of is spending too much time changing the security code in specific controller/action, I mean, when new user has to get access to specific place, I will have to go to the code, handle new role, code will grow, and so on. I want to keep this time as low as possible, and as flexible as possible. I believe there are some great solutions to this problem. Am I right?


What does 'between' and 'in range' mean in the world of numeric types?

Given is an integer with the value 5. Given is a range with start and end values of 2 and 5. So is the integer 5 now between the range? What should a 'InBetween()' method return and which one is the correct representation of 'between':               int val = 5                    if(val >= 2 && val <= 5) // would return true                    if(val > 2 && val < 5) // would return false


Data structure theory based on graph rewriting

First of all, I'm looking for a book, publication, project or any kind of information that should probably exceed the limits normally imposed on answers in this kind of forum. I know the rules about not asking to advice a book, but hold your breath, don't vote to close yet. I've been searching every place and returned empty-handed. Eventually I came across the mention of "Theory of data structures by relational and graph grammars" book, but I cannot find it. This book is really old, the author didn't continue the work in the same direction, instead he published several books related to programming practices rather then theory. Well, I cannot believe that was the only book. Will you please help me find more? TL;DR The motivation, if you are interested. Through the course of last few years I was specifically trying to reach to any, even if very exotic languages to have a better idea of how they organize their system of data structures. The reason to do so was that the mainstream languages provide the programmers with very fragmented, not unified under any rigorous theory set of tools. Some try to build a hierarchy / heterarchy of things they put into that basket, but really, it's just random. SQL has very nice theory (relational algebra) to back it up, alas, that doesn't include the very common things, like strings or lists etc. For some time I had a gut feeling that the general case of any data structure must be a graph and other data structures would be some kinds of either degenerate graph (list is an acyclic direct graph with the requirement that there should not be a vertex that connect more then one other vertex, etc.) or a "projection", like a two-dimensional relation. I found several pages from the book I mentioned earlier, where the author expresses what I've taken to be the same / similar idea. But there must be more to it. Similar to how relational algebra defines a set of operations on relations, that book mentioned basic graph operations, but the details were lost.


How to handle the large website rss feed

Portal website usually have very large number of posts. For example I have 50,000 posts in website. I even created the google sitemap as chunks and included it in main site map file. But I have no idea how to deal with RSS feed. 50,000 posts in RSS feed file size will be very huge, how to handle the situation?


Which DVCS (git or hg) is easier for programming students?

A bit of context: I'm in 3rd year of college. students are divided into teams of 4. Almost everyone will be working under windows (except a few like me who are on linux). As part of the school curriculum, we will soon start working on a project for a real client, but me and another team are wondering which way would be best for sharing our code with each other. I've been working part-time for 3 years and have had plenty of experience using both git and mercurial on different projects, so I don't have any problems using one system or the other. However, none of my teammates have ever used a version control system before. There's also another team who've tried using SVN but have had major problems and would prefer trying out something else, so they've asked for my opinion. My thoughts : I've heard that mercurial + TortoiseHg has a better integration under windows, but I'm wondering if the concept of anonymous heads might confuse them even If I explain them. On the other hand, I find that git branches are easier for a beginner to understand (clear seperation of work for each programmer) but doesn't work as well under windows.


Is it bad practice to resolve null arguments to default static variables?

First, let me show you an example (written in ActionScript 3.0):               class GameObject {         public static function MakeFromName( pName:String,                                              pAtlas:TextureAtlas = null,                                              pGameData:Object = null ):GameObject {                  // If these arguments are not passed, they default to the static INSTANCE's              // currentAtlas and currentData.             if (pAtlas == null) pAtlas = GameBaseClass.INSTANCE.currentAtlas; // <--             if (pGameData == null) pGameData = GameBaseClass.INSTANCE.currentData; // <--                  var theSymbolData:Object = pGameData.symbols[pName];             var theSymbolTextures:Vector.<Texture> = pAtlas.getTextures( pName );                  var newGO:GameObject = new GameObject();             newGO.MakeFromData( pName, theSymbolTextures, theSymbolData );                  return newGO;         }              // MakeFromData defined somewhere down in the code...     }      I'm having this debate with a coworker regarding the above 'null' (basically optional) parameters. To me, it makes sense to auto-resolve those two parameters ( _pAtlas_ and _pGameData_ ) to some sort of central resource (in this case, the primary Atlas and Data used in the game). This `GameBaseClass` goes hand-in-hand with `GameObject`, so I see no harm in referring to it's singleton-instance's properties. The developer still has the option to supply their own Atlas and Data. BUT, my coworker believes this ties the classes together too much - it isn't loose enough. I can understand his point if it was actually referring to the derived classes used in the game (i.e: `AwesomeGame.INSTANCE.currentAtlas`, where _AwesomeGame_ extends _GameBaseClass_ ). But it isn't! From his point of view, the developer should be forced to enter every single parameters, nothing optional (in this particular situation). Is there any way to have the best of both worlds? The only other way I can think of is just to write two separate methods (one with the 2nd and 3rd arguments, and one without), but that still doesn't address the issue with the GameBaseClass dependency. Any ideas? **EDIT: In the above example, I used ActionScript 3.0 which does not support assigning non-constant variables. In other words, it allows hardcoded Numbers, Strings (empty ones too), Booleans, and Constants (although I don't think it would work with non-primitive constants, could be wrong though). Since the`GameBaseClass.INSTANCE.currentAtlas` is a property that could change in the lifetime of the running application, this cannot be inlined as a 'compile- time' default value. Hope that makes more sense!**


Does making source code available affect your ability to generate revenue?

We’re working on a .Net framework which ultimately amounts to a single DLL. We intend to charge for commercial use of the framework, but make it free for open source/non-commercial use. The rough plan at the moment is to administer this through some form of fairly simple licence which will be issued whether you’re using it for free or paying. We’re debating whether to make the source code available. It’s our perception (and our own preference) that it’s far more appealing to use something where you have access to the source code. I’m interested in whether people think making the source code available will damage our ability to make money from the framework, or whether it will encourage more usage and enough “good” people will arrange to pay for the correct licence if using it commercially. My feeling is that, generally, commercial operations don’t mess about on the licencing front and so making the source code available will only encourage usage and therefore ultimately generate more revenue, but I’d be interested in others views/experience.


Open-source or closed-source for SaaS?

> **Possible Duplicate:**   >  Does making source code available affect your ability to generate revenue? Initially I was going closed-source all the way, or at least until we have a good reputation, and open-sourcing will only improve that rep. Recently though, I've been thinking about open-sourcing the entire solution. Various popular SaaS solutions have open-sourced under AGPL and are generating revenue. For instance, Gitorious (http://gitorious.com/subdomain) is AGPL but they make profit. OpenERP makes profit using the same sort of mechanism as Gitorious, advertising that they maintain the servers and keep servers online. I am building an ecommerce solution, and am considering offering free use of part of the system, pay per/month to use the entire system. By making the solution open-source, couldn't a competitor just download my project and offer it at a cheaper fee per/month? If I open-source, will that increase or decrease my revenue?


Should my internal MVC/MVVM application use Web Services for Persistence?

Just talking about internal applications or intranet web apps... At some companies I've seen their business-logic piece (Model in MVC/VM in MVVM) on one (or both) sides of a Web Service. And on the other side of the web service is the Persistence.               MVC/MVVM > Service Layer > Persistence      This is only for intranet/internal application customers, and both the web or app code, and the persistence (usually ORM) dlls both sit on the same server, or even in the same folder. I'm used to seeing internal apps and intranet websites that reference a business-layer... then that business-layer connects to persistence. So the app itself is persistence-ignorant. But with my own apps, if something needed to be exposed externally, that something is opened up via a web service. But otherwise, everything stays internal. Is there a reason for why I've seen a couple different companies do this? They didn't seem to know the answer themselves.


Javascript modularity, server based MVC & business reality

I understand this is a _very_ broad question, but I have worked with various aspects of this problem individually and am struggling to bring all the concepts and technologies together. I'd like to specify that answers should include these technologies:   * C#    * MVC 3 w/ Razor   * Javascript w/jQuery Anything above and beyond those (such as Backbone.js, Entity Framework, etc) are welcome as suggestions if they help answer the question which is: > **Using the above listed technologies, what is an _optimal_ strategy for > organizing code and logic while maintaining scalability and the ability to > create a rich, fast, clean UI?** Ideally the focus should be put on a solution being deployed in a business/corporate environment. On that note, the technologies list above **will not be changed** so please don't offer solutions with "you should be using _xxx_ instead of _yyy_ that you are using now". **Background** I work with jQuery everyday, have adopted ASP.NET's MVC and have been working with C# for a long time. So you can present solutions assuming intermediate- to-advanced knowledge of those technologies. I'll organize the question into **smaller parts** to make it simpler to respond to: **1\. Project structure** Given I am working with ASP.NET MVC (in **Visual Studio 2010** ) I would like a directory structure solution that offers some acceptance of the main layout this type of application. Something like Brunch I suppose, but with a little more detail of what each folder would contain and how it works with other areas of the app. **2\. Data access** I'd like to modualize my data access as much as I can, with an API-type structure. You can assume lots of POCO objects (`User`, `UserGroup`, `Customer`, `OrderHeader`, `OrderDetails`, etc), but there will also be some complex reports that require data intensive SQL and careful UI rendering. **EF + LINQ** are fantastic for the former but not so much for the latter. I can't find something that seems to fit both scenerios without being overly complicated or overly simple. **3\. Client-Side Code Organization and UI Rendering** Like most developers first picking up jQuery, I fell into the trap of mashing together code wherever it needed to go but quickly found it piling up and turning ugly. Although I've come leaps and bounds since then, I still struggle with modularizing my code and working with various parts of the UI without repeating code. As an example, a typical piece of code I might write would look like this, I have commented the stuff that bothers me ( _note that I've since changed to using deferred AJAX calls and separated the actual data requests from the DOM manipulation_ ):               $('#doSomethingDangerous').click(function () {         // maybe confirm something first         if (confirm('Are you sure you want to do this?')) {                     // show a spinner?  something global would be preferred so I dont have to repeat this on every page              $('#loading').show();                    // maybe the page should notify the user of what's going on in addition to the dialog?             $('#results').show().html('
Please wait, this may take a while...
');                    $.ajax({                 url: 'blah/DoDangerousThing',                 success: function (data) {                                          // The results will be loaded to the DOM obviously, is there a better way to pull this type of specific code out of the data access calls?                     $('#results').empty();                     $('#results').append('' + data.length + ' users were affected by this dangerous activity');                     $('#results').append('
');                          // I've recently started to use jQuery templates for this sort of logic, is that the way to go?                     $(data).each(function (i, user) {                         $('#results').append('
' + user.Username + '
');                     });                                         $('#results').append('
');                          // Need to hide the spinner, again would prefer to have this done elsewhere                     $('#loading').hide();                 }             });         }     });      **General Questions**   * Client MVC vs. server MVC? My project is already a server-side MVC structure, so is there still a need for client MVC like Backbone.js provides?   * Should Javascript files get created for each object (like an `OrderHeader.js`) and then minified/merged during the build? Or should there just be an `Order.js` which has logic for `OrderHeader, OrderDetails, Reports` etc?   * How should complex queries be handled? Right now my leading theory is `/Reports/Orders-By-Date/` or something along those lines and I use a custom SQL query that renders a custom dataset (or `ViewModel`) to the Razor View. But what about paging, sorting, etc? Is this better to be done client or server side? (assume larger dataset - 2 to 3 second SQL query)   * I've read through Microsoft's Project Silk. Is this a good way to go? How does it compare to Backbone.js or others?   * I'm very accustomed to an N-tiered architecture, do these concepts somewhat throw that out the window? It seems MVC is like a bunch of mini N-tiered sections within what would have been the front-end or top tier in the past. Again the more _specific_ your answers are the better they will be. **I've read alot of high level documentation and examples** , I'm trying to **better understand translating it into real world examples**.


Reinvent the wheel or using the existing wheel?

I would like to ask something about project management. I got a project that has some requirements, it can be done from scratch with the use of a big framework. Maybe some tools are necessary for some of the functions. But using a framework seems very cool, it seems that reduces the amount of work, but need to study a framework first. But study a frameworks seems very big for the team. So, what do you think? Just get the thing done from scratch or study a framework and get started like 'Standing on the shoulders of giants'?


Should I learn a programming language before I attend college for Computer Engineering?

I've dipped my toes in C++ programming but I haven't actually delved into it. I want to know if I actually need to learn it or any other languages before I go to college for Computer Engineering or am I just going to learn it at school anyway?


Is there any plugin for better viewing of exceptions?

I don’t think that I’m the only one that thinks that Visual Studio exception window is very poor. Trace information lacking formatting and is hardly readable.   * **Is there any plugin or external tool that shows exception information better?**


Question about Creating a Scripting Language

Say, for example, I wanted to pay somebody to create a programming language or scripting language for me. What type of document would they need, in order to fully understand what it is exactly that I want. I mean, are there standard documents that describe the new programming/scripting language in question?


Is there a design pattern for dynamically applying transformations or filters to a model?

For example, there is a model of an event with certain attributes that can be adjusted by existing processes: maybe one that looks at a geo-location stamp and determines a nearby city; another that looks at the number of registrations and applies rounding; another that calculates local popularity based on attendees vs. nearby events. The important piece is having a way to **dynamically order the operations** \--the filters/transformations/processing tasks--so that you can pass the events to a processing object that arranges the tasks in the correct order for the configuration/situation, and then passes the models through to apply them. I can think of some ugly ways to make this happen, but want to know if there is a SOLID pattern that would allow for better, more-testable code.


Single result as REST/ODATA response on GET

In an API which should be both restful and support OData for different client types. I have an endpoint that always returns a single result. Should I:   * Return the entity as a single entity?   * Put it in a list which will always contains 1 element?    * Do something completely different? Normally a Get request returns a list of items and Get(int key) returns a single item based on the key, this however is _the_ exception. I don't want to be inconsistent, but it seems counter productive to put a single element in a list.               public SingleEntity Get() { }     public IEnumerable<SingleEntity> Get() { }


How to allocate cross-cutting concerns in agile software development planning?

My employer has been moving from traditional waterfall projects to a modified version of agile. Work is broken into stories, which are estimated and sequenced into two-week long iterations. Each iteration includes points for building, testing, and accepting features. Stories are focused on testable business features. There is no way to plan and account for cross cutting concerns such as design, architecture, infrastructure, or (ironically) project management. Should agile teams explicitly include stories or tasks for these cross-cutting concerns? How does your team handle tasks that never go away? Are they "off book"?


Can I claim the website I made when the back-end technology such as MySQL and PHP weren't invented by me?

That's just an example case. What I'm trying to point out is, how can you claim something (software/website/or any 'ontouch-able' products) as yours while at the same time you are using some existing technologies behind it? (such as database engine, programming languages, compilers, or even the computer it self!). If you can, how far can you claim it?. Can we put a notice (Copyright (c) by Me) on an website that built on top of LAMPP?. Or can I put my own copyright notice for the program I wrote on top of OpenGL? I have the basic ideas about software licenses such as GPL, MIT, LGPL, etc. What I still don't understand is, the fact that we are all being helped all the time by existing technologies such as DBMS, compilers, IDE, and even the computer we use, now if we create something from these technologies, how far we can claim it as ours?


Intel mnemonic to machine code converter library

I'm trying to do the following: take a single IA32 instruction in the Intel syntax (such as `ADD EAX, EBX`) and produce the corresponding machine code for this instruction. Is there some small library, preferably open source, that can do this for me?


non-volatile virtual memory for C++ containers

Is there a virtual memory management process that would allow a program to use the standard container structures and classes, but retain these structures and their data when the program is not running (or being used), for use by the program at a later time? This should be possible, but can it be done without changing the source code and its (container) declarations? Is there a standard way of doing this?


Of which bad practice is require calling functions in order a sign?

Sometimes I find myself writing comments on class methods like this:               class A : public Base     {     public:         /**           * Sets variable;           * should be called before ImplementsInterfaceMtehod(),           * else has no effect.           */       void SetSomeVariable( var_type value );            virtual void ImplementsInterfaceMethod();     }      The callers of `Base::ImplementsInterfaceMethod` obviously do not know about the variable, and should not. But the users of `A` should set the variable if they want it to take effect. It is not required to set the variable (else it could be a parameter for the constructor), so I cannot throw exceptions in `ImplementsInterfaceMethod` if it is not set. Is this a sign of some typical bad practice? Is there a better way than writing a comment as shown to deal with this? **edit** here's a more concrete example resembling part of some realtime 3D image processing code; because of the realtime part and the fact images can get huge, everything has to be preallocated.               class DataProcessor     {     public:         /**           * Sets dimensions of the data for the next call to Process().           * Can be used by implementations to setup internals, eg preallocate.           * Upon returning out contains the dimensions that will be returned           * by the Process call, given dims as input dimensions.           * (A)           */       virtual bool SetInputDimensions( const Dimensions& dims, Dimensions& out ) = 0;            virtual bool Process( const Data& in, Data& out ) = 0;     };          class ImageStitcher : public DataProcessor     {         /**           * Set size of the output image returned by Process() as a factor,           * eg when size == 2, image will be twice as big.           * (B)           */        void SetOutputSize( const double size );              /**           * Set the position at which the next Data object passed to Process()           * will be stitched.           * (C)           */        void SetStitchPosition( double x, double y, double alpha );     }      So here (A) must be called at least once before Process() is called. Which I enforce by returning an error in Process() if that was not the case. Most of the time the dimensions are not known when constructing the object though so a constructor parameter is not an option. Two main components use the DataProcessor interface: all processors are in a network of processors, and that network is unaware of the type of processor, it just takes care of transferring data between them by calling Process() multiple time. Another component takes care of setting up the network by calling SetInputDimensions(), again unaware of what type the processor is. (B) should be called before SetInputDimensions() gets called, as it defines the size of the resulting image. (C) should be called before each call to process else the stitcher doesn't know where to put the image Now this whole processing network is actually used in commercial applications and works extremely well since I made sure everything is called nicely in order. Yet each time I write 'must/should be called before' bells start ringing all over the place..


What was the first commercial open-source software?

According to the Wikipedia article on open-source, the philosophy of sharing code has been used in projects since the early computer days (mostly through Universities sharing code). However, I'm interested to know what (and when) was the first commercial open-source software (successfull or not)? If there's any confusion on commercial, I define it as thus: "Having profit as a chief aim".


How did programming work when programmers used punchcards?

I saw this: Learning to program on punchcards and I've seen this: http://en.wikipedia.org/wiki/Computer_programming_in_the_punched_card_era but they leave much to be desired. Can anyone explain to me how programmers programmed when they used punchcards? Specifically, the system of input computers used to derive instructions from the punched card itself. I do not know much about retrocomputers, so any one system of input you are familiar with would be fine. More general answers are also appreciated.


Should Equality be commutative within a Class Hierachy?

It is easy to define the `Equals` operation in ways that are not commutative. When providing equality against other types, there are obviously situations (in most languages) were equality not being commutative is unavoidable. However, within one's own inheritance hierarchy where the root base class defines an equality member, a programmer has more control. Thus you can create situations where               (A = B) ≠ (B = A), where A and B both derive from base class T      Substituting the `=` with the appropriate variation for a given language. (`.Equals(_)`, `==`, etc.) That seems wrong to me, however, I recognize I may be biased by background in Mathematics. I have not been in programming long enough to know what is standard/accepted/preferred practice when programming. Do most programmers just accept `.Equals(_)`may not be commutative and code defensibly. Do they expect commutativity and get annoyed if it is not. In short, when working in a class hierarchy, should effort me made to ensure Equality is commutative?


How do you put a database online?

I have a very beginner question regarding web development. I've had some experience with JSP, Hibernate, and MAMP to create a simple system for tracking inventory and sales. But this was all done locally on one computer. This time, I want to create a system that could be accessible online. It's to help my mother track her business wherever she goes. So there would be similar aspects like tracking inventory and sales. I understand that you have to have a server in which to host all the files in. But I don't understand how you can access your database online. Or what sorts of applications or products should be used. Currently the host of my database is localhost. How do put it online such that you can still do CRUD operations? Are there any guides to do this?


In Scrum, should you split up the backlog in a functional backlog and a technical backlog or not?

In our Scrum teams we use a backlog, which mostly contains functional topics, but also sometimes contains technical topics. The advantage of having 1 backlog is that it becomes easy to choose the topics for the next sprint, but I have some questions:   * First, to me it seems more logical to have a separate technical backlog, where developers themselves can add pure technical items, like: we could improve performance in this method, this class lacks some technical documentation, ... By having one backlog, all developers always have to pass via the product owner to have their topics added to the backlog, which seems additional, unnecessary work for the product owner.   * Second, if you have a product owner that only focuses on the pure-functional items, the pure-technical items (like missing technical documentation, code that erodes and should be refactored, classes that always give problems during debugging because they don't have a stable foundation and should be refactored, ...) always end up at the end of the list because "they don't serve the customer directly". By having a separate technical backlog, and time reserved in every sprint for these pure technical items, we can improve the applications functionally, but also keep them healthy inside. What is the best approach? One backlog or two?


Community Programming

**Background** I just began working for a religious non-profit organization. As with most non-profits, the organization is resource-poor and has no IT department to speak of. In my two months here I've received 20 requests for websites, apps, and internal automation. Many of these 20 requests have merit and would benefit the organization. I'm a .net web developer and as such the open source community is relatively foreign to me... **Question** _For the sake of this question, lets say I'm talking about building a single, large, website._ Does software (web based, hopefully) exist that would allow me to post requirements and assets (graphics and CSS) for a site, and then invite programmers to participate in the sites development? As a simple example, I could post the requirements and data for the about us page and an individual would indicate that they could/would fulfill the requirement. Upon completion, they could upload the new source code to the shared repository (github).


How to save useful code snippets?

I do a lot of web development and there are many code snippets that come up again and again so I dive back into the most recent project where I used it which isn't that efficient. How do you store all your useful and oft used code pieces? Are there any products meant for this?


Classes and library archive

We are a group of 5 developers(scientists end engineers) that write code in C++. What we would like to do is to make all the code available to all the developers easily. The first step in this process was to set up a SVN server, and it worked fine. Now we are facing another need: we would like to have a system were all the base classes, mathematical libraries, algorithms are public and accessible to every developer. Something like a Wiki, or like the root documentation http://root.cern.ch/root/html/TH1.html. A sort of site where you can upload code, you can describe it and you can point out how to use it. Do you have any suggestion?


How to go about saving a Snippet / Block of Code

I am currently learning C#, I am pretty proficient in Java. A project I have been working on for a while is basically an application that lets you input code "Snippets" or blocks of frequently used code and lets you tag them with specific topics for easy sorting. How should I go about saving the inputted code so I can access it later and possibly format it or keep it in the formatting it's pasted in? I would want to put more information into the file it is stored in addition to the actual code, like the tags and dates/times so things like XML have came to mind but I really am not sure. Just for clarification, I am aware of the snippet function in visual basic. What I am asking about is for making my own C# standalone application and how to store the code on my own.


How to avoid code duplication across unrelated projects

I'm a contractor at a large Telco where I'm usually working on several different projects at once. The VCSs I use (mainly git and mercurial) tend to make me keep the code bases for unrelated projects in separate repositories, and I realise many benefits of this approach. However, there are many little bits of utility code and helper functions I've written which are useful across two or more projects, and I'm well aware of the benefits of keeping my code DRY - for example sometimes I find a better way to implement some piece of code and I don't want to have to update it in every place where I've duplicated the same idea. What is the best way to refactor out this common functionality (it is not always so simple as copy-and-paste, but sometimes it is..) without creating unnecessary dependencies between unrelated projects, and without adding needless complexity?


Automatic code snippets in VS 12

I've decided to customize my VS12 to perfectly mirror my wishes. However, due to the lack of time, I'd like to start by just simply adding some code snippets first. Addins and such will have to wait until fall. :( So, basically, I'd like to type _hazaa_ and get some (preferably, but not necessarily, tab-jumpable) text saying _yo, dude_. Something like _prop_ spits out a stub for a property (with tab-jumpable parts of it being optional). I've found this tutorial and I wonder if that's the quickest way to start creating ones own code snippets. If so, I can as well do it right from the ground but it'd be nice to have something Q&D to start with. Also, I can't really evaluate how well that article adapts to the modern capabilities of VS12 (and the upcoming VS13). It'd be a blast if somebody with experience of that shed some light on the matter.   1. Is the article the quickest way to automatic code generation?   2. Is the article a reliable and updated way to customizing VS12/13?   3. Is there a better resource for my plans and, in such case, where?


What design pattern should be used for implementing maintainable complex dialogs?

From time to time I implement functionality which requires asking user questions sequentially.   Questions are conditional, that is the answer defines the set of the following questtiongs.   Sure it is Wizzard UI design pattern, but for now I have no clear understanding how it is implemented from the point of view of software architecture. Screen/question can be a somewhat complex interface but most fo the time it's just a selection of several options.   Nonetheless after any step some calculations can be required, not only to get additional data but to define the set of questions.   I guess Strategy pattern has to do with this but I feel that the with this pattern the code which builds "execution flow" can become ugly. Thanks in advance.


The Service class in MVC

From time to time I find there is a need to build a service class. Something I can't really attach inside a model in order to respected GRASP and SOLID. So I created a class called AccountTransferService. * Are service classes good design practice ?  * Do they represent a Model ?  * If a Service is not a Model what are they in a MVC arhitecture ?


Work flow when editing files in /var/www. Constantly needing to input "sudo" commands

I installed Apache2 and PHP5 last night on my fresh Linux Mint machine. I created a folder and created a simple `index.php` file with a call to `phpinfo()` to test out the installation and every works correctly. However when I open the file with Sublime Text 2 or any other editor, I cannot save my changes. I can use the `sudo nano` command to open it with super user privileges and I can save just fine. The same goes with Mercurial. I cannot `hg commit` because of permissions. I can only `sudo hg commit`. Is this how the basic workflow is supposed to be? If I run the `chmod` command and recursively give `777` permissions to the folders and files within Apache can run it just fine, but if it's a dynamically created file ( _created by my web app_ ) then it seems Apache cannot access or run it. I have to run the `chmod` command **again**! Any suggestions on what I should do? I feel like 30% of my time is spent on redundant processes that shouldn't be done at all.


Lisp As A Langauge For A Beginner?

Should I learn Lisp as my first programming language? I have no prior experience but have heard great things about it from programming friends.


is it possible to sell a web site

There might be a situation where one of my clients won't pay for the web site that I've made. So I am wondering if it is possible to sell a web site? It is an internet shop, so there is no content that comes with it, but the source code is fully available, and it has a decent design. I've seen people trying to sell web site templates, and I've seen people who try to sell already running web sites, and there are plenty of commercial web site engines out there. But what about raw empty web sites, is there a market for them?


Is IPv6 support a "nice to have" feature anymore?

I work on an app that does a lot of network communication. I know that IPv4 addresses are being exhausted. At the same time, none of our customers are asking for IPv6 yet. We are examining which new features to add to the next release, so I ask: is IPv6 support a "must have" or a "nice to have" feature at this point?


Where should a programmer explain the extended logic behind the code?

I have developed a few quantitative libraries in C# where it is important to understand not only the classic information that goes with the XMLDoc comments (which contains basic information with the method signature) but also the mathematical formulas being use within the methods. Hence I would like to be able to include extended documentation with the code, which could contain, for example Latex formulas, graphs, and so on. Do you think such information should be included in the API documentation? Or should it be included in a dev blog for examples? Are there common tools that are usually used for this kind of purposes?


Methodology for documenting existing code base

I work as part of a team on an existing application that has no inline documentation, nor does it have technical documentation. As I've been working on various bug reports on the application, I've written a sort of breadcrumb trail for myself - bug numbers in various places so that the next developer can refer to that bug number to see what was going on. My question is thus: What is the most efficient method for documenting this code? Should I document as I touch the area (the virus method, if you will), or should I document from each section on its own, and not follow paths that branch out into other areas of the application? Should I insert inline comments where none previously existed (with the fear that I may end up incorrectly identifying what the code does)? What method would you use to accurately and quickly document a rather large application that has no existing inline documentation, nor inline references to external documentation?


When do you start documenting the code?

Some friends and I recently started a medium-size project. We already covered the design part (at least the first attempt) and now we are moving into coding. We already have implemented some objects of the design, just to test if everything is going as expected (we are beginners, so we do not really trust our programming skills). The project is growing really fast but I do not really know when to start documenting the code. If I do it too soon the code will probably change, and so the documentation. Is there any "golden rule" for when to start documenting the code? Is there any time which is optimal to start? or it just does not matter? Thanks! **EDIT** : I changed "commenting" to "documenting" because I realized it is not the same. Sorry. * * * **ANSWER** Thank you all for your contributions. I'll try to post here the solution I got from reading all your answers. **When do you start commenting?**   * Comment the code as you write it because...     1. you wont come back later to comment     2. it will never be clearer in your mind   * Document the API. Create a design document separated from the original code and/or comment the header of your interfaces so:     1. It gets everyone in the same page     2. It helps everyone stay in the same page (no unwanted morphing)     3. It can evolve in the future into a more elaborated document I selected @Octávio answer as the right one because it hit an important fact: comment before it is too late. Thank you all again for your insightful answers!


How do I document my code?

I'm a hobbyist programmer (with no formal education) looking to start doing small freelance jobs. One of the things that hobbyist programmers can get away with that those with a "real" job can't is lack of documentation. After all, you wrote it so you know how it works. I feel a little silly asking because it seems like such a basic thing, but how do I document my code?   * How should it be formatted?   * How should it be presented? (HTML pages? LaTeX?)   * What does/doesn't need to be documented? ...And maybe more specifics I haven't thought of. I mostly program in PHP but also C#.


What does your Technical Documentation look like?

I'm working on a large project and I would like to put together some technical documentation for other members of the team and for new programmers joining the project. What sort of documentation should I have? Just `///` code comments or some other file(s) explaining the architecture and class design? I've never really done documentation except the occasional word doc to go with smaller apps, and I think this project is too large to doc in a single word file.


What are the best documentation patterns?

I've seen a lot of different ways to [or not to] comment out the code, specially patterns on desciptions of function details and file purposes. I'd like to know what is most used pattern to do that [I'm specially interested on documentation generators and their patterns]


When to write software project documentation on code

I usually write my software projects in java, and I am still a bit confused as to when to document my classes, interfaces and methods. There are two ways: **1)** Write documentation after declaring or coding a class/interface/method/constructor. This way I am sure documentation is handled immediately. **Disadvantage:** I might modify the arguments of a method/constructor or I might modify the functionality of the class or interface and forget to edit the documentation. **2)** Write documentation after finishing the project (or a major finish/version of the project), this way I am sure to document the full functionality/arguments of methods/constructors as well as documenting all exceptions thrown. **Disadvantage:** It usually becomes another great overwhelming task to go through hundreds of classes and methods at the end of the project, trying to write documentation code. As you can see both scenarios have their disadvantages but I think one is more advantageous than the other. I am puzzled as to which. Also I am not implying this to Java alone, it can be applied to any programming language that requires documentation.


How do you create documentation when there is none?

I have recently inherited a large, legacy system with a complex codebase that has a lack of documentation. I'm the sole internal developer embedded with the core users, taking some responsibility from an external contractor. While modules and functions are documented well enough, there is no documentation around the system itself. What it is, why it exists, how overall modules fit together. This is a web-application, and an example of this is how it produces a page. This requires executing PHP that makes a call to the database that retrieves some XSLT with custom extensions, that is transformed (this process may happen many times), it may retrieve PHP _from the database_ , however sometimes when retrieving PHP, it will retrieve a PHP stub, which indicates it actually needs to retrieve a PHP file from the file system. While individual chunks of this process are captured, there is no documentation that takes a systemic or macro view of the world. So I've come in, and have begun writing what I've been able to figure out from emails to the current consultant, what I've been able to figure out from the code, and just raw determination. Because of the importance of this system, the people I work with have its important that the system can be understood, so they are less reliant on a single person - be it me, the original developer or anyone. To be honest, I am happy with this, I'm secure in my own abilities, and if part of my task is to help mitigate the organisational risk if I was to disappear then thats fair. I also enjoy the task of unravelling a giant legacy system - its a giant puzzle. However, the challenge is this - I need to produce some solid documentation around how the system works, both for me and whoever follows. While I have started to get a clear understanding, what I would like to know is **what are the kinds of things a new developer would need to see to make sence of a legacy system that was new to them?** Similarly, knowing what needs to be written **how would you tackle diving in, dissecting and documenting a large legacy codebase?**


What justifies the use of an IDE versus a standard editor?

I find myself using my text editor of choice (vim, nano, gedit, pick your poison) much more often than any IDE as of late. After noticing my ide shortcuts getting dusty I started to think about this and wonder: **what justifies use of an IDE for you opposed to a text editor**? For that matter what rationale would you have for **not** using an IDE and merely relying on an editor?


Time to drop Emacs and vi?

Every time you are looking for a text editor, no matter what language you are using, vi and Emacs are hall-of-famers. However they are ancient, and we have better alternatives (at least I hope we do). Why are developers stuck on these two editors? Shouldn't we drop them and try to invent or look for something new? _(I have full respect for Emacs and vi fans)._


Why do people use terminal text editors?

Are there any inherent advantages to a terminal text editor over a gui version of the same editor (vim and gvim for example) or are the people using terminal text editors just using them because that's what they're used to? I am not asking about vim in particular. I am asking whether, all else being equal, a terminal text editor has advantages over a gui text editor.


Must a programmer learn text editors like Emacs and Vim? How important are they?

I have been writing code so far in conventional text editors that come with the OS so far or use an IDE in some cases. I know there are some advanced text editors like `Emacs` and `Vim` available solely for the purpose of coders. How important are they really? Should a programmer dealing with `PHP`, `Python` etc. learn these editors? What are the advantages that they provide over conventional editors like `Notepad++`, `Scribes` etc.?


Why would you use vi/vim

I often see people express a preference for vi or vim for text editing or even for programming. I've tried it and I can't see how it could possibly be any faster or easier. If you use one of them, why?


How to start a development project when there are too many potential stakeholders

I've just taken on a new job at a college as (the sole) Web application developer. The college has a number of disparate but all pretty badly coded legacy systems. Mostly built in PHP they deal with things like attendance, exam results, marking etc. My first job is to build a system that incorporates a lot of this data, which is currently resting in various databases without any kind of friendly API to pull it out (the existing systems are coded in vanilla PHP with no separation of data and view) with a new platform for recording pastoral information about students and presents it to tutors and senior staff in a useful manner so they can react to issues with students quickly. In our first meeting, there were 18 people! There was no clear leader or voice that represented the majority. No identifiable _client_. The meeting swung from detailed implementation ideas on minor features from heads of faculty to arguments about whether we should use Excel spreadsheets or not for data input! As you can imagine my head was spinning at the end. I actually had a lot of good ideas but I couldn't get them heard. This is a very new role for me, before I was part of a development team in a marketing agency. We had very well defined roles: Project Manager, Client, Designer, Developer. I'd like to know if any seasoned developers or managers out their can give me some pointers on how I can whip my colleagues up into something that resembles a project team. Is agile the way to go? How would you approach handling all the disparate voices? It's clear that some process needs to be put in place very quickly, I'm just not sure what that is.


C++ for C# Developers

I know C# pretty well (self-taught, sadly) and need to do some C++ programming for a Windows application. I have been able to find a ton of information for C++ developers learning C# but haven't been able to find much on learning C++ when you already know C#. Has anyone come across a good rundown of the basics? MSDN has a comparison but it is not very in-depth. I can piece together several sources but figured something was out there - I just can't find it. Thanks for your help.


Good resources for learning about recursion

> **Possible Duplicate:**   >  Resources for improving your comprehension of recursion? I am a programmer with 2 years experience, and sometimes think I could solve a specific problem with recursion, but in most cases I fail miserably. I am asking your advice about resources for learning, refreshing and deepening one's knowledge about recursion, preferably:   * helping to identify when you could use recursion.   * practical examples (applied to contemporary programming languages).   * a reference handbook.   * source code.


Should a new class refactored out of an existing one have history pointing back to it's progenitor

If I split one class into two classes should both classes have history in source control tracing back to the original class that contained both; or should the new class be added as a new file without any history tracing back? When splitting a large class into two similar sized parts this seems like the natural approach since the older versions of the combined class will have large amounts of relevant history for both descendents. When I'm just pulling one or two methods out to create a helper class, having the complete history for the new class be >90% changes in the parent that affected code that wasn't split out seems like a recipe for confusion in the future.


Checking if my app is using any undocumented parts of the API

I just read through this question, but I am still confused. How can I know if my app is using undocumented API calls before submitting to it to the app store? Are there any tools I can use?


Decreasing vars in Scala programs

I have been studying scala for the past week or so and the ideologies associated with it and functional programming in general. As expected, the leap from imperative to functional programming is not as easy as I had hoped. For example, I converted a programming exercise that I did in Java into Scala. What I found was that it was near impossible for me to switch from mutable variables into the Scala style of immutable vals. For the TL;DR people, my main question is, how does one decrease the var usage in a functional program? For the sake of a use case, I'll provide some sample code:               import scala.io._     object Bowling {       def main(args: Array[String]): Unit = {         val input = Source.fromFile("bowling.in").getLines         for(testCase <- input) {           val numberOfRows = augmentString(testCase).toInt           var index = 0           var a = 1           var sum = 0           while(index < numberOfRows) {             sum += a             a += 4             index += 1           }           println(sum)         }       }     }      EDIT: I'm accepting Karl's answer because of its conciseness though I do really appreciate Ptharien's code example and Doval's explanation of functional concepts as a whole.


I can't remember programming 5 mins after learning?

I'm learning Java, and I found a great teacher. He explains everything perfectly. I understand it _all_. My problem, is that after learning a short section, for example "Nested If Statements" or "Many Methods and Instances", I can type it all great, but in 5 mins, after going on to a new section (when I'm comfortable with the last section) I forget the code to type for the last section. Any tips or techniques you guys use to remember code????


How do you keep cool when production system goes down?

This has happened to most of us... You come to work one day. Everything seems normal - the sun is shining, birds are chirping, but you notice a couple of weird things on your way to work that remind you of the déjà vu cat in the Matrix. You get into the office and there are a lot of phones ringing - but it could just be that they are doing a new sales promotion. You settle in, when you notice a dark cloud hovering over you. It takes you a couple of moments, but you recognize the cloud is your boss. Usually he checks on you every morning with his "Soooo Peeeeter, how about those TCP/IP reports?" routine, but today he forgot everything about common manners and rudely invaded your personal space. No "Good Morning", just some drooling, grunts and curses. He reminds you a bit of a neanderthal who is trying to get away from a cyber -toothed tiger, fear and panic all compressed in a tight ball. You try to decipher the new language that he created since yesterday and you start understanding that something bad happened overnight - the production system went down. Now, your system is usually used by clients during regular working hours from 9-5, but for whatever reason you didn't get any alerts on your beeper (for people under 30 - a beeper was like a mobile phone that could only ring and tell you who beeped you). You'll need to remember to charge it next time. So it is now 8:45am, and the system MUST be up at 9am. Every 10 seconds, your boss lets out yet another curse which communicates to you that another customer is having problems getting into the system. Also, several account managers are now hovering over your boss trying to make him understand how clients are REALLY REALLY suffering. Everyone is depending on you to get the system up ASAP and at the same time is hindering your progress by constantly distracting you. How do you keep cool in a situation like this?


Coding guidelines for seamless merging

I am looking for coding guidelines developers should follow while writing C#/ASPX/SQL code, so that merging into other branches is smooth if not seamless.


Should every programmer keep a "Lessons Learned" journal?

Every time I've finished a project, there is always something that I've learned (otherwise I don't find it very motivating). But I can't remember everything, and much later I may stumble across the same problem that I encountered in a previous project but no longer how I solved it (or at least what attempts I made). So would it be a good idea to write this down in a journal of some sort? I know that writing stuff down feels like writing documentation (which not everyone enjoys doing), and hope our memory to serve us when needed. But having it documented, it could be shared with other programmers and learn what lessons they learned. So, what do you think?


What to do when opensource project starts to tear apart? (or a manager tries to write code and then shouts at the team)

I'm working on an open source cross-platform client/server app. It is fairly complex and it's taken months for a group of developers to get it where it is now. At one point the team lead decided to implement a feature on his own. He had some development experience, but not a lot. He failed and the other developers finished the job for him. Since then his attitude got a lot more negative. He's trying to tell developers that their work is of poor quality and that all work should first be discussed with him. The current setup is that all team members are marked as "project owners" and thus have equal rights in the project. The team leader is now offering the developers the choice between always talking to him first or being demoted from project owners to contributors. So what are our options as developers? What arguments we can provide to the team leader to calm him down? Is it possible to save the project or is it better to fork out now? An important issue is that lately we had no active ticket system, and I personally think that this was the reason the mess appeared. So... any ideas?


Is it good idea to require to commit only working code?

Sometimes I hear people saying something like "All committed code must be working". In some articles people even write descriptions how to create svn or git hooks that compile and test code before commit. In my company we usually create one branch for a feature, and one programmer usually works in this branch. I often (1 per 100, I think and as I think with good reason) do non-compilable commits. It seems to me that requirement of "always compilable/stable" commits conflicts with the idea of frequent commits. A programmer would rather make one commit in a week than test the whole project's stability/compilability ten times a day. For only compilable code I use tags and some selected branches (trunk etc). I see these reasons to commit not fully working or not compilable code:   1. If I develop a new feature, it is hard to make it work writing a few lines of code.   2. If I am editing a feature, it is again sometimes hard to keep code working every time.   3. If I am changing some function's prototype or interface, I would also make hundreds of changes, not mechanical changes, but intellectual. Sometimes one of them could cause me to carry out hundreds of commits (but if I want all commits to be stable I should commit 1 time instead of 100). In all these cases to make stable commits I would make commits containing many-many-many changes and it will be very-very-very hard to find out "What happened in this commit?". Another aspect of this problem is that compiling code gives no guarantee of proper working. So is it good idea to require every commit to be stable/compilable? Does it depends on branching model or CVS? In your company, is it forbidden to make non compilable commits? Is it (and why) a bad idea to use only selected branches (including trunk) and tags for stable versions?


Why does the code auditing tools like FindBugs require a compile step to work properly?

Basically I ran Intellij Idea 's plug in called FindBugs-Idea to analyze my code . I corrected whatever errror was caught and then ran the tool again but it was still complaining about the same error even though it was fixed in the source file . It only stopped complaining after I recompiled my classses . Why does it require a compilation step ? Shouldn't it basically look in the source file and detect a possible bug ? How do these tools work in general ?


What's the name of this pattern involving multiple inputs and what to do based on an input?

If I've got code similar to this (although perhaps not as constrained as warning levels):               switch(item.StatusCode)     {         case StatusCode.SUCCESS:             CallSuccess(item);             break;         case StatusCode.WARNING:             CallWarning(item);             break;         case StatusCode.ERROR:             CallError(item);             break;     }      I often find myself converting it to something more like:               var behaviors = new Dictionary<StatusCode, Action<Item>>     {         {StatusCode.SUCCESS, (item) => CallSuccess(item)},         {StatusCode.WARNING, (item) => CallWarning(item)},         {StatusCode.ERROR,   (item) => CallError(item)},     }          behaviors[item.StatusCode](item);      I find that in a lot of cases this makes for more maintainable code. Is this a pattern, does it actually help like I think it does, and what's its name?


What does 'stage' mean in git?

I find git hard to understand as I could not find the meaning of the words used for the actions. I have checked the dictionary for the meaning of 'stage' and none of the meanings were related to source control concepts. What does 'stage' mean in the context of git?


Differential and integral calculus for programmer

> **Possible Duplicate:**   >  Where is the application of Calculus(of continuous quantities) in Computer > Science or programming   >  How can calculus and linear algebra be useful to a system programmer? Differential and integral calculus is part of my degree but I don't understand why. Where does it come in play, where is it used?


Where is the application of Calculus (of continuous quantities) in Computer Science or programming

I am a Software Engineer professional. I have studied calculus as a core course in my graduation studies. I want to ask question, that what/where is the implementation of calculus in computer science?


mysql fulltext search table design

I have been working on a Mysql db design which keyword based search seems to be necessary. Main table has two columns:               id | Title      For each entry, users will be required to enter 4 or 5 keywords. I think using a seperate table for keywords would be better. I would like to learn if there is any difference between these two designs in terms of performance, scalability and management. There will be millions of rows in the main table.               id | keywords     1  | 1kword1, 1kword2, 1kword3     2  | 2kword1, 2kword2, 2kword3      Or               id | keyword     1  | 1kword1      2  | 1kword2      3  | 1kword3     4  | 2kword1      5  | 2kword2      6  | 2kword3


Where can I get feedback and support from other programmers in real time?

I used to work in an office surrounded by a large team of programmers where we all used the same languages and had different expertises. Now that I am on my own forming a startup at home, my productivity is suffering because I miss having people I can talk to for specific help, inspiration and reality checks when working on a coding problem. I don't have access to business incubators or shared (co-working) office spaces for startups so I need to chat with people virtually. Where can I go for real-time chat with other programmers and developers (currently I'm looking for people developing for the web, javascript and python) for live debugging and problem-solving of the tasks I am working on? And what other resources can I use to get fellow programmer support?


Flow is a concept introduced by Mihaly Csikszentmihalyi; in short, it means to get into the "zone". You feel immersed in your task, focused; the task can be difficult but challenging at the same time. When people achieve flow their productivity shoots up. Programming requires a great deal of mental focus because we often need to juggle several things in our minds at once. Many like to work in a quiet environment where they can direct their full attention to the task. If they are interrupted, it may take several minutes or even hours to get back into flow. I understand there's a practice in agile development and extreme programming called pair programming. It means you put the whole software development team in one room so that communication is seamless. You do write code with your pair because this way you get instant code reviews and fewer bugs get through. I've always had problems achieving flow while doing pair programming because of constant interruptions. I'm thinking deep about an issue then all of sudden someone asks me a question from another pair. My train of thought is lost. How can you achieve and maintain flow while pair programming?


MVC/P in Desktop Application

I am developping a desktop application in C#, and have separated different layers in an MVC-ish architecture. As I have switched from GTK# to XWT, only views had to be adjusted, so the seperation of layers was done quite OK. As XWT does not have a layout designer, everything has to be set up in code, which in turn led to an architectural problem: I have one controller for displaying outlets, inlets and connections. This controller sends data to one view (outlined in red). This view in turn has subviews (green and blue), that only communicate with the view in red. ![Layout of view](http://i.stack.imgur.com/sQ2RT.png) On scrolling / collapsing / expanding the treeviews, the green view send events, which are received by the red view, which in turn trigger redrawing in the blue view. Controller does not see the green or blue views, every change in connections / outlets / inlets are only sent to the red view. My problem: As I understand MVC, views should not have much logic. But the green views is a class of 300 lines, the red view's class has 200 lines, which is too many. What architectural problem can arise from this? Am I overlooking a fault in my MVC logic?


How to increase the bus factor and specialize at the same time?

In agile pair programming it is recommended to switch pairs every now and then so as to increase the bus factor of the team. That means, most people in the team should work on different parts of the system at different times so that everyone has an understanding of it. Now it is impssible that everyone has an expert level of understanding of each part of the system. That's because people are urged to specialize in one area of expertise. If you are an expert database admin, what's the point of working on the user interface of the system when you switch pairs? You will not be able to do such a high quality job as someone who has extensive experience in UI design. How can you increase the bus factor and make sure that you have specialization in your team?


Does using GCC specific builtins qualify as incorporation within a project?

I understand that linking to a program licensed under the GPL requires that you release the source of your program under the GPL as well, while the LGPL does not require this. The terminology of the (L)GPL is very clear about this.               #include "gpl_program.h"      means you'd have to license GPL, because you're linking to GPL licensed code. And               #include "lgpl_program.h"      means you're free to license however you want, so that it doesn't explicitly prohibit linking to LGPL source. Now, my question about what isn't clear is: [begin question] **GCC is GPL licensed, compiling with GCC, does not constitute "integration" into your program, as the GPL puts it; does using builtin functions (which are specific to GCC) constitute "incorporation" even though you haven't explicitly linked to this GPL licensed code? My intuition tells me that this isn't the intention, but legality isn't always intuitive. I'm not actually worried, but I'm curious if this could be considered the case.** [end question] [begin aside] The reason for my equivocation is that GCC builtins like `__builtin_clzl()` or `__builtin_expect()` are an API _technically_ and _could_ be implemented in another way. For example, many builtins were replicated by LLVM and the argument could be made that it's not implementation specific to GCC. However, many builtins have no parallel and when compiled will link GPL licensed code in GCC and will not compile on other compilers. If you make the argument here that the API _could_ be replicated by another compiler, couldn't you make that identical claim about any program you link to, so long as you don't distribute that source? I understand that I'm being a legal snake about this, but it strikes me as odd that the GPL isn't more specific. I don't see this as a reasonable ploy for proprietary software creators to bypass the GPL, as they'd have to bundle the GPL software to make it work, removing their plausible deniability. However, isn't it possible that if builtins don't constitute linking, then open source proponents who oppose the GPL could simply write a BSD/MIT/Apache/Apple licensed product that links to a GPL'd program and claim that they intend to write a non-GPL interface that is identical to the GPL one, preserving their BSD license until it's actually compiled? [end aside] Sorry for the aside, I didn't think many people would follow why I care about this if I'm not facing any legal trouble or implications. Don't worry too much about the hypotheticals there, I'm just extrapolating what either answer to my actual question could imply.


Testing Framework Selection: xUnit family theory

**Background:**   I am familiar with xUnit family frameworks and have had experience with (shunit2, PhpUnit and simpletest). I am currently trying to find a testing framework for C++. I did a quick search for frameworks using Wikipedia's list of documented frameworks; however, the framework I would like to use is very difficult to setup and is poorly documented. There is another framework that I have tried that was (IMHO) extremely easy to setup and integrate into my production workflow. The difference between my framework of choice (the one that is difficult to setup) and the one that I'm currently using (the one that was easy to setup) is compliance with xUnit methodology. **Questions:**   1\. I have read quite a few articles about xUnit testing frameworks. I believe that they use similar naming conventions and testing methods for their test. Is this true and what are the naming methods utilized?   2\. Does staying with xUnit testing frameworks make it easier to run integration tests when using multiple languages?   3\. From a training perspective is it more cost effective to teach new programmers a set of tools based on the same concept or different individual tools that do the same thing? _I kept the frameworks that I am looking at anonymous because I am more interested in industry best practices than a comparison of the two said frameworks_


EPL-Licensed Library with Closed-Source Commercial Product

The Eclipse Public License is not entirely clear for me. As I understand it, anyone who redistributes a Library whose code is licensed under the EPL is considered to be a Contributor. It then states that you are not required to redistribute source-code but you must make mention of where to obtain it. Other websites have said you do not need to release the source code of your project unless you specifically modify parts of the EPL-licensed program, but from reading the license, it seems to indicate otherwise. If I would like to use Library X in my Java program where I link the library to my project via the Build Path and then redistribute Library X with my program, am I required to allow the obtaining of the source code or not, "Ask A Lawyer" advice aside.


Splitting code from form operations in C#

I have a large (at least for me - approximately 10k lines) project that is written in C#. I have a treeview object on the left of my form and i have many nodes on my treeview. When i click a node, i bring up a panel on the right side of form. Since i only do GUI item operations (filling textboxes, clicking buttons, showing images on pictureboxes etc.), i write all of my code into MainForm class. This seems not very good but on the other side, i think i have to write into MainForm class because all of my job is to evaluate form items on panels. What should i do to write a more portable or understandable code? Do i have to write into MainForm class or do i have some options or methods to implement?


Where to position logging statements

I have the following classes :               class Task     {         public void DoSomething()         {              var s = new Service();             s.First();             s.Second();             s.Third();         }     }          class Service     {         public void First() {};         public void Second() {};         public void Third() {};     }      If I want to add logging, should I put logging statements like this :                   public void DoSomething()         {              Log("new");             var s = new Service();                  Log("First");             s.First();                  Log("Second");             s.Second();                  Log("Third");             s.Third();         }      Or should I put each statement inside the called methods of Service class ? I know it is quite subjective, and won't change a lot of things, but I'm curious about the pros and cons of each approach. Update : I'm not asking about verbosity or level, just about placement of the logging statements.


Hourly rate benefits for the customer

It is good for a developer to work on a per-hour basis, but it's hard to explain the advantages of hourly rate to the customer. What are your arguments on the hourly rate for the customer? How do you explain him his benefits and how do you argue on "I want to know the exact cost of the project"?


Pros and cons of custom exceptions

This may be an pointless question based on opinion, style, and context but I've been racking my brain trying to decide whether or not to make use of custom exceptions and would love to hear some pros and cons from anyone with experience from both approaches. For example I'm trying to decide between a custom ObjectNotFoundException vs IllegalArgumentException/IllegalStateException. (Please note that I am not intending to throw an exception whenever a service cannot find an object with a given identifier. We simply return a null in that case. I'm speaking of when an action is to be performed on an object with a given identifier. In this case, the object in question is expected to exist, so if it does not, we want to throw an exception.) On one hand, a "GiraffeNotFoundException" is explicit and could be handled differently than a generic IllegalStateException, but then again I suppose that would only matter if such a differentiation is actually required. Another pro is that a custom message for such an exception can be set as the default message for this exception (reducing a bit of redundancy). On the other hand, it might not be a good idea to clutter the source code with custom exceptions. Also with standard exceptions, the Assert class from spring can be used quite efficiently. There are no intentions of publishing our code as a third party library so there are no pressures for using standard exceptions from that end. Any other thoughts?


What are possible/useful implementations when extending exceptions?

I have seen a lot of exceptions - custom or integrated in the language (PHP) itself that have no differences but their class name. When extending default exceptions to use within your own code, are there any other things you could implement that are useful besides the more specific exception name that do not violate things like single responsibility?


GoF Design Patterns - which ones do you actually use?

I'm trying to educate my colleagues in the area of design patterns. Some of the original Gang of Four patterns are a little esoteric, so I'm wondering if there is a sub-group of "essential" patterns that all programmers should know. As I look through the list, I think I've probably used -   * Abstract Factory    * Factory Method   * Singleton    * Bridge    * Facade    * Command Which ones do you actually use in practice, and what do you use them for? Link for those wanting a list of patterns


Why isn't reflection on the SCJP / OCJP?

I read through Kathy Sierra's SCJP study guide and I will read it again more throughly to improve myself as a Java programmer and be able to take the certification either Java 6 or wait for the Java 7 exam (I'm already employed as Java developer so I'm in no hurry to take the exam.) Now I wonder why reflection is not on the exam? The book it seems covers everything that should be on the exam and AFAIK reflection is at least as important as threads if not more used inpractice since many frameworks use reflection. Do you know why reflection is not part of the SCJP? Do you agree that it's at least important to know reflection as threads? Thanks for any answer


Do input template languages exist?

When I have to create some textual representation of data, I can use a template language, so that my code does not have to worry about the structure of the output file - I can sometimes even write code that's independent of whether the output is XML, LaTeX or any other plain text. A simple example: Template (in separate file):               <someXmlTag>     $variableName     </someXmlTag>      Code:               Template(temstring).substitute(variableName="value")      Result (written to output file):               <someXmlTag>     value     </someXmlTag>      I want to do the same, but in the opposite direction. I have XML or plain text or whatever files to input. I want to describe the input structure in a separate file that looks like the input but has these variable declarations in it, and I want to handle it with code that's independent of the structure. **Has this been done before? What approach was used and how did it work out?** (We usually handle XML input by using an XML parser library to describe the input structure in program code, handle plaintext input by writing regexes in code, and don't handle LaTeX input because LaTeX can't really be parsed.)


What are some precedents on how substantial a snippet must be to be copyrightable?

I occasionally worry that when I borrow snippets of code from websites, etc. there's at least the theoretical possibility that this will be copyright infringement. However, small pieces of code to accomplish common tasks may be too unoriginal for copyright and in practice this kind of sharing happens all the time. What are some **rules of thumb** , ideally supported by legal precedent, as to how substantial and original a piece of code must be to be copyrightable? P.S. I **know** there are no hard and fast rules on this and that a definitive answer to a specific case requires a lawyer. However, since I'm only looking for rules of thumb here, answers to this effect will be downvoted.


ETL Software Research Question

Where I work, we use an in-house ETL solution that's homegrown and has been around for 5-10 years. I'm still new to my data analysis job, but I was wondering about the ETL tools that are out there. This is a new area for me. My situation, and job, is basically   * digging in a set of databases (DB2, SQL2005, Citrix, Ancient Cobol Database with a SQL Wrapper on top, MySQL, etc).   * Gather the desired information.   * combine the different datasets into one set.    * output into a file of choice (CSV, Tab Separated, Pipe Separated, XLS, etc).   * FTP to customer. I guess what my real question is, given my job, what are some good ETL suites that I can look at and compare to my in-house tools? This is more to research some other options. Ultimately, I'd either suggest a new solution or get options/ideas to improve our current app.


Should you sacrifice code readability with how efficient code is? e.g. 3 lines of code into 1 line. I read in _Code Craft_ by Pete Goodliffe that readability is key. Your thoughts?


Database Change Auditing - Part of or Abstracted from ORM / Application Layer?

My fellow developers and I are at a crossroads in how to go about continuing our auditing of database changes. Most of our applications log changes via `INSERT`, `UPDATE`, and `DELETE` triggers. A few of our newer applications audit at the ORM layer; specifically using Hibernate Envers. While ORM layer auditing provides a much cleaner interface and is much more maintainable, it will not capture any manual database changes that are made. ORM layer auditing also means that our libraries will currently require a dependency on our ORM implementation unless, specifically in our case for example, JPA plans on providing something in the near future. Is there a common paradigm that addresses this?


What is REST (in simple English)

Lately I have become interested in familiarizing myself with REST. I tried reading wiki entry on REST, but it was of no help. I would really appreciate it if someone can explain in simple English (that is without **unnecessary** tech jargon)   1. What is REST   2. What position it occupies in web architecture ecosystem   3. How tightly (or loosely) it is coupled with protocol.   4. What are the alternatives to REST and how does REST compare with them. I understand it may not be possible to answer this in one or two paragraphs, in that case relevant links will be highly appreciated.


How could the first C++ compiler be written in C++?

Stroustrup claims that Cfront, the first C++ compiler, was written in C++ (Stroustrup FAQ). However, how is it even possible that the first C++ compiler be written in C++? The code that makes up the compiler needs to be compiled too, and thus the first C++ compiler couldn't have been written in C++, could it?


How can CoffeeScript be written in CoffeeScript?

How is it possible that written a programming language like CoffeeScript in itself like CoffeeScript? Firstly CoffeeScript doesn't exist that read CoffeeScript scripts and interpret them?


C is written in C, how is this possible?

> **Possible Duplicate:**   >  How could the first C++ compiler be written in C++? I know my question goes to the underground galaxy cave where languages are born and involves some lambda math and light-years of google-studying. But what kind of knowledge is necessary to create a language?


What should my "large codebase sample" look like?

If an employer asks for a large code sample, one for an entire project, what characteristics should the project have to show architectural skills and the ability to manage a large codebase? For example, should I show off managing modules/dependencies? writing test/build scripts? design patterns? etc.


What licensing implications (if any) are there when porting code from one language to another?

I'm considering taking an old PHP4 web application and re-writing it using ASP.Net MVC4 in C#. The old application was licensed under GPL2. I'm unsure how this affects my new application, if at all. I obviously can't directly copy any of the code from the old PHP application to my .Net application as the two languages are totally different. Equally, the old application wasn't even OO in nature, nor did it follow any kind of design pattern (i.e. MVC). In essence, my new application will only be taking the "ideas & features" of the original application. Even the database schema will be significantly different. Would I still have to GPL my new application or is it considered a new work where I choose a license myself?


Porting an LGPLv3 library to a different language under Apache v2 License

Is it legal / ethical to port a library that is written in C under LGPLv3 to (pure) Go under the Apache v2 license? Keep in mind the port will be 100% compatible with full attribution to the original author and it will be a complete rewrite being a different language and all.


Difference between Pattern and Principle

What is the difference between Object Oriented Design Patterns and Principles? Are they different things? As far as I understood both of them try to achieve some common goal (e,g. flexibility). So can I say a pattern is a principle and vice versa? Design Principle = SOLID (i.e. Dependency Inversion Principle) Design Pattern = Gof (i.e. Abstract Factory Pattern)


Is a client side developer usually expected to do design work also, or know designing and CSS as well?

If I'm applying for a client side developer job, am I usually expected to know designing as well? Such as CSS? I have knowledge of JavaScript, JQuery, Ajax and HTML5 basics, and HTML DOM. Is this enough or should I also be able to style nicely in CSS? I have a basic knowledge of CSS, but I certainly can't style anything at all. And I really dislike CSS or styling tasks


XML vs SQL for small projects?

I'm working on a small project which will only have one user at a time since it's a local application (developed in WPF and C#). To store data I was thinking of using an XML file but I'm wondering if this would be the best approach. What the data is for:   * Shedules   * Library of files in folders (with Artist name, Title, Location on HDD)   * Possibly statistics based on the shedule data   * ... Information regarding the library would be fine in XML I imagine but about all the rest I'm not so sure. Also LINQ to SQL seems to be alot more profitable in terms of development speed than LINQ to XML. Is this correct or am I wrong? I was unsure if I should post this on SO or here but it seemed more appropriate here! Thank you in advance


How to create different paths for users to take through the pages in my site?

I have a website where users are directed to go through a sequence of pages to perform a sequence of work tasks (transcribe a paragraph, answer a survey, interact with another user, etc). For short, let's call these tasks A, B, C, etc. I'm using Django, and each task is currently implemented as a view function (or method), e.g. `def A(request)`. Currently, each view function has the next step hardcoded in an HTTP redirect, e.g. `HttpResponseRedirect(reverse(B))`. My challenge is that I will soon have a requirement to create various permutations of the sequence of tasks. Sometimes I will want users to do A, B, C; for others, B, C, D; for others, A, B, D, F. How can I architect this so that I can define these permutations elegantly and concisely in my code? Intuitively, I feel like I need to genericize the HTTP redirect calls with a variable, like: `HttpResponseRedirect(reverse(next_view_function))`, but I struggle to figure out where `next_view_function` should be defined, and how the definition of the sequence (e.g. A, B, D) should be persisted across requests. Can anyone lead me down the right path with a suggestion or idea? I'm happy to provide more details. **Edit** in response to Bart's questions:   * The order of tasks is predetermined. Once we have defined it, we send the users a URL that takes them to the first page. They should then be routed through the tasks. One group of users might get a URL that takes them through steps A,B,C, while another group of users gets a URL that takes them through steps A,B,D. We decide in advance which users should get which URL.   * Since the order is predetermined, the next step does not depend on the results of the current task. The only requirement is for them to complete the task (we of course validate the POST data they submit as a precondition to the HTTP redirect). **Edit 2** , my solution so far: A central concept in my code architecture is that of a "Treatment" (defined in my models.py). A Treatment is a specification of the experience a user has when they use my site, such as what UI is presented to them. I split my users into groups and assign each group to a different treatment by emailing them a URL that contains the PK of their treatment. (There are also different subclasses of Treatment, since some Treatments are totally different from others. SoccerTreatment and HockeyTreatment have little in common, so it makes sense to subclass them.) So, the class definition for a Treatment seems like the sensible place to store the sequence of views as a Python list, as follows:               # in soccer/models.py     class SoccerTreatment(BaseTreatment):              world_cup = models.BooleanField()         ....              def views(self, request):             seq = [soccer.views.ViewClassA]             if self.world_cup:                 seq.append(soccer.views.ViewClassWorldCup)                  return seq          # in shared/models.py     class BaseTreatment(models.Model):             def next_view(self, request):             seq = self.views() # views() method implemented by descendant classes             if request.session.get('current_view_index'):                 request.session['current_view_index'] += 1             else:                 request.session['current_view_index'] = 0             # [handle boundary cases, code snipped...]             # ...             return seq[request.session['current_view_index']]                   # ...          # in views.py, at the end of a view function     # ...     HttpResponseRedirect(reverse(user.treatment.next_view()))      However, the design above wouldn't work, since then models.py would have to import views.py, creating a circular import. So the list elements would have to be strings (either URLs, or a the name of the view class as a string), which could be brittle since renaming my classes or URLs won't automatically rename these strings. Maybe I am being too picky, but I wonder if there is a better design.


Chain class behaviour

I have a Bird class. A bird can learn and a bird can fly (methods). A bird can only fly after it learns. Considering both methods are public. How can you make this clear to another fellow developer. Usually they should take a look at the public method names and understand what they do. But how can he understand without reading comments or understand the encapsulated code that method2 can be called only after method1?


25 years old and considering a career change...possible? practical?

I'm new to this site and new to programming as well. I've spent some time going through an intro cs book that uses python as the language of choice. I find the exercises interesting and engaging and I generally have had a favorable experience programming so far. I've gone through some of the basics with python like writing simple programs, basics of GUIs, manipulating strings, lists, defining functions, etc. And I've always loved technology. Although I've never done any real hardcore programming yet, I was inclined to building websites from a very young age but I never really developed my skills. Now, the thing is I'm 25, I have my bacholors in environmental studies and two masters degrees in urban planning and landscape architecture respectively. I know, it would be quite a departure to pursue a career in programming at this point. Currently, I'm working as a geographic information systems intern. I've taken some GIS classes and have a lot of experience with making maps, doing spatial analysis etc. So what I'm thinking is maybe I can learn some solid programming skills and apply these skills in the field of GIS. From what I've seen, .net languages are the norm in this arena. Could you perhaps provide some guidance to me in terms of what languages I should focus on or courses I should take at this point? What about for building web mapping applications? Also, I was thinking about getting a certificate in programming from a university extension program. Do you think it would be worth it? And furthermore, do you think potential employers would be interested in hiring someone like me (once I get a couple of languages down pretty well) as an intern or in an entry level position? I'll be living in the bay area so I feel that there should be decent opportunities even though I don't have a b.s. in cs.