Search Results

Search found 5642 results on 226 pages for 'coding efficiency'.

Page 2/226 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • What is the recommended coding style for PowerShell?

    - by stej
    Is there any recommended coding style how to write PowerShell scripts? It's not about how to structure the code (how many functions, if to use module, ...). It's about 'how to write the code so that it is readable'. In programming languages there are some recommended coding styles (what to indent, how to indent - spaces/tabs, where to make new line, where to put braces,...), but I haven't seen any suggestion for PowerShell. What I'm interested particularly in: How to write parameters function New-XYZItem ( [string] $ItemName , [scriptblock] $definition ) { ... (I see that it's more like 'V1' syntax) or function New-PSClass { param([string] $ClassName ,[scriptblock] $definition )... or (why to add empty attribute?) function New-PSClass { param([Parameter()][string] $ClassName ,[Parameter()][scriptblock] $definition )... or (other formatting I saw maybe in Jaykul's code) function New-PSClass { param( [Parameter()] [string] $ClassName , [Parameter()] [scriptblock] $definition )... or ..? How to write complex pipeline Get-SomeData -param1 abc -param2 xyz | % { $temp1 = $_ 1..100 | % { Process-somehow $temp1 $_ } } | % { Process-Again $_ } | Sort-Object -desc or (name of cmdlet on new line) Get-SomeData -param1 abc -param2 xyz | % { $temp1 = $_ 1..100 | % { Process-somehow $temp1 $_ } } | % { Process-Again $_ } | Sort-Object -desc | and what if there are -begin -process -end params? how to make it the most readable? Get-SomeData -param1 abc -param2 xyz | % -begin { init } -process { Process-somehow2 ... } -end { Process-somehow3 ... } | % -begin { } .... or Get-SomeData -param1 abc -param2 xyz | % ` -begin { init } ` -process { Process-somehow2 ... } ` -end { Process-somehow3 ... } | % -begin { } .... the indentitation is important here and what element is put on new line as well. I have covered only questions that come on my mind very frequently. There are some others, but I'd like to keep this SO question 'short'. Any other suggestions are welcome.

    Read the article

  • Arithmetic Coding Questions

    - by Xophmeister
    I have been reading up on arithmetic coding and, while I understand how it works, all the guides and instructions I've read start with something like: Set up your intervals based upon the frequency of symbols in your data; i.e., more likely symbols get proportionally larger intervals. My main query is, once I have encoded my data, presumably I also need to include this statistical model with the encoding, otherwise the compressed data can't be decoded. Is that correct? I don't see this mentioned anywhere -- the most I've seen is that you need to include the number of iterations (i.e., encoded symbols) -- but unless I'm missing something, this also seems necessary to me. If this is true, that will obviously add an overhead to the final output. At what point does this outweigh the benefits of compression (e.g., say if I'm trying to compress just a few thousand bits)? Will the choice of symbol size also make a significant difference (e.g., if I'm looking at 2-bit words, rather than full octets/whatever)?

    Read the article

  • Can someone explain to me C#'s coding convention?

    - by AedonEtLIRA
    I recently started working with Unity3D and primarily scripting with C#. As, I normally program in Java, the differences aren't too great but I still referred to a crash course just to make sure I am on the right track. However, My biggest curiosity with C# is that is capitalises the first letter its method names (eg. java: getPrime() C#: GetPrime() aka: Pascal Case?). Is there a good reason for this? I understand from the crash course page that I read that apparently it's convention for .Net and I have no way of ever changing it, but I am curious to hear why it was done like this as opposed to the normal (relative?) camel case that, say, Java uses. Note: I understand that languages have their own coding conventions (python methods are all lower case which also applies in this question) but I've never really understood why it isn't formalised into a standard.

    Read the article

  • Coding style advice? [closed]

    - by user1064918
    I'm a newly grad. I've got a lot of complaints from my supervisor at work during code-review sessions with regard to my coding style (Surprise!). I don't know if it's just him being cranky or my style is really that annoying to read. I come from the low-level language world (assembly, mostly), so I've been taught to use bitwise ops and all the cool tricks to do math whenever possible. I also have the habits of doing some other things that've been regarded as "too excessively dense to read". So I'm hoping to get some feedback from any experienced programmers! :) Also how should I justify between code performance and readability? Thanks!!

    Read the article

  • Setting coding priorities

    - by dotnetdev
    Hi, In the dev shops I've worked in, nobody has ever mentioned "coding priorities". I read this in a book or site somewhere, and sets the expectation of what priority should be first in the code. In places where this is not specified, what should the first priority be? It may sound simple to say "do what the business need requires", but that could be at the expense of performance/maintainability. Many people say maintainability first, regardless, some say fulfill the need regardless. I am a young developer, so I am probably missing the point somewhere. Of course, programming is engineering and tough because you can never have the perfect solution. Thanks

    Read the article

  • experience: coding on netbooks

    - by pascal
    HI, i want to buy a netbook for doing some stuff in the train. Can someone report how it is to code simple stuff on a netbook? 10/12". I wanted to buy a very cheap one. like 1gb ram 1,6ghz blabla. and run linux on it with apache. i will code with JS/PHP. and as IDE i'll be using notepad++. so nothing big like eclispe or something else. maybe later on eclipse for java, but that doesn't really matter. so first, would this setup work fine on such a netbook and, is it okay for coding? I don't style any homepages on the netbook, I just want to code. would be nice if someone can share his experience in that. thanks :)

    Read the article

  • Good Haskell coding standards

    - by Alexey Romanov
    Could someone provide a link to a good coding standard for Haskell? I've found this and this, but they are far from comprehensive. Not to mention that the HaskellWiki one includes such "gems" as "use classes with care" and "defining symbolic infix identifiers should be left to library writers only."

    Read the article

  • Aging vs. Coding Skills

    - by Renan Malke Stigliani
    A little background, since it can be part of my point fo view. I'm a C#/Java programmer with age of 23, coding since my 18's. I started studying C and working with Cobol, and after 1 year I quickly moved to C#/Java Web Development, and have worked with it in about 3/4 companies. (I've just moved again) In my (brief) professional career I encountered some older programmers, all the times it was very hard to work with them, since I was way better programmer than they. And it is not about just the language skills, some of them had seriously problems understanding basic logic. Now I wonder how theese programmer get jobs on the market since (I imagine) they have more expenses, and thus have to make more money, and are really counter-productives. In theese examples, others project member have to constantly keep stoping for helping them out. All the times, they eventually quit... So I wonder... May the aging process slow down the learning rate and logic thinking? Does the programmer has to, or at least should, move to a management area before getting old? Please, my intention is not to be disrespectful with older persons. I am fully aware that this is NOT the case of all older programmers, I often see around very good old programmers on the net, I just never met them for close.

    Read the article

  • Are there any widespread, modern Java coding conventions?

    - by brianegge
    Sun's "Code Conventions for the Java Programming Language" was last updated April 1999. Ten years later a lot has changed in the language, as well as general usage patterns. Are there more up to date, widely adopted standards? Most guidelines omit specifying file encoding and line endings. Sun recommends mixed tabs and spaces. The Eclipse IDE defaults to Eclipse's standard, which is tabs only. The Maven style guide is spaces only. Many style guides, such as JBoss, follow Sun's guidelines, but prefer K&R braces instead of OTBS. Each Apache project has it's own style guide, with slight differences between each one.

    Read the article

  • Should i continue my self-taught coding practice or learn how to do coding professionally?

    - by G1i1ch
    Lately I've been getting professional work, hanging out with other programmers, and making friends in the industry. The only thing is I'm 100% self-taught. It's caused my style to extremely deviate from the style of those that are properly trained. It's the techniques and organization of my code that's different. It's a mixture of several things I do. I tend to blend several programming paradigms together. Like Functional and OO. I lean to the Functional side more than OO, but I see the use of OO when something would make more sense as an abstract entity. Like a game object. Next I also go the simple route when doing something. When in contrast, it seems like sometimes the code I see from professional programmers is complicated for the sake of it! I use lots of closures. And lastly, I'm not the best commenter. I find it easier just to read through my code than reading the comment. And most cases I just end up reading the code even if there are comments. Plus I've been told that, because of how simply I write my code, it's very easy to read it. I hear professionally trained programmers go on and on about things like unit tests. Something I've never used before so I haven't even the faintest idea of what they are or how they work. Lots and lots of underscores "_", which aren't really my taste. Most of the techniques I use are straight from me, or a few books I've read. Don't know anything about MVC, I've heard a lot about it though with things like backbone.js. I think it's a way to organize an application. It just confuses me though because by now I've made my own organizational structures. It's a bit of a pain. I can't use template applications at all when learning something new like with Ubuntu's Quickly. I have trouble understanding code that I can tell is from someone trained. Complete OO programming really leaves a bad taste in my mouth, yet that seems to be what EVERYONE else is strictly using. It's left me not that confident in the look of my code, or wondering whether I'll cause sparks when joining a company or maybe contributing to open source projects. In fact I'm rather scared of the fact that people will eventually be checking out my code. Is this just something normal any programmer goes through or should I really look to change up my techniques?

    Read the article

  • Would a cut and paste coder ever get past a job interview?

    - by bigdave
    As a long time cut and paste coder I never committed much of the syntax of a language to memory. Even worse, I now use google to solve many of the coding problems which are of the type typically used in job interviews. This has greatly increased my productivity, the quality of the end result and stops me perpetuating the same bugs across all my code. However it means I don't actually remember the detail of the solution. For some reason in a job interview "I would look that up on google" does not seem to be the right answer. Am I better off in the interview to pass no comment on my coding style and simply pull out an iPad and produce the solution?

    Read the article

  • What's Your Method of not forgetting the end brackets, parentheses

    - by JMC Creative
    disclaimer: for simplicity sake, brackets will refer to brackets, braces, quotes, and parentheses in the couse of this question. Carry on. When writing code, I usually type the beginning and end element first, and then go back and type the inner stuff. This gets to be a lot of backspacing, especially when doing something with many nested elements like: jQuery(function($){$('#element[input="file"]').hover(function(){$(this).fadeOut();})); Is there a more efficient way of remembering how many brackets you've got open ? Or a second example with quotes: <?php echo '<input value="'.$_POST['name'].'" />"; ?>

    Read the article

  • Coding Standards

    - by kevchadders
    For those of us that have programmed enough I’m sure we have come across many different flavours of coding standards that you can use when it comes to programming. e.g. http://msdn.microsoft.com/en-us/library/ms229042.aspx You might derive your coding standards for the current company you work for or from the original author of the code you’re working on. Coding styles are often used for specific program languages and some styles in one coding language might not be considered appropriate for others. Of course some coding standards can be applied across many different program languages. My question is do you have any good advice/links yourselves to a set of coding standards that you would recommend to others, or best practices to follow? Thank you for your time. EDIT: As we know there are many related articles on this subject, but C# Coding standard / Best practices in SO has some very useful links in there which is worth a visit. (Check out the 2 links on .NET/C# guidelines by ESV - Accepted Answer)

    Read the article

  • How to deal with different programming styles in a team?

    - by user3287
    We have a small dev team (only 3 developers) and we recently got a new team member. While he is a smart coder, his coding style is completely different from ours. Our existing code base contains mostly readable, clean and maintainable code, but the new team member is quickly changing many files, introducing ugly hacks and shortcuts, using defines all over the place, adding functions in the wrong places, etc. My question is if others have experienced such a situation before, and if anyone has tips on how to talk to him.

    Read the article

  • iOS Efficiency File Saving Efficiency

    - by Guvvy Aba
    I was working on my iOS app and my goal is to save a file that I am receiving from the internet bit by bit. My current setup is that I have a NSMutableData object and I add a bit of data to it as I receive my file. After the last "packet" is received, I write the NSData to a file and the process is complete. I'm kind of worried that this isn't the ideal way to do it because of the limitations of RAM in a mobile device and it would be problematic to receive large files. My next thought was to implement a NSFileHandle so that as the file arrives, it would be saved to the disk, rather than the virtual memory. In terms of speed and efficiency, which method do you think will work decently on an iOS device. I am currently using the first, NSMutableData approach. Is it worth changing my app to use the NSFileHandle? Thanks in advance, Guvvy

    Read the article

  • using "IS" is better or checking for "NOT NULL"

    - by BDotA
    In C#.NET language: This style of coding is recommended or the one below it? if (sheet.Models.Data is GroupDataModel) { GroupDataModel gdm = (GroupDataModel)sheet.Models.Data; Group group = gdm.GetGroup(sheet.ActiveCell.Row.Index); if (group!=null && controller != null) { controller.CheckApplicationState(); } } or this one: var gdm = sheet.Models.Data as GroupDataModel; if (gdm != null) { Group group = gdm.GetGroup(sheet.ActiveCell.Row.Index); if (@group!=null && controller != null) { controller.CheckApplicationState(); } }

    Read the article

  • Have you changed your coding style recently? It wasn't hard wasn't it?

    - by Ernelli
    I've used to write code in C-like languages using the Allman style, regarding the position of braces. void foo(int bar) { if(bar) { //... } else return; //... } Now the last two years I have been working mostly in JavaScript and when we adopted jslint as part of our QA process, I had to adopt to the Crockford way of doing things. So I had to change the coding style into: function foo(bar) { if (bar) { //... } else { return; } //... } Now apart from comparing a C/C++ example with JavaScript, I must say that my JavaScript-Crockford-coding style now has spread into my C/C++/Java coding when I revise old projects and work on code in those languages that for example has no problem with single line statements or ambiguous newline insertion. I used to consider the later format very awkward, I have never had any problems with adapting my coding style to the one chosen by my predecessors, except for when I was a Junior developer mostly being the solve developer on legacy projects and the first thing I did was to change the indenting style. But now after a couple of months I consider the Allman style a little bit too spacious and feel more comfortable with the K&R-like style. Have you changed your coding style during your career?

    Read the article

  • What effects do various drugs have on coding style / productivity? [closed]

    - by codecraft
    Can anyone tell me what the effect of various drugs are on coding style, and if coding on drugs can be more productive, or more fun? Are some types of drugs better suited to certain tasks and phases of software development? And which programming languages are best suited to coding on drugs? It would be great if you could back up your answers by data, probably even code snippets showcasing the effect of the drug experience.

    Read the article

  • Career advice on whether to stick with coding or move on to tech. lead\management [closed]

    - by flk
    I'm at a point in my career where I need to decide what to do next. I've mainly done C# desktop development (with a little python and Silverlight) for 5 or 6 years and I'm trying to decide whether to start learning JavaScript\HTML or to moving into a role where I do less coding and more tech. lead\management role. With all the talk around HTML5\JavaScript, the rise of mobile and the changes with Windows 8 (metro at least) I wonder if I should stick with coding to get some experience in these areas before moving on. But at the same time if I decide stick with coding for a ‘couple more years’ I will probably be faced with the same situation with some other new\interesting technology that I feel I should learn before moving on. I feel if I stick just with coding I'm limiting my career options but if I move to tech. lead\management I will loose my coding skills. Is going one direction or the other going to limiting my career options in the future? I know that there is no real answer to this question so I’m really just looking for some thoughts from others and perhaps experiences from other people that faced similar situations. Thanks

    Read the article

  • Practical considerations for HTML / CSS naming conventions (syntax)

    - by Jeroen
    Question: what are the practical considerations for the syntax in class and id values? Note that I'm not asking about the semantics, i.e. the actual words that are being used, as for example described in this blogpost. There are a lot of resources on that side of naming conventions already, in fact obscuring my search for practical information on the various syntactical bits: casing, use of interpunction (specifically the - dash), specific characters to use or avoid, etc. To sum up the reasons I'm asking this question: The naming restrictions on id and class don't naturally lead to any conventions The abundance of resources on the semantic side of naming conventions obscure searches on the syntactic considerations I couldn't find any authorative source on this There wasn't any question on SE Programmers yet on this topic :) Some of the conventions I've considered using: UpperCamelCase, mainly as a cross-over habit from server side coding lowerCamelCase, for consistency with JavaScript naming conventions css-style-classes, which is consistent with naming of css properties (but can be annoying when Ctrl+Shift+ArrowKey selection of text) with_under_scores, which I personally haven't seen used much alllowercase, simple to remember but can be hard to read for longer names UPPERCASEFTW, as a great way to annoy your fellow programmers (perhaps combined with option 4 for readability) And probably I've left out some important options or combinations as well. So: what considerations are there for naming conventions, and to which convention do they lead?

    Read the article

  • Create new variable or make multiple chained calls?

    - by Rodrigo
    What is the best way to get this attributes, thinking in performance and code quality? Using chained calls: name = this.product.getStock().getItems().get(index).getName(); id = this.product.getStock().getItems().get(index).getId(); Creating new variable: final item = this.product.getStock().getItems().get(index); name = item.getName(); it = item.getId(); I prefer the second way, to let the code cleaner. But I would like to see some opinions about it. Thank you!

    Read the article

  • Should you create a class within a method?

    - by Amndeep7
    I have made a program using Java that is an implementation of this project: http://nifty.stanford.edu/2009/stone-random-art/sml/index.html. Essentially, you create a mathematical expression and, using the pixel coordinate as input, make a picture. After I initially implemented this in serial, I then implemented it in parallel due to the fact that if the picture size is too large or if the mathematical expression is too complex (especially considering the fact that I made the expression recursively), it takes a really long time. During this process, I realized that I needed two classes which implemented the Runnable interface as I had to put in parameters for the run method, which you aren't allowed to do directly. One of these classes ended up being a medium sized static inner class (not large enough to make an independent class file for it though). The other though, just needed a few parameters to determine some indexes and the size of the for loop that I was making run in parallel - here it is: class DataConversionRunnable implements Runnable { int jj, kk, w; DataConversionRunnable(int column, int matrix, int wid) { jj = column; kk = matrix; w = wid; } public void run() { for(int i = 0; i < w; i++) colorvals[kk][jj][i] = (int) ((raw[kk][jj][i] + 1.0) * 255 / 2.0); increaseCounter(); } } My question is should I make it a static inner class or can I just create it in a method? What is the general programming convention followed in this case?

    Read the article

  • Should comments say WHY the program is doing what it is doing? (opinion on a dictum by the inventor of Forth)

    - by AKE
    The often provocative Chuck Moore (inventor of the Forth language) gave the following advice (paraphrasing): "Use comments sparingly. Programs are self-documenting, with a modicum of help from mnemonics. Comments should say WHAT the program is doing, not HOW." My question: Should comments say WHY the program is doing what it is doing? Update: In addition to the answers below, these two provide additional insight. Beginner's guide to writing comments? http://programmers.stackexchange.com/a/98609/62203

    Read the article

  • What should NOT be included in comments? (opinion on a dictum by the inventor of Forth)

    - by AKE
    The often provocative Chuck Moore (inventor of the Forth language) gave the following advice (paraphrasing): "Use comments sparingly. Programs are self-documenting, with a modicum of help from mnemonics. Comments should say WHAT the program is doing, not HOW." My question: Should comments say WHY the program is doing what it is doing? Update: In addition to the answers below, these two provide additional insight. 1: Beginner's guide to writing comments? 2: http://programmers.stackexchange.com/a/98609/62203

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >