Search Results

Search found 15300 results on 612 pages for 'programming languages'.

Page 17/612 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • What are functional-programming ways of implementing Conway's Game of Life

    - by George Mauer
    I recently implemented for fun Conway's Game of Life in Javascript (actually coffeescript but same thing). Since javascript can be used as a functional language I was trying to stay to that end of the spectrum. I was not happy with my results. I am a fairly good OO programmer and my solution smacked of same-old-same-old. So long question short: what is the (pseudocode) functional style of doing it? Here is Pseudocode for my attempt: class Node update: (board) -> get number_of_alive_neighbors from board get this_is_alive from board if this_is_alive and number_of_alive_neighbors < 2 then die if this_is_alive and number_of_alive_neighbors > 3 then die if not this_is_alive and number_of_alive_neighbors == 3 then alive class NodeLocations at: (x, y) -> return node value at x,y of: (node) -> return x,y of node class Board getNeighbors: (node) -> use node_locations to check 8 neighbors around node and return count nodes = for 1..100 new Node state = new NodeState(nodes) locations = new NodeLocations(nodes) board = new Board(locations, state) executeRound: state = clone state accumulated_changes = for n in nodes n.update(board) apply accumulated_changes to state board = new Board(locations, state)

    Read the article

  • Programming Geek's CV Design

    - by benhowdle89
    What is the best practice or advice for a programmer's CV? If I were a graphic designer or more of a web designer as opposed to a programmer, then I'd imagine a CV would have a bit more flourish to it. Yet as a programmer, aren't we judged on not only efficiency and results but also creativity, imagination and initiative? Should this be reflected in a CV? Or is it all about the information, no wishy washy designs in sight? Has anyone experimented with an original alternative to a PDF CV with a template from MS Word or Mac Pages?

    Read the article

  • Basic Defensive Database Programming Techniques

    We can all recognise good-quality database code: It doesn't break with every change in the server's configuration, or on upgrade. It isn't affected by concurrent usage, or high workload. In an extract from his forthcoming book, Alex explains just how to go about producing resilient TSQL code that works, and carries on working.

    Read the article

  • Yet another use of OUTER APPLY in defensive programming

    - by Alexander Kuznetsov
    When a SELECT is used to populate variables from a subquery, it fails to change them if the subquery returns nothing - and that can lead to subtle bugs. We shall use OUTER APPLY to eliminate this problem. Prerequisites All we need is the following mock function that imitates a subquery: CREATE FUNCTION dbo.BoxById ( @BoxId INT ) RETURNS TABLE AS RETURN ( SELECT CAST ( 1 AS INT ) AS [Length] , CAST ( 2 AS INT ) AS [Width] , CAST ( 3 AS INT ) AS [Height] WHERE @BoxId = 1 ) ; Let us assume that this...(read more)

    Read the article

  • Is using ELSE bad programming?

    - by dave.b
    I've often come across bugs that have been caused by using the ELSE construct. A prime example is something along the lines of: If (passwordCheck() == false){ displayMessage(); }else{ letThemIn(); } To me this screams security problem. I know that passwordCheck is likely to be a boolean, but I wouldn't place my applications security on it. What would happen if its a string, int etc? I usually try to avoid using ELSE, and instead opt for two completely separate IF statements to test for what I expect. Anything else then either gets ignored OR is specifically handled. Surely this is a better way to prevent bugs / security issues entering your app. How do you guys do it?

    Read the article

  • Book Review: Defensive Database Programming With SQL Server

    It distils a great deal of practical experience; the writing of it was a considerable task; It packs in a great deal of information. Alex's book shows how to write robust database applications, and we can all learn from it. We took the book to a critic who never minces his words, and were relieved to find that Joe Celko liked it.

    Read the article

  • Keep a programming language backwards compatible vs. fixing its flaws

    - by Radu Murzea
    First, some context (stuff that most of you know anyway): Every popular programming language has a clear evolution, most of the time marked by its version: you have Java 5, 6, 7 etc., PHP 5.1, 5.2, 5.3 etc. Releasing a new version makes new APIs available, fixes bugs, adds new features, new frameworks etc. So all in all: it's good. But what about the language's (or platform's) problems? If and when there's something wrong in a language, developers either avoid it (if they can) or they learn to live with it. Now, the developers of those languages get a lot of feedback from the programmers that use them. So it kind of makes sense that, as time (and version numbers) goes by, the problems in those languages will slowly but surely go away. Well, not really. Why? Backwards compatibility, that's why. But why is this so? Read below for a more concrete situation. The best way I can explain my question is to use PHP as an example: PHP is loved thousands of people and hated by just as many thousands. All languages have flaws, but apparently PHP is special. Check out this blog post. It has a very long list of so called flaws in PHP. Now, I'm not a PHP developer (not yet), but I read through all of it and I'm sure that a big chunk of that list are indeed real issues. (Not all of it, since it's potentially subjective). Now, if I was one of the guys who actively develops PHP, I would surely want to fix those problems, one by one. However, if I do that, then code that relies on a particular behaviour of the language will break if it runs on the new version. Summing it up in 2 words: backwards compatibility. What I don't understand is: why should I keep PHP backwards compatible? If I release PHP version 8 with all those problems fixed, can't I just put a big warning on it saying: "Don't run old code on this version !"? There is a thing called deprecation. We had it for years and it works. In the context of PHP: look at how these days people actively discourage the use of the mysql_* functions (and instead recommend mysqli_* and PDO). Deprecation works. We can use it. We should use it. If it works for functions, why shouldn't it work for entire languages? Let's say I (the developer of PHP) do this: Launch a new version of PHP (let's say 8) with all of those flaws fixed New projects will start using that version, since it's much better, clearer, more secure etc. However, in order not to abandon older versions of PHP, I keep releasing updates to it, fixing security issues, bugs etc. This makes sense for reasons that I'm not listing here. It's common practice: look for example at how Oracle kept updating version 5.1.x of MySQL, even though it mostly focused on version 5.5.x. After about 3 or 4 years, I stop updating old versions of PHP and leave them to die. This is fine, since in those 3 or 4 years, most projects will have switched to PHP 8 anyway. My question is: Do all these steps make sense? Would it be so hard to do? If it can be done, then why isn't it done? Yes, the downside is that you break backwards compatibility. But isn't that a price worth paying ? As an upside, in 3 or 4 years you'll have a language that has 90 % of its problems fixed.... a language much more pleasant to work with. Its name will ensure its popularity. EDIT: OK, so I didn't expressed myself correctly when I said that in 3 or 4 years people will move to the hypothetical PHP 8. What I meant was: in 3 or 4 years, people will use PHP 8 if they start a new project.

    Read the article

  • Programming bots in games

    - by Bane
    I'm interested in how bots are usually written. Here's my situation: I plan to make an online 2D mecha game in HTML5, and the server-side will be done with node. It is intended to be multiplayer, but I also want to make bots in case there aren't enough players. How does my game logic see them, as players or as bots? Is there a standard by which I should make them? Also, any general tips and hints will be OK.

    Read the article

  • ViewController in programming

    - by Vishwas Gagrani
    ViewController is a term for classes that handle views in a framework. This is especially used in MVC frameworks. I go through various projects, written by various programmers, who implement MVC in different ways. Especially, i get confused, about the relation between the MainView ( parent view ) and some CustomView ( widget etc) in the framework. I personally pass reference of the MainView into the ViewController to be instantiated. All the subviews of ViewController are added to that reference of MainView. Additionally, ViewController itself is added as a child of MainView. Like this : Want to know, if this is the right way to relate each other ?

    Read the article

  • Structure vs. programming

    - by ChristopherW
    Is it bad that I often find myself spending more time on program structure than actually writing code inside methods? Is this common? I feel I spend more time laying the foundation than actually building the house (metaphorically). While I understand that without a good foundation the house will cave in, but does it legitimately need to take half of the project to finalize code structure? I understand design patterns, and I know where to go if I need help on choosing one, but often I find myself doubting my own choices.

    Read the article

  • General List of Common Programming Errors

    - by javamonkey79
    As one journey's from apprentice to journeyman to master I've noticed that one accumulates a list of best practices for things they've been bitten by. Personally, I write most of my stuff in java & SQL so my list tends to be slated towards them. I've accumulated the following: When doing list removal, always reverse iterate Avoid adding items to a list you are currently iterating on Watch out for NullPointerExceptions Now, I know there are language specific "common errors" links out there like this one. And I'm also aware of the pragmatic programmer tips, Martin Fowler's "code smells". Does anyone know of any good lists out there of things like I've listed above (re: list removal, adding items, etc). My guess is that there are some good QA folks out there that can probably throw me a bone here. I'm not looking for things the compiler can catch - I'm looking for common things that cause bugs. In the event that there isn't a list out there already then I welcome posting your own findings here. Thanks in advance!

    Read the article

  • What is the right option of programming languages and tools for building our website?

    - by Goma
    We are 3 persons trying to build a large website which will be available in 3 languges. However, we will start with one language and with small idea then we are going to improve it and make it larger! What do you think the best tools and language that we should use? We are caring alot about the speed of loading the pages and tools that provide excellent qulaity with cheaper fees. Edit: We are graphic designers, so we did not choose the programming language yet. But we studied computer science and we have an idea but we found that this is the best place to ask the question and expect the right answer from you. Should we use ASP.NET for example? or PHP? We do not want an expesive option that will cost us alot in the future and we do not want to change the technology at least for the first 5 years. Thanks!

    Read the article

  • Why did visual programming never take off and what future paradigms might change that?

    - by Rego
    As the number of "visual" OS's such as Android, iOS and the promised Windows 8 are becoming more popular, it does not seem to me that we programmers have new ways to code using these new technologies, due to a possible lack in new visual programming languages paradigms. I've seen several discussions about incompatibilities between the current coding development environment, and the new OS approaches from Windows 8, Android and other tablets OS's. I mean, today if we have a new tablet, it's almost a requirement for coding, to have, for instance, an external keyboard (due it seems to me it's very difficult to program using the touch screen), exactly because the coding assistance is not conceived to "write" thousands of lines of code. So, how advanced should be the "new" visual programming languages paradigms? Which characteristics these new paradigms would be required?

    Read the article

  • Event Driven Programming 101

    - by JHarley1
    Good Morning, I previously asked the Q. of how Event Handlers Work (which I got a great answer for). I would now like to understand the basics of how are events are associated with on-screen objects? An explanation of how Events are associated with on Screen Objects: The application registers the Event, the Event Handler and the Component with the GUI Server. When an Event is detected the GUI Server has to link an Event to a Window and then to a Component, it then consults the Event / Component Table to identify which Handler (s) to be executed. I am having problems finding resources/papers that have mention of this process - especially of a Event / Component Table - can anyone clarify?

    Read the article

  • Question on methods in Object Oriented Programming

    - by mal
    I’m learning Java at the minute (first language), and as a project I’m looking at developing a simple puzzle game. My question relates to the methods within a class. I have my Block type class; it has its many attributes, set methods, get methods and just plain methods. There are quite a few. Then I have my main board class. At the moment it does most of the logic, positioning of sprites collision detection and then draws the sprites etc... As I am learning to program as much as I’m learning to program games I’m curious to know how much code is typically acceptable within a given method. Is there such thing as having too many methods? All my draw functionality happens in one method, should I break this into a few ‘sub’ methods? My thinking is if I find at a later stage that the for loop I’m using to cycle through the array of sprites searching for collisions in the spriteCollision() method is inefficient I code a new method and just replace the old method calls with the new one, leaving the old code intact. Is it bad practice to have a method that contains one if statement, and place the call for that method in the for loop? I’m very much in the early stages of coding/designing and I need all the help I can get! I find it a little intimidating when people are talking about throwing together a prototype in a day too! Can’t wait until I’m that good!

    Read the article

  • What are some non-MS languages that can write xlsx (Excel 2007+) documents efficiently?

    - by Honus Wagner
    Unfortunately, Excel format is required for the project I am working on. I have no problems getting the data I need in objects and arrays, and currently PHPExcel is doing handling the document generation. It works, but it's slow and loopy. Was wondering if there is a more efficient server language to generate Excel documents (not CSVs). This is a pure Linux environment so I need to stay away from .NET. I am open to any programming language that does it cleanly and efficiently. Thanks.

    Read the article

  • Functional Programming, JavaScript and UI - some neophyte questions

    - by jamesson
    This has been discussed in other threads, however I am hoping for some comments relevant to UI and an explanation of some vitriol I had flung my way in a Certain IRC Channel Which shall remain nameless. In the discussion here, the comments in the accepted answer suggest that I approach the given code from a functional perspective, which was new to me at the time. Wikipedia said, among other things, that FP "avoids state and mutable data", which includes according to the discussion global vars. Now, being that I am already pretty far along in my project I am not going to learn FP before I finish, but... How is it possible to avoid global vars if, for instance, I have a UI whose entire functionality changes if a mousebutton is down? I have a number of things like this. Why was there a strong negative reaction in the Certain IRC channel to implementing FP in JS? When I Brought up what seemed to me to be supportive comments by Crockford, people got even madder. Now, this being IRC there is no rep system, but they at least gave indication of having read TGP (which I haven't gotten to yet) so I'm assuming they're not idiots. Many thanks in advance Joe

    Read the article

  • Why use other number bases when programming

    - by JMD
    My coworkers and I have been bending our minds to figuring out why anyone would go out of their way to program numbers in a base other than base 10. I suggested that perhaps you could optimize longer equations by putting the variables in the correct base you are working with (for instance, if you have only sets of 5 of something with no remainders you could use base 5), but I'm not sure if that's true. Any thoughts?

    Read the article

  • New to Java Programming - Error help

    - by JJJ
    I am going through a Java book and drafting the examples and have run into the following error when compiling this code. Any help would be appreciated thank you. Error: Main.java:3: class Addition is public, should be declared in a file named Addition.java public class Addition        ^ 1 error Code: import java.io.*; import java.util.Scanner; public class Addition {   public static void main(String[] args) { java.util.Scanner input = new java.util.Scanner(System.in);  int number1; int number2; int sum; System.out.print( "Enter first digit: " ); number1 = input.nextInt(); System.out.print( "Enter second digit:" ); number2 = input.nextInt(); sum = number1 + number2; System.out.printf( "Sum is %d\n, sum" );      } }

    Read the article

  • Is there a well grounded theory on backward and forward compatibility of formats, languages, grammars and vocabularies?

    - by Breton
    I have a friend who has the specific problem of building a case against the use of a custom HTML <wrapper> tag in some site's markup. Now, intuitively we can answer that use of such a tag is risky, as future HTML specs may define a wrapper tag with semantics that conflict with its use on the site. We can also appeal to a particular section of the HTML5 spec which also recommends against the use of custom tags for this reason. And while I agree with the conclusion, I find these arguments a little on the weak side, on their own. Is there some well grounded and proven theory in computer science from which we can derive this conclusion? Have programming language theorists created proofs about the properties of vocabulary versioning, or some such thing?

    Read the article

  • How to measure his own skill in a programming language? [closed]

    - by lollancf37
    Possible Duplicate: How Can I Know Whether I Am a Good Programmer? As many programmers I have worked in several languages. While of course there are some that I am more at ease than other, I do not have a real way to precisely measure my skill in a specific language. So I thought of a system which allows me to help me with that. I am looking for 5 common criteria in programming languages, to which I will have a value from 1 (junior) to 4 ( Senior) to represent my skill. I however have no real idea of the criteria I should choose for that. Does anybody have suggestion ? Thanks.

    Read the article

  • Facebook Game Development - Which Programming languages?

    - by Ben
    Hi folks, I am going to develop a facebook game as topic for my thesis. I am wondering which programming languages i should choice. I am used to programming in .NET. But i am also comfortable in C++ and Java. I don't want to use Flash as the graphical frontend since i don't like it. So i guess i'll go with ASP.NET + Silverlight. What do you think?

    Read the article

  • Will HTML5/JS Eventually Replace All Client Side Languages? [closed]

    - by Shnitzel
    I'm just wondering about the future of it all. IMHO, there are 4 forces that define where technology goes: Microsoft, Apple, Google, Adobe. It looks like in Apple's iPhone/iPad iADs can now be programmed in HTML5. So does that mean HTML5 will eventually replace objective-c? Also, Microsoft has now shifted it's focus from WPF/Silverlight to HTML5 and I assume Visual Studio 2011 will be all about tooling support for HTML5. Because that's what Microsoft do. (Tools). In a few months IE9 the last major browser will support HTML5. Similarly Adobe is getting on the HTML5 bandwagon and allows to export flash content to HTML5 in their latest tools. And we all know how much in bed Google is with html5. Heck, their latest Operating System (Chrome OS) is nothing but a big fat web browser. Apps for Mobile (i.e., iPhone, Android, WM7) are very hard for a company to program especially for many different devices (each with their own language) so I'm assuming this won't last too long. I.e., HTML5 will be the unifying language. Which is somewhat sad for app developers because now users will be able to play the "cool" html5 apps for free on the web and it'll be hard to charge for them. So are strongly-typed languages really doomed, and in the future, say 5-10 years, will client side programming only be in HTML5? Will all of us become javascript programmers? :) Because the signs are sure pointing that way...

    Read the article

  • Do there exist programming languages where a variable can truly know its own name?

    - by Job
    In PHP and Python one can iterate over the local variables and, if there is only once choice where the value matches, you could say that you know what the variable's name is, but this does not always work. Machine code does not have variable names. C compiles to assembly and does not have any native reflection capabilities, so it would not know it's name. (Edit: per Anton's answer the pre-processor can know the variable's name). Do there exist programming languages where a variable would know it's name? It gets tricky if you do something like b = a and b does not become a copy of a but a reference to the same place. EDIT: Why in the world would you want this? I can think of one example: error checking that can survive automatic refactoring. Consider this C# snippet: private void CheckEnumStr(string paramName, string paramValue) { if (paramName != "pony" && paramName != "horse") { string exceptionMessage = String.Format( "Unexpected value '{0}' of the parameter named '{1}'.", paramValue, paramName); throw new ArgumentException(exceptionMessage); } } ... CheckEnumStr("a", a); // Var 'a' does not know its name - this will not survive naive auto-refactoring There are other libraries provided by Microsoft and others that allow to check for errors (sorry the names have escaped me). I have seen one library which with the help of closures/lambdas can accomplish error checking that can survive refactoring, but it does not feel idiomatic. This would be one reason why I might want a language where a variable knows its name.

    Read the article

  • Is aspect oriented programming a misnomer?

    - by glenviewjeff
    From everything I have learned about "Aspect Oriented Programming" or "Aspect Oriented Software Development," labeling it as a programming paradigm or methodology appears to be inaccurate. From what I can tell it is not a fundamental technique for programming. To nail down what is meant by "paradigm" and "methodology," please refer to the following definitions from the American Heritage Dictionary. Compare how well or poorly "Object-Oriented Programming" applies to each vs. how well AOP fits. Paradigm: A set of assumptions, concepts, values, and practices that constitutes a way of viewing reality for the community that shares them, especially in an intellectual discipline. Methodology: A body of practices, procedures, and rules used by those who work in a discipline or engage in an inquiry; a set of working methods. "Evidence-based medicine" satisfies the definition of paradigm, but "hysterectomy-based medicine" would be a misnomer because the problem space is too narrow. I am getting the impression that AOP may be misnamed because based on the "oriented-programming" suffix, AOP is alleging to be both a paradigm and a methodology in the same way "Object-Oriented Programming" is. Both of these terms (paradigm and methodology) indicate a fundamental technique, where what I understand about aspects is a technology for solving a narrow problem scope, maybe comparable in magnitude to the static variable feature of Java. If it's true that aspects solve a narrow set of problems, and AOP isn't a misnomer, then why shouldn't all programming techniques be given the "oriented-programming" suffix, such as "inheritance-oriented programming," "dependency-oriented programming," or "scope-oriented programming?"

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >