Search Results

Search found 10 results on 1 pages for 'user828584'.

Page 1/1 | 1 

  • Gathering all data in single iteration vs using functions for readable code

    - by user828584
    Say I have an array of runners with which I need to find the tallest runner, the fastest runner, and the lightest runner. It seems like the most readable solution would be: runners = getRunners(); tallestRunner = getTallestRunner(runners); fastestRunner = getFastestRunner(runners); lightestRunner = getLightestRunner(runners); ..where each function iterates over the runners and keeps track of the largest height, greatest speed, and lowest weight. Iterating over the array three times, however, doesn't seem like a very good idea. It would instead be better to do: int greatestHeght, greatestSpeed, leastWeight; Runner tallestRunner, fastestRunner, lightestRunner; for(runner in runners){ if(runner.height > greatestHeight) { greatestHeight = runner.height; tallestRunner = runner; } if(runner.speed > ... } While this isn't too unreadable, it can get messy when there is more logic for each piece of information being extracted in the iteration. What's the middle ground here? How can I use only a single iteration while still keeping the code divided into logical units?

    Read the article

  • What non-programming tools do programmers use?

    - by user828584
    I'm reading code complete with the intention of learning how to better structure my code, but I'm also learning a lot about how many aspects of programming something there are that aren't just writing the code. The book talks a lot about problem definition, determining the requirements, defining the structure, designing the code, etc. What tools are used for these non-writing steps of programming? Is there software that will help me design and plan out what I'm going to write before I do?

    Read the article

  • Best exception handling practices or recommendations?

    - by user828584
    I think the two main problems with my programs are my code structure/organization and my error handling. I'm reading Code Complete 2, but I need something to read for working with potential problems. For example, on a website, if something can only happen if the user tampers with data via javascript, do you write for that? Also, when do you not catch errors? When you write a class that expects a string and an int as input, and they aren't a string and int, do you check for that, or do you let it bubble up to the calling method that passed incorrect parameters? I know this is a broad topic that can't be answered in a single answer here, so what I'm looking for is a book or resource that's commonly accepted as teaching proper exception handling practice.

    Read the article

  • How do I find a programming internship / practice?

    - by user828584
    I'm taking the SAT soon, and quickly heading toward the chaos of figuring out which college's I will be able to attend, and how on Earth I'll be able to afford it. I would like to be able to gain some experience in programming or web development, but I don't know where to look. I've been trying my best to learn over the past year, and have been doing alright in C# and the web languages (HTML, PHP, CSS, javascript). I have no idea where to look though. I've asked similar questions and rummaged through old questions on here, and they all say nothing specifically. The main two points are always "Contribute to open source projects" and "Find a company and ask to be a part of it." I don't know how to find either of the two. I've looked online at github and source forge, and the like, but all the projects are already so progressed and I just don't have the experience needed to bring myself up to speed with their code. I don't have much experience in code management, and I don't know how to get it. I would be ecstatic to be able to start a project with a group of more experienced members, but, like I said, I have no clue how to find these people.

    Read the article

  • Where can I find simple, but well-written programs to learn from?

    - by user828584
    I've tried a few times to look at the source code for various things from github or other sites, in javascript, C#, PHP, etc. I'm never able to understand the programs as a whole though. I can sort of piece together what a specific snippet of code does, but I quickly lose the context of what I'm looking at and how it fits in. I want to be able to improve, but everything I've tried learning from so far has been too big. Where can I find well-written, but not very complex source code to look at? edit: Sorry, to be more specific, I'm hoping for javascript/php/C#.

    Read the article

  • Programming habits, patterns, and standards that have developed out of appeal to tradition/by mistake? [closed]

    - by user828584
    Being self-taught, the vast majority of what I know about programming has come from reading other peoples' code on websites like this. I'm starting to wonder if I've developed bad or otherwise pointless habits from other people, or even just made invalid assumptions. For example, in javascript, void 0 is used in a lot of places, and until I saw this, I just assumed it was necessary and that 0 had some significance. Also, the http header, referer is misspelled but hasn't been changed because it would break a lot of applications. Also mentioned in Code Complete 2: The architecture should describe the motivations for all major decisions. Be wary of “we’ve always done it that way” justifications. One story goes that Beth wanted to cook a pot roast according to an award-winning pot roast recipe handed down in her husband’s family. Her husband, Abdul, said that his mother had taught him to sprinkle it with salt and pepper, cut both ends off, put it in the pan, cover it, and cook it. Beth asked, “Why do you cut both ends off?” Abdul said, “I don’t know. I’ve always done it that way. Let me ask my mother.” He called her, and she said, “I don’t know. I’ve always done it that way. Let me ask your grandmother.” She called his grandmother, who said, “I don’t know why you do it that way. I did it that way because it was too big to fit in my pan.” What are some other examples of this?

    Read the article

  • Is there a point to writing in C or C++ instead of C# without knowing specifically what would make a program faster?

    - by user828584
    I wrote a small library in Python for handling the xbox 360's STFS files to be used on my web applications. I would like to rewrite it for use in the many desktop programs people are writing for 360 game modding, but I'm not quite if I should continue using C# or delve into C++ or even C. STFS is an in-file file system used by the xbox 360 and the job of the library would be extracting/injecting files, which could take noticeable amounts of time to do. What I know in C# comes from internet tutorials and resources, as would anything I learn about C++, so what I'm asking is if it's better to bring myself to a slightly lower-level language without knowing beforehand the features of the language that increase performance, or continue assuming that compiler optimizations and that my lack of experience will mean that the language I choose won't matter.

    Read the article

  • Is this paragraph in Code Complete 2 backwards, or am I misunderstanding it?

    - by user828584
    In chapter 13, when talking about pointers, there is a paragraph: Sometimes, however, you would like to have the semantics of pass by reference—that is, that the passed object should not be altered—with the implementation of pass by value—that is, passing the actual object rather than a copy. It seems like the author made a mistake and mixed the two up. Is this true, or am I not understanding what he's saying correctly?

    Read the article

  • Why are effect-less functions executed?

    - by user828584
    All the languages I know of would execute something like: i = 0 while i < 100000000 i += 1 ..and you can see it take a noticeable amount of time to execute. Why though, do languages do this? The only effect this code will have is taking time. edit: I mean inside a function which is called function main(){ useless() } function useless(){ i = 0 while i < 100000000 i += 1 }

    Read the article

  • Writing drivers for a printer?

    - by user828584
    My goal is to be able to fax 20 page pdf documents for free. I've looked online, and there are some free fax services, but all of them have their limits. I do have an old fax machine, but the documents that need to be faxed are on the computer, and to print them would be far from free. Unfortunately, the only way to send a fax with the machine is by scanning it. What's strange is that it can scan to the computer and print from it, but it won't fax from it... :(. Is it possible to write something (preferably C#, but it's going to take some learning anyway) that will allow me to send a fax from the computer? I have very little software experience, and none in anything like this, so I have no idea where to start. If it is possible, where can I find all the information needed to write the program?

    Read the article

1