_id
stringlengths 1
6
| title
stringlengths 15
150
| text
stringlengths 30
21.8k
|
---|---|---|
228054 | Are (mostly) client-side JavaScript web apps slower or less efficient? | I am in the midst of writing a web application for work. Everything is from scratch. I have been a PHP programmer for about 13 years, Node.js programmer for the past 2 years, and have no shortage of experience with JavaScript. I love Node.js, and recently rebuilt the company's API in it... So, in planning this web application, the approach I'm considering is, have the Node.js API for getting data from the server, but render everything in the browser. Use AJAX for retrieving data, History API for loading pages, and a MVC-like pattern for the different components. I have read articles detailing twitters rebuild a few years ago. It was more or less a client-side JavaScript app, but a couple years after launching it, they started moving a lot of processing/rendering back to the server, claiming the app improved dramatically in terms of speed. So, my question is as the title asks, is a client-side centric app substantially slower? |
110557 | How can a team apply the Scrum methodology without a clear customer? | Our team is trying to understand and adapt Scrum and other agile practices, but we can not figure out how to deal with customer feedback when there is no customer. Every document about the subject emphasizes how important is having the customer involved in every sprint and how having early feedback helps correcting problems fast and maximizes satisfaction to both sides. I understand clearly this point. In our case, we have no single customer. We develop a website and a smartphone app for an already established and growing audience. I am sure this is a fairly common case so I would like to know some real world experience about how to apply and manage Scrum in this case. Do you just decide all features by yourselves or do incorporate user testing in the sprint? Any other solution? |
11546 | Are there laws to protect us from hackers who disclose vulnerabilities prior to alerting the vendor? | Take the example of the recent ASP.NET (and Java Server Faces) vulnerability disclosure at a Hacker conference in Brazil. It's my understanding that the poet tool was demonstrated before Microsoft was even aware of the issue. Are there laws to protect legitimate customers from people who encite the hacker community to start hacking all the ASP.NET servers they can? Who knows how many legitimate businesses were compromised between when the tool was demoed and the patch was applied to the server. |
89378 | Is EF4 mature enough with MySQL or Oracle? | Is Entity Framework 4 with MySQL or Oracle mature enough to be used on production level web application? Can it provide high level of performance, or should we stick with just plain data access with `SqlCommand`? |
232179 | Are patches a bad sign for the customer? | At the office we just got out of a long period where we released patches on a too-frequent basis. Near the end of that period we were doing almost three patches per week on average. Beside that this was very demotivating for the developers, I was wondering what the customer would think about this. I asked the question myself and concluded that I never knew software that was updated that frequently. However, for the case that comes the closest I do not care really since the patches are pretty quickly applied. The customers which received these patches differ a lot from each other. Some were really waiting for the patch where others did not really cared, yet they all got the same patches. The time to update the customers software is less than 30 seconds, so I do not expect any problems concerning time. They do need to be logged out though. So my question in more detail: Is getting updates frequently giving a 'negative' message to the receiver? Of course, I could ask the customers, but I'm not in that position nor do I want to 'Awaken the sleeping dogs'. PS: If there is anything I could do to improve my question, please leave a comment. |
19397 | Why would anyone need this java syntax? | One day while trawling through the Java language documentation, as you do, I found this little beauty lurking within Double: 0.25 == 0x1.0p-2 Now, obviously (!) this means take the number hexadecimal 1 and right shift it decimal 2 times. The rule seems to be to use base 16 on the integer side and base 2 on the real side. Has anyone out there **actually used the right hand syntax** in a necessary context, not just as a way getting beers out of your fellow developers? |
19392 | When is it better to offload work to the RDBMS rather than to do it in code? | Okay, I'll cop to it: I'm a better coder than I am at databases, and I'm wondering where thoughts on "best practices" lie on the subject of doing "simple" calculations in the SQL query vs. in the code, such as this MySQL example (I didn't write it, I just have to maintain it!) -- This returns the username, and the users age as of the last event. SELECT u.username as user, IF ((DAY(max(e.date)) - DAY(u.DOB)) < 0 , TRUNCATE(((((YEAR(max(e.date))*12)+MONTH(max(e.date))) -((YEAR(u.DOB)*12)+MONTH(u.DOB)))-1)/12, 0), TRUNCATE((((YEAR(max(e.date))*12)+MONTH(max(e.date))) - ((YEAR(u.DOB)*12)+MONTH(u.DOB)))/12, 0)) AS age FROM users as u JOIN events as e ON u.id = e.uid ... Compared to doing the "heavy" lifting in code: Query: SELECT u.username, u.DOB as dob, e.event_date as edate FROM users as u JOIN events as e ON u.id = e.uid code: function ageAsOfDate($birth, $aod) { //expects dates in mysql Y-m-d format... list($by,$bm,$bd) = explode('-',$birth); list($ay,$am,$ad) = explode('-',$aod); //Insert Calculations here ... return $Dy; //Difference in years } echo "Hey! ". $row['user'] ." was ". ageAsOfDate($row['dob'], $row['edate']) . " when we last saw him."; I'm pretty sure in a simple case like this it wouldn't make much difference (other than the creeping feeling of horror when I have to make changes to queries like the first one), but I think it makes it clearer what I'm looking for. Thanks! |
155638 | Designing a Content-Based ETL Process with .NET and SFDC | As my firm makes the transition to using SFDC as our main operational system, we've spun together a couple of SFDC portals where we can post customer- specific documents to be viewed at will. As such, we've had the need for pseudo-ETL applications to be implemented that are able to extract metadata from the documents our analysts generate internally (most are industry- standard PDFs, XML, or MS Office formats) and place in networked "queue" folders. From there, our applications scoop of the queued documents and upload them to the appropriate SFDC CRM Content Library along with some select pieces of metadata. I've mostly used DbAmp to broker communication with SFDC (DbAmp is a Linked Server provider that allows you to use SQL conventions to interact with your SFDC Org data). I've been able to create [console] applications in C# that work pretty well, and they're usually structured something like this: static void Main() { // Load parameters from app.config. // Get documents from queue. var files = someInterface.GetFiles(someFilterOrRegexPattern); foreach (var file in files) { // Extract metadata from the file. // Validate some attributes of the file; add any validation errors to an in-memory // structure (e.g. List<ValidationErrors>). if (isValid) { var fileData = File.ReadAllBytes(file); // Upload using some wrapper for an ORM or DAL someInterface.Upload(fileData, meta.Param1, meta.Param2, ...); } else { // Bounce the file } } // Report any validation errors (via message bus or SMTP or some such). } And that's pretty much it. Most of the time I wrap all these operations in a "Worker" class that takes the needed interfaces as constructor parameters. This approach has worked reasonably well, but I just get this feeling in my gut that there's something awful about it and would love some feedback. Is writing an ETL process as a C# Console app a bad idea? I'm also wondering if there are some design patterns that would be useful in this scenario that I'm clearly overlooking. Thanks in advance! |
155639 | Which algorithms/data structures should I "recognize" and know by name? | I'd like to consider myself a fairly experienced programmer. I've been programming for over 5 years now. My weak point though is terminology. I'm self-taught, so while I know how to program, I don't know some of the more formal aspects of computer science. So, what are practical algorithms/data structures that I could recognize and know by name? Note, I'm not asking for a book recommendation about implementing algorithms. I don't care about implementing them, I just want to be able to recognize when an algorithm/data structure would be a good solution to a problem. I'm asking more for a list of algorithms/data structures that I should "recognize". For instance, I know the solution to a problem like this: > You manage a set of lockers labeled 0-999. People come to you to rent the > locker and then come back to return the locker key. How would you build a > piece of software to manage knowing which lockers are free and which are in > used? The solution, would be a queue or stack. What I'm looking for are things like "in what situation should a B-Tree be used -- What search algorithm should be used here" etc. And maybe a quick introduction of how the more complex(but commonly used) data structures/algorithms work. I tried looking at Wikipedia's list of data structures and algorithms but I think that's a bit overkill. So I'm looking more for what are the essential things I should recognize? |
127472 | Is Agile Development used in Machine Learning and Natural Language Processing? | I've been developing web apps for a while now and it is standard practice in our team to use agile development techniques and principles to implement the software. Recently, I've also become involved in Machine Learning and Natural Language Processing. I heard people primarily use Matlab for developing ML and NLP algorithms. Does agile development have a place there or is that skill completely redundant? In other words, when you develop ML and NLP algorithms as a job, do you use agile development in the process? |
103545 | Switching from SVN to Mercurial: one repository or many? | We currently have a large Subversion repository, with a tree like: root /libraries /library1 /trunk /library2 /trunk /solutions /solution1 /trunk /solution2 /trunk There are 81 solutions and 22 libraries. The `trunk` subdirectories were added so we could use branches, but in practice, we don't use branches at all. My question is: if we migrate this to Mercurial, should be set up one big Mercurial tree with the same structure? Or should we create 81+22 Mercurial repositories? |
123857 | Allowing the user to specify the location of a logfile | I'm working on an application, and adding logging, but now I'm stuck. I want to allow ( _not force!_ ) the user to set the location of the logfile. Basically, my problem is: * logger initialization should be the first thing the program does * but I can't initialize the logger until I determine where the user wants the log to be saved * determining where the log should be saved ... is a process that should be logged How is this problem solved? Are log file locations not user-customizable? Is log output buffered until a logfile is set? |
254376 | How to implement a genetic algorithm with distance, time, and cost | I want to make a solution to find the optimum route of school visit. For example, I want to visit 5 schools (A, B, C, D, E) in my city. Given the choice of five routes regarding what school I should visit first, then the second, then the third etc., how do I calculate the efficiency of each route with distance, time, and cost criteria? Once I've done this, how do I use my calculations (distance with time and cost fuel usage) in a genetic algorithm to find the optimum route? |
215304 | Is this a typo in the Artistic License 2.0? | _I'm not sure if this would fit better inStackExchange/English, but regardless, there is no practical use to the answer, other than to cure my curiosity._ Note this sentence at the end of the Artistic License 2.0: > THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND > WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. It does not affect any legal aspects of the license, but is there a reason they mixed the use of single and double quotes on `"AS IS'`? The license is so new that this wouldn't have been for "command prompt friendly" reasons. Is there special use or meaning behind this in the English language, or was it a typo? |
148701 | Information about how much time in spent in a function, based on the input of this function | Is there a (quantitative) tool to measure performance of functions based on its input? So far, the tools I used to measure performance of my code, tells me how much time I spent in functions (like Jetbrain Dottrace for .Net), but I'd like to have more information about the parameters passed to the function in order to know which parameters impact the most the performance. Let's say that I have function like that: int myFunction(int myParam1, int myParam 2) { // Do and return something based on the value of myParam1 and myParam2. // The code is likely to use if, for, while, switch, etc.... } If would like a tool that would allow me to tell me how much time is spent in `myFunction` based on the value of `myParam1` and `myParam2`. For example, the tool would give me a result looking like this: For "myFunction" : value | value | Number of | Average myParam1 | myParam2 | call | time ---------|----------|-----------|-------- 1 | 5 | 500 | 301 ms 2 | 5 | 250 | 1253 ms 3 | 7 | 1268 | 538 ms ... > That would mean that myFunction has been call 500 times with myParam1=1 and > myParam2=5, and that with those parameters, it took on average 301ms to > return a value. The idea behind that is to do some statistical optimization by organizing my code such that, the blocs of codes that are the most likely to be executed are tested before the one that are less likely to be executed. To put it bluntly, if I know which values are used the most, I can reorganize the if/while/for etc.. structure of the function (and the whole program) to optimize it. I'd like to find such tools for C++, Java or.Net. **Note** : I am not looking for technical tips to optimize the code (like passing parameters as const, inlining functions, initializing the capacity of vectors and the like). |
215301 | How Microsoft Market DotNet? | I just read an Joel's article about Microsoft's breaking change (non-backwards compatibility) with dot net's introduction. It is interesting and explicitly reflected the condition during that time. But now almost 10 years has passed. ## The breaking change It is mainly on how bad is Microsoft introducing non-backwards compatibility development tools, such as dot net, instead of improving the already-widely used asp classic or VB6. As much have known, dot net is not natively embedded in windows XP (yes in vista or 7), so in order to use the .net apps, you need to install the .net framework of over 300mb (it's big that day). However, as we see that nowadays many business use .net as their main development tools, with asp.net or mvc as their web-based applications. C# nowadays be one of tops programming languages (the most questions in stackoverflow). The more interesing part is, win32api still alive even there is newer technology out there (and still widely used). Imagine if microsoft does not introduce the breaking change, there will many corporates still uses asp classic or vb-based applications (there still is, but not that much). There are many corporates use additional services such as azure or sharepoint (beside how expensive is it). Please note that I also know there are many flagships applications (maybe adobe's and blizzard's) still use C-based or older language and not porting to newer high-level language. ## The question How can Microsoft persuade the users to migrate their old applications into dot net? As we have known it is very hard and give no immediate value when rewrite the applications (netscape story), and it is very risky. I am more interested in Microsoft's way and not opinion such as "because dot net is OOP, or dot net is dll-embedable, etc". This question may be constructive, as the technology is vastly changes over times lately. As we can see, Microsoft changes Asp.Net webform to MVC, winform is legacy now, it is starting to change to use windows store rather than basic-installment, touchscreen and later on we will have see-through applications such as google class. And that will be breaking changes. We will need to account portability as an issue nowadays. We will need other than just mere technology choice, but also migration plans. Even maybe as critical as we might need multiplatform language compiler, as approached by Joel's Wasabi. (hey, I read his articles too much!) |
120126 | What is the history of why bytes are eight bits? | What where the historical forces at work, the tradeoffs to make, in deciding to use groups of eight bits as the fundamental unit ? There were machines, once upon a time, using other word sizes, but today for non-eight-bitness you must look to museum pieces, specialized chips for embedded applications, and DSPs. How did the byte evolve out of the chaos and creativity of the early days of computer design? I can imagine that fewer bits would be ineffective for handling enough data to make computing feasible, while too many would have lead to expensive hardware. Were other influences in play? Why did these forces balance out to eight bits? (BTW, if I could time travel, I'd go back to when the "byte" was declared to be 8 bits, and convince everyone to make it 12 bits, bribing them with some early 21st Century trinkets.) |
235388 | How can I gauge the supportability and reliability of a package before introducing it to a project? | I recently found a package (JavaBuilders) that I like and I think will help develop on my project but it has some issues: * No longer being developed (last commit on github >1 year ago) * Lack of activity implies no longer supported by Developers * No noticeable community implies it is not supported by a larger userbase For all I know this package is dead and any issues we have will be insurmountable without a large re-write to remove it's use in the Worst Case Scenario. Separately (probably worth another question) if this package is not widely known, it'll increase lead-in time for any new members who join the team. Is there a more reliable way to gauge the use of a package, to see if it's 'supportable' and flexible enough (e.g. if we want it to do feature X we can't go back to a developer who has vanished from developing the package) to not put the project at risk? |
173154 | What are the differences between programming languages? | Once upon a time, I heard from someone > the only difference between programming languages is the syntax I wanted to deny it - to say that there are other **fundamental** aspects that truly set a language apart from others than just syntax. But I couldn't... So, can you? Whenever I search Google for something like "differences between programming languages", the results tend to be debates between two specific languages (I'd like something more general) - however, some of the aspects that people seemed to debate the most were: * Object-Oriented * Method/Operator overloading (I actually see this rather related to syntax) * Garbage-Collection (While it seems like a good difference, for some reason it doesn't seem that "fundamental") What important aspects other than syntax can you think of? |
173153 | JSF best practice for binding UI components to backing bean? | In JSF is it ok to bind UI components to backing bean just to render messages or we should only bind when we need to do lot more than just rendering messages? |
203507 | What's so useful about closures (in JS)? | In my quest to understand closures in the context of JS, I find myself asking why do you even need to use closures? What's so great about having an inner function be able to access the parent function's variables even after the parent function returns? I'm not even sure I asked that question correctly because I don't understand how to use them. Can someone give a real world example in JS where a closure is more beneficial vs. the alternative, whatever that may be? Edit: the question Why is closure important for JavaScript? did not answer clearly enough what I want to understand. So, I don't consider this a duplicate. I'll take a look at all of the answers/resources, and I'll mark an accepted one. Thanks to everyone! |
46137 | What is the main difference between Scripting Languages and Programming Languages? | Say difference between Python and C++? |
254370 | Security Pattern to store SSH Keys | I am writing a simple flask application to submit scientific tasks to remote HPC resources. My application in background talks to remote machines via SSH (because it is widely available on various HPC resources). To be able to maintain this connection in background I need either to use the user's ssh keys on the running machine (when user's have passwordless ssh access to the remote machine) or I have to store user's credentials for the remote machines. I am not sure which path I have to take, should I store remote machine's username/password or should I store user's SSH key pair in database? I want to know what is the correct and safe way to connect to remote servers in background in context of a web application. |
177641 | Is it efficient to use the number pad in your programming | I'm a programmer and use vim for all my software. I use the `hjkl` keys to avoid moving from the home row. Is it efficient/inefficient using the number pad on the keyboard? My thoughts are probably that it's inefficient because you need to move your hand? Many thanks. |
89374 | Help me understand this "mindmap / constellation" visual pattern | Please help me identify and understand this visual pattern, what's the common name used for such mindmap / constellation visualisations? http://asterisq.com/products/constellation/roamer/demo http://apps.asterisq.com/mentionmap/#user-scobleizer I am also looking a for a framework, library or **math formula** that will help me build something similar. I am especially interested in the auto arranging functionality as I will have plenty of nodes that I need to arrange on the screen in the best possible fashion. What's the math behing auto arranging somethoing in 2D? I also need combine to that all with extensive zooming and map-like navigation. If you know about anything that could help achieve my goal please don't hesitate to leave an answer. My preferred language is ActionScript 3 / Flash but I will be thankful for any info, tutorial or article in any language. |
177649 | What is constructor injection? | I have been looking at the terms constructor injection and dependency injection while going through articles on (Service locator) design patterns. When I googled about constructor injection, I got unclear results, which prompted me to check in here. What is constructor injection? Is this a specific type of dependency injection? A canonical example would be a great help! **Edit** Revisiting this questions after a gap of a week, I can see how lost I was... Just in case anyone else pops in here, I will update the question body with a little learning of mine. Please do feel free to comment/correct. _Constructor injection and property injection are two types of Dependency Injection._ |
102813 | Best practices for graph representation of a system architecture? | I don't really know the nomenclature regarding these matters, but here is a brief description of what I want. Please let me know if I should substantiate more. So I have this larger project involving databases, different languages, and interfaces (SQL, R, C, Python, both GUI & CLI). It's growing a little too big to fit into a simple mental construct of what is actually going on. I am interested in making the mother of all charts mapping out the project from a system architecture perspective. Generally speaking I'd like the information to show some meta information of the data rather and where it is produced / consumed. I guess it is close to a flow chart, but as I am no expert in these matters I am asking for help. Are there any tools for this? Any best practices regarding formatting etc? How about symbols for all the procedures / classes / methods / functions? Please chime in if you have any opinion regarding the matter. Just to frame a little bit more what I would be interested in: * I rather use tools like Latex than Visio * I hate large and fancy IDEs, but I adore VIM * I would do with static solutions, but I would be interested in automated solutions too (as long as they are not too complicated of course) |
78758 | Downloadable Game vs Non-Downloadable | I want to make a networked building game with limited physics(just for the characters) and I wanted to know what the best route would be. I was looking at a browser based Java game or a downloadable C++ game or maybe even a downloadable Java game. Anyways, would a browser based game be too slow for something like this(thousands of blocks with multiple players)? What are your thoughts/suggestions? |
272 | When someone asks you what you do, what do you say (e.g. programmer, developer, code monkey)? | Do you call yourself a programmer, a developer, or a code monkey? I personally prefer to say I am a developer. |
66393 | Motivation and practical learning | I'm a newcomer to StackExchange and this seems a very good place to ask my question, that's been wandering in my head for a few months. Currently I'm 22, I'm studying a BS of Computer Science in the UNED (Spanish Distance University) and I'm doing well. I have a job as well, doing web programming (PHP, SQL, CSS, HTML, Apache, that kind of stuff) in a company, but working from my home. I've tried those last few years to accomplish success in other programming languages. I started with C++, Java, Perl & Python and although I can say I have a decent level on it, it's difficult for me to find some projects where I can use them. And I mean **real projects** where you can drive the language level to its cap. I think the lack of motivation is one of the reasons behind this. Its like after a full day repetitive programming, my brain is exhausted and it is hard to achieve something. Also, I have problems with my learning methods. I read a lot of forums (like this one), a lot of books and websites talking about programming, but I don't know how to apply the knowledge acquired. It's like I need a different approach to learning, a more practical one. So, the question is: How do you find the motivation to keep programming after a full day at the job? How do you find a more practical learning method? (It's easy to keep _reading about_ programming after all, but it's another to actually code **something big** ). Thank you in advance. PS: I'm not a native speaker, so don't mind me for lexical and grammatical errors. |
239180 | Working on a project, lacking motivation to actually get to coding | I'm a hobbyist programmer. Often during a period of working on a project, I find myself having a hard time to actually get to coding. I sit in front of my computer, sometimes open the IDE, and instead of continuing work on the project, I find myself watching YouTube videos (often programming related), browsing Facebook, reading questions on this site, etc. Also sometimes in the design phase of something, I think hard of different designs and solutions, come up with a cool solution which I get excited about, sketch it on paper, but eventually when I actually sit in front of my computer to implement what I designed, I don't program but rather do other stuff, or sometimes code a little bit. I do like programming a lot. And I also enjoy designing stuff and thinking of ideas. However often when I actually sit down to continue my current project, I have this lack of motivation to code. I have two questions about this: 1. Is this normal? **Are there other people - _that enjoy programming very much_ \- that experience the same problem?** Is this 'starting-to-work-bummer' feeling common? 2. How do you suggest I solve this? **When sitting down to code, should I just 'power through' this initial phase of lack of motivation, knowing it'll get more fun after I 'warm up' and get deep into coding?** **Or am I risking getting burned out and tired of programming by forcing myself into this when I lack motivation?** What do you suggest from your personal experience? **This isn't just a "do you sympathize with this?" kind of question. I'm asking in order to find a solution. Thanks for your help** _I don't think this is a duplicate. There are a lot of questions about lack of motivation, but this one in particular is about a specific feeling of lack of motivation when sitting down to code._ |
29852 | Motivating yourself to actually write the code after you've designed something | **Does it happen only to me or is this familiar to you too?** It's like this: You have to create something; a module, a feature, an entire application... whatever. It is something interesting that you have never done before, it is challenging. So you start to think how you are going to do it. You draw some sketches. You write some prototypes to test your ideas. You are putting different pieces together to get the complete view. You finally end up with a design that you like, something that is simple, clear to everybody, easy maintainable... you name it. You covered every base, you thought of everything. You know that you are going to have this class and that file and that database schema. Configure this here, adapt this other thingy there etc. But now, after everything is settled, you have to sit down and actually write the code for it. And is not challenging anymore.... Been there, done that! Writing the code now is just "formalities" and makes it look like re-iterating what you've just finished. At my previous job I sometimes got away with it because someone else did the coding based on my specifications, but at my new gig I'm in charge of the entire process so I have to do this too ('cause I get payed to do it). But I have a pet project I'm working on at home, after work and there is just me and no one is paying me to do it. I do the creative work and then when time comes to write it down I just don't feel like it (lets browse the web a little, see what's new on P.SE, on SO etc). I just want to move to the next challenging thing, and then to the next, and the next... Does this happen to you too? How do you deal with it? How do you convince yourself to go in and write the freaking code? I'll take any answer. |
80599 | Is it worth the experience gained by publishing a simple app on the App Store? | Eg. Another stupid Fart app or something of that sort. Not for money or recognition or anything else except maybe the experience you get from it. Are there any caveats one should be a aware of before deciding to go through with it? |
19974 | IDE Generated Code | Many IDEs have the ability to spit out automatically written pieces of code. For example, it might generate a getter/setter pair for you. I wonder whether it isn't an attempt to work around some flaws in the language. If your IDE can figure out what the code should be without your help, why can't the compiler? Are there cases where this is a really good idea? What kind of code generation does your IDE provide? Would the same thing be better provided as a feature of the language? |
16701 | Is time tracking required for web based/service industries? | I work in the web development industry and we implement a time tracking system to log our time (Project/time/comment). In the beginning of a project, we create a contract, and decide upon a price based on our hourly rate _x_ estimated hours. We log out times to see if we go "over budget". Is time tracking in this industry the norm? Is it required? What are the pros and cons? |
80591 | Why is no C++ interview complete if it does not have vtable questions? | Frankly, I don't understand the practical importance of vtable. For me it is just a theoretical concept which needs to be mugged up since interviewer will ask it surely. Can anyone shed some light on it that why interviewers love vtable? I don't see how knowledge of vtable makes me a competent c++ developer :-| |
245825 | Why GPL was made so that it requires open application code yet not open pipe of compiled applications? | Say we have a GPL library (CGAL for example). We have a big tasks chain like pipes modeling and testing. We would love to use library for our indoors application yet we must open sources... so we make a minimal application that takes arguments and files in, and returns files and data out. And is being used like `closedSourceApp > GPLApp > closedSourceApp`. And all interesting/relevant parts are excluded from GPL app. At the same time GPL library is not used at its full potential and does not get integrated into bigger applications. So the question is what reasons were behind GPL license idea to force project new code to live under it? |
245824 | How to mentor a junior team member while remaining productive on your own projects? | This question is not about multitasking... there are plenty of tips around for that. This is about how to take steps to efficiently multi-project (work on two projects at a time) on a single large code-base. More specifically, how does a senior programmer go about working on one project, and mentoring another beginner programmer on a different project with the same codebase, and thus assisting with training, design, integration, troubleshooting, etc. The beginner needs to be mentored so as to prevent unnecessary complexity and debt from creeping into the codebase. I don't see any questions pertaining to this scenario. Closest is senior + senior, but mentoring a beginner is a different animal. I wonder if multi-project'ing is even normal in the industry. Are there patterns for making it more efficient? The context switching is brutal. Multitasking is already hard enough as it is. I would think both engineers should ideally work on the same project until the beginner is far enough along to be able to handle a project on his or her own, always with some assistance from a senior of course. Not to get too far off topic, but to give context, it seems management wants to skip the training step and throw the beginner into the deep end of a large code base. I am less concerned about the success of the near term project(s), and more concerned with resulting increased entropy and complexity in the code if I were to not mentor, which would prove disastrous in the long run. |
245827 | Setting global parameters: is this a reasonable use of const_cast and volatile? | I have a program that I run repeatedly with various parameter sets. Different parameters are used in different parts of the program (including different source files). The same parameter may also be used in different places. However, all parameters are **constant** during run-time after they have been set. I discovered very quickly that declaring the parameters locally does not make sense (it involves having to remember where every parameter is defined, etc.), so I resorted to using a `params.h` where I declared and defined all the parameters: `const int Param1 = 42;`, etc. The downside of this is that I have to recompile every time I change a parameter. So I'm thinking of using the method below. It relies on using`volatile` and `const_cast`, which is normally considered "dirty", but it ensures once the parameters have been set in `main`, they are not accidentally changed anywhere else in the program. I'm wondering whether people think this is OK, because eventually I want to open-source my code. In `params.h`: namespace Params { extern volatile const int Param1; // etc. } In `main.cpp`: #include "params.h" volatile const int Params::Param1 = 0; int main(int argc, char* argv[]) { int* const pParam1 = const_cast<int*>(Params::Param1); *pParam1 = // Get value from argv[] or some config.ini file. // etc. } |
88020 | Why would a code analysis tool be priced based on lines of code count? | I heard some static analysis tools are priced depending on how much code they are licensed for. I can think that it's usual segmentation - the more code the customer has the more care he needs and the more useful the tool is for him, so he should pay more, so basically it's the way for the tool supplier to get more money. Are there any other objective reasons why a source code analysis tool would be priced depending on how much code the customer is planning to analyse? |
136792 | Is this a proper implementation of an iOS MVC pattern? | After browsing the apple docs, I came across this sample of their MVC pattern: ![mvc](http://i.stack.imgur.com/BYaCl.png) Using NSNotificationCenter and without using KVO, would this diagram below represent a correct implementation of the MVC pattern? If not, what’s wrong and how can it be corrected or improved? ![mvc example](http://i.stack.imgur.com/jjQa2.png) 1. App starts with the left light set to on, and the right one off. Only one light may be on at a time. 2. Users presses the right switch, which sends a target action to the view controller. 3. The view controller receives the message, and send a message to the right light data model. 4. The right light uses NSNotificationCenter to notify the controller the right light has changed. 5. The controller receives the message, and performs the following method `BOOL rightLightOn = [rightLightData on]; if( rightLightOn ) { [rightLightImage setImage:onImage]; [leftLightSwitch setOn:NO]; } else { [rightLightImage setImage:offImage]; }` 6. The switch change causes the UISwitch to call the method “leftSwitchChanged” in the controller. 7. The controller receives the message, and send a message to the left light data model. 8. The left light uses NSNotificationCenter to notify the controller the left light has changed. 9. The controller receives the message, and again performs the same method shown above, but modified for the right light. In addition, what if the system wasn’t using a switch, and instead was using a UIButton that displayed the text, “Turn On” or “Turn Off.” Would the switch update it’s own text, then call “rightSwitchChanged” or would it call rightSwitchChanged immediately and wait for the view controller to change the text? |
88025 | Quickly Large Data Pivoting | We are developing a product which can be used for developing predictive models and the slicing and dicing of the data in order to provide BI. We are having two kind of data access requirements. For predictive modeling, we need to read data on daily basis and do it row by row. In this the normal SQL Server database is sufficient and we are not getting any issues. In case of slicing and dicing data of huge sizes like 1GB of data having let us say 300 M rows. We want to pivot that data easily with minimum response time. The current SQL Database is having response time issues in this. We like our product to run on any normal client machine with 2GB RAM with Core 2 Duo processor. I would like to know how should I store this data and then how I can create a pivoting experience for each of the dimension. Ideally we will have data of let us say daily sales by sales person by region by product for a large corporation. Then we would like to slice and dice it based on any dimension and also be able to perform aggregation, unique values, maximum, minimum, average values and some other statistical functions. |
12017 | Software development books are useful, but when to find the time to read them? | I have 5 books in my "read-wish-list". When do I read them? I mean I could force myself to use 1 hour during working hours, but this will last for 2 days then someone will ask me to do more "high priority things". One option can be reading at night, but also this has limits, even because I prefer to spend time with kids. Could you please share your experiences? A long term plan is needed of course, it makes no sense to read 5 books in a week, but to continuously read something. For this reason it must not be a stressful thing. It should be easy. It must not be a struggle to find time to read, but it should be done on a continuous regular basis. Somehow this question can be similar to THIS ONE but I want to ask about books. How many if you read books at work for self improvement, not to tackle a specific task? |
48697 | Should a programmer be indispensable? | As a programmer or system administrator, you could either strive to have your fingers in every system or to isolate yourself as much as possible to become an easily-substituted cog. Advantages of the latter include being able to take vacations and not being on call, while the former means that you'd always have something to do and be very difficult to fire. Aiming for either extreme would require a conscious effort. **Except for the obvious ethical considerations** , what should one strive for? |
245828 | Pair-programming and company privacy guidelines | At our office new privacy regulations are introduced requiring every employee to protect his or her computer with a personal password. The employees are required not to share these passwords. Prior to this, everybody could access everybody's computer. No, there is little doubt that this is an improvement from a security point of view. However we - as developers - struggle with this, because we do a lot of pair programming (often for several days in a row) and due to flexible working hours and a like, access to different working station is needed without the presence of the developer who owns the computer. There is a tendency, that developers will share their passwords (even going so far as putting it as a list on the wall). How can you reconcile the need for accessing uncommitted code on a working station from different developers with security and privacy guidelines regarding these working stations? |
153777 | Personal Version Control Benefits | What are the benefits, if any, of having a personal Version Control System? This includes such things as personal projects, hobbies, sample code accumulated over the years, etc. ### Over and above the obvious benefits such as backup/history. |
203618 | Should I Use Native Generic PHP or a Framework | I'm working with a team i just met. I've been using the normal native generic php for coding up until now, and built several webapps with it. But a team member suggests we switch to using a framework for development. I personally prefer going the normal way, using native generic PHP codes, but he Suggests we use a framework. I learnt Code Igniter has problem with loading images, and this is one problem with some frameworks, they have some difficulties you just have to go with, unlike writing native PHP Codes. I have a large archive of PHP Codes, that does the work of what some Framework does, i can use this and implement it in the WebApp. Is it better to go with a Framework or Go Native & Generic PHP. Another thing is that, this is a web app for mobile devices, which me and the team are developing for a company, and there will be need for maintenance in the nearest future, if we are not available for the maintenance. Our codes has to be very simple, not too ambiguous and self explanatory, and with comments too, for the future developer. Which is why i'm thinking we write out our own codes, and make it very Simple in the best possible way. |
100010 | How to flag a class as under development in Java | I'm working on a internship project, but I have to leave before I can finish up everything. I have 1 class that is not stable enough for production use. I want to mark/flag this class so that other people will not accidentally use it in production. I have already put the notice in Javadoc, but that doesn't seem enough. Some compiler error or warning would be better. The code is organized like this: [Package] | company.foo.bar.myproject |-- Class1.java |-- Class2.java |-- Class3.java <--(not stable) If there was a single factory class that calls those classes in public methods, I could have set the method to `class3` as `private`. However the API is NOT exposed that way. Users will directly use those class, e.g. `new Class1();`, but I can't make a top-level class private. What's the best practice to deal with this situation? |
119864 | Has anyone used Sproutcore? | Has anyone used Sproutcore for a web application? If so, can you give me a description of your experience? I am currently considering it, but I have a few concerns. First, the documentation is bad/incomplete, and I'm afraid that I'll spend lots of time figuring things out or digging through source code. Also, I'm a bit hesitant to use a project that is relatively new and could undergo significant changes. Any thoughts from people who have developed in Sproutcore are appreciated! EDIT/PS: Yes, I've seen this post: http://stackoverflow.com/questions/370598/sproutcore-and-cappuccino . However I'm interested in a bit lengthier description of Sproutcore itself from someone who's used it for a significant project. |
17254 | Do poor writers make poor programmers? | I'm reading _Coders at Work_ by Peter Seibel, and many a time it has been mentioned that programmers who can't write generally make poor programmers - it's been claimed by Douglas Crockford, Joshua Bloch, Joe Armstrong, Dijkstra (and I've only read half the book). What's your view of this? Is an inability to express yourself in writing in a natural language such as English a hindrance of writing good code? |
52466 | What should a freelancer's business card have? | For example, when I first started out freelancing a year ago, my business card had my name, email and website - and up top a list of the technologies I'm comfortable with. In retrospect I don't feel this was a wise decision. Why would a potential client know what Python or Ruby is? How could he know what .NET was? I still have a couple of the old batch left, but I'm going to send out for some new cards. What do you recommend we developers have to show on our business cards? Am I correct in thinking listing technologies is meaningless to potential clients? |
235967 | Use a global variable, a singleton, or something else | **Preface:** I am working in PHP ( _Abandon hope all ye who enter here_ ). **Background:** There exists a large set of global functions in PHP, a number of which are miscellaneous system calls, like sleep (and others). Now, I use `sleep` (and others) in a bunch of different scripts I run in a bunch of different places, and I have found I need sleep to call `pcntl_signal_dispatch` as soon as the `sleep` finishes- but possibly not in all my scripts. **A Generalization:** I need to make global function do more than it currently does, hopefully without disrupting my current ecosystem too much. **My Solution:** I figure I could create a wrapper class that executes the correct `"sleep"`. _Singleton:_ I could make a singleton "System" class that wraps the global functions. Hell, I could even make the wrappers static methods. The downside is that there would be a lot of boilerplate checking to see which version I would need to execute, either a vanilla function call or one with extra stuff. _Global variable:_ I could make a generic "System" class that wraps the global functions. I could then extend the System class with different classes that override the wrapper functions. I create a global `System` variable within each script, dependent upon how I need the functions to behave. All my scripts have access to that global variable. The downside is I would have to make sure the global variable is declared, is never overwritten, and uses the proper `System`. _Something else:_ I could create a `SysControl` class with a static `System` variable and static wrappers of the `System`'s wrappers of the functions, and then swap out which `System` my `SysControl` class references. The downside is that I feel I am going overboard. Are there any more options I should consider? Which of these methods is the best, and why? What pitfalls should I look for going forward? EDIT: I ended up using the _Something else_ solution. |
95796 | Why is C++ often the first language taught in college? | My school starts the computer science curriculum with C++ programming courses, meaning this is the first language that many of the students learn. I've seen that many people dislike C++, and I've read a variety of reasons why. It almost seems to be popular opinion that C++ isn't a very good language. I get the impression it's not very liked based on some questions on StackExchange as well as posts such as: http://damienkatz.net/2004/08/why-c-sucks.html http://blogs.kde.org/node/2298 http://blogs.cio.com/esther_schindler/linus_torvalds_why_c_sucks http://www.dacris.com/blog/2010/02/16/why-c-sucks-part-2/ etc. _(Note: It is not my opinion that C++ is a bad language. In fact, it's the main language I use. However, the internet as well as some professors have given me the impression that it's not a very widely liked language. In fact, one of my professor constantly rags on C++, yet it's still the starting language at my college!)_ With that in mind, **why is this the first language taught at many schools? What are the reasons for starting a programming curriculum with C++?** Note: This question is similar to "Is C++ suitable as a first language", but is a little different since I'm not interested in whether it's suitable, but why it's been chosen. |
63028 | In term of performance : while , for ... Loops VS recursion | What is better for performance to write the loop as linear e.g. for , while or write it as recursion ? |
235962 | What is the process of determining which method in a class hierarchy should execute known as? | I thought I understood inheritance and polymorphism, but I was given this question, and I can't, for the life of me, figure out what the proper answer is or what they're trying to get at: > The process of determining which method in a class hierarchy should execute > is known as: > > * a) inheritance > * b) polymorphism > * c) is-a > * d) has-a > * e) parent class > Looking at each of the terms, none of them seem like the proper answer. **Inheritance** is just when a class automatically gets the public variables and methods in its parent class. So this clearly isn't the right answer. **Polymorphism** allows us to write one method to handle object A, and as a result will work with everything that extends object A (or continues to extend it, IE Object B extends Object A. Object C extends Object B, etc) So this clearly isn't the right answer! **Is-a** : This doesn't even make any sense. Is-a is just used to declare that a class is an instance of its parent class (dog is-an animal), so it inherits its public variables and methods. I don't see how this is "determining which method in a class hierarchy should execute" **Has-a** : I'm not too familiar with this, but it's essentially composition, where Object-A has-a Object B, but object-B isn't an instance of Object A. This doesn't seem like the right answer either **Parent Class** : This is just the base class, if we trace the tree of inheritance up, the top of the tree is the parent class. Can someone please explain which term can also be defined as _"The process of determining which method in a class hierarchy should execute is known as"?_ Am I not understanding one or more of the terms? Is this simply a poorly worded question? |
180131 | What are Web runtime environments and programming languages | I've been looking into the details behind these two different categories: 1. Web runtime environments 2. Web application programming languages I believe I have the correct information and have phrased it correctly but I am unsure. I have been searching for a while but only find snippets of information or what I can see as useless information (I could be wrong). Here are my descriptions so far: Web runtime environments - A Run-time environment implements part of the core behaviour of any computer language and allows it to be modified via an API or embedded domain-specific language. A web runtime environment is similar except it uses web based languages such as Java-script which utilises the core behaviour a computer language. Another example of a Run-time environment web language is JsLibs which is a standable JavaScript development runtime environment for using JavaScript as a general all round scripting language. JavaScript is often used to create responsive interfaces which improve the user experience and provide dynamic functionality without having to wait for the server to react and direct to another page. Web application programming languages - A web application program language is something that mimics a traditional desktop application within a web page. For example, using PHP you can create forms and tables which use a database similar to that of Microsoft Excel. Some of the other languages for web application programming are: * Ajax * Perl * Ruby Here are some of the resources used: http://en.wikipedia.org/wiki/Web_application_development http://code.google.com/p/jslibs/ **I would like some confirmation that the descriptions I have created are correct as I am still slightly unsure as to whether I have hit the nail on the head.** |
176063 | How to be successful at BDD Specifications Workshops? | Today we tried to introduce BDD in our software development process by having a specification workshop. For this workshop we had 2 developers, 1 tester and 1 business analyst. The workshop lasted 1h30 and by the end of it we managed to figure out some BDD scenarios for our new feature. We tried to focus on finding the scenarios that we could miss, and the difficult ones. At the end of the workshop some people were actually unhappy with the workshop. One developer felt he **wasted his time** as he was used to be given out the scenarios directly by the business analyst and review them with her. The business analyst **didn't feel confident with our scenario coverage** (Had a feeling that we could have missed out other important stuff) but **more importantly felt that this workshop was also a waste of time as she could have figured out all these scenarios by herself and in a shorter period of time**. This experimental workshop lasted 1h30, and by the end of it, we didn't feel confident enought about what we did...sure we could have spent more time on it but honestly most people get exhausted after 1h30 of brainstorming to fetch out business rules from the BA brain. So my question is how that kind of workshop can actually work. In the theory, given you have a new feature to develop, you put the tree 'amigos' (dev/tester/ba) in the same room so that they can collaborate together on writing the differents requirements for the new feature using examples. I can see all the benefits from that. Specially in term of knowledge sharing and common product/end goal/done vision. Our conclusion from this experiment was that it is actually more cost effective to **first have a BA to work on his own on the examples** and only **then to have the scenarios to be reviewed/reworked by the 3 'amigos'**. By having the BA to work on his own, we actually feel more confident that we are less going to miss out stuff + we still get to review the scenarios afterward to double check. We don't think than simple one time brainstorming/deliberate discovery session is actually enought to seriously cover all the requirement for a new feature. The business analyst is actually the best person for that kind of stuff. The best thing we can do is to review what she wrote and see if then we have a common understanding (which could then lead to rewrite some of her scenarios or add new ones she could have missed). So how can you get that to work effectively **in practice** ? |
176065 | Brief material on C++ object-lifetime management and on passing and returning values/references | I was wondering if anybody can point to a post, pdf, or excerpt of a book containing the rules for C++ variable life-times and best practices for passing and returning function parameters. Things like when to pass by value and by reference, how to share ownership, avoid unnecessary copies, etc. This is not for a particular problem of mine, I've been programming in C++ for long enough to know the rules by instinct, but it is something that a lot of newcomers to the language stumble with, and I would be glad to point them to such a thing. |
21617 | GPL Notice on Snippets | I just wan't to ask, is it ok to put a GPL notice inside a small script or a snippet? > This program is free software: you can redistribute it and/or modify it > under the terms of the GNU General Public License as published by the Free > Software Foundation, either version 3 of the License, or (at your option) > any later version. > > This program is distributed in the hope that it will be useful, but WITHOUT > ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > more details. > > You should have received a copy of the GNU General Public License along with > this program. If not, see http://www.gnu.org/licenses/. Or just the Copyright notice will be enough? |
212820 | Generating a custom widget that users can embed into their external website based on my server data which changes periodically | I'm deciding on how to generate the code to allow users generate an embeddable widget (much like the StackOverflow badge) into external websites. The content of the embedded widget will periodically change, but it doesn't need to be communicating in real-time with my server after a visitor has loaded the page where it's embedded. This opens up several possibilities for getting this to work: 1. On the server, pre-generate the static html content I want rendered in their page (and have a scheduled job which regenerates the static file). My users can then embed it in their page using an iframe reference to the static resource. 2. Same as above, but instead of the iframe I create a js file which they reference (much like an Google Analytics code) and then the js file served inserts the data in into their DOM. My web server would need to dynamically generate the js file on each request for the file resource. 3. Give them a js file which creates the element on their page like the above, except the js file payload doesn't include all the data and instead basically generates the DOM element as a template, then calls web services to populate the data (like their name and score) using JSONP requests to my server. I like 2 for the explicit server-side control, but it will take more time. 3 is good because the services I expose to retrieve this data can be reused for other purposes later. I don't generally like iframes, but they work and are very quick to implement. Any suggestions of which way to proceed or ideas that I've missed? |
212822 | Why many designs ignore normalization in RDBMS? | I got to see many designs that normalization wasn't the first consideration in decision making phase. In many cases those designs included more than 30 columns, and the main approach was "to put everything in the same place" According to what I remember normalization is one of the first, most important things, so why is it dropped so easily sometimes? **Edit:** Is it true that good architects and experts choose a denormalized design while non-experienced developers choose the opposite? What are the arguments against starting your design with normalization in mind? |
69178 | What is the benefit of git's two-stage commit process (staging)? | I'm learning git and I've noticed that it has a two-step commit process: 1. `git add <files>` 2. `git commit` The first step places revisions into what's called a "staging area" or "index". What I'm interested in is why this design decision is made, and what its benefits are? Also, as a git user do you do this or just use `git commit -a`? I ask this as I come from bzr (Bazaar) which does not have this feature. |
45447 | Foreign key restrictions -> yes or no? | I would like to hear some”real life experience” suggestions if foreign key restrictions are good or bad thing to enforce in DB. I would kindly ask students/beginners to refrain from jumping and answering quickly and without thinking. At the beginning of my career I thought that stupidest thing you can do is disregard the referential integrity. Today, after "few" projects I'm thinking different. Quite different. What do you think: Should we enforce foreign key restrictions or not? *Please explain your answer. |
250991 | Is immutability very worthwhile when there is no concurrency? | It seems that thread-safety is always/often mentioned as the main benefit of using immutable types and especially collections. I have a situation where I would like to make sure that a method will not modify a dictionary of strings (which are immutable in C#). I’d like to constrain things as much as possible. However I am not sure whether adding a dependency to a new package (Microsoft Immutable Collections) is worth it. Performance is not a big issue either. So I guess my question is whether immutable collections are _strongly_ advised for when there are no hard performance requirements and there are no thread safety issues? Consider that value semantics (as in my example) might or might not be a requirement as well. |
250994 | Static and dynamic data : should I use different databases? | Say I am building a website that uses two different types of data : * Static : information that will hardly change, like movie awards or world countries names (I want fast access so no external API) * Dynamic : information entered by users I have not written a single line of code yet. My static db is more likely to be quite large but will not change overtime. As for the dynamic db I have no idea yet but I might need scalability. Should I use different databases in the long run ? Is it common practice to do so ? |
125401 | Do you keep DONE stories in the physical product backlog? | We have our Product Backlog as a physical Kanban board with TODO & DONE column. Some of the stories are moving from the TODO column to the Sprint backlog during our planning, and then during the Sprint review back in the Product Backlog in the DONE column for the one which we completed. I was wondering if keeping history of DONE stories on the wall was intresting at all. It's starting to take up space Sprints after Sprints and I can't see any value from it for now. |
125402 | How can I learn practical applications of software engineering principles? | I'm having problems bringing the software engineering I learned in school into my projects at my job. The patterns are all easy enough to apply, but coming up with architectures and general class structures is tough for me. It's so open ended and I never know how to approach my projects, with the exception of any project that cleanly fits the MVC architecture. I've been working on some increasingly larger projects. The end product works because I know testing well, but getting there is hell and going back to add features is worse. My work usually degrades into planning from the applications entry point and thinking through the use cases. This works eventually, but I end up with low cohesion and tightly coupled code. I had enough experience coming out of school to start in a job with more responsibilities than entry level programmers, so I don't have the benefits of learning from a more experienced team. The problem is I'm very inefficient. My boss said once that if I get these projects out faster and with the same level of testing I can make more. So I have to teach myself software engineering. I've read a lot of books, but they are a little too abstract; I need something concrete. **Where should I go to learn real project software engineering?** **EDIT:** It may help to know that I sometimes end up with clean code. It either just takes me a really long time to get there, or I give up and hack it cause I know it will work. Most people will say this comes with experience, but there must be some place I can go that says: if your project is like this this and this, try these architectures. |
254679 | Python IZIP list comprehension returns empty list | I have a list of strings that I am sorting. There are 12 different key strings within the list that I am using to sort by. So instead of writing 12 separate list comprehensions I would like to use a list of empty lists and a list of key strings to sort, then use izip to perform list comprehensions. Here is what I am doing: >>> from itertools import izip >>> tran_types = ['DDA Debit', 'DDA Credit'] >>> tran_list = [[] for item in tran_types] >>> trans = get_info_for_branch('sco_monday.txt',RT_NUMBER) >>> for x,y in izip(tran_list, TRANSACTION_TYPES): x = [[item.strip() for item in line.split(' ') if not item == ''] for line in trans if y in line] >>> tran_list[0] [] I would like to see an output more like the following: >>> tran_list[0] [['DDA Debit','0120','18','3','83.33'],['DDA Debit','0120','9','1','88.88']] The output doesn't make sense to me; the objects that izip returns are lists and strings >>> for x,y in itertools.izip(tran_list, TRANSACTION_TYPES): type(x), type(y) (<type 'list'>, <type 'str'>) (<type 'list'>, <type 'str'>) Why is this process returning empty lists? |
168087 | Learning Issued Token in Federated Service | I would like to learn federated WCF service. I have the following in my system. • Windows XP • Visual Studio 2010 Express • SQL Server 2008 Express Is it possible to create a federated service sample with this infrastructure? Is there any article for that? **UPDATE** Federation: http://msdn.microsoft.com/en-us/library/ms730908.aspx Federation Sample: http://msdn.microsoft.com/en-us/library/aa355045.aspx |
254672 | How could a system be zero-knowledge? | I'm actually interest about zero-knowledge storage system. Those system where the storage provider claims he can't have any access to the data stored. As far I know, the data are encryptit using a symmetric encryption system, such as AES or other, But those system needs a key to function. So what happens to the key? is it stored? Where? If a user connect from an other location, and want to retrieve one of his file, he must retrieve the key first. So if the storage provider store the key too, he could have access to the encrypted data. It's like having a chest locked and the code on a paper next to the chest, then claim that you couldn't open the chest. So is there a flaw in that? I'm I mistaking completely about those zero- knowledge system? If they can finally open the file, how some of them could escape justice by saying "We can not know that we are hosting illegal files?" |
254673 | LAMP without PHP | My question is that is the P part of the LAMP really necessary? I will have the database and I can connect to it via the appache http so why will I need php/python in the server side (if it is a really simple set up) also from a seperation of concern it might be more robust at least thertically to leave the P out of the equation and to use LAM only. What are you guys think? I need to build this as a linux server in order to backend mobile ios and android. cheers |
168089 | Why has extreme programming (XP) gone out of date in favor of Agile, Kanban etc? | I like XP (extreme programming) especially the part where there are 2 programmers at the same screen since often a problem's solution gets closer if only you explain what you're doing and pair programming forces you to explain what your doing. Last 10 years or so, the XP style of working seems to have gone out of date in favor of the working methodologies Agile and/or Kanban. Why? Since XP to me seems a veru good way to work and is a lot about the programming where Agile and Kanban are more about processes. |
44792 | The Basics of Project Management / Software Development | It suddenly struck me today that I have never developed any large application or worked with a team of programmers, and so am missing out a lot - both in terms of technical knowledge and the social-fun part of it. And I would like to rectify that - an idea is to start an open source group by training college students (for no charge) and developing some open source application with them. Please give me some basic advice on the whole process of how to (1) plan and (2) manage projects in a team. What new skill sets would you recommend? (I have read _joel on software_ and _37 Signals_ , and got many insightful tips from them. But I'd like a little more technical knowledge ...) * * * Background (freelancer, past 4+ years) - Computer engineer > graphic / web designer > online marketing > moved on to programming in PHP, Perl, Python > did Oracle DBA OCP training to understand DB's > current self-assigned title - web application developer. |
254674 | Accepting the UUID collision risk based on number of clients | After reading some questions about the probability of UUID collisions it seems like collisions although unlikely, are still possible and a conflict solution is still needed. Therefore I am wondering about the background of choosing UUIDs for CouchDB * Is the "unlikely collision" a responsibility of the developer? * Was it expected that IDs will be used by a reduced set of clients? When I went through the documentation it looked like CouchDB algorithm was great to withstand partition, but the more I read about the problems of distributed ID generation, the more I believe taking the UUID collision risk is only feasible with a low number of clients. Although I am still interested in the previous questions, the main thing I want to find out is: * Is it the normal practice accepting the collision risk of UUIDs counting on a low number of distributed generators? Or always assumed that the probability of collision is so low that is not a concern? |
160258 | Looking for a very memory-efficient way of finding exporting all relations in a family tree | Think of the question as a family tree, in the **PS** section I will explain what exactly it is but family tree is easier to imagine: so father, has kids, those kids may have more kids, those kids may have more kids, etc.. 1- I don't have the whole information in memory to traverse them. With each method call and hitting the database I have just the father at some level and its kids. See here is the high-level of the method that I have and need to some how use some good parts of it: private void Foo(string fatherNode) { // call some DB scripts and grab data you need to work with. int numberOfKids = // get it from the thing you populated from the DB call. for(int i = 1 to numberOfKids) { Node Child = // grab child[i] from the list we populated from DB calls //Add it to the treeView } } Well this was working because it is a GUI application and with each you know "click" event we were really requesting just one level of info but Now I need a new functionality where I can click an Export button and it writes the WHOLE structure of this whole family tree to a XML file..( so you can expand those nodes and still see the family hierarchy) 2- There is a lot of data. One Father might have 400 children, each children might have 10 more children and each of those chilcren might have 500 more children...so I need to also be concerned about getting memory exceptions... 3- Recursion? can we really load ALL of this hierarchy to memory? I don't think so..remember the goal is to export it to a XML SO Maybe the efficient way is write a good algorithm that at each call writes one level of hierarchy to file and doesn't load the whole thing in memory... But I am pulling my hair and banging my head on desk and can't crack the code and figure it out.. So what are your pseduo-code- suggestions... I am using C# by the way. * * * **P.S:** This is actually a Clinical Bioinformatics hierarchy, so you say Ok human genomes..ok now there 27000 genes under it, Ok now gets gene234 and let's say what are its children,... |
190339 | Performance and other issues with using floating point types in C++ | Being interested in C++ performance programming there is one aspect I really have no clue about- and that is the implications of using floating point calculations vs doubles vs normal integer mathematics? What performance issues with these types of calculations should I consider? What other issues need to be considered when deciding which kind of operators to use? All I currently know is that doubles are probably the most expensive because they are larger, floating point is next and then integer calculations are usually the fastest on a CPU because they are much simpler. |
160254 | Using a openid in a "closed system" | I would like to publish a website for certain family members only. Simply put, like a mishmash of family photos and videos. I want it to remain private, however. I was considering using openid for the login process because I really wanted to avoid: 1. Storing Usernames and Passwords (Too much maintainance) 2. Making a obfuscated url that can be picked up by toolbar (Not private enough) 3. Making a password to access the page (I've had users unable to manage this) So I was hoping to use openid to have say my brother log in using his google account. But from what I've seen openid used for, it wouldn't prevent others from logging in to the website. I was thinking maybe I could limit it manually however this paragraph from Google App Platform best practices has me double thinking: > From a protocol perspective, both logins to the two IDPs are legitimate and > the attributes returned by the 2nd IDP appear identical — the same email > address, name, and so on. The only thing that differs between the two > requests is the user's claimed identity. In fact, relying parties are > required to verify that IDPs only return identities that they're > authoritative to prevent a rogue IDP from asserting identities from other > providers. But nothing prevents a rogue IDP from asserting attributes like > names and email address that may not be truthful. Is openid the "right" tool for what I wish to do? (Have a private web interface that requires logins but no user management beyond identifying family members) |
160252 | Is it a good practice to capture build artifacts in Artifactory that Jenkins produces? | We use Jenkins to run continuous integration builds. The output of these builds might be EAR files, WAR files, or just a collection of files that are TAR'd up. To this point we have used Jenkins to manage the produced artifacts. We have Artifactory deployed in-house. Would it be a bad idea to leverage Artifactory to capture the produced artifacts? Or is Artifactory meant to hold JARs with versions that can be pulled into projects with Maven when building and not meant to capture artifacts that a continuous integration tool uses? |
46867 | How can I tell if software is highly-coupled? | I am familiar with the term "highly coupled" but am curious if there are signs (code smells) that can indicate that code is highly coupled. I'm currently working with Java EE but this can apply to any language. **Edit:** In case anyone's interested, this article sounds helpful: In pursuit of code quality: Beware the tight couple! (IBM) |
160251 | Being a team manager and a developer in a Scrum team | I am managing a team of 6 people that recently moved to Scrum. We have a Scrum Master (one of the developers in the team) and a Product Owner. Since I have quite a lot of free time (because a lot of management work that I used to do is now done by the Scrum Master and Product Owner), and since I want to remain technically relevant, I am doing some technical development work. I act as a part of the development team, commit to some of the stories in each sprint, and participate in all the meetings as a part of the team. Do you think it is a good idea? Can it contradict the "self-organization" of the team? |
211558 | Design patterns for multi-threaded messaging server | I'm designing an instant messaging server as a personal exercise to improve my understanding and application of multi-threading and design patterns in Java. I'm still designing, there's no code yet. My goal is to have a server that should make effective use of a multi-CPU box. I'd like the server to be distributable across multiple boxes, but wonder if that's running before I can walk. My initial thoughts are: * `ClientConnectionManager` has `ServerSocket` object that constantly accepts client `Socket` connections. * `ClientConnectionManager` has a thread pool that spawns a new `ClientProxy` object when a client socket connection is accepted, handing in the client `Socket` object. * The `ClientProxy` objects represent the client app and handles sending/receiving messages across the `Socket` stream. Is it correct that only one `ServerSocket` may bind to a Port? I take it there's no way to have a pool of objects accepting Socket connections? I have two ideas for passing messages between `ClientProxy` objects. Either directly between `ClientProxy` objects that are "buddies" or via a central "Exchange" object, or better yet, pool of objects. What are the Pros/Cons of the two approaches? Does the Exchange lend itself better to a distributed app? Would the Observer and Mediator patterns, respectively, be appropriate? |
158713 | GDI low on memory | I am fresh to Visual C++. While moving forward in the book "Programming Windows with MFC", I came across GDI (Graphics Device Interface) and use of paint brush. The book says a brush cannot be created if your GDI is low on memory. I want to know when and how does GDI get low on memory? And more important, what is the reason that we cannot create brush when GDI is low on memory? |
158715 | Are small amounts of functional programming understandable by non-FP people? | **Case** : I'm working at a company, writing an application in Python that is handling a lot of data in arrays. I'm the only developer of this program at the moment, but it will probably be used/modified/extended in the future (1-3 years) by some other programmer, at this moment unknown to me. I will probably not be there directly to help then, but maybe give some support via email if I have time for it. So, as a developer who has learned functional programming (Haskell), I tend to solve, for example, filtering like this: filtered = filter(lambda item: included(item.time, dur), measures) The rest of the code is OO, it's just some small cases where I want to solve it like this, because it is much simpler and more beautiful according to me. **Question** : Is it OK today to write code like this? * How does a developer that hasn't written/learned FP react to code like this? * Is it readable? * Modifiable? * Should I write documentation like explaining to a child what the line does? # Filter out the items from measures for which included(item.time, dur) != True I have asked my boss, and he just says "FP is black magic, but if it works and is the most efficient solution, then it's OK to use it." What is your opinion on this? As a non-FP programmer, how do you react to the code? Is the code "googable" so you can understand what it does? I would love feedback on this :) **Edit** : I marked phant0m's post as answer, because he gives good advice on how to write the code in a more readable way, and still keep the advantages. But I would also like to recommend superM's post because of his viewpoint as a non-FP programmer. |
158716 | Is Liskov Substitution Principle incompatible with Introspection or Duck Typing? | Do I understand correctly that Liskov Substitution Principle cannot be observed in languages where objects can inspect themselves, like what is usual in duck typed languages? For example, in Ruby, if a class `B` inherits from a class `A`, then for every object `x` of `A`, `x.class` is going to return `A`, but if `x` is an object of `B`, `x.class` is not going to return `A`. Here is a statement of LSP: > Let _q(x)_ be a property provable about objects _x_ of type _T_. Then _q(y)_ > should be provable for objects _y_ of type _S_ where _S_ is a subtype of > _T_. So in Ruby, for example, class T; end class S < T; end violate LSP in this form, as witnessed by the property _q(x)_ = `x.class.name == 'T'` * * * _Addition._ If the answer is "yes" (LSP incompatible with introspection), then my other question would be: is there some modified "weak" form of LSP which can possibly hold for a dynamic language, possibly under some additional conditions and with only special types of _properties_. * * * _Update._ For reference, here is another formulation of LSP that I've found on the web: > Functions that use pointers or references to base classes must be able to > use objects of derived classes without knowing it. And another: > If S is a declared subtype of T, objects of type S should behave as objects > of type T are expected to behave, if they are treated as objects of type T. The last one is annotated with: > Note that the LSP is all about expected behaviour of objects. One can only > follow the LSP if one is clear about what the expected behaviour of objects > is. This seems to be weaker than the original one, and might be possible to observe, but I would like to see it formalized, in particular explained who decides what the expected behavior is. Is then LSP not a property of a pair of classes in a programming language, but of a pair of classes together with a given set of properties, satisfied by the ancestor class? Practically, would this mean that to construct a subclass (descendant class) respecting LSP, all possible uses of the ancestor class have to be known? According to LSP, the ancestor class is supposed to be replaceable with any descendant class, right? * * * _Update._ I have already accepted the answer, but i would like to add one more concrete example from Ruby to illustrate the question. In Ruby, each class is a module in the sense that `Class` class is a descendant of `Module` class. However: class C; end C.is_a?(Module) # => true C.class # => Class Class.superclass # => Module module M; end M.class # => Module o = Object.new o.extend(M) # ok o.extend(C) # => TypeError: wrong argument type Class (expected Module) |
193821 | Are there any problems with implementing custom HTTP methods? | We have a URL in the following format > /instance/{instanceType}/{instanceId} You can call it with the standard HTTP methods: POST, GET, DELETE, PUT. However, there are a few more actions that we take on it such as "Save as draft" or "Curate" We thought we could just use custom HTTP methods like: DRAFT, VALIDATE, CURATE I think this is acceptable since the standards say > "The set of common methods for HTTP/1.1 is defined below. Although this set > can be expanded, additional methods cannot be assumed to share the same > semantics for separately extended clients and servers." And tools like WebDav create some of their own extensions. Are there problems someone has run into with custom methods? I'm thinking of proxy servers and firewalls but any other areas of concern are welcome. Should I stay on the safe side and just have a URL parameter like action=validate|curate|draft? |
193820 | What should I consider when choosing between taking a MOOC or working on a project? | As background, I've been programming for about 5 years, and feel like I'm somewhat "up to speed" on industry best-practices and techniques (for web development, specifically), as well as software development fundamentals. However, I know I have a lot to learn. Recently, many free online classes, MOOCs, have been made available from multiple initiatives, including many universities. A number of these courses are in software development, theoretical computer science, mathematics, and other fields that are generally relevant for programming. I've been taking many of these MOOCs, learned a lot, and had lots of fun in the process. However, the time that it takes for me to complete the material **leaves little room for doing much of anything else** , including diving deeper into the subject matter or applying the material in the form of a project (I'm usually taking 3+ courses at once). Thinking about this, I've come up with a few questions: * From a purely skill-oriented perspective, _what are the pros and cons of taking classes / working on projects?_ Will working on projects help me improve my real programming skills faster? Will I miss out on some deep insight by not taking courses? * From a career perspective, _what do employers value most?_ (I suspect that I already know the answer) Will a multitude of (open source) projects or a plethora of coursework be most convincing? * Finally, assuming courses are deemed as a "net positive", _how much formal education is enough?_ If I continue taking MOOCs, when should I take a break and work on a project? |
193824 | java classes and database queries | Can someone please explain the best way to solve this problem. Suppose I have three classes 1. `Person` 2. `Venue` 3. `Vehicle` I have a DAO method that needs to return some or all of these attributes from each of the classes after doing a query. Please note, by requirements I am using one DAO for all three classes and no frameworks. Only my own MVC implementation How do I accomplish this? It seems very wrong to make a class `PersonVenueVehicle` and return that as an object to get the instance field, values. I was taught that the database entities must be reflected by classes, if this is case how is it implemented in such a situation? |
222228 | Algorithm to find times when resources are available | I'm writing a semi-automatic scheduling application. Given some existing bookings and some resource requirements, it needs to find the times at which a new event can be scheduled. A human user will then evaluate the results and choose one of the options. It does not need to optimise a timetable for multiple events and hence it is not the usual NP-Hard timetabling problem. The system has a number of resources (trainers, rooms, equipment) each of which has a type (e.g. French teacher, seminar room, projector...). Resources are booked for events each of which has a start and end time. Now, say I need to schedule a 2 hour long French class using a projector in a seminar room, what are the times that at least one resource of each required resource type is available? In order to limit the problem space, it's acceptable to consider only 9am-5pm, Mon-Fri at 15 minute intervals for the next 90 days. Total number of resources in of the order of 1000. How can I do this without having to compare every resource with every other resource? |
163509 | In centralized version control, is it always good to update often? | Assuming that: * You are in a team developing some software. * Your team is using centralized version control in the development process. * You are working on a new feature which will surely take several days to complete, and you won't be able to commit before that because it would break the build. * Your team members commit something every day that affects some of the files you're working with for your fancy new feature. Since this is centralized version control, you will have to update your local checkout at some point: at least once right before committing the new feature. If you update only once right before your commit, then there might be a lot of conflicts due to the many other changes by your teammates, which could be a world of pain to resolve all at once. Or, you could update often, and even if there are a few conflicts to resolve day by day, it should be easier to do, little by little. Can we say that it is always a good idea to update often? |
176681 | Did C++11 address concerns passing std lib objects between dynamic/shared library boundaries? (ie dlls and so)? | One of my major complaints about C++ is how hard in practice it is to pass std library objects outside of dynamic library (ie dll/so) boundaries. The std library is often header-only. Which is great for doing some awesome optimizations. However, for dll's, they are often built with different compiler settings that may impact the internal structure/code of a std library containers. For example, in MSVC one dll may build with iterator debugging on while another builds with it off. These two dlls may run into issues passing std containers around. If I expose `std::string` in my interface, I can't guarantee the code the client is using for `std::string` is an exact match of my library's `std::string`. This leads to hard to debug problems, headaches, etc. You either rigidly control the compiler settings in your organization to prevent these issues or you use a simpler C interface that won't have these problems. Or specify to your clients the expected compiler settings they should use (which sucks if another library specifies other compiler settings). My question is whether or not C++11 tried to do anything to solve these issues? |
163506 | How does one handle sensitive data when using Github and Heroku? | I am not yet accustomed with the way Git works (And wonder if someone besides Linus is ;)). If you use Heroku to host you application, you need to have your code checked in a Git repo. If you work on an open-source project, you are more likely going to share this repo on Github or other Git hosts. Some things should not be checked in the public repo; database passwords, API keys, certificates, etc... But these things still need to be part of the Git repo since you use it to push your code to Heroku. How to work with this use case? Note: I know that Heroku or PHPFog can use server variables to circumvent this problem. My question is more about how to "hide" parts of the code. |
163502 | Port numbers in Visual Studio projects and IIS | I have a few questions about localhost and port numbers as this is an area where I do not have a lot of knowledge, and because I recently had to work with setting up Visual Studio projects and IIS and there are things I'm not clear on. I have the following questions on the things I find confusing. I thought it made more sense to include them all in one question instead of making separate questions. 1. I have noticed a random port number is generated with projects I have worked on in the past, but I recently saw a project where the port number was fixed. What is the purpose of having a fixed/default localhost port number? i.e is it particularly useful on projects that have many programmers working on the project? 2. If a solution contains multiple projects (for example, WCF services, Domain, MVC/Web pages), is it possible to setup a different localhost port for each of them? If so, what is the benefit of this? 3. If a solution contains multiple projects and has different localhost urls/port numbers, must there be a corresponding website (and application pool) for each project in IIS? Or just for the project that contains the actual web pages? |
34609 | Most commonly forgotten thing to do when programming/web developing | Does anyone else have that one thing they always forget to do when programming or developing a website? Personally mine is forgetting to include the Doctype in a website...the amount of time i have spent ages fixing/adding/hacking around with CSS to fix IE problems and it turns out to be the F'in Doctype declaration!!! |
112953 | Is it wrong to take code you have produced at work and re-use it for personal projects? | Throughout my various workplaces and through my university life I always wrote code which I thought "this would be really useful in generic situations". Indeed, I intentionally write code, even if it takes me a while to write, which I know will help me in the future (e.g. custom `SubString()` functions). Hence the reason for 'Helper' classes. These functions I'm sure can probably be found elsewhere online but the point is, I wrote them, and I will use them again later in other jobs or for personal projects. Currently I don't maintain a personal code library as I never have time to sit there and copy code from my work place / projects to another personal location. Question is, is it wrong to take code you have produced at work and re-use it ( **a** ) for personal projects, and ( **b** ) in other jobs? |
237529 | AI development, variation on the horizon effect | Developing an alpha-beta search for "Colorito", which has the characteristic that sometimes simple hill-climbing is impossible; so a sequence of 2 or 3 moves is the only way to make progress. I came up with an endgame position where, with a 6 ply search, it's possible to make good progress in 2 moves but the third move must be the "bad" move of a new sequence. It's also possible to make the same 2-move sequence take 3 moves, avoiding the "bad" move on the horizon. This 3-moves which could be 2-moves becomes the principle variation. The problem is that this same analysis applies to the next move, too; so the AI becomes stuck, making no progress. The search framework serves a lot of different games, so I'm most interested in generic approaches to detecting/avoiding this problem, but also game- specific ideas that might avoid this particular problem. Edit: After some thought, a reasonable and somewhat general approach is to allow "pass" moves at the terminal level of the search, even if the game does not. These artificial passes can be valued at zero, or slightly positive, so instead of finding a "bad" move at the search depth limit, the search will find a pass. |
118806 | Translating longer texts (view and email templates) with gettext | I'm developing a multilingual PHP web application, and I've got long(-ish) texts that I need to translate with gettext. These are email templates (usually short, but still several lines) and parts of view templates (longer descriptive blocks of text). These texts would include some simple HTML (things like bold/italic for emphasis, probably a link here or there). The templates are PHP scripts whose output is captured. The problem is that gettext seems very clumsy for handling longer texts. Longer texts would generally have more changes over time than short texts — I can either change the msgid and make sure to update it in all translations (could be lots of work and very error-prone when the msgid is long), or I can keep the msgid unchanged and modify only the translations (which would leave misleading outdated texts in the templates). Also, I've seen advice against including HTML in gettext strings, but avoiding it would break a single natural piece of text into lots of chunks, which will be an even bigger nightmare to translate and reassemble, and I've also seen advice against unnecessary splitting of gettext strings into separate msgids. The other approach I see is to ignore gettext altogether for these longer texts, and to separate those blocks in external subtemplates for each locale, and just include the one for the current locale. The disadvantage is that I'm separating the translation effort between gettext .po files and separate templates located in a completely different location. Since this application will be used as a starting point for other applications in the future, I'm trying to come up with the best approach for the long term. I need some advice for best practices in such scenarios. How have you implemented similar cases? What turned out to work and what turned out a bad idea? |
118801 | Sharing Authentication Across Subdomains using cookies | I know that in general cookies themselves are not considered robust enough to store authentication information. What I am wondering is if there is an existing design pattern or framework for sharing authentication across subdomains without having to use something more complex like OpenID. Ideally, the process would be that the user visits abc.example.org, logs in, and continues on to xyz.example.org where they are automatically recognized (ideally, the reverse should also be possible -- a login via xyz means automatic login at abc). The snag is that abc.example.org and xyz.example.org are both on different servers and different web application frameworks, although they can both use a shared database. The web application platforms include PHP, ColdFusion, and Python (Django), although I'm also interested in this from a more general perspective (i.e. language agnostic). |
13053 | First languages with generic programming support | Which was the first language with generic programming support, and what was the first major staticly typed language (widely used) with generics support. Generics implement the concept of parameterized types to allow for multiple types. The term generic means "pertaining to or appropriate to large groups of classes." I have seen the following mentions of "first": > First-order parametric polymorphism is now a standard element of statically > typed programming languages. Starting with System F [20,42] and functional > programming lan- guages, the constructs have found their way into mainstream > languages such as Java and C#. In these languages, first-order parametric > polymorphism is usually called generics. From "Generics of a Higher Kind", Adriaan Moors, Frank Piessens, and Martin Odersky > Generic programming is a style of computer programming in which algorithms > are written in terms of to-be-specified-later types that are then > instantiated when needed for specific types provided as parameters. This > approach, pioneered by Ada in 1983 From Wikipedia Generic Programming |
222222 | Building a distributed system on Amazon Web Services | Would simply using AWS to build an application make this application a distributed system? For example if someone uses **RDS** for the database server, **EC2** for the application itself and **S3** for hosting user uploaded media, does that make it a distributed system? If not, then what should it be called and what is this application lacking for it to be distributed? **Update** Here is my take on the application to clarify my approach to building the system: 1. The application I'm building is a social game for Facebook. 2. I developed the application locally on a LAMP stack using Symfony2. 3. For production I used an a single EC2 Micro instance for hosting the app itself, RDS for hosting my database, S3 for the user uploaded files and CloudFront for hosting static content. I know this may sound like a naive approach, so don't be shy to express your ideas. |
237526 | Practical programming according to the Dependency Inversion Principle | What the Dependency Inversion Priciple implies in practice is that in a system, high level components should depend on abstractions of the low level components (instead of on the low level components directly), and the low level components should be defined in terms of these abstractions. The key point for my question is that _the low level components are defined in terms of the abstractions, which is defined in terms of the high level components_. Meaning: the high level components 'define the abstraction' in terms of what would be convenient for them, and the low level components have to be defined according to that abstraction (usually an interface). So if the high level component is a `Car`, and the low level component is the `Engine`, and an interface `IEngine` is defined - it will be defined according to the needs of the `Car`, and `Engine` will have to fit these needs. So if it's convenient for the `Car` to be able to simply start the engine, `IEngine` would feature a method `start()` and `Engine` would have to implement it. My question is: When starting programming on a project designed according to the Dependency Inversion Principle - are the high level components usually implemented before the low level ones, ie. "top to bottom" development? Since the principle implies that the low level components are designed according to what is convenient for the high level components, it makes sense to first start programming the high level components, and only then define the `ILowLevelComponent` interface, based on what we learned the high level components need when we programmed them. For example we're implementing a system that simulates a car. `Car` is the high level component, while `Engine` and `SteeringWheel` are the low level components. `Engine` and `SteeringWheel` take care of the concrete work of moving the car around, while `Car` takes care of coordinating everything and creating a functioning system. If we were designing the system according to DIP, that means that `Engine` and `SteeringWheel` are defined in terms of an abstraction, that is defined in terms of what is convenient for `Car`. So it would make sense to first implement `Car`, understand exactly how it's going to work in high level terms and what it needs to work, and only then define the `IEngine` and `ISteeringWheel` interfaces, according to what the `Car` needs. And then ofcourse implement the concrete classes that implement the interfaces. **So what I'm asking is: when working on a project that is designed in the spirit of DIP, is the "top to bottom development" approach common? Is this how work is usually done on project following the Dependency Inversion Principle?** |