Search Results

Search found 9 results on 1 pages for 'skiwi'.

Page 1/1 | 1 

  • Builder Pattern: When to fail?

    - by skiwi
    When implementing the Builder Pattern, I often find myself confused with when to let building fail and I even manage to take different stands on the matter every few days. First some explanation: With failing early I mean that building an object should fail as soon as an invalid parameter is passed in. So inside the SomeObjectBuilder. With failing late I mean that building an object only can fail on the build() call that implicitely calls a constructor of the object to be built. Then some arguments: In favor of failing late: A builder class should be no more than a class that simply holds values. Moreover, it leads to less code duplication. In favor of failing early: A general approach in software programming is that you want to detect issues as early as possible and therefore the most logical place to check would be in the builder class' constructor, 'setters' and ultimately in the build method. What is the general concensus about this?

    Read the article

  • OGRE 3D: How to create very basic gameworld [on hold]

    - by skiwi
    I'm considering trying around to create an FPS (First person shooter), using the Ogre 3D engine. I have done the Basic Tutorials (except CEGUI), and have read through the Intermediate Tutorial, I understand some of the more advanced concepts, but I'm stuck with very simple concepts. First of all: I would want to use some tiles (square ones, with relative little height) as the floor, I guess I need to set up a loop to get those tiles done. But how would I go about creating those tiles exactly? Like making it to be their own mesh, and then I would need to find some texture. Secondly: I guess I can derive the camera and movement functions from the basic tutorial. But I'll be needing a "soldier" (anything does for now), what is the best way to create a moderately decent looking soldier? (Or obtain a decent one from an open library?) And thirdly: How can I ensure that the soldier is actually walking on the ground, instead of mid air? Will raycasting into the ground + adjust position based on that, suffice?

    Read the article

  • Is it feasible and useful to auto-generate some code of unit tests?

    - by skiwi
    Earlier today I have come up with an idea, based upon a particular real use case, which I would want to have checked for feasability and usefulness. This question will feature a fair chunk of Java code, but can be applied to all languages running inside a VM, and maybe even outside. While there is real code, it uses nothing language-specific, so please read it mostly as pseudo code. The idea Make unit testing less cumbersome by adding in some ways to autogenerate code based on human interaction with the codebase. I understand this goes against the principle of TDD, but I don't think anyone ever proved that doing TDD is better over first creating code and then immediatly therafter the tests. This may even be adapted to be fit into TDD, but that is not my current goal. To show how it is intended to be used, I'll copy one of my classes here, for which I need to make unit tests. public class PutMonsterOnFieldAction implements PlayerAction { private final int handCardIndex; private final int fieldMonsterIndex; public PutMonsterOnFieldAction(final int handCardIndex, final int fieldMonsterIndex) { this.handCardIndex = Arguments.requirePositiveOrZero(handCardIndex, "handCardIndex"); this.fieldMonsterIndex = Arguments.requirePositiveOrZero(fieldMonsterIndex, "fieldCardIndex"); } @Override public boolean isActionAllowed(final Player player) { Objects.requireNonNull(player, "player"); Hand hand = player.getHand(); Field field = player.getField(); if (handCardIndex >= hand.getCapacity()) { return false; } if (fieldMonsterIndex >= field.getMonsterCapacity()) { return false; } if (field.hasMonster(fieldMonsterIndex)) { return false; } if (!(hand.get(handCardIndex) instanceof MonsterCard)) { return false; } return true; } @Override public void performAction(final Player player) { Objects.requireNonNull(player); if (!isActionAllowed(player)) { throw new PlayerActionNotAllowedException(); } Hand hand = player.getHand(); Field field = player.getField(); field.setMonster(fieldMonsterIndex, (MonsterCard)hand.play(handCardIndex)); } } We can observe the need for the following tests: Constructor test with valid input Constructor test with invalid inputs isActionAllowed test with valid input isActionAllowed test with invalid inputs performAction test with valid input performAction test with invalid inputs My idea mainly focuses on the isActionAllowed test with invalid inputs. Writing these tests is not fun, you need to ensure a number of conditions and you check whether it really returns false, this can be extended to performAction, where an exception needs to be thrown in that case. The goal of my idea is to generate those tests, by indicating (through GUI of IDE hopefully) that you want to generate tests based on a specific branch. The implementation by example User clicks on "Generate code for branch if (handCardIndex >= hand.getCapacity())". Now the tool needs to find a case where that holds. (I haven't added the relevant code as that may clutter the post ultimately) To invalidate the branch, the tool needs to find a handCardIndex and hand.getCapacity() such that the condition >= holds. It needs to construct a Player with a Hand that has a capacity of at least 1. It notices that the capacity private int of Hand needs to be at least 1. It searches for ways to set it to 1. Fortunately it finds a constructor that takes the capacity as an argument. It uses 1 for this. Some more work needs to be done to succesfully construct a Player instance, involving the creation of objects that have constraints that can be seen by inspecting the source code. It has found the hand with the least capacity possible and is able to construct it. Now to invalidate the test it will need to set handCardIndex = 1. It constructs the test and asserts it to be false (the returned value of the branch) What does the tool need to work? In order to function properly, it will need the ability to scan through all source code (including JDK code) to figure out all constraints. Optionally this could be done through the javadoc, but that is not always used to indicate all constraints. It could also do some trial and error, but it pretty much stops if you cannot attach source code to compiled classes. Then it needs some basic knowledge of what the primitive types are, including arrays. And it needs to be able to construct some form of "modification trees". The tool knows that it needs to change a certain variable to a different value in order to get the correct testcase. Hence it will need to list all possible ways to change it, without using reflection obviously. What this tool will not replace is the need to create tailored unit tests that tests all kinds of conditions when a certain method actually works. It is purely to be used to test methods when they invalidate constraints. My questions: Is creating such a tool feasible? Would it ever work, or are there some obvious problems? Would such a tool be useful? Is it even useful to automatically generate these testcases at all? Could it be extended to do even more useful things? Does, by chance, such a project already exist and would I be reinventing the wheel? If not proven useful, but still possible to make such thing, I will still consider it for fun. If it's considered useful, then I might make an open source project for it depending on the time. For people searching more background information about the used Player and Hand classes in my example, please refer to this repository. At the time of writing the PutMonsterOnFieldAction has not been uploaded to the repo yet, but this will be done once I'm done with the unit tests.

    Read the article

  • What kind of programmer job positions are there in professional game development? [on hold]

    - by skiwi
    I have been wondering the following since recently, seeing as I want to pursue a career in game development after university: What programmer job positions are there in professional game development? Think about AAA titles, etc. What programming language are the most commonly used ones in that area? I can think of some job aspects, like game engine, network, centralized server and artificial intelligence. I am just wondering what options I have later on, and in what programming languages I should invest right now. I am quite proficient with Java, and also wondering if that is of any help.

    Read the article

  • Are VM-based languages becoming viable for Graphics since the move to GPU computing?

    - by skiwi
    Perhaps the title is not the most clear, so let me elaborate it more: I am talking about VM-based languages, by that I mean languages that run on the JVM (java) and for example C#. Also I am talking about 3D graphics, just to be clear. Lately the trend has been that most computing is being done on the GPU and not on the CPU, and since times the issue with programming games on a VM-based language is that garbage collecting may happen randomly. So let's take a look which is responsible for what: Showing the graphics: GPU Uploading graphics to the GPU: CPU? Needs to be done every frame? Calculating physics constraints: GPU Doing the real game logic (Determining when to move objects (independent of physics calculations), processing AI): CPU Is my list actually correct? And if it is, is for example Java becoming more viable? Or is uploading the graphics (vertices) still the most expensive operation? Would like to get more insight into this.

    Read the article

  • Intel Core i7 clockspeeds

    - by skiwi
    I've got an Intel i7 3770 CPU and am generally quite happy about it. However when I am just browsing around without programs running in background it seems to underclock itself quite a lot. This is not a real issue, however there seems to be a small hiccup (0.1s maybe) when it clocks itself higher again. Does anyone have a similar issue? Can I change the thresholds that are being used to change the clocks? I absolutely like that it underclocks the CPU whenever I am not around, but it shouldn't start to annoy me. It might also be related to Windows 8.1, but I am not sure about that, just saying that it's a possibility. I ran LatencyMon as suggested and got this (worrying?) result:

    Read the article

  • SSD/HDD not exceeding 120 MB/s

    - by skiwi
    SO here is the situation: First this was my old PC, it had a 2x 1TB RAID 0 and a Corsair Force 3 SSD in it. This were the old speeds, measured by HDTune Pro. 2x 1TB RAID 0: Corsair Force 3 SSD Then my dad got my PC and we had several issues, in the end turned out both RAID and SSD controller were malfunctioning causing BlueScreens on 100% load. Removed the RAID 0, but leaving the HDD's intact and bought an Samsung 840 EVO 120GB, though the Corsair SSD is still in the system, just not as sytem disk anymore. 1TB HDD (one of them): Corsair SSD: Samsung SSD: We did not assemble the PC ourselves, so answering some technical questions might be more difficult, though we will do our best. First thing we noticed is that the Samsung 840 EVO is no where reaching it's advertised speed, even an Samsung 840 250GB (non-EVO) is reaching 350 MB/s in my own PC. Then we noticed that both SSD's are capped at 120 MB/s exactly, not sure if this is being caused by HDTune Pro, but very unlikely. And even worse, the Corsair Forza 3 was running faster before the system got reassembled. Does anyone have any clue what is going on?

    Read the article

  • Running server-program from a .jar file

    - by skiwi
    I have created and am working on a server-application that monitors for specific folders and takes appropriate actions whenever files are being added. Now I come to the point where I want to be able to shutdown the program, for example for applying a patch. The server runs simply in a command prompt, how can I signal that I want to perform maintenance on it? I do not think reading System.In is feasible as I am also outputting text in the prompt. Regards.

    Read the article

  • Java/MySQL: Working with data in classes

    - by skiwi
    What is the best way to deal with accessing/modifying tables in a database? I have read about the Data Access Object approach, but none of the resources I have found so far indicate a clear implementation of it. So assume you have a database with a table called accounts that has columns id, name, password and email. How would you properly access it within Java? I mean most people know how to do SQL statements, but that is not really the point. I hope people here can be of help. Regards.

    Read the article

1