什么是给准雇主提供好的示例代码块? [英] What constitutes a good block of Sample Code to give a prospective employer?

查看:65
本文介绍了什么是给准雇主提供好的示例代码块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近有位雇主要求我提供我的代码示例..

除了有效的方法外,什么构成了可以给潜在雇主的示例代码的很好的组成部分?P?

应该是叔...< 1M吗?

例如,解决未知问题的解决方案应该具有创造性吗? :laugh:

它是否需要优雅,评论,独立等...

1.正确的命名约定<-取决于一个人在哪里工作.
2.处理的异常<-好的代码不应引发异常..否则我是否认为错误
3.坚持单一责任原则<-谁说一个责任范围比另一个责任范围更好/更合适?
4.处理错误的数据<-参见上述第二点

我最大的问题是:我处理过的所有代码都是其他人的知识产权.因此,我需要提供一个代码示例...我没有想法...

I was recently asked for a sample of my code.. by a prospective employer...

What constitutes a good block of Sample Code to give a prospective employer, other than something that works ;P ?

Should it be tert... <1M?

Should it be inventive, say a solution for solving unknown problems? :laugh:

Does it need to be elegant, commented, stand alone, etc...

1. Proper naming conventions <- dependant on where one works.
2. Exceptions handled <- Good code shouldn''t throw exceptions.. or Am i wrong in that assumption
3. Single responsibility principle held <- who says one scope of responsibility is better/more appropriate than another?
4. Bad data handled <- See point two above

My biggest issue is this: All of the code i''ve worked on is intelecual property of someone else.. as such I need to come up with a code sample... I am without ideas...

推荐答案

对我来说,一个好的代码块将构成(除了某些可以正常工作的代码!):

1.正确的命名约定
2.在必要的地方发表评论
3.异常处理
4.坚持单一责任原则
5.处理不良数据

更新:
:)
你至少要告诉柜台老板,不是吗?
毕竟,不能仅仅假设每个人都一样好,并会自己考虑您的计数器吗?你需要放东西!

您自己说过:好的代码不应该抛出异常" ..恰到好处..那就是他要的...给他看好的代码! :thumbsup:

更新2:
为什么这样?你为什么没主意呢?您使用的是某人拥有知识产权的代码,没关系-雇主一定不要要求显示"该代码.要么拿出您的一些小例子,要么更好地请雇主告诉您一些您可以在上面写一小段代码的事,并告诉他您可以写出多好!完毕! :thumbsup:

更新3:
毫无疑问,这是可以讨论的一点,只要它是相对的并且取决于人与人之间.尽管我写的观点可以满足并且应该足以说服潜在的雇主!:thumbsup:
For me, a good block of code would constitute (other than something that works as expected!):

1. Proper naming conventions
2. Commented where and if necessary
3. Exceptions handled
4. Single responsibility principle held
5. Bad data handled

UPDATE:
:)
Atleast you have to tell your counters to employer, isin''t?
After all, one cannot just assume that everyone is equally good and would take your counters into consideration themselves? You need to put something up!

You yourself said "Good code shouldn''t throw exception".. well right enough.. thats what he is asking for... show him the GOOD CODE! :thumbsup:

UPDATE 2:
Why so? Why are you out of ideas? You worked on code that had intellectual property rights by someone, its ok - employer must not be asking to "show" that code. Either come up with some small example of yours or better ask the employer to tell something on which you can write a small piece of code and show him how good you can write! done! :thumbsup:

UPDATE 3:
No doubt it''s a point that can be discussed long as it''s quite relative and depends on person to person. Though what points i wrote can satisfy and should be sufficient to convince the prospective employer then!:thumbsup:


雇主可能对所有您感兴趣的东西都不感兴趣.

您说的一切都不是绝对值",而是对上下文的理解.
好的代码不会引发异常" ...不一定:基本代码可以引发...单一责任原则":在某些情况下,无法应用它……

雇主感兴趣的可能是评估您的一致性"的背景.这仅意味着样式的一致性,格式的一致性,名称的一致性,注释的一致性等.

独立于代码的作用,良好的样式化"代码比随机放置的尝试并粘贴"代码显示出更好的逻辑思维.
The employer is probably interested in all and none of the things you talked.

Everything you said is not "absolute value" but realtive to the context.
"Good code doesn''t throw exception" ... Not necessarily: base code can throw... "Single responsibility principle": there are canonical cases where it cannot be applied ...

What the employer is interested is probably a context into which evaluate your "congruence". That merely means consistence of style, consistence of formats, consistence of names, consistence of comments etc.

Independently on what the code does, good "styled" code reveal better logic minds than randomly placed "try and paste" code.


1.正确= 一致且明智
2.好的代码应达成,但要有例外.同样,在许多环境中,异常是发出错误信号的标准机制-尽管并非无处不在.我不确定您从何处获得这种通才.
3.经验
4.参见以上第二点.您不需要使用异常-但是您需要处理它.

-----------------

至于最大的问题:您从未为自己编写过一个小工具吗?为自己尝试了一些东西?好吧-写点东西. oyu希望您的工作中有任何事情,而烦恼计算机的任何事情.
1. Proper = consistent and sensible
2. Good code should deal with exceptions. Also, exceptions are in many environments the standard mechanism for signaling errors - though not everywhere. I''m not sure where you got that generalism from.
3. Experience
4. See point two above. You don''t need to use exceptions - but you need to handle it.

-----------------

As for your biggest issue: you never wrote a little tool for yourself? Tried out something for yourself? Well then - write something. Anythign oyu wished you had for your job, anything that annoys you about computers.


这篇关于什么是给准雇主提供好的示例代码块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