Jump to content

  • Log In with Google      Sign In   
  • Create Account


Telastyn

Member Since 13 Oct 2003
Offline Last Active Yesterday, 07:02 PM
*****

#5121060 Modifying my own code while it's running

Posted by Telastyn on 03 January 2014 - 09:24 PM

Enh, up I imagine the runtime modification would screw up your profiling more than simply including it always (in beta) and turning on logging when needed. When done judiciously, it won't substantially impact performance but still give you plenty of instrumentation to identify issues.


#5121056 Modifying my own code while it's running

Posted by Telastyn on 03 January 2014 - 09:07 PM

You're better off using an aspect oriented programming framework like PostSharp to inject these things during a build step rather than at runtime. I'm not sure how viable ubiquitous runtime modification of a loaded assembly is.


#5119197 Having trouble accessing an objects properties.

Posted by Telastyn on 25 December 2013 - 09:06 AM

The solution is to not need BladeWarrior's methods to fight. Generally that means making common methods available on character, making BladeWarrior an instance of Character (rather than a derivative of it), or by letting the thing that controls the fighting get a BladeWarrior rather than a Character array (though that one depends a lot more on how your game works).


#5113375 Code Review - Event Use?

Posted by Telastyn on 30 November 2013 - 05:59 PM


I know it would work fine, but in the interest of the single responsibility principle, would it be ok?

 

But it has a single responsibility: to allocate power to a subsystem. It knows how to tie the various other single responsibilities together. Something has to do that after all.

 

It might be good to separate that responsibility from the power source, but I'm not sure the decoupling benefits (flexibility, testability) here are worth the downsides (more overhead, harder to implement/read/maintain).




#5113262 Code Review - Event Use?

Posted by Telastyn on 30 November 2013 - 08:35 AM


The only other way I see writing this is if I pass instances of the relay, warp core, and subsystem to each other.

 

Yes, that seems to be the obvious thing to do.

 


Feels over kill

 

Just passing things around is the simplest, most straightforward way to code. It should be your default approach until you have some requirement (there may or may not be something passed in, there may be N things passed in at any given time, there may be things in weird plugins we don't know about).

 

I don't know your requirements but I would approach it like this:

public interface Subsystem {
        bool IsPowered { get; }
        int MaxPower { get; }
        int PowerLevel { get; }
    }

    public interface PowerSource {
        int SuppliedPower { get; }
        IEnumerable<KeyValuePair<Subsystem, int>> PowerAllocation { get; }
        void AllocatePowerToSubsystem(Subsystem target);
    }

If you can't simply allocate any subsystem to any power source, the Allocate method may need to be in a higher level "Ship" object. Either way, the entire logic for that operation lives in the one method devoted to doing it - not spread across 6 event handlers which provide no benefit.




#5101153 Am I read to start making games yet?

Posted by Telastyn on 13 October 2013 - 07:36 PM

I will disagree with some of my colleges here...

The old "If you have to ask..." line of idioms comes to mind here. It is (or should be) pretty obvious as you're learning to program how you can apply this thing you learned into making a (ugly, incomplete, stupid, buggy) game. Just take X and make that HP, and take Y and make that some enemy and *poof* you have a game rather than a homework problem.

...if you can't see that, or somehow can't envision how a game would work - then you're not ready. You'll just flounder, or worse, copy-paste some code and have no idea how it works or how to adapt it to your problem. Just keep moving forward. It doesn't really matter where you are (or even where you're going) as long as you keep improving.


#5100048 How to get motivated to learn Programming?

Posted by Telastyn on 09 October 2013 - 08:21 PM

I don't mean to more of a sourpuss than normal, but you don't need a mentor to learn to program, you need to learn how to learn; and learn how to work effectively. Eventually the mentor will leave or the engaging web tutorial will end. What then? You get to the part that is actually hard: slogging through years of unfun debugging and polish to make (statistically) a really bad, ugly game work.

All the programming-fu in the world will not help you if you cannot develop the work ethic (or at least stubbornness) to put it to use.

Hopefully this advice will help, even if I have no idea how to achieve it. For me, it took a whole lot of trial, error and introspection while failing my way out of college.


#5093168 CS Degree - Is it worth it?

