Jump to content

  • Log In with Google      Sign In   
  • Create Account


capn_midnight

Member Since 11 Sep 2000
Offline Last Active Mar 24 2014 01:47 PM
-----

#5135878 How to get good fast?

Posted by capn_midnight on 02 March 2014 - 12:04 PM

"How do I get the work done?" By getting the work done. There is no better substitute for getting the work done than getting the work done. Finding the best chair, the best keyboard, the best text editor, the best caffeine vector, the best excuse this week for why you haven't gotten the work done, they all feel like getting the work done. But they aren't. You just have to get the work done.

 

Or, in the words of my father, standing over me as I procrastinated my homework, "Put the pencil, on the paper. Move your hand. Move your hand."




#5093272 Highest level of math needed for 2D game development?

Posted by capn_midnight on 11 September 2013 - 08:06 AM

I consider a solid understanding of discrete math to be a necessary skill for any type of programming. If you don't agree, I submit you probably don't know discrete math very well. Learn it, and you'll be enlightened.

 

I've only just started delving into lambda calculus, but what I have learned so far has drastically improved my productivity and the quality of my code.

 

If you're interested in anything involving free motion, i.e. an Asteroids clone or an FPS, then trigonometry and linear algebra are important. A solid understanding of differential calculus can significantly enhance your understanding of many problems you might encounter with your update loop as well.




#5045318 Database change management

Posted by capn_midnight on 21 March 2013 - 11:35 AM

I'm curious about how other people use and live with databases, specifically the types of tools they use around their database to simplify work with it. For background info, what database(s) do you use, and what is the scope of your project? What kind of tools do you use to manage change with your database (implicit or explicit schema, server deployments, etc.)? What kind of "generator" tools are you using (thick- or thin-ORM, data access layers, whatever)? What pain points do you still experience? Thanks!

 
For myself, I have worked on a lot of custom enterprise resource planning systems over the years. Data is generally small, and highly relational. It's been mostly SQL Server, but there is some MySQL in there too. In other words, all pretty basic RDBMSs. I've played around with ORM systems like NHibernate and Entity Framework, found them quite useful for designing the initial database, but lacking something in the long run for any time changes were necessary after a nontrivial amount of data had been recorded. As a result, I've tended to try to leave the database changing in the database realm and use only a thin ORM (direct table mapping) with classes automatically generated from the schema. This seems to avoid lost data problems, but comes at a high development cost for constantly repeating yourself and not having change management ala source control in place.
 
Redgate has a tool called SQL Compare that I've used in the past that makes diffing and merging databases a snap, but it is very expensive. Without a SQL Compare-like tool, it's really easy to miss changes to tables and stored procedures without extremely comprehensive testing (and really, who does that?) when deploying from a development- to testing- or production-environment. And still, that is a uni-direction move. Unlike source control, you never get to see the past again (unless you're restoring from backup, and that is just not automatic enough or simple enough to be a workable solution).



#5021812 Source Control - Perforce

Posted by capn_midnight on 15 January 2013 - 09:11 AM

Client-server model SCMs are just a degenerate case of distributed SCMs; you can model a client-server SCM with a distributed one, but you can't model a distributed SCM with a client-server one. Also, Git's merge tool is killer, and without its powerful merge tool, branching (which is a vital operation in mature code bases) is just too difficult and dangerous to bother.

 

I remember thinking SVN was leagues away from VSS or CVS in quality. Now, I see them as more alike than different. All client-server SCMs are basically garbage, and Git is the gold standard of distributed SCMs.




#5018857 Programming progression

Posted by capn_midnight on 07 January 2013 - 08:19 PM

There is a reason why I didn't recommend a specific language. It doesn't matter. Learn Prolog as your first language. Learn Fortran. Heck, learn Malebolge. Doesn't matter. 

 

What does matter is your incessant worrying about the "right" and "proper" and "correct" way to do things, which is going to do nothing but hurt you in the long run.




#5017841 Java images?

Posted by capn_midnight on 05 January 2013 - 01:13 PM

drawImage returns immediately, whether the image is loaded or not. Check the return value of drawImage. If it's false, then the image has not yet loaded. Since you're reloading the image every time you paint, I suspect this is probably the case.

 

This may have more information for you




#5017837 Javascript / HTML5 best practices

Posted by capn_midnight on 05 January 2013 - 01:02 PM

First and foremost, since JavaScript is a programming language, the same general rules apply to writing efficient code:

  • Use the best algorithm for the task. Example, don't spend hours optimizing your bubble sort procedure when a quicksort will always be faster.

  • Use the features provided by the language's standard library, because they're probably written better than anything you'll create. Example, don't write your own quicksort. The standard library sort probably already does it.

Since javascript is a dynamic language, most of the same rules apply when optimizing:

  • Function calls to JavaScript are expensive. Calls to built-in functions may or may not be.

  • Dictionary references are expensive. Example: dictionary['thing']. If you need to access the same element more than once in a loop, assign it to a local variable before the loop then reference it with the variable.

  • Consider dictionary.thing to be equivalent to dictionary['thing'] as far as performance is concerned.

  • Functions are first class objects, and being first class objects they are no different than any other element in a dictionary on your objects: This line: "myobject.function()" can be considered the equivalent of "myobject['function']()" as far as efficiency goes. You can hoist this outside the loop too: 
    var myobject = new MyObject(whatever);
    var hoisted = myobject.function;
    
    for (var i = 0; i < 1000; ++i) {
        for (var j = 0; j < 1000; ++j) {
            hoisted(i, j);
        }
    }

     

     


  • "for (var i = 0; i < arrayLength; ++i)" is more efficient than "for (var i in array)" or even "for (var i = 0; i < array.length; ++i)" when the dictionary can be indexed sequentially.

  • Use built-in functions whenever possible, because they're often implemented in a low level language and compiled to machine code.

  • jsPerf is a great resource.

  • Don't optimize until you've profiled.

  • What is fast in Chrome might be slow in Safari, Firefox or Internet Explorer.

 

This is all very good advice, with the exception of "quicksort is always faster than bubblesort". That isn't necessarily true. Bubblesort is very fast on nearly sorted data and quicksort has a large constant value to its runtime that makes some algorithms like insertionsort faster than it for small sets of data. It really, really depends on the situation, which I think was your more general point, assume nothing.

 

Really, really, assume nothing. There is so much out there that can go wrong or can change at the last minute or looks one way but is really another. Whenever you find yourself in a situation of not understanding why something is broken, that is a big hint that you have a false assumption somewhere and need to start proving and disproving them.




#5017836 Javascript / HTML5 best practices

Posted by capn_midnight on 05 January 2013 - 12:54 PM

There are some cross-browser issues you will have to watch out for, but you'll find them with experience and figure out how to get around them.

Well isn't that what JQuery, Mootools, and other JS libraries are for?

I haven't used Mootools that much, but I have used JQuery a fair bit. I like the design of the interface a lot. Unfortunately, I think it adds a lot of overhead, especially on mobile devices. I don't think there are *that* many cross-browser issues to warrant such a huge cost in download size and startup time. Yes, the issues are annoying, but they are really easy to get around, and then you've learned it and never have to deal with it again.




#5017508 Javascript / HTML5 best practices

Posted by capn_midnight on 04 January 2013 - 03:28 PM

Honestly, so few people know what they're actually talking about with JS, it's really hard to make any recommendations. There's a tendency these days to treat JS as a "low level" language (lol, I know) and everyone is scrambling to figure out what the best other language to get that "compiles" to JS (lloll, I double know).

 

As long as you're following very basic principles of OO and Functional Programming, not writing sloppy code, you're going to be fine. There are some cross-browser issues you will have to watch out for, but you'll find them with experience and figure out how to get around them. JS isn't hard, just spend a little time with it and you'll know what to do.




#5017388 Applying for local jobs with the intent to move.

Posted by capn_midnight on 04 January 2013 - 12:35 AM

Just tell the truth, you're "willing to relocate". Don't try to game the system with half-truths and technically-rights.

 

Most places start off with phone interviews. If they like you and need you to come in for a face-to-face interview, a lot of companies will pay for a plane ticket to get you there. I had one place even pay for my hotel and dinner, it was rather nice.




#5017359 IDE?

Posted by capn_midnight on 03 January 2013 - 10:22 PM

2012. Why use old software?




#5017351 No knowledge of any programming language

Posted by capn_midnight on 03 January 2013 - 09:51 PM

Java, lacking lambda expressions, feels nothing like C# to me. But then, I use a LOT of lambdas.

 

There really are a bunch of different ways you can go. Probably one of the easier ones that gets you started, doesn't take a lot of tools, and is easy to show off your results, is HTML 5 and JavaScript. You technically have everything you need on your computer already: a text editor and a browser. Some tools like a syntax highlighting editor will help make the job easier, but you never really have to worry about keeping up to date on the latest versions of compilers and what not.




#5017348 Programming progression

Posted by capn_midnight on 03 January 2013 - 09:45 PM

Pick a language that has freely available, official documentation. Read it, then read it again, as much as you can. Don't even peak at tutorials, they all suck. Write code. Write code. Write code.

 

Can't stress it enough. Most of the questions I've ever fielded on programming have been because the asker never took the time to even try writing some code to see if it would work. Most of the arguments I've gotten into with coworkers at work were because they refused to take 15 minutes to write some piece of code to see if it would work. Just write code, write code, write code.




#5017347 IDE?

Posted by capn_midnight on 03 January 2013 - 09:39 PM

Stick with Visual Studio so you're only having to learn on thing at a time. Frankly, there isn't a better IDE than Visual Studio, anyway.




#5001403 Unique ID for every objects using reinterpret_cast

Posted by capn_midnight on 15 November 2012 - 06:19 PM

In 15 years of software development, I've never *actually* needed anything more than a sequential sequence starting at 1 for such a thing. I have thought I needed it, but in the end it turned out to be more trouble than it was worth.




PARTNERS