Posted by Telastyn on 10 September 2013 - 07:21 PM

Pssh. It's as good a reason as any. You're only 18-22 once, and if you're off being an adult you'll generally have a very hard time finding friends (and dating partners) around your age - they're all off at college.

Learning who you are is a key part of college, and sexuality is an important aspect of adulthood. Beyond that, the social aspects of finding and maintaining relationships are important skills to grow so that you can be successful both professionally and personally.

It's certainly not a key reason you should go to college, but seeing "I already know how to program" as the only aspect of improvement at school is absurdly shortsighted.


#5092499 Stick with C++ or venture into C#?

Posted by Telastyn on 08 September 2013 - 10:51 AM

I personally have a lot less aggravation using C# than C++. Games are hard (and frustrating) enough that adding to that is unwise.




#5092491 CS Degree - Is it worth it?

Posted by Telastyn on 08 September 2013 - 09:45 AM

As a skilled programmer without a degree (yet), let me say in no uncertain terms: get a degree.
Even if you can _do_ the job, getting that first job is tons easier with a degree. HR departments (and most hiring managers) will hire a candidate with a degree over one without. And even when you do get a job, you'll get paid far less than a "more qualified" candidate.
And really, why would you *choose* to slave away 40 hours a week rather than spending 4 years hanging out with uninhibited coeds?

 
Uninhibited coeds tend to have an inverse financial effect when compared to employment.

I have lost somewhere around $25-30k *per year* over the past 15 years by making less than my degree'd peers. And that doesn't include the 15 months I spent unemployed because nobody would hire a non-degree'd computer programmer with no formal experience.

Not getting a degree is absurdly more expensive than even today's universities.


#5092383 CS Degree - Is it worth it?

Posted by Telastyn on 07 September 2013 - 08:13 PM

As a skilled programmer without a degree (yet), let me say in no uncertain terms: get a degree.

Even if you can _do_ the job, getting that first job is tons easier with a degree. HR departments (and most hiring managers) will hire a candidate with a degree over one without. And even when you do get a job, you'll get paid far less than a "more qualified" candidate.

And really, why would you *choose* to slave away 40 hours a week rather than spending 4 years hanging out with uninhibited coeds?


#5086761 Reference to a Reference?

Posted by Telastyn on 17 August 2013 - 07:38 AM

Is this possible without venturing into unmanned code land?

 

 

In general, the C# idiom is to make RefToRefCow a Func<RefCow>

var RefCow = Cow1;
var RefToRefCow = ()=>RefCow;
RefToRefCow().HowMuchWeight();  // 5

RefCow = Cow2;
RefToRefCow().HowMuchWeight(); // 10



#5078671 Programming the right way?

Posted by Telastyn on 18 July 2013 - 04:59 AM


Can anyone point me in the right direction to coding the right way with less bugs and more reliability?

 

First things first, there's no "right" way - there are a bunch of ways that will get the job done well.

 

Beyond that, I would look at the code you have written, and figure out why there are bugs. Did you use certain patterns that made the code fragile? Did you name things poorly so they got misused? Did the functions have too many side effects? Did you not have a good process to prevent typos/merge errors/etc?

 

Books and even good programmers can only bring you so far. Eventually you have to internalize the knowledge so that you can get the feel of what things are troublesome and why; what things are usually good and why. Then you can better apply those things to the problems at hand.




#5073567 Basic Concepts of Programming

Posted by Telastyn on 28 June 2013 - 05:56 AM

I concur with Khaiy. Even if you know the syntax (and you don't), watching videos does not teach you how to program - writing progressively more difficult programs does. I think that focusing on C++ is a mistake, and thinking that C# or Java are more difficult is a clear cut sign that you have no actual experience making programs.

Slow down. *Practice*. Show that you can take the knowledge you've gained and apply it to solving problems.


#5072251 Basic Concepts of Programming

Posted by Telastyn on 23 June 2013 - 10:29 AM

As a dissenting view, I'd just like to say that how computer architecture works, or what high level languages compile down to is largely orthogonal to being able to use them effectively.

 

Knowing all of that stuff won't help the OP understand bad tutorials better, it just provides more terms they don't understand and relationships that aren't clear.






PARTNERS